SELECT FOR UPDATE....LIMIT ...broken

From: Darren Govoni <darren(at)ontrenet(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: SELECT FOR UPDATE....LIMIT ...broken
Date: 2009-01-11 17:00:00
Message-ID: 1231693200.1239.65.camel@nuraku
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I have a simple scenario that is producing incorrect results with
8.3,ubuntu.

I have queries attempting the same "select-for update limit 1". at the
same time. There are 2 rows in my test database.

The first will enter the transaction and only update ONE of the rows it
selected, because it uses "LIMIT 1" in the select for update.only 1 row
is returned.

The second naturally will block when entering the query until the first
commits its update. But when the second unblocks, it sees 0 rows, even
though there is 1 row left that satisfies its query.

If I re-run the second query, it finds the 1 row left. But not when
released from the UPDATE block.

This seems like a bug to me. Is it fixed in the current dev build? Or is
there something else I'm missing?

Darren

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-01-11 17:12:50 Re: SELECT FOR UPDATE....LIMIT ...broken
Previous Message Martijn van Oosterhout 2009-01-11 13:31:00 Re: Question about updates and MVCC