Re: bad variable subst after "AS"

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Darren Duncan <darren(at)darrenduncan(dot)net>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bad variable subst after "AS"
Date: 2010-09-16 15:12:51
Message-ID: 1284649877-sup-6411@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Darren Duncan's message of jue sep 16 02:33:37 -0400 2010:

> My impression of this is that Pg is treating the "a1" after the "AS" like it was
> a variable reference and so substituted it for $1.

Yes.

> Now that just seems wrong to me. I can understand either "a0" or "rv" getting a
> substitution, but something following an "AS" being substituted is just wrong.
>
> Is that a bug and if not then what is the rationale for working that way, and
> can it be changed?

Fixed in 9.0.

> Meanwhile, what is the best way to write f to work around this misbehavior?

Give the column a different alias, one not colliding with a variable name.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2010-09-16 17:05:30 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Previous Message Tom Lane 2010-09-16 14:42:05 Re: autonomous transactions