Re: ORDER BY TABLENAME, possible bug

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: dv <udv(dot)mail(at)gmail(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: ORDER BY TABLENAME, possible bug
Date: 2016-10-29 14:23:07
Message-ID: CAFj8pRCkPrb=OfOa6A63WpLJExXkKDg1GKfJ4bPs8088bcBAFA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi

2016-10-29 14:13 GMT+02:00 dv <udv(dot)mail(at)gmail(dot)com>:

> 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.
>

It is not bug. Postgresql's table has fictive column with same name as
tablename that is composite of all columns

postgres=# select * from foo;
┌────┬────┐
│ a │ b │
╞════╪════╡
│ 10 │ 20 │
└────┴────┘
(1 row)

Time: 0.837 ms
postgres=# select foo from foo;
┌─────────┐
│ foo │
╞═════════╡
│ (10,20) │
└─────────┘
(1 row)

Regards

Pavel

> Best regards, Dmitry.
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Francisco Olarte 2016-10-29 14:54:23 Re: BUG #14405: ORDER BY TABLENAME, possible bug
Previous Message udv.mail 2016-10-29 12:19:06 BUG #14405: ORDER BY TABLENAME, possible bug