Re: Possible parser bug? .... Re: Picking out the most recent row using a time stamp column

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Friday, February 25, 2011, 12:53:08 AM you wrote:

> select distinct on (a,    b,    c)
> a,   b c,   time_stamp,    value

Without the comma, you declare 'b AS c'

> from data
> order by a, b, c, time_stamp desc;

> The output produced is the same as this query:

> select distinct on (a,    b)
> a,   b,   time_stamp,    value
> from data
> order by a, b, time_stamp desc;

the 'c' is optimized away, since it is an alias for b, and thus redundant 
for the distinct.

> Not sure if this is considered a parser bug or not, but it feels slightly
> odd not to get an error.

No error, just plain SQL :-)



-- 
Jochen Erwied     |   home: jochen@xxxxxxxxx     +49-208-38800-18, FAX: -19
Sauerbruchstr. 17 |   work: joe@xxxxxxxxxxxxxxx  +49-2151-7294-24, FAX: -50
D-45470 Muelheim  | mobile: jochen.erwied@xxxxxxxxxxx       +49-173-5404164


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



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux