Re: Locating ( FKs ) References to a Primary Key
От | Roger Tannous |
---|---|
Тема | Re: Locating ( FKs ) References to a Primary Key |
Дата | |
Msg-id | 20050818055821.34703.qmail@web51902.mail.yahoo.com обсуждение исходный текст |
Ответ на | Locating ( FKs ) References to a Primary Key (Roger Motorola <roger77_lb@yahoo.com>) |
Список | pgsql-sql |
Dmitri, Thanks !! I got exactly what I wanted :) In fact, I used your query like this: SELECTcl.relname AS FK_table_name, a.attname AS FK_column_name,clf.relname AS PK_table_name,af.attname AS PK_column_name FROM pg_catalog.pg_attribute a JOIN pg_catalog.pg_class cl ON (a.attrelid = cl.oid AND cl.relkind = 'r') JOIN pg_catalog.pg_namespace n ON (n.oid = cl.relnamespace) JOIN pg_catalog.pg_constraint ct ON (a.attrelid = ct.conrelid AND ct.confrelid != 0 AND ct.conkey[1] = a.attnum) JOIN pg_catalog.pg_class clf ON (ct.confrelid = clf.oid AND clf.relkind = 'r') JOIN pg_catalog.pg_namespace nf ON (nf.oid = clf.relnamespace) JOIN pg_catalog.pg_attribute af ON (af.attrelid = ct.confrelid AND af.attnum = ct.confkey[1]) WHERE n.nspname = nf.nspname AND n.nspname = 'public' AND clf.relname like 'sip_emp' AND af.attname = 'id'; Best Regards, Roger Tannous. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
В списке pgsql-sql по дате отправления: