BUG #6482: Service terminates executing "With ... as ... UPDATE" query - Mailing list pgsql-bugs

From dzolotarevskiy@gmail.com
Subject BUG #6482: Service terminates executing "With ... as ... UPDATE" query
Date
Msg-id E1S0DrY-0007GQ-9O@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #6482: Service terminates executing "With ... as ... UPDATE" query
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      6482
Logged by:          Dmitriy
Email address:      dzolotarevskiy@gmail.com
PostgreSQL version: 9.1.2
Operating system:   Windows Server 2003 r2 32bit
Description:=20=20=20=20=20=20=20=20


All Postgres processes terinates.
In log you can find only=20
LOG: server process (PID ...) was terminated by exception OxC0000005.

All queries works fine when there is only one session. When Sessions more
then 20 it starts terminating with some probability.=20
On my production server it stops about 50 times per day.
On my dev pc, with testing utility that uses 50 sessions at one time, it
falls down in about 1 minute.

Investigating problem i have found the  "fatal" query and excluding part by
part found out that new syntax produce that exception.

To reproduce create 3 tables and execute my query in at least 20
simultaneous threads, each one should use separate session.

Tables:
user_task (pk id, fk user_proxy_id)
user_proxy (pk id, fk proxy_last_id, date)
proxy_last (pk id, last_used)

Query:

with mup as
    (=20
    UPDATE user_proxy=20
    SET date =3D now()=20
    WHERE id=3D
       (select user_proxy_id
        from user_task=20
        where id=3D420
        )=20
    returning proxy_last_id
    )
UPDATE proxy_last=20
SET last_used =3D now()=20
WHERE id=3D(select proxy_last_id=20
          from mup);


I have solved the problem rewriting query to old syntax.

pgsql-bugs by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: BUG #6483: Rows being evaluated, although being outside the LIMIT / OFFSET boundaries
Next
From: michal.rakoczy@sb-betting.com
Date:
Subject: BUG #6481: postgres shuts down unexpectedly