MySQLs Describe emulator!
От | Boulat Khakimov |
---|---|
Тема | MySQLs Describe emulator! |
Дата | |
Msg-id | 3AA44897.121D60F0@inet-interactif.com обсуждение исходный текст |
Ответы |
Re: MySQLs Describe emulator!
|
Список | pgsql-general |
Hi, Here is a nifty query I came up with that provides a detailed information on any row of any table. Something that is build into mySQL (DESC tablename fieldname) but not into PG. SELECT a.attname AS Field, c.typname as Type, a.atttypmod-4 AS Size FROM pg_attribute a, pg_class b, pg_type c WHERE a.attrelid=b.oid AND a.attname='[fieldname]' AND b.relname='[tablename]' AND c.OID=a.atttypid; Output looks like this funio=# SELECT a.attname AS Field, c.typname as Type, funio-# a.atttypmod-4 AS Size funio-# FROM pg_attribute a, pg_class b, pg_type c funio-# WHERE a.attrelid=b.oid funio-# AND a.attname='company' funio-# AND b.relname='tbluser' funio-# AND c.OID=a.atttypid; field | type | size ---------+---------+------ company | varchar | 50 (1 row) Pretty nifty huh? ;) If I have time im gonna make a buildin function (DESC) out of it -- Nothing Like the Sun
В списке pgsql-general по дате отправления: