BUG #15967: Sequence generation using NEXTVAL() fails on 64bit systems

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: ziegenberg(at)web(dot)de
Subject: BUG #15967: Sequence generation using NEXTVAL() fails on 64bit systems
Date: 2019-08-20 06:52:12
Message-ID: 15967-ae7fd939200f4547@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15967
Logged by: Christoph Ziegenberg
Email address: ziegenberg(at)web(dot)de
PostgreSQL version: 11.5
Operating system: Windows / Linux

Parallel API requests to an application which result in inserts into the
database cause an duplicate key error. The column is the primary key, which
value is generated by a sequence.The number of requests required to cause
this varies in dependence of the database server/load, in my tests it took
between 5 and 20 parallel requests.

For the inserts the next sequence value is selected using NEXTVAL(), done in
a separate query (not directly in the INSERT).

I did many tests:
- with/without transactions (which shouldn't affect the sequence),
- with/without a DEFAULT of NEXTVAL() for the primary key column
- several Postgres versions...
and could reduce the error to 64bit Postgres 10 / 11 installations on
Windows and Ubuntu (didn't test older versions).

Test results with different Postgres versions:
- Postgres 10.10, 64bit (Ubuntu): failed
- Postgres 10.10, 64bit (Windows): failed
- Postgres 11.5, 64bit (Windows): failed
- Postgres 10.10 32bit (Windows): works


Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Lakhin 2019-08-20 07:00:01 Re: BUG #15943: Valgrind-detected error in SlruPhysicalWritePage
Previous Message Tom Lane 2019-08-19 22:04:25 Re: BUG #15940: json_populate_recordset fails with ERROR: record type has not been registered