Re: Reverse-sort indexes and NULLS FIRST/LAST sorting

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Glaesemann <grzm(at)seespotcode(dot)net>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Reverse-sort indexes and NULLS FIRST/LAST sorting
Date: 2007-01-05 20:34:41
Message-ID: 4186.1168029281@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Glaesemann <grzm(at)seespotcode(dot)net> writes:
> On Jan 4, 2007, at 13:33 , Tom Lane wrote:
>> index-column-id [ opclass-name ] [ DESC ] [ NULLS {FIRST|LAST} ]
>>
>> DESC must be a fully reserved word else it can't be distinguished from
>> an opclass name. But guess what, it already is.

> A point in favor of using DESC over REVERSE as you had earlier
> proposed is that DESC is already a reserved word, while REVERSE isnt'
> even in the list of key words.

Right, that's what convinced me not to use REVERSE. Also, the
parallelism of this construct to what is allowed in ORDER BY seems a
bit pleasing.

> As DESC is quite closely associated
> with its antonym ASC wrt ordering, any thoughts of allowing ASC as an
> optional noise word? Users may be surprised if ASC were to throw an
> error.

Yup, I'd come to the same plan. Actually ASC will not be a complete
noise word: if you specify it (or a NULLS clause) on an index type that
doesn't have a sort order, you'll get an error.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2007-01-05 20:54:43 pgsql: Stamp major release 8.3.0, and increment library version numbers.
Previous Message Ron Mayer 2007-01-05 20:33:36 Re: InitPostgres and flatfiles question