From: | Phillip Couto <phillip(dot)couto01(at)gmail(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:53:49 |
Message-ID: | CAEuORezLrptSPb7dQFH7x41-TRi_r-d6_RN-aCgpuRbf95x=Cg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The WHERE is executed before the SELECT. The value of a is not available to
the WHERE clause as it is assigned at the end of the query.
To actually make your query work it would have to read:
select * from (select 1 as a) as b where a = 1
The from provides the data that the where will operate on, the select then
determines what to be returned.
On Fri, 8 Apr 2016 at 18:41 <hector(dot)bejarano(at)gmail(dot)com> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 14079
> Logged by: Hector Bejarano
> Email address: hector(dot)bejarano(at)gmail(dot)com
> PostgreSQL version: 9.5.0
> Operating system: Ubuntu 14
> Description:
>
> 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.
>
> Regards,
> Hector.
>
>
> --
> 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
>
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2016-04-08 22:55:47 | Re: BUG #14079: Issues with query |
Previous Message | jack | 2016-04-08 22:43:45 | BUG #14080: JSONB order changes when using json_pretty() |