Re: BUG #6774: FOR IN SELECT LOOP ignores ORDER BY

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: Boris Folgmann <boris(at)folgmann(dot)de>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6774: FOR IN SELECT LOOP ignores ORDER BY
Date: 2012-07-30 16:36:13
Message-ID: 1186.1343666173@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Jan Wieck <JanWieck(at)Yahoo(dot)com> writes:
> Note that PL/pgSQL replaces all local variables inside a query with
> $-parameters for the prepared SPI plan. The parser rejects ordering by
> non-integer constants, but it does not reject ordering by $-parameters
> or constant expressions. (maybe it should).

The only real reason it complains about simple constants is that
otherwise people might think "ORDER BY 1" means something different
than what it does mean according to SQL92. Otherwise, if you want
to sort by a constant, who are we to stop you?

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Fábio Hentz Lunkes 2012-07-30 23:31:20 Re: BUG #6768: Failure in OBDC
Previous Message Jan Wieck 2012-07-30 16:21:38 Re: BUG #6774: FOR IN SELECT LOOP ignores ORDER BY