Re: Strangeness with UNIQUE indexes and UTF-8

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Omar Kilani <omar(dot)kilani(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Strangeness with UNIQUE indexes and UTF-8
Date: 2021-06-06 11:46:17
Message-ID: 224f667e31c565c9c73f7479a8fe9e8028dc0fb7.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 2021-06-06 at 03:54 -0700, Omar Kilani wrote:
> There seems to be a weird bug in Postgres (last tested 11.12) where it
> allows an INSERT into a table with a UNIQUE / UNIQUE CONSTRAINT index
> on a TEXT/VARCHAR when there's already a value present in that index,
> but only for UTF-8 input.
>
> I just had this happen on our user table and it somehow made it so
> that Postgres returned no results for *any* SELECT ... FROM x WHERE
> unique_col = 'x', which unfortunately meant no one could login to our
> service.
>
> I had to:
>
> SET enable_indexscan = off;
> SET enable_bitmapscan = off;
>
> And then the data was returned properly.

Sounds like data corruption.
REINDEX the index and see if that fixes the problem.
Try to figure out the cause (bad hardware?).

Yours,
Laurenz Albe

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2021-06-06 11:59:39 Re: Strangeness with UNIQUE indexes and UTF-8
Previous Message Omar Kilani 2021-06-06 10:54:48 Strangeness with UNIQUE indexes and UTF-8