From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: mael.villat@gmail.com
Subject: BUG #18324: Duplicate value when I insert values in PK column
Date: Fri, 02 Feb 2024 13:05:56 +0000
Message-ID: <18324-c399192389d72f74@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 18324
Logged by: Mael Villat
Email address: mael.villat@gmail.com
PostgreSQL version: 16.1
Operating system: Windows Server
Description:
Dear Dev team,
I have a table called mdt_prestation with the following column:
colId integer NOT NULL GENERATED BY DEFAULT AS IDENTITY
I have a timesheet app with only one query that INSERT values in this table
(extract from the psql log):
INSERT INTO myTable (Client, Employee)VALUES('1150','185') RETURNING colId
I have about 35 users that uses this app and sometimes we have the following
error:
ERREUR: la valeur d'une clé dupliquée rompt la contrainte unique «
myTable_pkey» (error duplicate value key, unique constraint violation, )
DETAIL: La clé « (colid)=(1704236) » existe déjà (key 1704236 already
exist)
Most of the time we don't have this issue. And the sequence is correct
(sequence = max id value). I'm sure that nobody insert manuel id.
So I believe that there is a concurrency issue in postgresql server with the
sequence when we insert a value.
Best regards
Mael
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, mael.villat@gmail.com
Subject: Re: BUG #18324: Duplicate value when I insert values in PK column
In-Reply-To: <18324-c399192389d72f74@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