Re: list all columns in db

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: list all columns in db
Дата
Msg-id 20070608022447.GA2575@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: list all columns in db  (Jon Sime <jsime@mediamatters.org>)
Список pgsql-general
On Thu, Jun 07, 2007 at 06:36:07PM -0400, Jon Sime wrote:
>     select n.nspname as table_schema, c.relname as table_name,
>         a.attname as column_name
>     from pg_catalog.pg_attribute a
>         join pg_catalog.pg_class c on (a.attrelid = c.oid)
>         join pg_catalog.pg_namespace n on (c.relnamespace = n.oid)
>     where c.relkind in ('r','v') and a.attnum > 0
>         and n.nspname not in ('pg_catalog','information_schema')
>     order by 1,2,3

Don't forget "and not a.attisdropped" else you might get something
like

 table_schema | table_name |         column_name
--------------+------------+------------------------------
 public       | foo        | ........pg.dropped.2........
 public       | foo        | col1
 public       | foo        | col3
(3 rows)

--
Michael Fuhr

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

Предыдущее
От: Guy Rouillier
Дата:
Сообщение: Re: Creditcard Number Security was Re: Encrypted column
Следующее
От: Kevin Hunter
Дата:
Сообщение: Re: [SQL] subtract a day from the NOW function