Re: [BUGS] Status of issue 4593

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Robert Haas" <robertmhaas(at)gmail(dot)com>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>, "Jeff Davis" <pgsql(at)j-davis(dot)com>, "Lee McKeeman" <lmckeeman(at)opushealthcare(dot)com>, "PG Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUGS] Status of issue 4593
Date: 2009-01-13 16:59:52
Message-ID: 496C7428.EE98.0025.0@wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

>>> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
>> Would it make any sense to roll back and generate a
>> SERIALIZATION_FAILURE?
>
> If that's what you want then you run the transaction in serializable
> mode. The point of doing it in READ COMMITTED mode is that you
> don't want such a failure.

Wait a minute -- there is not such guarantee in PostgreSQL when you
start using WITH UPDATE on SELECT statements in READ COMMITTED mode.
By starting two transactions in READ COMMITTED, and having each do two
SELECTs WITH UPDATE (in opposite order) I was able to generate this:

ERROR: deadlock detected
DETAIL: Process 4945 waits for ShareLock on transaction 20234373;
blocked by process 5185.
Process 5185 waits for ShareLock on transaction 20233798; blocked by
process 4945.

So, wouldn't it be better, if it's actually feasible to detect the
problem situation, to make this another situation where SELECT FOR
UPDATE can cause serialization failures? That would allow
applications to count on getting the rows in the requested order if
the query completes successfully. If existing documentation doesn't
already cover the possibility of serialization failures when using FOR
UPDATE, it should. If we need to document something around the issue
of this thread, that seems like the place to do it.

-Kevin

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-01-13 17:16:28 Re: [BUGS] Status of issue 4593
Previous Message Kevin Grittner 2009-01-13 16:18:58 Re: [BUGS] Status of issue 4593

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-01-13 17:02:57 Re: per-database locale: createdb switches
Previous Message Tom Lane 2009-01-13 16:57:00 Re: New patch for Column-level privileges