Обсуждение: Re: Field list from table

Поиск
Список
Период
Сортировка

Re: Field list from table

От
Christopher Browne
Дата:
"Jan Pips" <jan_pips@op.pl> wrote:
> How can I, using SELECT, get the full list of fields from a given table?

portfolio=# select column_name, data_type from information_schema.columns where table_catalog = 'portfolio' and
table_schema= 'public' and table_name = 'stocktxns';column_name |        data_type         
 
-------------+--------------------------symbol      | character varyingdate        | timestamp with time zoneprice
| numericquantity    | numeric
 
(4 rows)

information_schema.columns has additional columns to provide
information about numeric precision, string widths, and such...
-- 
"cbbrowne","@","ntlug.org"
http://www.ntlug.org/~cbbrowne/postgresql.html
Rules  of the  Evil Overlord  #4.  "Shooting is  not too  good for  my
enemies." <http://www.eviloverlord.com/>