Home > Archive > PostgreSQL SQL > March 2006 > R: Re: R: Re: R: R: Re: schema inspection









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author R: Re: R: Re: R: R: Re: schema inspection
rcolmegna@tiscali.it

2006-03-19, 11:09 am

>Well thats it if you use only *single column* Foreign keys.
>In the general case the above will need extra work.


Are you sure? I have tested query with 3 table with multiple FK and
it works (see below) [as you can see
"C" table have two FK to A and B]

test=> SELECT
test-> (SELECT relname FROM pg_catalog.pg_class WHERE oid=conrelid)
AS fromTbl,
test-> (SELECT relname FROM pg_catalog.pg_class WHERE oid=confrelid)
AS toTbl,
test-> (SELECT attname FROM pg_catalog.pg_attribute WHERE
attrelid=conrelid AND conkey[1]=attnum) AS viaCol
test-> FROM pg_catalog.pg_constraint AS rel WHERE contype='f' ORDER BY
fromTbl;
fromtbl | totbl | viacol
---------+-------+--------
b | a | ida
c | a | ida
c | b | idb

TIA
Roberto Colmegna




Tiscali ADSL 4 Mega Flat
Naviga senza limiti con l'unica Adsl a 4 Mega di velocitÃ_ a soli 19,95 € al mese!
Attivala subito e hai GRATIS 2 MESI e l'ATTIVAZIONE.
http://abbonati.tiscali.it/banner/m...&z=webmail&t=14

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com