Re: [SQL] Howto automatically define collumn names for a function result.

2009-08-27 Thread Jorge Godoy
Have you tried returning SETOF RECORD[] and using the OUT specification? CREATE OR REPLACE FUNCTION bla(integer, date, OUT date, OUT integer) RETURNS SETOF RECORD[] AS $_$ SELECT date AS output_date, $1+2 AS next_record FROM table WHERE id = $1 AND start_date >= $2; $_$ LANGUAGE SQL; (Just an

[SQL] Howto automatically define collumn names for a function result.

2009-08-27 Thread Andreas
Hi, wouldn't it be great to have functions return "setof something" as result where "something" was determined out of the result of a SELECT within the function? like CREATE OR REPLACE FUNCTION coffee(integer, timestamp, timestamp) RETURNS SETOF AS $BODY$ SELECT staff_id, name, room, COUN