Is there any way to query and inlist all the comments associated with tables and their columns
Please reply back if you any query for this
Thanks
Is there any way to query and inlist all the comments associated with tables and their columns
Please reply back if you any query for this
Thanks
Running Postgresql 9.4
Here's an example
CREATE TABLE test (
did integer,
name varchar(40)
);
Comments can be added at table creation or using sql Ref Postgresql 9.4 Comment
COMMENT ON TABLE test IS 'This is a test table.';
COMMENT ON COLUMN test.did IS 'Description ID number';
COMMENT ON COLUMN test.name IS 'Description name varchar 20';
First of all we need to find the OID
SELECT oid FROM pg_class WHERE relname = 'test' AND relkind = 'r';
IN my case the OID IS 24650
table comment in this case
select pg_catalog.obj_description(24650);
(1st) Column comment in this case
select pg_catalog.col_description(24650,1);
(2nd) Column comment in this case
select pg_catalog.col_description(24650,2);