Hi, PL/pgsql seems to have a strange restriction regarding "RETURN". Normally, you can write "RETURN <expression>". But if the function returns a row type, then you can only write "RETURN variable" or "RETURN NULL".
rhaas=# create type xyz as (a int, b int); CREATE TYPE rhaas=# select row(1,2)::xyz; row ------- (1,2) (1 row) rhaas=# create or replace function return_xyz() returns xyz as $$ rhaas$# begin rhaas$# return row(1,2)::xyz; rhaas$# end$$ language plpgsql; ERROR: RETURN must specify a record or row variable in function returning row LINE 3: return row(1,2)::xyz; ^ Off the top of my head, I can't think of any reason for this restriction, nor can I find any code comments or anything in the commit log which explains the reason for it. Does anyone know why we don't allow this? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers