pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
List table with same column name
6+ messages / 4 participants
[nested] [flat]

* List table with same column name
@ 2003-10-23 07:46  Abdul Wahab Dahalan <wahab@mimos.my>
  0 siblings, 1 reply; 6+ messages in thread

From: Abdul Wahab Dahalan @ 2003-10-23 07:46 UTC (permalink / raw)
  To: pgsql-sql; wahab@mimos.my

Hi!
How do I list all the tables in the database which has a same column name?.

Thanks




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: List table with same column name
@ 2003-10-23 08:31  achill@matrix.gatewaynet.com
  parent: Abdul Wahab Dahalan <wahab@mimos.my>
  0 siblings, 1 reply; 6+ messages in thread

From: achill@matrix.gatewaynet.com @ 2003-10-23 08:31 UTC (permalink / raw)
  To: Abdul Wahab Dahalan <wahab@mimos.my>; +Cc: pgsql-sql

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<t2.relname and a1.attname = a2.attname;

> 
> Thanks
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

-- 
-Achilleus




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: List table with same column name
@ 2003-10-23 08:40  Peter Childs <blue.dragon@blueyonder.co.uk>
  parent: achill@matrix.gatewaynet.com
  0 siblings, 1 reply; 6+ messages in thread

From: Peter Childs @ 2003-10-23 08:40 UTC (permalink / raw)
  To: achill@matrix.gatewaynet.com; +Cc: Abdul Wahab Dahalan <wahab@mimos.my>; pgsql-sql



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<t2.relname and a1.attname = a2.attname;

	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<t2.relname and a1.attname = a2.attname and
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?

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
>



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: List table with same column name
@ 2003-10-23 09:08  achill@matrix.gatewaynet.com
  parent: Peter Childs <blue.dragon@blueyonder.co.uk>
  0 siblings, 1 reply; 6+ messages in thread

From: achill@matrix.gatewaynet.com @ 2003-10-23 09:08 UTC (permalink / raw)
  To: Peter Childs <blue.dragon@blueyonder.co.uk>; +Cc: Abdul Wahab Dahalan <wahab@mimos.my>; pgsql-sql

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<t2.relname and a1.attname = a2.attname;
> 
> 	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<t2.relname and a1.attname = a2.attname and
> 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<y implies x!=y ?

> 
> 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




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: List table with same column name
@ 2003-10-23 09:09  Peter Childs <blue.dragon@blueyonder.co.uk>
  parent: achill@matrix.gatewaynet.com
  0 siblings, 1 reply; 6+ messages in thread

From: Peter Childs @ 2003-10-23 09:09 UTC (permalink / raw)
  To: achill@matrix.gatewaynet.com; +Cc: Peter Childs <blue.dragon@blueyonder.co.uk>; Abdul Wahab Dahalan <wahab@mimos.my>; pgsql-sql



On Thu, 23 Oct 2003 achill@matrix.gatewaynet.com wrote:

> 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<t2.relname and a1.attname = a2.attname;
> >
> > 	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<t2.relname and a1.attname = a2.attname and
> > 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<y implies x!=y ?

	Yes but when I tested it due to pure intrest to told me that
column a in table 1 also appeared in table 1. Most strange.

Peter Childs

>
> >
> > 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
>
>



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: List table with same column name
@ 2003-10-23 09:57  Achilleus Mantzios <achill@matrix.gatewaynet.com>
  parent: Peter Childs <blue.dragon@blueyonder.co.uk>
  0 siblings, 0 replies; 6+ messages in thread

From: Achilleus Mantzios @ 2003-10-23 09:57 UTC (permalink / raw)
  To: Peter Childs <blue.dragon@blueyonder.co.uk>; +Cc: Abdul Wahab Dahalan <wahab@mimos.my>; pgsql-sql

On Thu, 23 Oct 2003, Peter Childs wrote:

> 
> 
> On Thu, 23 Oct 2003 achill@matrix.gatewaynet.com wrote:
> 
> > 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<t2.relname and a1.attname = a2.attname;
> > >
> > > 	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<t2.relname and a1.attname = a2.attname and
> > > 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<y implies x!=y ?
> 
> 	Yes but when I tested it due to pure intrest to told me that
> column a in table 1 also appeared in table 1. Most strange.

By adding x!= you probably influenced the ordering of the rows,
which gave you the impression of "solving" the "bug",
while actually the "bug" in the first place,
was an effect of a too large xterm that gives the illusion
of a left item to be the same as the right item of a
adjacent line.

Now seriously, if the meaning of x<y was not actually x<y for postgresql,
that would mean a general alarm, heads up, or whatever else we might
call it!

> 
> Peter Childs
> 
> >
> > >
> > > 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
> >
> >
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
> 

-- 
-Achilleus




^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2003-10-23 09:57 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-23 07:46 List table with same column name Abdul Wahab Dahalan <wahab@mimos.my>
2003-10-23 08:31 ` achill@matrix.gatewaynet.com
2003-10-23 08:40   ` Peter Childs <blue.dragon@blueyonder.co.uk>
2003-10-23 09:08     ` achill@matrix.gatewaynet.com
2003-10-23 09:09       ` Peter Childs <blue.dragon@blueyonder.co.uk>
2003-10-23 09:57         ` Achilleus Mantzios <achill@matrix.gatewaynet.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox