This is a discussion on INOUT/OUT problems with IMMUTABLE within the pgsql Hackers forums, part of the PostgreSQL category; --> Is the following behavior intended? CREATE FUNCTION foo(INOUT x integer, INOUT y integer) AS $$ BEGIN x := x ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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/ ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend |
| ||||
| Michael Fuhr <mike@fuhr.org> writes: > Is the following behavior intended? Nope. Thanks for the report ;-) regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org |