Get Comments on Tables / Functions

Started by Alex -over 16 years ago2 messagesgeneral
Jump to latest
#1Alex -
aintokyo@hotmail.com

Hi,i am adding comments to tables and functions with version information and would like to extract that information through a query.
Is there and easy way to do that? simple list. table_name, comment

ThanksAlex
_________________________________________________________________
Use Messenger in your Hotmail inbox Find out how
http://windowslive.ninemsn.com.au/hotmail/article/823454/web-im-for-hotmail-is-here

#2Thomas Kellerer
spam_eater@gmx.net
In reply to: Alex - (#1)
Re: Get Comments on Tables / Functions

Alex - wrote on 27.12.2009 14:57:

Hi,
i am adding comments to tables and functions with version information
and would like to extract that information through a query.

Is there and easy way to do that? simple list. table_name, comment

SELECT n.nspname as schema_name,
c.relname as table_name,
a.attname as column_name,
dsc.description
FROM pg_catalog.pg_namespace n
JOIN pg_catalog.pg_class c ON (c.relnamespace = n.oid)
JOIN pg_catalog.pg_attribute a ON (a.attrelid = c.oid)
LEFT JOIN pg_catalog.pg_description dsc ON (c.oid = dsc.objoid AND a.attnum = dsc.objsubid)
WHERE a.attnum > 0
AND NOT a.attisdropped
and c.relname = 'account'

Regards
Thomas