Re: Does anybody use ORDER BY x USING y?

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Hannu Krosing <hannu(at)skype(dot)net>, John Hansen <john(at)geeknet(dot)com(dot)au>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Does anybody use ORDER BY x USING y?
Date: 2005-09-19 15:24:33
Message-ID: 87br2pozbi.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:

> On Sun, Sep 18, 2005 at 11:23:01PM -0400, Tom Lane wrote:
> <snip>
> > class families" to relate opclasses for different datatypes. Basically
> > I'd like to solve most of these issues by constructing a new layer atop
> > opclasses, not by deciding that an opclass doesn't convey the full story
> > about the behavior of an index column.

The thing is that these opclasses you're describing are closely related. It
ought to be possible to use a single index to produce results in any of the
four orders you describe.

> Where I'm currently going is creating a table of COLLATE orders. These
> collate orders would refer to operator classes but "tweak" them. For
> example, things like:
>
> - Sort ascending or descending (descending reverses the bt*cmp test)
> - NULLs first or last
> - Locale for text types
> - etc

These aren't all related in the same way. While it obviously isn't hard to
produce results ascending or descending, and it shouldn't be hard to produce
NULLs first or last regardless of where they appear in the index, it would be
utterly impossible to use an index built with the wrong locale collation.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-09-19 15:33:34 Re: Does anybody use ORDER BY x USING y?
Previous Message Magnus Hagander 2005-09-19 15:12:14 Re: Beta2 Wrap Up ...