Re: breakage in schema with foreign keys between 7.0.3 and 7.1

From: Stef Telford <stef(at)chronozon(dot)artofdns(dot)com>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: breakage in schema with foreign keys between 7.0.3 and 7.1
Date: 2001-04-18 20:39:01
Message-ID: 01041816390109.00282@devil.hades
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Stephan Szabo wrote:
> Hmm, don't know why it's not in changelog, but the spec requires that
> the target fields of a foreign key constraint are themselves constrained
> by a unique or primary key constraint.

maybe its time for me to go and re-read the changelog with a fine tooth
comb (it has been known for me to be blind to the obvious before and
if this is the case then i more than apologise :)

> 7.0 didn't actually check this,
> but 7.1 does. The reason for this is because while 7.0 would let you
> specify such a constraint, it wouldn't really work entirely properly
> if the field wasn't actually unique. You'll need a unique constraint
> on client.client_id.

hhrrm. the only problem with -that- is that client_id by itself is not
unique, but in conjunction with order_id it is. order_id is wholly
unique. maybe i should jst drop the foreign key on client_id then,
although i did want to use referential integrity on the client_id on
an insert.

although now i think about this, the criteria for having the changes
on client_id cascading are totally gone and i could (read will) jst
use a 'references' column.

in short, thank you, i have jst figured out what an idiot i have been
(again i hear you all say ;)

many thanks and good work on postrgresql 7.1, it seems to be quite
a bit quicker (and praise the lord for outer joins =)

stefs

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Diehl, Jeffrey 2001-04-18 21:06:50 RE: Re: DB porting questions...
Previous Message Stephan Szabo 2001-04-18 19:48:13 Re: breakage in schema with foreign keys between 7.0.3 and 7.1