Re: plpgsql.warn_shadow - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: plpgsql.warn_shadow
Date
Msg-id 531623A4.709@dunslane.net
Whole thread Raw
In response to Re: plpgsql.warn_shadow  (Joel Jacobson <joel@trustly.com>)
Responses Re: plpgsql.warn_shadow
List pgsql-hackers
On 03/04/2014 11:23 AM, Joel Jacobson wrote:

> I understand that from a technical perspective, the mandatory
> BEGIN...END you always need in a PL/pgSQL function, is a new block,
> and the variables declared are perhaps technically in a new block, at
> a deeper level than the IN/OUT variables. But I would still argue the
> expected behaviour of PL/pgSQL for a new user would be to consider the
> IN/OUT variables to be in the same block as the variables declared in
> the function's first block.
>


No they are not. Teaching a new user to consider them as the same is 
simply wrong.

The parameters belong to a block that matches the function name. The 
outermost block has a different name if supplied (I usually use <<fn>>), 
or is otherwise anonymous. Lots of code quite correctly relies on this, 
including some I have written.

This isn't a mere technical difference, and there is surely zero chance 
that we will label use of it an error under any circumstances.

cheers

andrew




pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Fwd: patch: make_timestamp function
Next
From: Alvaro Herrera
Date:
Subject: Re: Fwd: patch: make_timestamp function