Re: BUG #14079: Issues with query - Mailing list pgsql-bugs

From John R Pierce
Subject Re: BUG #14079: Issues with query
Date
Msg-id 570836F3.9090603@hogranch.com
Whole thread Raw
In response to BUG #14079: Issues with query  (hector.bejarano@gmail.com)
List pgsql-bugs
On 4/8/2016 2:47 PM, hector.bejarano@gmail.com wrote:
> This query works:
> select 1 as a
>
> But this one fails:
> select 1 as a where a = 1
>
> And I think they should both work.


nope.      doesn't work that way.   Aliases to selected fields can not
be used in the WHERE clause, because the WHERE clause is executed BEFORE
the fields are selected and calculated.

this is per the SQL standard.


--
john r pierce, recycling bits in santa cruz

pgsql-bugs by date:

Previous
From: Phillip Couto
Date:
Subject: Re: BUG #14079: Issues with query
Next
From: Miklós Fazekas
Date:
Subject: Re: released savepoint blocking further statements