Re: TODO for plpgsql: RETURN should accept arbitrary composite expressions - Mailing list pgsql-hackers

From Josh Berkus
Subject Re: TODO for plpgsql: RETURN should accept arbitrary composite expressions
Date
Msg-id 200510281550.17595.josh@agliodbs.com
Whole thread Raw
In response to TODO for plpgsql: RETURN should accept arbitrary composite expressions  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: TODO for plpgsql: RETURN should accept arbitrary composite expressions
Next
From: Josh Berkus
Date:
Subject: FKs on temp tables: hard, or just omitted?