pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: ziegenberg@web.de
Subject: BUG #15967: Sequence generation using NEXTVAL() fails on 64bit systems
Date: Tue, 20 Aug 2019 06:52:12 +0000
Message-ID: <15967-ae7fd939200f4547@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15967
Logged by:          Christoph Ziegenberg
Email address:      ziegenberg@web.de
PostgreSQL version: 11.5
Operating system:   Windows / Linux
Description:        

Problem:
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.

Details:
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



view thread (9+ messages)  latest in thread

Message-ID: <15967-ae7fd939200f4547@postgresql.org>
Permalink:  ../15967-ae7fd939200f4547@postgresql.org/
Also on:    postgresql.org/message-id/15967-ae7fd939200f4547@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, ziegenberg@web.de
  Subject: Re: BUG #15967: Sequence generation using NEXTVAL() fails on 64bit systems
  In-Reply-To: <15967-ae7fd939200f4547@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox