Re: BUG #14405: ORDER BY TABLENAME, possible bug

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: udv(dot)mail(at)gmail(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14405: ORDER BY TABLENAME, possible bug
Date: 2016-10-29 14:54:23
Message-ID: CA+bJJbz=7rU1r94PLTt0MiPJJGsitybF6TR8HNpXkC5La_uGTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi:

On Sat, Oct 29, 2016 at 2:19 PM, <udv(dot)mail(at)gmail(dot)com> wrote:
> The following bug has been logged on the website:
> E.g. query:
>
> SELECT col1, col2, col3
> FROM table1
> ORDER BY table1
>
> Postgres uses col1 for ASC ordering, if we write "ORDER BY table1
> DESC" then DESC-ordering. I'm not sure this is a bug, but didn't find
> description for such behaviour.

That piked my curiosity, and I found doing the equivalent of (select
table1 from table1) sends back a single column output of record
values, with one record in each one, so if col1 is the first column in
table1 as rows seem to sort lexicographically that will explain the
behaviour. Try it yourself. ( Note, not the same as select table1.*
from table1, which gives n column )

Then, I do not remember whether that's a bug or a feature, and have
not been able to see it in the docs, do not even know how to do it (
tried some places without luck ), so someone more knowledgeable can
point us in the right direction.

Francisco Olarte.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-10-29 15:34:39 Re: BUG #14405: ORDER BY TABLENAME, possible bug
Previous Message Pavel Stehule 2016-10-29 14:23:07 Re: ORDER BY TABLENAME, possible bug