Re: ORDER BY 1 COLLATE

From: Dann Corbit <DCorbit(at)connx(dot)com>
To: 'Andrew Dunstan' <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ORDER BY 1 COLLATE
Date: 2011-04-18 20:45:59
Message-ID: 87F42982BF2B434F831FCEF4C45FC33E421EB099@EXCHANGE.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: pgsql-hackers-owner(at)postgresql(dot)org [mailto:pgsql-hackers-
> owner(at)postgresql(dot)org] On Behalf Of Andrew Dunstan
> Sent: Monday, April 18, 2011 1:43 PM
> To: Tom Lane
> Cc: Peter Eisentraut; pgsql-hackers
> Subject: Re: [HACKERS] ORDER BY 1 COLLATE
>
> On 04/18/2011 04:20 PM, Tom Lane wrote:
> > Peter Eisentraut<peter_e(at)gmx(dot)net> writes:
> >> This came from a review by Noah Misch a great while ago:
> >> test=> SELECT b FROM foo ORDER BY 1 COLLATE "C";
> >> ERROR: 42804: collations are not supported by type integer
> >> According to SQL92, this should be supported. Do we want to bother?
> It
> >> doesn't look hard to fix, so it's really only a question of whether
> this
> >> would be useful, or its absence would be too confusing.
> > The ORDER BY 1 business seems to me to be legacy anyway. I'm not
> > inclined to put in even more hacks to make strange combinations work
> > there --- I think we're likely to find ourselves painted into a
> corner
> > someday as it is.
> >
> >
>
> It's likely to be used by SQL generators if nothing else, and I've been
> known to use it as a very convenient shorthand. It would seem to me
> like
> quite a strange inconsistency to allow order by n with some qualifiers
> but not others.

I use order by <result_set_column_number> a lot, especially when result_set_column is a complicated expression.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2011-04-18 21:02:53 pgbench \for or similar loop
Previous Message Andrew Dunstan 2011-04-18 20:43:18 Re: ORDER BY 1 COLLATE