Bug #722: SELECT FOR UPDATE bug

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #722: SELECT FOR UPDATE bug
Date: 2002-07-27 01:36:07
Message-ID: 20020727013607.3C124475B5B@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Pablo Avils Cisneros (paviles(at)its(dot)co(dot)cr) reports a bug with a severity of 1
The lower the number the more severe it is.

Short Description
SELECT FOR UPDATE bug

Long Description
Hi, I'm encountered a problem with a select for update sentence with postgresql.

If I use...:
BEGIN TRANSACTION;
SELECT * FROM employees
WHERE status = 'A'
LIMIT 1
FOR UPDATE;
...

The problem, in the previous sentence, is block every record on employees, although we want one record, we want limit 1. The bug it seems the limit 1, because if I dispose the limit 1 line, only the return records are blocked.

If I use:
BEGIN TRANSACTION;
SELECT * FROM employees
WHERE (status = 1) AND (id_employee = 123)
ORDER BY id_employee
FOR UPDATE;
...
it block every record on employees, although we want one record, we want id_employee = 123. The bug it seems the order by line, because if I dispose the order by line, only the return records are blocked.

Do you have an alternative way? Is this a bug? Any suggestion?

I'm using Delphi 6 with dbexpress, and the transaction was make with an TSQLClientDataSet component after an TSQLConnection

Pablo Avils Cisneros
Technology, ITS
Software Development Area
Technology, ITS
San Jos, Costa Rica
email: paviles(at)its(dot)co(dot)cr

Sample Code

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message paviles 2002-07-27 05:09:55 Bug #722: SELECT FOR UPDATE bug
Previous Message Kathy zhu 2002-07-26 18:02:00 bug: 2 dimensional array