pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Francisco Olarte <folarte@peoplecall.com>
Cc: Emiel Hermsen <s32191234@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: Case in Order By Ignored without warning or error
Date: Wed, 08 Jun 2016 10:32:52 -0400
Message-ID: <19406.1465396372@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+bJJbwi0CdEeCuoVE1HTh8n=qfrGPvNzHYRK7_RGqcJEBkeRw@mail.gmail.com>
References: <CABBJNBuLrK2giyL9tmauipdRHZsMoOpDs3cJcnCUUdWJGj6ftw@mail.gmail.com>
	<CA+bJJbyffQXoC=ZBgU+2C3D=Nw2RWw_TNVvjNYZg=UEUAj+aLw@mail.gmail.com>
	<CAKFQuwaSm9MPoEeU2N1xrQ3a+eSRb-T5w22LXxuG4myaq0GXmA@mail.gmail.com>
	<CABBJNBvw11d+6LS0yoeivLYGhf40DYZ77JicEjhmCNSusPOLyg@mail.gmail.com>
	<CA+bJJbwi0CdEeCuoVE1HTh8n=qfrGPvNzHYRK7_RGqcJEBkeRw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Francisco Olarte <folarte@peoplecall.com> writes:
> On Wed, Jun 8, 2016 at 10:39 AM, Emiel Hermsen <s32191234@gmail.com> wrote:
>> The second option, again just my opinion, would be to change the behavior
>> where the ORDER BY clause refuses any contained content other than numbers
>> and column names combined with the ASC and DESC keywords.

> I *strongly* disagree with that.

Yeah, there is very little chance we'd change the behavior here.  Some
context might help: the behavior whereby ORDER BY's arguments are names
or numbers of output columns was mandated in SQL92.  SQL99, and more
recent iterations of the standard, redefined ORDER BY's arguments as
being arbitrary expressions over the input columns.  Postgres attempts
to be compatible with both of those interpretations.  There's no way that
we would drop the SQL99 behavior, because that's required by current
spec.  Dropping the SQL92 behavior is also unpleasant to contemplate,
because it would break a lot of legacy code, and frankly "ORDER BY 1"
is just too convenient a shorthand to give up easily.  So we live with
the fact that the behavior is a bit ambiguous.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (10+ messages)  latest in thread

Message-ID: <19406.1465396372@sss.pgh.pa.us>
Permalink:  ../19406.1465396372@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19406.1465396372@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, folarte@peoplecall.com, s32191234@gmail.com, david.g.johnston@gmail.com
  Subject: Re: Case in Order By Ignored without warning or error
  In-Reply-To: <19406.1465396372@sss.pgh.pa.us>
  References: <CABBJNBuLrK2giyL9tmauipdRHZsMoOpDs3cJcnCUUdWJGj6ftw@mail.gmail.com> <CA+bJJbyffQXoC=ZBgU+2C3D=Nw2RWw_TNVvjNYZg=UEUAj+aLw@mail.gmail.com> <CAKFQuwaSm9MPoEeU2N1xrQ3a+eSRb-T5w22LXxuG4myaq0GXmA@mail.gmail.com> <CABBJNBvw11d+6LS0yoeivLYGhf40DYZ77JicEjhmCNSusPOLyg@mail.gmail.com> <CA+bJJbwi0CdEeCuoVE1HTh8n=qfrGPvNzHYRK7_RGqcJEBkeRw@mail.gmail.com> <19406.1465396372@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox