Re: Getting table attributes
От | Franco Bruno Borghesi |
---|---|
Тема | Re: Getting table attributes |
Дата | |
Msg-id | 1076088465.12238.4.camel@taz.oficina.oficina обсуждение исходный текст |
Ответ на | Getting table attributes ("C G" <csgcsg39@hotmail.com>) |
Список | pgsql-general |
this query will list every table (with its attributes) in the "public" schema. You could alter the where clause to add more schemas (maybe using IN):
SELECT
N.nspname,
C.relname,
A.attname,
pg_catalog.format_type(a.atttypid, a.atttypmod) AS typeName
FROM
pg_class C,
pg_namespace N,
pg_attribute A,
pg_type T
WHERE
(C.relkind='r') AND
(N.oid=C.relnamespace) AND
(A.attrelid=C.oid) AND
(A.atttypid=T.oid) AND
(A.attnum>0) AND
(NOT A.attisdropped) AND
(N.nspname ILIKE 'public')
ORDER BY
C.oid, A.attnum;
On Fri, 2004-02-06 at 13:53, C G wrote:
SELECT
N.nspname,
C.relname,
A.attname,
pg_catalog.format_type(a.atttypid, a.atttypmod) AS typeName
FROM
pg_class C,
pg_namespace N,
pg_attribute A,
pg_type T
WHERE
(C.relkind='r') AND
(N.oid=C.relnamespace) AND
(A.attrelid=C.oid) AND
(A.atttypid=T.oid) AND
(A.attnum>0) AND
(NOT A.attisdropped) AND
(N.nspname ILIKE 'public')
ORDER BY
C.oid, A.attnum;
On Fri, 2004-02-06 at 13:53, C G wrote:
Dear All, I'm trying to get a table containing all the user created tables, which contains the column name and their types. Basically, I want to be able to do "\d all_user_tables" - but I can't use the \d notation. I tried to combine the pg_ tables, but I couldn't get what I wanted (due to my lack of skill). Any ideas? Thanks Colin _________________________________________________________________ Find a cheaper internet access deal - choose one to suit you. http://www.msn.co.uk/internetaccess ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend
Вложения
В списке pgsql-general по дате отправления: