Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id CEA299FB394 for ; Fri, 19 Jan 2007 10:23:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 16042-02 for ; Fri, 19 Jan 2007 10:23:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from kcout01.prserv.net (kcout01.prserv.net [12.154.55.31]) by postgresql.org (Postfix) with ESMTP id 73A389FB2F8 for ; Fri, 19 Jan 2007 10:23:33 -0400 (AST) Received: from kcreg02 (kcreg02.backbone.kan[10.254.3.132]) by prserv.net (kcout01) with SMTP id <2007011914233220100mc7aie>; Fri, 19 Jan 2007 14:23:32 +0000 X-Originating-IP: [10.254.3.132] From: paallen@attglobal.net To: pgsql-sql@postgresql.org, Subject: Re: Query to return schema/table/columname/columntype Date: Fri, 19 Jan 2007 14:23:32 +0000 X-Priority: 3 MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <20070119142333.73A389FB2F8@postgresql.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.207 tagged_above=0 required=5 tests=AWL, BAYES_50, DNS_FROM_RFC_ABUSE, MSGID_FROM_MTA_ID, NO_REAL_NAME X-Spam-Level: ** X-Archive-Number: 200701/80 X-Sequence-Number: 27232 Hi all, I think I have fixed my own problem. At: http://developer.postgresql.org/~momjian/upgrade_tips_7.3 I found the answer which was: SELECT a.attrelid as oid, a.attname, t.typname FROM pg_attribute a inner join pg_type t on a.atttypid = t.oid WHERE a.attrelid = 'co.hole_test'::regclass AND a.attnum > 0 ORDER BY a.attnum; thanks anyway! Phil Hi all, 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. For background I am selecting table & schema by the query: SELECT schemaname || '.' || tablename AS tablename FROM pg_tables ORDER BY tablename; Then I need to obtain the columns within that table/schema. The original query was: select c.oid,a.attname, t.typname from pg_class c inner join pg_attribute a on a.attrelid = c.oid inner join pg_type t on a.atttypid = t.oid where c.relname = 'thetablename and a.attnum > 0; Now my problem is how to create a new column to replace c.relname so I can query on "theschemaname.thetablename". Any suggestions will be welcomed. Thanks, Phil