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

Поиск
Список
Период
Сортировка
От paulo matadr
Тема Res: Finding all tables that have foreign keys referencing a table
Дата
Msg-id 45399.2939.qm@web52506.mail.re2.yahoo.com
обсуждение исходный текст
Ответ на Finding all tables that have foreign keys referencing a table  (Andreas Joseph Krogh <andreak@officenet.no>)
Ответы Re: Res: Finding all tables that have foreign keys referencing a table  (Andreas Joseph Krogh <andreak@officenet.no>)
Список pgsql-sql
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 <andreak@officenet.no>
Para: pgsql-sql@postgresql.org
Enviadas: Quinta-feira, 6 de Novembro de 2008 19:35:23
Assunto: [SQL] Finding all tables that have foreign keys referencing a table

Hi.
I see the last comment here suggests a solution for $subject:
http://www.postgresql.org/docs/8.1/interactive/ddl-constraints.html

But it turns out it assumes constraint_name is unique, which is not the case. It is only unique pr. table. In other words, it produces a lot of false results.

I'm trying to make a function which finds all my old "$1" constraints and replaces those names with proper names (_fkey).

So - anybody who knows a good solution for how to find all tables with constraint-names that have foreign keys referencing a table's particluar colum?

--
Andreas Joseph Krogh <andreak@officenet.no>
Senior Software Developer / CEO
------------------------+---------------------------------------------+
OfficeNet AS            | The most difficult thing in the world is to |
Karenslyst Allé 11      | know how to do a thing and to watch        |
PO. Box 529 Skøyen      | somebody else doing it wrong, without      |
0214 Oslo              | comment.                                    |
NORWAY                  |                                            |
Tlf:    +47 24 15 38 90 |                                            |
Fax:    +47 24 15 38 91 |                                            |
Mobile: +47 909  56 963 |                                            |
------------------------+---------------------------------------------+

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua cara @ymail.com ou @rocketmail.com.

В списке pgsql-sql по дате отправления:

Предыдущее
От: Markus Schatten
Дата:
Сообщение: Creating input/output_functions
Следующее
От: paulo matadr
Дата:
Сообщение: sum timestamp result in hours