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.
create or replace function test1(x int) returns int as
$$
declare x int;
begin
return x;
end;
$$ language 'plpgsql';
Thanks
Sim