Re: plpgsql.warn_shadow

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: plpgsql.warn_shadow
Дата
Msg-id 531623A4.709@dunslane.net
обсуждение исходный текст
Ответ на Re: plpgsql.warn_shadow  (Joel Jacobson <joel@trustly.com>)
Ответы Re: plpgsql.warn_shadow  (Joel Jacobson <joel@trustly.com>)
Список 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 по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Fwd: patch: make_timestamp function
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Fwd: patch: make_timestamp function