How do I list foreign key info/relationships?
Hi,
Sorry if this is a re-post. Could someone tell me how I can list the foreign
key info for a given column or for a given table?
All I want is the information about the relationships for a specified column.
The best I've come up with so far is looking in the pg_trigger table, but this
is not ideal. There must be a way, because pg_dump gets the relationships
somehow.
I would be grateful for any suggestions,
Jason Davies
=====
Jason Davies,
_ _ _|_ _ _ _ _| _ | www.netspade.com
| |(/_ | _\|_)(_|(_|(/_ | programming tutorials
| | programming community
----------------------- | programming news
__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/
AFAIK, right now all you can do is use pg_trigger and that is how pg_dump
is reading the constraint information.
On Mon, 13 Nov 2000, Jason Davies wrote:
Show quoted text
Hi,
Sorry if this is a re-post. Could someone tell me how I can list the foreign
key info for a given column or for a given table?All I want is the information about the relationships for a specified column.
The best I've come up with so far is looking in the pg_trigger table, but this
is not ideal. There must be a way, because pg_dump gets the relationships
somehow.
Hi,
Thanks for that. My problem now is it would be nice to have a way to get this
in one SQL query. I can't find a way to split up the pg_trigger.tgargs column
up into components. The data I need is separated by "\000", but the column type
is bytea. How do I split it up? I've tried using instr and substr, but I can't
get them to work.
Thankyou for your help,
Jason Davies.
--- Stephan Szabo <sszabo@megazone23.bigpanda.com> wrote:
AFAIK, right now all you can do is use pg_trigger and that is how pg_dump
is reading the constraint information.On Mon, 13 Nov 2000, Jason Davies wrote:
Hi,
Sorry if this is a re-post. Could someone tell me how I can list the
foreign
key info for a given column or for a given table?
All I want is the information about the relationships for a specified
column.
The best I've come up with so far is looking in the pg_trigger table, but
this
is not ideal. There must be a way, because pg_dump gets the relationships
somehow.
=====
Jason Davies,
_ _ _|_ _ _ _ _| _ | www.netspade.com
| |(/_ | _\|_)(_|(_|(/_ | programming tutorials
| | programming community
----------------------- | programming news
__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/
Import Notes
Resolved by subject fallback
Unfortunately I don't think there's a good way to do it in SQL itself.
You might be able to do something in one of the procedural
languages. When i did the support for the older pg_dump (which may
look nothing like the current one), all I did was enhance the code that
was already there to handle constraint triggers.
You will probably have to break it up on the client side. If I get a
chance to do computer stuff other than job related stuff I'm probably
going to write something that will return a constraint string for fk
constraints that look like the original statement (plus or minus a
little).
Stephan Szabo
sszabo@bigpanda.com
On Mon, 13 Nov 2000, Jason Davies wrote:
Show quoted text
Thanks for that. My problem now is it would be nice to have a way to get this
in one SQL query. I can't find a way to split up the pg_trigger.tgargs column
up into components. The data I need is separated by "\000", but the column type
is bytea. How do I split it up? I've tried using instr and substr, but I can't
get them to work.