3

I would like to version control PostgreSQL schemas with the COMMENT ON syntax (whether that's a good practice is another question) but I'm not sure how to retrieve these comments later on.

There's quite some writing around how to retrieve database and column comments, not so much about schemas.

Any ideas?

Raf
  • 842
  • 1
  • 9
  • 25
  • See https://stackoverflow.com/questions/11493978/how-to-retrieve-the-comment-of-a-postgresql-database – Stefan Feb 25 '20 at 08:05

2 Answers2

8
SELECT obj_description('public'::regnamespace, 'pg_namespace');
Nick Barnes
  • 19,816
  • 3
  • 51
  • 63
1

To retrieve Schema comments, you can use psql utility. The comments can be viewed with \dn+ in the prompt. Comments are stored in the Description Column.

Lohit Gupta
  • 1,045
  • 6
  • 11