Duplicated IDs

From: Alexis Bernard <alexis(at)bernard(dot)io>
To: pgsql-general(at)postgresql(dot)org
Subject: Duplicated IDs
Date: 2014-08-09 09:38:52
Message-ID: CANiB9R9ARsN0xM3uokUqzAw-W_PxxwOPDwSq0fNom5PP2Miynw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I am having regurlarly duplicated rows with the same primary key.

=> select id, created_at, updated_at from tracks where created_at =
'2014-07-03 15:09:16.336488';
id | created_at | updated_at
--------+----------------------------+----------------------------
331804 | 2014-07-03 15:09:16.336488 | 2014-07-03 15:37:55.253729
331804 | 2014-07-03 15:09:16.336488 | 2014-07-03 15:37:55.253801

=> select id from tracks where id = 331804;
id
----
(0 rows)

=> delete from tracks where created_at = '2014-07-03 15:09:16.336488' and
updated_at = '2014-07-03 15:37:55.253801';
ERROR: update or delete on table "tracks" violates foreign key constraint
"fk_sources_on_track_id" on table "sources"
DETAIL: Key (id)=(331804) is still referenced from table "sources".

All colums are identical except the updated_at.

PostgreSQL version is 9.3 and fsync is true.

Any idea how I can clean my table? And then how I can stop this?

Cheers,
Alexis

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2014-08-09 10:35:14 Re: Duplicated IDs
Previous Message Tim Smith 2014-08-09 07:20:40 Re: A question for Postgres OLAP gurus....