Yes, if you start psql with the -E switch (ie, psql -E -h dbserver 
database) then do a \d tablename it will show you the SQL query that's used 
to display the table definition.  You can then use this to do your 
selects.  Here is what I get when I do the above:

QUERY: SELECT a.attnum, a.attname, t.typname, a.attlen, a.atttypmod, 
a.attnotnull, a.atthasdef FROM pg_class c, pg_attribute a, pg_type t WHERE 
c.relname = 'tablename'    and a.attnum > 0     and a.attrelid = 
c.oid     and a.atttypid = t.oid   ORDER BY attnum

QUERY: SELECT viewname, definition FROM pg_views WHERE viewname like 
'tablename'


At 12:57 PM 4/9/00, Michael Hall wrote:
>Is there a way to 'select' the names of the fields and the field types
>of a table?
>
>--
>Michael J. Hall, CCA                    Intelligence Technologies Int'l
>[EMAIL PROTECTED]                            http://www.inteltec.com
>secure: [EMAIL PROTECTED]

Reply via email to