Re: Prepare/Execute silently discards prohibited ORDER BY values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Prepare/Execute silently discards prohibited ORDER BY values
Date: 2015-05-14 01:05:04
Message-ID: 13099.1431565504@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Josh Berkus <josh(at)agliodbs(dot)com> writes:
> On 05/11/2015 08:35 PM, Tom Lane wrote:
>> Somewhere along the line we decided that "ORDER BY non-integer-constant"
>> was too close to the boundary line between those two interpretations, so
>> it would be better to reject it and make you use a less ambiguous syntax.

> Well, the fact that:
> ORDER BY 'test'
> ... errrors, whereas
> ORDER BY 'test'::TEXT
> ... does not is a very small POLS violation.

Agreed; I think the reason why we disallow this case is not so much
string literals as numeric literals. It would be an even bigger POLA
violation if "ORDER BY 1" and "ORDER BY 1.0" were both accepted and did
fundamentally different things.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message maxim.boguk 2015-05-14 04:24:57 BUG #13286: Core dumped during pg_terminate_backend call.
Previous Message Josh Berkus 2015-05-14 00:54:35 Re: Prepare/Execute silently discards prohibited ORDER BY values