Re: Warts with SELECT DISTINCT - Mailing list pgsql-hackers

From Bruno Wolff III
Subject Re: Warts with SELECT DISTINCT
Date
Msg-id 20060504045042.GA14214@wolff.to
Whole thread Raw
In response to Re: Warts with SELECT DISTINCT  (Greg Stark <gsstark@mit.edu>)
Responses Re: Warts with SELECT DISTINCT
List pgsql-hackers
On Thu, May 04, 2006 at 00:05:16 -0400, Greg Stark <gsstark@mit.edu> wrote:
> Bruno Wolff III <bruno@wolff.to> writes:
> 
> > > Whereas it shouldn't be hard to prove that this is equivalent:
> > > 
> > > stark=> explain select col1 from test group by upper(col1),col1 order by upper(col1);
> > >                              QUERY PLAN                              
> > > ---------------------------------------------------------------------
> > >  Group  (cost=88.50..98.23 rows=200 width=32)
> > >    ->  Sort  (cost=88.50..91.58 rows=1230 width=32)
> > >          Sort Key: upper(col1), col1
> > >          ->  Seq Scan on test  (cost=0.00..25.38 rows=1230 width=32)
> > > (4 rows)
> > 
> > I don't think you can assume that that will be true for any locale. If there
> > are two different characters that both have the same uppercase version, this
> > will break things.
> 
> No it won't.

Sure it will, because when you do the group by you will get a different
number of groups. When grouping by the original characters you will get
separate groups for characters that have the same uppercase character, where
as when grouing by the uppercased characters you won't.


pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: Warts with SELECT DISTINCT
Next
From: Tom Lane
Date:
Subject: Re: Warts with SELECT DISTINCT