I use the PG 13.1 version, I do not know if this is a bug or is the default behavior, have the following example
DROP FUNCTION IF EXISTS test;
CREATE OR REPLACE FUNCTION test(
v1 int,
v2 float
) RETURNS boolean AS
$$
DECLARE
v1 int;
v2 float;
BEGIN
RAISE INFO 'v1 => %, v2 => %', v1, v2;
RETURN true;
END;
$$
LANGUAGE plpgsql;
SELECT test(10,20);
Showing
INFO: v1 => <NULL>, v2 => <NULL>
Successfully run. Total query runtime: 79 msec.
1 rows affected.
Could someone please explain why Postgres does not detect the "duplicate name" error?
Obviously the result it shows is that of the variables of the DECLARE section
in_,out_, or perhapsp_.