Re: Case in Order By Ignored without warning or error

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Francisco Olarte <folarte(at)peoplecall(dot)com>
Cc: Emiel Hermsen <s32191234(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Case in Order By Ignored without warning or error
Date: 2016-06-09 15:15:58
Message-ID: CAKFQuwar3xN+1i8KcY-UYU7b4txjuufD4c-Bnj_OQyGL4RWs1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Jun 9, 2016 at 10:58 AM, Francisco Olarte <folarte(at)peoplecall(dot)com>
wrote:

> Hi Emiel:
>
> On Wed, Jun 8, 2016 at 1:31 PM, Emiel Hermsen <s32191234(at)gmail(dot)com> wrote:
> > Understood. I did test the order by (a+b)+c with the statement: SELECT *
> > FROM films ORDER BY 1+1; which does not sort on the second column.
> Therefore
> > I assume that any construction like (a+b)+c will not work either.
>
> mmm, aybe you misnterpreted your test result, order by 1+1 correctly
> sorts by the expresion 1+1, = 2, so no sorting ( something that
> happens on underspecified sort criteria ). So a+b+c or othres should
> work too, as proven by 1+1. The problem is you thought 1+ select a
> column where only naked names and single numbers do. I think even '+1'
> does not do the same as '1'.
>
> > I do agree on your last statement about the difficulty.
> > My opinion in this matter is mostly based of my findings regarding the
> > "ORDER BY 1+1" not doing anything.
>
> As before, it is doing a thing, sorting by a constant.
>
>
​I think its a fair characterization to call "sorting on a constant" as
"doing nothing" or "not useful". There is no noticeable difference between
that and omitting the constant.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message hubert depesz lubaczewski 2016-06-09 15:46:10 PostgreSQL (9.3 and 9.6) eats all memory when using many tables
Previous Message Francisco Olarte 2016-06-09 14:58:04 Re: Case in Order By Ignored without warning or error