Wednesday, December 9, 2009

Get the info of a table fields

SELECT
                     a.attname,
                     b.typname,
                     attnum
FROM
                     pg_attribute a
                     left outer join pg_type b ON b.oid = a.atttypid
WHERE
                     attrelid = upper('claim_id')::regclass and
                     attnum>0
ORDER BY
                     attnum
 

 Ref : http://www.alberton.info/postgresql_meta_info.html
         http://old.nabble.com/pg_attribute.attnum---wrong-column-ordinal--td26505966.html

No comments:

Post a Comment