Re: pl/pgsql breakage in 8.1b4? - Mailing list pgsql-hackers

From Stephan Szabo
Subject Re: pl/pgsql breakage in 8.1b4?
Date
Msg-id 20051027203237.N31249@megazone.bigpanda.com
Whole thread Raw
In response to pl/pgsql breakage in 8.1b4?  (Philip Yarra <philip@utiba.com>)
Responses Re: pl/pgsql breakage in 8.1b4?
List pgsql-hackers
On Fri, 28 Oct 2005, Philip Yarra wrote:

> Just testing pl/pgsql functions in 8.1beta4, I see failures for syntax that
> works in 8.0.3. The simplest test case for this is:

The function below fails for me similarly in 8.0.3 on execution.  8.1
merely tells you at creation time.

Using bar and foo as both parameter names and the field names doesn't
really work.

> create table ptest(foo int, bar varchar(10));
> create or replace function modify_ptest(
>     foo int,
>     bar varchar)
> returns numeric as $$
> declare
>     res numeric;
> begin
>     update ptest
>     set bar = modify_ptest.bar
>     where foo = modify_ptest.foo;
>     res := 0;
> return res;
> end;
> $$ LANGUAGE plpgsql;
>
> The error message from psql is:
>
> ERROR:  syntax error at or near "$1" at character 19
> QUERY:  update ptest set  $1  = modify_ptest.bar where  $2  = modify_ptest.foo
> CONTEXT:  SQL statement in PL/PgSQL function "modify_ptest" near line 7
> LINE 1: update ptest set  $1  = modify_ptest.bar where  $2  = modify...
>                           ^
>
> I assume what I'm trying should still work, though I couldn't find comparable
> examples in the doco. Looks to me like a problem with parameter aliasing.


pgsql-hackers by date:

Previous
From: Rod Taylor
Date:
Subject: Re: enums
Next
From: Tom Lane
Date:
Subject: Re: TRAP: FailedAssertion("!((itemid)->lp_flags & 0x01)", File: "nbtsearch.c", Line: 89)