Re: BUG #14079: Issues with query

From: John R Pierce <pierce(at)hogranch(dot)com>
To: hector(dot)bejarano(at)gmail(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14079: Issues with query
Date: 2016-04-08 22:55:47
Message-ID: 570836F3.9090603@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 4/8/2016 2:47 PM, hector(dot)bejarano(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Hector Bejarano 2016-04-09 13:37:20 Re: BUG #14079: Issues with query
Previous Message Phillip Couto 2016-04-08 22:53:49 Re: BUG #14079: Issues with query