X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B9556D1B4FE for ; Thu, 23 Oct 2003 08:55:21 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 08864-07 for ; Thu, 23 Oct 2003 05:54:52 -0300 (ADT) Received: from matrix.gatewaynet.com (unknown [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id 002F8D1B4E6 for ; Thu, 23 Oct 2003 05:54:49 -0300 (ADT) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id h9N98ldN029765; Thu, 23 Oct 2003 12:08:47 +0300 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id h9N98lbn029761; Thu, 23 Oct 2003 12:08:47 +0300 Date: Thu, 23 Oct 2003 12:08:47 +0300 (EEST) From: achill@matrix.gatewaynet.com To: Peter Childs Cc: Abdul Wahab Dahalan , Subject: Re: List table with same column name In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/300 X-Sequence-Number: 15700 On Thu, 23 Oct 2003, Peter Childs wrote: > > > On Thu, 23 Oct 2003 achill@matrix.gatewaynet.com wrote: > > > On Thu, 23 Oct 2003, Abdul Wahab Dahalan wrote: > > > > > Hi! > > > How do I list all the tables in the database which has a same column name?. > > > > SELECT t1.relname,a1.attname,t2.relname from pg_class t1,pg_attribute > > a1,pg_class t2,pg_attribute a2 where a1.attrelid=t1.oid and t1.relkind='r' > > and a1.attnum>0 and a2.attrelid=t2.oid and t2.relkind='r' and a2.attnum>0 > > and t1.relname > That will not work. > > SELECT t1.relname,a1.attname,t2.relname from pg_class t1,pg_attribute > a1,pg_class t2,pg_attribute a2 where a1.attrelid=t1.oid and > t1.relkind='r'and a1.attnum>0 and a2.attrelid=t2.oid and t2.relkind='r' > and a2.attnum>0 and t1.relname a1.attisdropped=false and a2.attisdropped=false and t1.relname != > t2.relname; > > Why? > > Well two bugs. > 1> Dropped Columns needed for 7.3. > 2> Do you really need to know that column a in table 1 also appears in > table 1? Have you ever thought that x > Peter Childs > > > > > > > > > Thanks > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 4: Don't 'kill -9' the postmaster > > > > > > > -- > > -Achilleus > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 5: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > -- -Achilleus