From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: muhammadalinazarov@gmail.com
Subject: BUG #15935: Auto increment column changes on error while inserting (violating unique constraint)
Date: Wed, 31 Jul 2019 11:30:06 +0000
Message-ID: <15935-20633f1e9fb4d69f@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15935
Logged by: Muhammadali Nazarov
Email address: muhammadalinazarov@gmail.com
PostgreSQL version: 11.1
Operating system: Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-96-generic x86
Description:
I have seen one interesting behavior.
Let me show on example.
create table tmp (
id serial,
user_id int unique not null);
insert into tmp(user_id)
select 1;
our id => 1, autoincrement value 2;
insert into tmp(user_id)
select 1;
violating unique constraint, autoincrement value 3;
insert into tmp(user_id)
select 2;
select id, user_id
from tmp;
id | user_id
----+---------
1 | 1
3 | 2
Is this a bug or no?
Thank you for your attention.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, muhammadalinazarov@gmail.com
Subject: Re: BUG #15935: Auto increment column changes on error while inserting (violating unique constraint)
In-Reply-To: <15935-20633f1e9fb4d69f@postgresql.org>
References: <15935-20633f1e9fb4d69f@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