Is the following behavior intended?
CREATE FUNCTION foo(INOUT x integer, INOUT y integer) AS $$
BEGIN
x := x * 10;
y := y * 10;
END;
$$ LANGUAGE plpgsql;
SELECT * FROM foo(1, 2);
x | y
----+----
10 | 20
(1 row)
ALTER FUNCTION foo(integer, integer) IMMUTABLE;
SELECT * FROM foo(1, 2);
ERROR: function return row and query-specified return row do not match
DETAIL: Returned row contains 2 attributes, but query expects 0.
A case with a single parameter works:
CREATE FUNCTION bar(INOUT x integer) AS $$
BEGIN
x := x * 10;
END;
$$ LANGUAGE plpgsql;
SELECT * FROM bar(1);
bar
-----
10
(1 row)
ALTER FUNCTION bar(integer) IMMUTABLE;
SELECT * FROM bar(1);
bar
-----
10
(1 row)
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/