Re: BUG #1266: Improper unique constraint / MVCCactivitieswithin

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Aleksey Fedorchenko <alexey_f(at)ukr(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1266: Improper unique constraint / MVCCactivitieswithin
Date: 2004-09-26 18:11:08
Message-ID: 20040926110407.J36848@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On Sun, 26 Sep 2004, Aleksey Fedorchenko wrote:

> As i told, under pgAdmin's console and PHP it fails anyway but psql
> falls only with function invocation.

Hmm, for PHP was it sent as one big string with all the statements or a
separate statements? There's a side issue that I believe you can send
multiple statements in one query string, but they're treated specially if
you do so.

> > In the former case there's a reading of spec
> > question for the timing of the actions (are they on the statement or at
> > check time -- we've done the latter although a rereading implies that we
> > may have previously read it wrong) and the latter, up until Tom's very
> > recent patch, any AFTER triggers (or foreign keys) waited until the end of
> > the original statement from the user to run.
>
> I misunderstood this sentence... Do you wanna told me that within single
> statements batch there could be non-serializable execution? If true then
> it seems to be a architectual issue (i could expect parallel execution
> within single sql statement but all constraints have to be checked right
> after it finished - not before and not after, just at a statement
> execution finish moment). Otherwise it is a bug anyway, imho.

What I'm saying is that, constraints are checked at end of statement. In
current releases (8.0b2 included I believe but not 8.0b3) functions are
considered part of the statement that called them, so the constraints are
check at the end of the full outer statement that called the function.
8.0b3 should change this so that the inner statements are considered
separately. In addition, referential actions are currently (but may not be
in 8.0 final) considered to occur at constraint check time, which means
for a deferred constraint, at end of transaction or when set constraints
is used to make the constraint immediate. The reason the latter may
change is that with rereading the spec we are not sure if that is actually
what the spec intends and are still investigating that.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2004-09-26 18:15:25 Re: BUG #1266: Improper unique constraint / MVCCactivitieswithin
Previous Message Aleksey Fedorchenko 2004-09-26 18:09:41 Re: BUG #1266: Improper unique constraint / MVCCactivitieswithin single transaction - addendum