Postgresql: delete all comments from database

postgresql

I have a database for which the comments on objects (PSQL command COMMENT) are just pollution for us: they are obsolete and in a language that no one reads in our organisation. Hence, I'd like to delete all these comments at once. There are hundreds of them and I don't want to write hundreds of command lines "COMMENT ON xxx IS NULL".

Anybody knows how to do this ?

Best Answer

Erwin Brandstetter gave a very good answer on how to do this on this question Removing COMMENT ON from all objects in PostgreSQL on Stack Overflow.

It basically consists of removing the comments directly from the system catalogues like so (disclaimer - the following code is copied directly from his answer):

DELETE FROM pg_description WHERE description = 'something special';

Or you could delete the comments based on any other criteria you may choose.