By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,852 Members | 2,259 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,852 IT Pros & Developers. It's quick & easy.

Retrieving a column comment

P: n/a
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/s...ions-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
--
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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)

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #2

P: n/a
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
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #3

P: n/a
Alvaro Herrera <al******@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

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.