Re: Duplicate Values or Not?! - Mailing list pgsql-general

From Tom Lane
Subject Re: Duplicate Values or Not?!
Date
Msg-id 7576.1126966962@sss.pgh.pa.us
Whole thread Raw
In response to Re: Duplicate Values or Not?!  (Greg Stark <gsstark@mit.edu>)
Responses Re: Duplicate Values or Not?!
List pgsql-general
Greg Stark <gsstark@mit.edu> writes:
> John Seberg <johnseberg@yahoo.com> writes:
>> This tells me that Postgresql is not using the same
>> method for determining duplicates when GROUPING and
>> INDEXing.

> You might try running the GROUP BY query after doing:
> set enable_hashagg = false;

> With that false it would have to sort the results which should be exactly the
> same code as the index is using. I think.

If that does change the results, it indicates you've got strings which
are bytewise different but compare equal according to strcoll().  We've
seen this and other misbehaviors from some locale definitions when faced
with data that is invalid per the encoding the locale expects.

So, yeah, the answer is to fix your encoding problems.  In particular,
don't ever use a locale like that with a SQL_ASCII database encoding,
because then Postgres won't prevent strcoll from seeing data it fails
on.  The only safe locale setting for a SQL_ASCII database is C,
I think.

            regards, tom lane

pgsql-general by date:

Previous
From: cbeahm@gmail.com
Date:
Subject: Contraint Trigger Permissions
Next
From: Greg Stark
Date:
Subject: Re: Duplicate Values or Not?!