Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 644DB9FB3D0 for ; Fri, 19 Jan 2007 12:28:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 89766-06 for ; Fri, 19 Jan 2007 12:28:55 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from web54312.mail.yahoo.com (web54312.mail.yahoo.com [206.190.49.122]) by postgresql.org (Postfix) with SMTP id BCE119FB3CA for ; Fri, 19 Jan 2007 12:28:55 -0400 (AST) Received: (qmail 37967 invoked by uid 60001); 19 Jan 2007 16:28:54 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=EPQKkHH/b8gWjNOe9UmpHbIQZWxtASpb2XrCcTOj3t26OPmd+GzKDqzJZc0njGyKHcEOXAhym0npttUH88d0ZV723rBxVAPAHIq9mz28pv4rMRKbi9FqwVl6417oK8mBo+9E1K/USyNdbKGfBI/4WLlgupYR3i54Y1wtndpIZnY=; X-YMail-OSG: svBDc2sVM1l6kpfxcJqPOQ9JGLE2BAbrcGa7Kr32 Received: from [24.10.123.39] by web54312.mail.yahoo.com via HTTP; Fri, 19 Jan 2007 08:28:53 PST Date: Fri, 19 Jan 2007 08:28:53 -0800 (PST) From: chester c young Subject: Re: Query to return schema/table/columname/columntype To: paallen@attglobal.net, pgsql-sql@postgresql.org In-Reply-To: <20070119124622.0DE929FB2A3@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <176107.34655.qm@web54312.mail.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/82 X-Sequence-Number: 27234 > 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