|From:||Andrew Dunstan <andrew(at)dunslane(dot)net>|
|To:||Darren Duncan <darren(at)darrenduncan(dot)net>|
|Cc:||PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>|
|Subject:||Re: bad variable subst after "AS"|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
On 09/16/2010 02:33 AM, Darren Duncan wrote:
> I don't know if this is a bug or not, but if not, it looks like a
> misfeature ...
> When executing the following in Pg 8.4.4:
> CREATE OR REPLACE FUNCTION f () RETURNS TABLE(a1 INTEGER) AS
> RETURN QUERY SELECT a0 AS a1 FROM rv;
> LANGUAGE plpgsql;
> ... I get this error:
> ERROR: syntax error at or near "$1"
> SQL state: 42601
> 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.
> 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?
> Meanwhile, what is the best way to write f to work around this
> Thank you.
Remove the AS clause. You don't need it here at all.
|Next Message||Abhijit Menon-Sen||2010-09-16 07:49:06||[REVIEW] Re: I: About "Our CLUSTER implementation is pessimal" patch|
|Previous Message||Itagaki Takahiro||2010-09-16 06:58:36||Re: patch: SQL/MED(FDW) DDL|