INOUT/OUT problems with IMMUTABLE

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: INOUT/OUT problems with IMMUTABLE
Date: 2005-05-28 02:54:12
Message-ID: 20050528025412.GA33054@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2005-05-28 03:39:14 Re: overlaps() does not work as expected?
Previous Message Bruce Momjian 2005-05-28 02:21:19 Re: [HACKERS] Fix PID file location?