Thread: Get Comments on Tables / Functions

Get Comments on Tables / Functions

From
Alex -
Date:
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


Thanks
Alex


Find out how Use Messenger in your Hotmail inbox

Re: Get Comments on Tables / Functions

From
Thomas Kellerer
Date:
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