Postgresql allows adding comments to objects such as tables. For example I\'ve added a comment to table \"mytable\" by using this SQL command:
COMMENT ON TAB
All comments are stored in pg_description
To get the comments on a table, you need to join it to pg_class
As an alternative you can also use the function obj_description()
to retrieve this information:
SELECT obj_description(oid)
FROM pg_class
WHERE relkind = 'r'
Edit
In psql you can simply use the \d+
command to show all tables including their comments. Or use the \dd
command to show all comments in the system