Re: Strangeness with UNIQUE indexes and UTF-8 - Mailing list pgsql-hackers

From Laurenz Albe
Subject Re: Strangeness with UNIQUE indexes and UTF-8
Date
Msg-id 224f667e31c565c9c73f7479a8fe9e8028dc0fb7.camel@cybertec.at
Whole thread Raw
In response to Strangeness with UNIQUE indexes and UTF-8  (Omar Kilani <omar.kilani@gmail.com>)
List 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




pgsql-hackers by date:

Previous
From: Omar Kilani
Date:
Subject: Strangeness with UNIQUE indexes and UTF-8
Next
From: David Rowley
Date:
Subject: Re: Strangeness with UNIQUE indexes and UTF-8