Re: Using arguments with functions - Mailing list pgsql-general

From Tom Lane
Subject Re: Using arguments with functions
Date
Msg-id 20082.1089491606@sss.pgh.pa.us
Whole thread Raw
In response to Using arguments with functions  ("Robert Fitzpatrick" <robert@webtent.com>)
List pgsql-general
"Robert Fitzpatrick" <robert@webtent.com> writes:
> CREATE OR REPLACE FUNCTION "public"."get_next" (varchar) RETURNS varchar AS'
> DECLARE
>   var1 alias for $1;
> BEGIN
>   var1 = chr( (ascii(var1) + 1) );
> ...
> ohc=> select get_next('a');
> ERROR:  "$1" is declared CONSTANT
> CONTEXT:  compile of PL/pgSQL function "get_next" near line 5

plpgsql does not allow you to overwrite an argument value.

            regards, tom lane

pgsql-general by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: Using arguments with functions
Next
From: Bruce Momjian
Date:
Subject: Re: Trying to minimize the impact of checkpoints