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