Re: plpgsql.warn_shadow

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Joel Jacobson <joel(at)trustly(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Marko Tiikkaja <marko(at)joh(dot)to>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plpgsql.warn_shadow
Date: 2014-03-04 19:04:04
Message-ID: 531623A4.709@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-03-04 19:20:10 Re: Fwd: patch: make_timestamp function
Previous Message Pavel Stehule 2014-03-04 19:00:58 Re: Fwd: patch: make_timestamp function