Re: Removing SORTFUNC_LT/REVLT

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: andrew(at)supernews(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Removing SORTFUNC_LT/REVLT
Date: 2006-01-01 11:01:42
Message-ID: 20060101110134.GA1182@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jan 01, 2006 at 07:48:56AM -0000, Andrew - Supernews wrote:
> Doesn't this result in incorrect output in multi-column sorts?
>
> i.e. if 'Foo' = 'foo', but for sorting purposes you always sort them
> with 'Foo' first, then a multicolumn sort of the following data:
>
> ('Foo',1)
> ('foo',2)
> ('Foo',3)
>
> would produce the wrong output, no?

Yeah, I was thinking about that but I'm not sure how big a problem it
is.

We could make this work by having the sorting routines (and by
extension the lookups for indexes) by doing two passes: one with the
comparison routines and use the actual sorting routines only on
tie-breaks. A kind of big mark against the idea. Although this is
exactly the kind of work required for string sorting in many locales...

Whatever we do, the result of ORDER BY has to match index order. Does
this mean scankeys need to have two functions, in case of tie-breaking
multi-column keys. I dunno but it needs thinking about.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-01-01 11:12:24 Re: Removing SORTFUNC_LT/REVLT
Previous Message Qingqing Zhou 2006-01-01 07:52:48 Re: EINTR error in SunOS