Re: problem with distinct not distincting...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: John Beynon <john(at)kyan(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: problem with distinct not distincting...
Date: 2012-10-17 16:00:16
Message-ID: 15100.1350489616@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

John Beynon <john(at)kyan(dot)com> writes:
> I have a pretty basic query;
> select distinct on (name) name, length(name) from
> drugs
> where customer_id IS NOT NULL
> order by name;

> which I'd expect to only return me a single drug name if there are
> duplicates, yet I get

> name | length
> ==========
> Roaccutane | 10
> Roaccutane | 10

> table encoding is UTF8...

> I'm scratching my head!

Yeah, me too. What PG version is this exactly? What does EXPLAIN
show for the query? Can you extract a self-contained test case?

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Serodio 2012-10-17 17:06:31 Re: database corruption questions
Previous Message Tom Lane 2012-10-17 15:57:58 Re: pg_stats in 9.2