Hi there.

I'm trying to create a function that will return a single row (containing three touples). I've tried the following:

CREATE OR REPLACE FUNCTION RecTest() RETURNS RECORD AS
'
DECLARE
rec RECORD;
BEGIN
SELECT INTO rec ID, reciepient, message FROM Messages where ID=5;

RETURN rec;
END;
'
LANGUAGE 'plpgsql';

This falls out ok. But when I've try to get the result;

SELECT * FROM RecTest() as (ID integer, reciepient text, message text);

It fails. Iäve tried on both 7.2 and 7.3.1 without success. Any ideas?