Folks,

On 8.0.4 and 8.1b4 given:

create type return_value as (
        id INTEGER,
        message TEXT
);

this function:

create function return_test (
        vuser INT, vsession INT
) returns return_value as $fnc$
declare vtemp return_value;
begin
vtemp := row( -1, 'bad' );
return vtemp;
end; $fnc$ language plpgsql;

works, but this function:

create function return_test_2 (
        vuser INT, vsession INT
) returns return_value as $fnc$
begin
vtemp := row( -1, 'bad' );
end; $fnc$ language plpgsql;

gives this error at run time:

ERROR:  syntax error at or near "vtemp" at character 1
QUERY:  vtemp := row( -1, 'bad' )
CONTEXT:  PL/pgSQL function "return_test_2" line 2 at SQL statement
LINE 1: vtemp := row( -1, 'bad' )

... the problem seems to be that RETURN will accept variables and constants 
but not arbitrary composites.  We should fix that eventually.   Can we put 
it on the TODO list?



-- 
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to