Re: 7.1beta4 bug creating a certain table

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org, ltibor(at)mail(dot)tiszanet(dot)hu
Subject: Re: 7.1beta4 bug creating a certain table
Date: 2001-01-30 18:19:17
Message-ID: Pine.BSF.4.21.0101301012290.7051-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

On Tue, 30 Jan 2001, Kovacs Zoltan wrote:

> > It appears to me that this is correct, since there is no constraint
> > on the first column that says that those three columns form a unique
> > key *by themselves*. I believe there were bugs in the code that checked
> > for this error before ...
> >
> > regards, tom lane
> >
> I don't know the exact SQL definition whether my declaration is correct or
> not. But, checking our model, we realized that our implementation is not
> correct. So I should rewrite these definitions. Thanks! :-)
>
> But, if this declaration is not correct in the sense of SQL standards, I
> can imagine that PostgreSQL may allow such declarations. (A NOTICE may be
> given instead of an ERROR.) Or, are there any drawbacks of allowing this?

Yes. The columns *must* be unique because the logic that the foreign keys
are defined to use doesn't really make sense for match unspecified and
match full if they can have duplicates.

You'd need logic like that for match partial for all of the cases for it
to really make sense. For example, if you can have two pk rows with key
values (1,2) and a fk row (1,2) and you update one of the two pk rows to
(2,3) what happens on an on update cascade? Match partial still
"requires" that the keys be unique but since fk rows can already match
more than one pk row it's probably not as big a deal. Of course, match
partial is a real pain because you need to keep stuff around about what
*other* rows were modified during the statement while you're running the
trigger.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message m w 2001-01-30 18:48:14 Like vs '=' bug with indexing
Previous Message Barry Lind 2001-01-30 17:41:11 Re: Re: [GENERAL] Trouble porting postgreSQL to WinNT

Browse pgsql-sql by date

  From Date Subject
Next Message Najm Hashmi 2001-01-30 21:36:38 Re: [SQL] 7.1beta4 bug creating a certain table
Previous Message Stef Telford 2001-01-30 17:23:01 Re: Archival of Live database to Historical database