Re: Res: [SQL] Finding all tables that have foreign keys referencing a table

2008-11-07 Thread Tom Lane
Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > Needless to say that it would be nice if this information was available in > the information_schema, I'm probably not the only one spending lots of time > in there. It's probably not in in the standard, but i would be a nice > PG-extention to al

Re: Res: [SQL] Finding all tables that have foreign keys referencing a table

2008-11-07 Thread Andreas Joseph Krogh
On Friday 07 November 2008 21:09:33 Tom Lane wrote: > Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > > AFAICS this lists all tables which have a column named '?', which is not > > what I'm after. I'm after listing all columns referencing a certain column > > as a FOREIGN KEY. > > Should be p

Re: Res: [SQL] Finding all tables that have foreign keys referencing a table

2008-11-07 Thread Tom Lane
Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > AFAICS this lists all tables which have a column named '?', which is not what > I'm after. I'm after listing all columns referencing a certain column as a > FOREIGN KEY. Should be possible to dredge that out of pg_constraint ... about like this:

Re: Res: [SQL] Finding all tables that have foreign keys referencing a table

2008-11-07 Thread Andreas Joseph Krogh
On Friday 07 November 2008 15:15:49 paulo matadr wrote: > Try this > > select table_schema, table_name > from information_schema.columns > where table_schema not in > ('information_schema','pg_catalog') > and column_name = '?' AFAICS this lists all tables which have a column named '?', which is n

Res: [SQL] Finding all tables that have foreign keys referencing a table

2008-11-07 Thread paulo matadr
Try this select table_schema, table_name from information_schema.columns where table_schema not in ('information_schema','pg_catalog') and column_name = '?' De: Andreas Joseph Krogh <[EMAIL PROTECTED]> Para: pgsql-sql@postgresql.org Enviadas: Quinta-feira, 6 de N