Select For Update bug???

Started by Nonameover 23 years ago2 messagesbugs
Jump to latest
#1Noname
paviles@its.co.cr

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 Avilés Cisneros
Technology, ITS
Software Development Area
Technology, ITS
San José, Costa Rica
email: paviles@its.co.cr

#2Bruce Momjian
bruce@momjian.us
In reply to: Noname (#1)
Re: Select For Update bug???

What PostgreSQL version are you using? Please try this in two psql
sessions and see if you see the same thing.

---------------------------------------------------------------------------

paviles@its.co.cr wrote:

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 Avil?s Cisneros
Technology, ITS
Software Development Area
Technology, ITS
San Jos?, Costa Rica
email: paviles@its.co.cr

[ image/gif is not supported, skipping... ]

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026