[BUGS] BUG #14874: Dublicate values in primary key

Поиск
Список
Период
Сортировка
От sideuxb-ky.consultant@dgfip.finances.gouv.fr
Тема [BUGS] BUG #14874: Dublicate values in primary key
Дата
Msg-id 20171026151611.1471.44846@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: [BUGS] BUG #14874: Dublicate values in primary key
Список pgsql-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
NOCYCLE
 
; 

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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: postgresql@arkhena.33mail.com
Дата:
Сообщение: [BUGS] BUG #14873: table_constraint description missing in ALTER TABLEsynopsis
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: [BUGS] BUG #14874: Dublicate values in primary key