Re: Get Comments on Tables / Functions

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Get Comments on Tables / Functions
Date: 2009-12-27 14:17:51
Message-ID: hh7qa6$36a$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2009-12-28 00:18:02 Re: Finding the bin path
Previous Message Alex - 2009-12-27 13:57:49 Get Comments on Tables / Functions