Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 3E04563221F for ; Wed, 13 May 2009 16:03:37 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 26399-06 for ; Wed, 13 May 2009 16:03:36 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 267B3632175 for ; Wed, 13 May 2009 16:03:36 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id n4DJ3Y10014781; Wed, 13 May 2009 15:03:34 -0400 (EDT) To: Glenn Maynard cc: pgsql-sql@postgresql.org Subject: Re: Distinct oddity In-reply-to: References: <6111.1241879627@sss.pgh.pa.us> Comments: In-reply-to Glenn Maynard message dated "Wed, 13 May 2009 14:48:44 -0400" Date: Wed, 13 May 2009 15:03:33 -0400 Message-ID: <14780.1242241413@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200905/65 X-Sequence-Number: 32557 Glenn Maynard 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