George Weaver <gweaver@shaw.ca> writes:
> test=# select description from pg_description where objoid = 306461 and
> objsubid = 0;
Also, there is a col_description() function that encapsulates this
query. I'd recommend col_description() and its sibling obj_description()
in preference to examining the pg_description catalog directly. See
"Comment Information Functions" in
http://www.postgresql.org/docs/7.4/static/functions-misc.html
Here's a simple example:
regression=# create table mytab (mycol int);
CREATE TABLE
regression=# comment on column mytab.mycol is 'my comment';
COMMENT
regression=# select col_description('mytab'::regclass, 1);
col_description
-----------------
my comment
(1 row)
(I'm using the regclass datatype as a substitute for an explicit
lookup in pg_class to get the OID of the table. This feature is
new since 7.3 or thereabouts.)
regards, tom lane