pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stef Telford <stef@chronozon.artofdns.com>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: breakage in schema with foreign keys between 7.0.3 and 7.1
Date: Wed, 18 Apr 2001 16:39:01 -0400
Message-ID: <01041816390109.00282@devil.hades> (raw)
In-Reply-To: <Pine.BSF.4.21.0104181245001.82947-100000@megazone23.bigpanda.com>
References: <Pine.BSF.4.21.0104181245001.82947-100000@megazone23.bigpanda.com>

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



view thread (3+ messages)

Message-ID: <01041816390109.00282@devil.hades>
Permalink:  ../01041816390109.00282@devil.hades/
Also on:    postgresql.org/message-id/01041816390109.00282@devil.hades

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: stef@chronozon.artofdns.com, sszabo@megazone23.bigpanda.com
  Subject: Re: breakage in schema with foreign keys between 7.0.3 and 7.1
  In-Reply-To: <01041816390109.00282@devil.hades>
  References: <Pine.BSF.4.21.0104181245001.82947-100000@megazone23.bigpanda.com> <01041816390109.00282@devil.hades>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox