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