Skip site navigation (1) Skip section navigation (2)

Re: SQL to get a table columns comments?

From: "codeWarrior" <gpatnude(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org(dot)pgsql-hackers(at)postgresql(dot)org
Subject: Re: SQL to get a table columns comments?
Date: 2007-01-30 17:15:11
Message-ID: epnu7t$1vbv$ (view raw, whole thread or download thread mbox)
Lists: pgsql-generalpgsql-hackers
            WHEN sfl.description IS NOT NULL THEN sfl.description
            WHEN sfl.description IS NULL THEN pa.attname::character varying
            ELSE pd.description::character varying
        END AS label
   FROM ONLY pg_class pc
   JOIN ONLY pg_attribute pa ON pc.oid = pa.attrelid AND pc.relnamespace = 
2200::oid AND pc.reltype > 0::oid AND (pc.relkind = 'r'::"char" OR 
pc.relkind = 'c'::"char" OR pc.relkind = 'v'::"char")
   JOIN ONLY pg_type pt ON pa.atttypid = pt.oid
   LEFT JOIN ONLY pg_description pd ON pc.oid = pd.objoid AND pa.attnum = 
   LEFT JOIN sys_flex_labels sfl ON pc.oid = sfl.table_oid::oid AND 
pa.attname::character varying::text = sfl.column_name::text
  WHERE pa.attnum > 0
  ORDER BY pc.relname::character varying, pa.attnum;

"Timasmith" <timasmith(at)hotmail(dot)com> wrote in message 
> Hi,
> What query can I run to get the comments for my table columns.
> i.e. the ones on my 8.1 database added with this command:
> COMMENT ON COLUMN addresses.address_id IS 'Unique identifier for the
> addresses table';
> thanks
> Tim

In response to


pgsql-hackers by date

Next:From: Kris JurkaDate: 2007-01-30 17:35:01
Subject: Re: log ssl mode with connections?
Previous:From: Andrew DunstanDate: 2007-01-30 17:10:31
Subject: Re: log ssl mode with connections?

pgsql-general by date

Next:From: jasonDate: 2007-01-30 17:18:57
Subject: When an index and a constraint have the same name...
Previous:From: Dániel DénesDate: 2007-01-30 16:54:40
Subject: Re: SELECT FOR UPDATE with ORDER BY to avoid row-level deadlock?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group