BUG #5027: SQL query error?

From: "Dmitry" <master(at)hsdesign(dot)ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5027: SQL query error?
Date: 2009-09-01 13:51:52
Message-ID: 200909011351.n81DpqVU034477@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5027
Logged by: Dmitry
Email address: master(at)hsdesign(dot)ru
PostgreSQL version: 8.3.5
Operating system: ALT Linux
Description: SQL query error?
Details:

Hello,

I try to make user rating by this query:

"BEGIN;
ALTER SEQUENCE service.rate_seq RESTART 1;
UPDATE service.user u
SET rate = sr.rate
FROM (
SELECT user_id, nextval('service.rate_seq') as rate
FROM
(
SELECT user_id, score FROM service.user
ORDER BY score DESC
) a
) sr
WHERE u.user_id = sr.user_id;
END;"

all work fine, but if while this query is executing another process do
"UPDATE service.user SET score=score+1" i get wrong sequence value; for
example
if user count = 55000 i can get 512321 in sequence ;(
why? query error?

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-09-01 15:06:35 Re: BUG #5025: Aggregate function with subquery in 8.3 and 8.4.
Previous Message Narendra Shah 2009-09-01 12:02:50 BUG #5026: No buffer space available error. Does any other solution exist other than changing windows paramete