Re: Foreign Keys and OIDs

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Toshio Kuratomi <badger(at)prtr-13(dot)ucsc(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Foreign Keys and OIDs
Date: 2000-12-17 02:01:57
Message-ID: Pine.BSF.4.21.0012161757540.67800-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Foreign keys to oids are not currently supported (and won't
be 7.1 either I believe). Right now you'll have to use a new
key column.

On Sat, 16 Dec 2000, Toshio Kuratomi wrote:

> Is the foreign key mechanism supposed to work with OIDs?
> Is it known to be broken in 7.0.3?
>
> I declare two tables:
>
> CREATE TABLE address (
> street text,
> city text,
> state char(2) check ( state ~'[A-Z]{2}')
> );
>
> CREATE TABLE personaddress (
> person_id integer,
> address_id oid references address(oid),
> notes text,
> primary key (person_id, address_id)
> );
>
> Then I insert data into both address and person.
> When I try to insert into personaddress I get the following reply:
>
> =>INSERT INTO personaddress VALUES ('1', '29321', 'My home');
> ERROR: constraint <unnamed>: table address does not have an attribute oid
>
> Should I create a new primary key column or is there some workaround or a
> fix in the upcoming release or am I just plain doing something wrong?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-12-17 02:55:36 Re: Concurrent transaction problem
Previous Message Robert B. Easter 2000-12-17 01:30:15 Re: question