From: sideuxb-ky.consultant@dgfip.finances.gouv.fr
To: pgsql-bugs@postgresql.org
Cc: sideuxb-ky.consultant@dgfip.finances.gouv.fr
Subject: BUG #14874: Dublicate values in primary key
Date: Thu, 26 Oct 2017 15:16:11 +0000
Message-ID: <20171026151611.1471.44846@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 14874
Logged by: Henri Ky
Email address: sideuxb-ky.consultant@dgfip.finances.gouv.fr
PostgreSQL version: 9.4.4
Operating system: CentOS release 6.5
Description:
We have serious issue with duplicate values in primary key with our database
running in PostgreSQL 9.4.4.
This only occured during about 19 hours and in on table. There were no
restart of the base before and after the issue, and no error found in
PostgreSQL logs.
We use sequence to generate automatically the ID of the PK for each data
row.
Only the ID of the PK are duplicated, whereas the data of their rows are
different.
We have tried to reindex the PK, but failed the following error:
reindex index anomalie_pk;
ERROR: could not create unique index "anomalie_pk"
DÉTAIL : Key (id_anomalie)=(xxxxxxx) is duplicated.
And we have about 260000 data records with duplicated key.
Could you help us to fix the issue?
We create the table and the sequence with the following commandes:
CREATE TABLE anomalie
(
id_anomalie BIGINT NOT NULL,
id_fichier_collecte BIGINT NOT NULL,
id_anomalie_reference BIGINT NOT NULL,
nombre INTEGER
)
TABLESPACE ges_dat;
CREATE SEQUENCE anomalie_id_seq
START WITH 1
INCREMENT BY 1
MINVALUE 1
MAXVALUE 9223372036854775807
CACHE 1
NO CYCLE
;
ALTER SEQUENCE anomalie_id_seq OWNED BY anomalie.id_anomalie;
ALTER TABLE ONLY anomalie ALTER COLUMN id_anomalie SET DEFAULT
nextval('anomalie_id_seq');
ALTER TABLE anomalie ADD CONSTRAINT anomalie_pk PRIMARY KEY (id_anomalie)
USING INDEX TABLESPACE ges_idx;
Regards
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: sideuxb-ky.consultant@dgfip.finances.gouv.fr
Subject: Re: BUG #14874: Dublicate values in primary key
In-Reply-To: <20171026151611.1471.44846@wrigleys.postgresql.org>
References: <20171026151611.1471.44846@wrigleys.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