Re: Distinct oddity

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Maximilian Tyrtania <maximilian(dot)tyrtania(at)onlinehome(dot)de>
Cc: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Distinct oddity
Date: 2009-05-08 19:52:43
Message-ID: 13494.1241812363@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Maximilian Tyrtania <maximilian(dot)tyrtania(at)onlinehome(dot)de> writes:
> am 07.05.2009 20:54 Uhr schrieb Scott Marlowe unter scott(dot)marlowe(at)gmail(dot)com:
>> Yeah, that does seem odd. Could it be something like nulls in your
>> data set? just guessing really. If you could make a small test case
>> that shows it happening and allows others to reproduce it you're
>> likely to get more bites.

> It doesn't seem to be related to null values (which wouldn't explain it
> anyway) nor to this particular field...

Can you reproduce it in other contexts than specifically count(distinct)?
In particular I'd try

select count(*) from
(select distinct f.bezeichnung from firmen f) ss;

select count(*) from
(select distinct f.bezeichnung||'e' from firmen f) ss;

If those give the same numbers as you're showing here, then the
next step would be to dump out the actual results of the SELECT DISTINCT
queries and compare them --- looking at the actual data values should
give some insight as to what's happening.

BTW, what is the datatype of f.bezeichnung, and what locale are you
running in?

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Emi Lu 2009-05-08 21:05:27 view vs. tables used to define that view
Previous Message Peter Koczan 2009-05-08 19:08:56 Re: ascii-betical sort order?