From: | "John Sidney-Woollett" <johnsw(at)wardbrook(dot)com> |
---|---|
To: | "Devrim GUNDUZ" <devrim(at)gunduz(dot)org> |
Cc: | "Alexander Antonakakis" <motoris(at)sdf(dot)lonestar(dot)org>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: sql to get the column names of a table |
Date: | 2004-01-20 11:34:35 |
Message-ID: | 1604.192.168.0.64.1074598475.squirrel@mercury.wardbrook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Devrim GUNDUZ said:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Hi,
>
> On Tue, 20 Jan 2004, Alexander Antonakakis wrote:
>
>> How can I get the column names of a table with sql ?
>
> SELECT tablename FROM pg_tables WHERE tablename NOT LIKE 'pg_%';
>
> will work, I think.
If you want COLUMNS and not TABLES and are using 7.4 then use the views
provided in the information_schema. eg
select column_name from information_schema.columns
where table_name = 'mytable';
Look at the view, you can select all sorts of info, and filter on other
criteria too.
John Sidney-Woollett
From | Date | Subject | |
---|---|---|---|
Next Message | lnd | 2004-01-20 15:05:30 | Transaction id |
Previous Message | Devrim GUNDUZ | 2004-01-20 11:08:21 | Re: sql to get the column names of a table |