| Achilleus Mantzios 2006-03-17, 3:27 am |
| O rcolmegna@tiscali.it Ýãñáøå óôéò Mar 17, 2006 :
> pg_class
>
> Thanks! I have obtained my query! Here is:
>
> SELECT
> (SELECT relname FROM pg_catalog.pg_class WHERE oid=conrelid) AS
> fromTbl,
> (SELECT relname FROM pg_catalog.pg_class WHERE oid=confrelid) AS
> toTbl,
> (SELECT attname FROM pg_catalog.pg_attribute WHERE attrelid=conrelid
> AND conkey[1]=attnum) AS viaCol
> FROM pg_catalog.pg_constraint AS rel WHERE contype='f';
Well thats it if you use only *single column* Foreign keys.
In the general case the above will need extra work.
Of course you will also have to ensure that the constraint is indeed
a FK constraint, that the column is not droped, etc....
which leads to the answer that enabling statement logging,
and then \d and watching the log is a very good friend too.
>
> 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
>
--
-Achilleus
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
|