Re: Query to return schema/table/columname/columntype

From: chester c young <chestercyoung(at)yahoo(dot)com>
To: paallen(at)attglobal(dot)net, pgsql-sql(at)postgresql(dot)org
Subject: Re: Query to return schema/table/columname/columntype
Date: 2007-01-19 16:28:53
Message-ID: 176107.34655.qm@web54312.mail.yahoo.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql


> I am trying to modify the dabo (a python wxpython
> ide for database forms creation) code to allow the
> selection of tables in any schema. I need a query
> that will return records with schema, table,
> columname and columne type.

create view pg_cols as select
s.nspname as schema_nm,
r.relname as table_nm,
a.attnum as column_sq,
a.attname as column_nm,
t.typname as datatype,
a.atttypmod as datalen
from pg_attribute a
join pg_type t on( t.oid = a.atttypid )
join pg_class r on( r.oid = a.attrelid )
join pg_namespace s on( s.oid = r.relnamespace )
where a.attnum > 0
and r.relkind = 'r'
and s.nspname = :schemaq;


____________________________________________________________________________________
Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.
http://farechase.yahoo.com/promo-generic-14795097

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message codeWarrior 2007-01-19 16:39:16 Re: Query to return schema/table/columname/columntype
Previous Message Bruno Wolff III 2007-01-19 15:45:49 Re: Query to return schema/table/columname/columntype