Re: Inexplicable duplicate rows with unique constraint

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Richard van der Hoff <richard(at)matrix(dot)org>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Inexplicable duplicate rows with unique constraint
Date: 2020-01-16 17:12:30
Message-ID: CABUevEwqyQeFKJbucVTjcchsxeq=eZ+AAsSWi8WKf8HM-EVQoQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 16, 2020 at 6:08 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Richard van der Hoff <richard(at)matrix(dot)org> writes:
> > I'm trying to track down the cause of some duplicate rows in a table
> > which I would expect to be impossible due to a unique constraint. I'm
> > hoping that somebody here will be able to suggest something I might have
> > missed.
>
> Since these are text columns, one possibility you should be looking into
> is that the indexes have become corrupt due to a change in the operating
> system's sorting rules for the underlying locale. I don't recall details
> at the moment, but I do remember that a recent glibc update changed the
> sorting rules for some popular locale settings. If an installation had
> applied such an update underneath an existing database, you'd have a
> situation where existing entries in an index are not in-order according
> to the new behavior of the text comparison operators, leading to havoc
> because btree searching relies on the entries being correctly sorted.

See https://wiki.postgresql.org/wiki/Locale_data_changes for hints on
which linux distros updated when.

--
Magnus Hagander
Me: https://www.hagander.net/
Work: https://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard van der Hoff 2020-01-16 17:24:02 Re: Inexplicable duplicate rows with unique constraint
Previous Message Daniel Verite 2020-01-16 17:11:24 Re: Inexplicable duplicate rows with unique constraint