2011/9/1 Sim Zacks <sim@compulab.co.il>:
Tested in 8.2 and 9.0.1
In plpgsql, if you have a function parameter and a variable of the same
name, it ignores the value passed in and initializes the variable to null.
The correct action, IMO, would be to raise an error.
You can access params via $n conventions. functions params and
functions variables are not in same space, so it should not be a
error. What behave is in PL/SQL? There should be problem with backward
compatibility when we change it.
Regards
Pavel Stehule
While you _can_ access the variable using the $n convention, it is
an obvious mistake in the function definition. It may break existing
functions, but all of those functions have bugs in them that will
then be caught. Can you think of any valid case for passing in a
variable and having the variable name refer to something else?