In the following short code, the out parameter d3 is also declared, so
its value will be null in the output.
create or replace function public.test_function(in varchar, in char, in date, ou
t d1 text, out d2 integer, out d3 char, out d4 date )
stable as $$
DECLARE
wk_intxt alias for $1;
wk_inchar alias for $2;
wk_indate alias for $3;
d3 char;
BEGIN
d1 := 'foo,bar';
d2 := 15;
d3 := 'X';
d4 := current_date;
END
$$ language 'plpgsql';
Here's what happens in 16.1:
psql (16.1)
Type "help" for help.
uscf=> select test_function('1234','a','2024-01-01')
uscf-> \g
test_function
----------------------------
("foo,bar",15,,2024-07-06)
(1 row)
Shouldn't declaring a field that is also an OUT parameter throw an error?
Mike Nolan
htfoot@gmail.com