Re: BUG #6774: FOR IN SELECT LOOP ignores ORDER BY
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jan Wieck <JanWieck@Yahoo.com>
Cc: Boris Folgmann <boris@folgmann.de>, pgsql-bugs@postgresql.org
Date: 2012-07-30T16:36:13Z
Lists: pgsql-bugs
Jan Wieck <JanWieck@Yahoo.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