Re: How can I select a comment on a column in a query?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How can I select a comment on a column in a query?
Дата
Msg-id 28332.1074527643@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: How can I select a comment on a column in a query?  (George Weaver <gweaver@shaw.ca>)
Список pgsql-novice
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

В списке pgsql-novice по дате отправления:

Предыдущее
От: George Weaver
Дата:
Сообщение: Re: How can I select a comment on a column in a query?
Следующее
От: Lduren02@aol.com
Дата:
Сообщение: absolute beginner