It is valid in ANSI. The order by expression gets evaluated as a boolean
(true or false) in postgres.

postgres=# create table dest2 (col1 int, key int);
CREATE TABLE
postgres=# insert into dest2 values (1,1);
INSERT 0 1
postgres=# insert into dest2 values (2,2);
INSERT 0 1
postgres=# select *, key+1=2 from dest2 order by key+1=2 ;
 col1 | key | ?column?
------+-----+----------
    2 |   2 | f
    1 |   1 | t
(2 rows)

postgres=#

On Mon, Nov 2, 2015 at 8:14 PM, rahul challapalli <
[email protected]> wrote:

> Drillers,
>
> What are the semantics for the below query ? Should this syntax even be
> supported?
>
> select * from hive.dest2 order by key+1 = 497;
>
> - Rahul
>

Reply via email to