From: | Nico Erichsen <nico(dot)e(at)gmx(dot)de> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Transaction isolation with concurrent increments |
Date: | 2002-06-03 19:55:30 |
Message-ID: | 20020603195316.76CE04760D5@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Well, I'm a relative newbie to SQL, but I have been told that this behaviour
is a bug. I hope I didn't misunderstand something.
To reproduce, first create a table 'counters' that looks like that:
counter1
----------
0
(1 row)
Then execute the following commands parallelly on two psql terminals:
set transaction isolation level serializable;
begin;
update counters set counter1=(select counter1+1 from counters);
(The second psql terminal will not return from executing the last statement)
Commit on both terminals, then do a select again. The result will be:
counter1
----------
1
(1 row)
Oops! ;-)
If instead I use an update statement like that:
update counters set counter1=counter1+1;
psql behaves like expected, i.E. the result is 2.
--
Grüße,
Nico
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-06-03 23:33:41 | Re: Should the optimizer optimize "current_date - interval '1 days'" (fwd) |
Previous Message | Ron Mayer | 2002-06-03 19:37:48 | Should the optimizer optimize "current_date - interval '1 days'" (fwd) |