Folks,
Two corrections:
The second example was the wrong code, it should have been this function:
create function return_test_2 (
vuser INT, vsession INT
) returns return_value as $fnc$
begin
return row( -1, 'bad' );
end; $fnc$ language plpgsql;
Also, this issue is documented, but I believe that it still needs fixing,
as current behavior is cumbersome and unintuitive:
"When returning a scalar type, any expression can be used. The expression's
result will be automatically cast into the function's return type as
described for assignments. To return a composite (row) value, you must
write a record or row variable as the expression."
--
--Josh
Josh Berkus
Aglio Database Solutions
San Francisco