Re: sql to get the column names of a table

Поиск
Список
Период
Сортировка
От John Sidney-Woollett
Тема Re: sql to get the column names of a table
Дата
Msg-id 1604.192.168.0.64.1074598475.squirrel@mercury.wardbrook.com
обсуждение исходный текст
Ответ на Re: sql to get the column names of a table  (Devrim GUNDUZ <devrim@gunduz.org>)
Список 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



В списке pgsql-general по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Foreign key constraint accepted even when not same
Следующее
От: "Eric Anderson Vianet SAO"
Дата:
Сообщение: Re: sql to get the column names of a table