Unix Technical Forum

INOUT/OUT problems with IMMUTABLE

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 ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 05:05 AM
Michael Fuhr
 
Posts: n/a
Default INOUT/OUT problems with IMMUTABLE

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 05:06 AM
Tom Lane
 
Posts: n/a
Default Re: INOUT/OUT problems with IMMUTABLE

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:23 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com