Retrieving a column comment
Hi,
I can't seem to retrieve a comment on a table column. The following copy from
psql should I think return a comment:
====================
mydatabase=> COMMENT ON COLUMN car.manufacturer IS 'manufacturer name';
COMMENT
mydatabase=> SELECT relnamespace FROM pg_class WHERE relname='car';
relnamespace
--------------
2200
(1 row)
mydatabase=> SELECT col_description(2200,1);
col_description
-----------------
(1 row)
====================
i.e. it just returns a blank row.
The col_description is described at
http://www.postgresql.org/docs/7.3/static/functions-misc.html
The field number supplied above '1' is right if the first col in a table is
'0', in fact no number I've tried returns anything.
I can't seem to find any examples at all on the web about retrieving column
COMMENTs. Has anyone done this? Postgres version is 7.3
Regards,
Oliver Kohll
GT webMarque
--
On Sun, Oct 26, 2003 at 10:02:22PM +0000, Oliver Kohll wrote:
I can't seem to retrieve a comment on a table column. The following copy from
psql should I think return a comment:mydatabase=> SELECT relnamespace FROM pg_class WHERE relname='car';
relnamespace
--------------
2200
(1 row)
Try using relfilenode instead of relnamespace.
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Hay que recordar que la existencia en el cosmos, y particularmente la
elaboraci�n de civilizaciones dentre de �l no son, por desgracia,
nada id�licas" (Ijon Tichy)
On Sunday 26 October 2003 23:03, Alvaro Herrera wrote:
On Sun, Oct 26, 2003 at 10:02:22PM +0000, Oliver Kohll wrote:
I can't seem to retrieve a comment on a table column. The following copy
from psql should I think return a comment:mydatabase=> SELECT relnamespace FROM pg_class WHERE relname='car';
relnamespace
--------------
2200
(1 row)Try using relfilenode instead of relnamespace.
Great, thanks Alvaro. The webpage I found the original code in must have been
wrong but that's it.
Oliver
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
On Sun, Oct 26, 2003 at 10:02:22PM +0000, Oliver Kohll wrote:
I can't seem to retrieve a comment on a table column. The following copy from
psql should I think return a comment:mydatabase=> SELECT relnamespace FROM pg_class WHERE relname='car';
relnamespace
--------------
2200
(1 row)
Try using relfilenode instead of relnamespace.
Actually what he wants is the oid. relfilenode is not relevant to
anything except the table's disk file name.
regards, tom lane