how to find referenced column and table

From: "Jules Alberts" <jules(dot)alberts(at)arbodienst-limburg(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Subject: how to find referenced column and table
Date: 2002-12-16 09:01:11
Message-ID: 200212160914.gBG9EObH021007@artemis.cuci.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello everyone,

I have a db with lots of relations like this:

create table country (
code varchar primary key,
name varchar not null
);
create table customer (
code varchar primary key,
name varchar not null,
country references country (code)
);

Now I'm building a PHP function that creates an HTML form to change one
row of table CUSTOMER. It's a generic function, it should work on any
table, and it should be able to recognise if a row references another
table, so that a pulldown list can be created dynamically. In this case
a pulldown with all COUNTRY codes in it.

CUSTOMER
code [ ]
name [ ]
country [pick one...[V]

So what I'm looking for is a query that will tell me that row A of
table B references row X of table Y. How would I do this?

TIA for any pointers / help!

--
Jules Alberts.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2002-12-16 09:57:22 Kerberos support interfering with normal access?
Previous Message Manfred Koizar 2002-12-16 07:23:43 Re: Index and performance