TODO for plpgsql: RETURN should accept arbitrary composite expressions

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: TODO for plpgsql: RETURN should accept arbitrary composite expressions
Date: 2005-10-28 22:41:38
Message-ID: 200510281541.38296.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2005-10-28 22:50:17 Re: TODO for plpgsql: RETURN should accept arbitrary composite expressions
Previous Message Jim C. Nasby 2005-10-28 22:21:54 Re: enums