pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #16938: Duplicate records with same Primary Key
2+ messages / 2 participants
[nested] [flat]
* BUG #16938: Duplicate records with same Primary Key
@ 2021-03-22 17:28 PG Bug reporting form <noreply@postgresql.org>
2021-03-22 18:22 ` Re: BUG #16938: Duplicate records with same Primary Key Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2021-03-22 17:28 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: susanacastela@hotmail.com
The following bug has been logged on the website:
Bug reference: 16938
Logged by: Susana Castela Ibáñez
Email address: susanacastela@hotmail.com
PostgreSQL version: 13.2
Operating system: Ubuntu
Description:
Hi,
We're running an instance of postgres 13.2 and some days ago we noticed
duplicated rows with the same primary key.
This was noticed restoring a pg_dump of our db that would be failing because
it tried to insert a duplicate primary key that violated the primary key
restriction.
Our live aplication showed no signs of error during this time.
The issue is very similar to what is described in this discussion:
https://dba.stackexchange.com/questions/62675/why-does-my-table-hold-duplicate-primary-keys
Running a "SELECT primary_key FROM table GROUP BY primary_key HAVING
COUNT(*) > 1" would be yielding the affected records.
We would be pleased to know if this is a known bug or what could be the
cause of it, also a definitive solution for it (we removed the conflictive
rows of the table but the issue reapeared after some days). For the time
being we're going to try to reindex our database.
Thanks a lot.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #16938: Duplicate records with same Primary Key
2021-03-22 17:28 BUG #16938: Duplicate records with same Primary Key PG Bug reporting form <noreply@postgresql.org>
@ 2021-03-22 18:22 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2021-03-22 18:22 UTC (permalink / raw)
To: susanacastela@hotmail.com; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.org> writes:
> We're running an instance of postgres 13.2 and some days ago we noticed
> duplicated rows with the same primary key.
If the key column is of a text type, you might have gotten bit by
operating-system-level changes of sorting rules, which would effectively
make indexes on text columns corrupt [1]. If so, reindexing is the
appropriate fix. There's work in progress to try to notice this sort
of problem automatically, but it's not done yet.
regards, tom lane
[1] https://wiki.postgresql.org/wiki/Locale_data_changes
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2021-03-22 18:22 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 17:28 BUG #16938: Duplicate records with same Primary Key PG Bug reporting form <noreply@postgresql.org>
2021-03-22 18:22 ` Tom Lane <tgl@sss.pgh.pa.us>
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