From: John R Pierce <pierce@hogranch.com>
To: hector.bejarano@gmail.com
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #14079: Issues with query
Date: Fri, 8 Apr 2016 15:55:47 -0700
Message-ID: <570836F3.9090603@hogranch.com> (raw)
In-Reply-To: <20160408214743.15197.6247@wrigleys.postgresql.org>
References: <20160408214743.15197.6247@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: pierce@hogranch.com, hector.bejarano@gmail.com
Subject: Re: BUG #14079: Issues with query
In-Reply-To: <570836F3.9090603@hogranch.com>
References: <20160408214743.15197.6247@wrigleys.postgresql.org> <570836F3.9090603@hogranch.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox