Re: Referential integrity problem postgresql 7.2 ?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Referential integrity problem postgresql 7.2 ?
Date: 2002-06-11 20:52:21
Message-ID: 20020611133833.U82390-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Tue, 11 Jun 2002, Tom Lane wrote:

> Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> writes:
> > As a related side note. The other part of the original patch (the NOT
> > EXISTS in the upd/del no action trigger) was rejected. For match
> > full and match unspecified the same result can be reached by doing another
> > query which may be better than the subquery. Do you think that'd be
> > better?
>
> No opinion offhand; can you show examples of the alternatives you have
> in mind?

[guessing that -bugs is probably not appropriate anymore, moving to
-hackers]

An additional query of the form...
SELECT 1 FROM ONLY <pktable> WHERE pkatt=<keyval1> [AND ...]

to the upd/del no action triggers. Right now in either deferred
constraints or when multiple statements are run in a function
we can sometimes raise an error where there shouldn't be one
if a pk row is modified and a new pk row that has the old values
is added. The above should catch this (and in fact the first versions
of the patch that I did which were only sent to a couple of people
who were having problems did exactly that). When I did the
later patch, I changed it to a NOT EXISTS() subquery because
for match partial, the new row might not need to exactly match,
but the details of how it needs to match are based on what
matching rows there are in the fk table. I'm not sure in general
how else (apart from doing a lower level scan of the table) how
to tell if another unrelated row with the same values has been
added to the table between the point of the action that caused
this trigger to be added to the queue and the point the trigger
runs.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2002-06-11 21:33:57 Re: Bug #690: pg_ctl doesn't act properly for option -w
Previous Message pgsql-bugs 2002-06-11 20:34:26 Bug #690: pg_ctl doesn't act properly for option -w

Browse pgsql-hackers by date

  From Date Subject
Next Message Ross J. Reedstrom 2002-06-11 21:01:46 Re: New string functions; initdb required
Previous Message Victor Wagner 2002-06-11 20:13:11 Re: Referential integrity problem postgresql 7.2 ?