Re: Distinct oddity - Mailing list pgsql-sql

From Tom Lane
Subject Re: Distinct oddity
Date
Msg-id 14780.1242241413@sss.pgh.pa.us
Whole thread Raw
In response to Re: Distinct oddity  (Glenn Maynard <glennfmaynard@gmail.com>)
List pgsql-sql
Glenn Maynard <glennfmaynard@gmail.com> writes:
> For purposes of DISTINCT, I'd expect any sort order should do; all it
> needs is for equal values to be grouped together.  If strcoll() ever
> fails to do that, I'd call it a critical bug--even throwing total
> garbage at it should result in a consistent ordering, even if the
> ordering itself is totally meaningless.

Feel free to complain to the libc authors for your platform --- there
are quite a number of platforms where we know that strcoll does in fact
return garbage (as in inconsistent results) when given garbage input
(which in this case typically means data that's invalid according to
what strcoll thinks the encoding is).  That's one reason why we've been
tightening up the encoding-validity enforcement in recent PG releases.

It's not entirely clear to me how things are going wrong in Maximilian's
particular example, but I suspect that the root of it is a problem of
this type.

> Tangentally, is there a better way of rolling back a function than a
> dumb hack like "SELECT 1/0"?

RAISE ERROR?
        regards, tom lane


pgsql-sql by date:

Previous
From: Glenn Maynard
Date:
Subject: Re: Distinct oddity
Next
From: Emi Lu
Date:
Subject: How to dump views definition in one schema?