Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id C534A632D0F for ; Sat, 9 May 2009 11:33:57 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 36920-09 for ; Sat, 9 May 2009 11:33:47 -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 F1C9D6327B7 for ; Sat, 9 May 2009 11:33:55 -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 n49EXlPC006112; Sat, 9 May 2009 10:33:48 -0400 (EDT) To: Maximilian Tyrtania cc: pgsql-sql@postgresql.org Subject: Re: Distinct oddity In-reply-to: References: Comments: In-reply-to Maximilian Tyrtania message dated "Sat, 09 May 2009 09:22:24 +0200" Date: Sat, 09 May 2009 10:33:47 -0400 Message-ID: <6111.1241879627@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.143 tagged_above=0 required=5 tests=AWL=0.143 X-Spam-Level: X-Archive-Number: 200905/41 X-Sequence-Number: 32533 Maximilian Tyrtania writes: > FAKDB=# select distinct f.bezeichnung from firmen f order by 1 limit 5 > FAKDB-# ; > bezeichnung > ----------------------------------------- > Šsterreichisches Verkehrsbro AG > \x01Assistenz > \x10Frohstoff Design & Textilveredelung > "1. Mittelschule ""Am Kupferberg""" > (5 rows) > FAKDB=# select distinct f.bezeichnung||'e' from firmen f order by 1 limit 5 > ; > ?column? > ------------------------------------------ > Österreich/Welt (Ltg.)e > Šsterreichisches Verkehrsbro AGe > \x01Assistenze > \x10Frohstoff Design & Textilveredelunge > "1. Mittelschule ""Am Kupferberg"""e > (5 rows) > Aha, the "Österreich/Welt (Ltg.)"-entry is missing in the 1st query. So that > does smell like a locale problem. That only proves that adding the 'e' changes the sort order, which is completely unsurprising for any non-C locale. What you need to do is dump out the *entire* results of the DISTINCT queries and look for the unmatched lines. I'd try dumping to two files, stripping the 'e' with sed, and then sort/diff. regards, tom lane