The simple recursive function:
--
DROP FUNCTION testRecurse(int,int);
CREATE FUNCTION testRecurse(int,int) RETURNS text AS '
DECLARE
rslt text;
BEGIN
IF $1 = 0 THEN
rslt= CAST($2 AS TEXT);
ELSE
rslt= CAST($1 AS TEXT) || '','' || testRecurse($1 - 1, $2);
END IF;
RETURN rslt;
END;
' LANGUAGE 'plpgsql';
--
does not give the result I expect. For example, for:
SELECT testRecurse(4,3);
it seems to me that the result should be:
4,3,2,1,3
instead of what is returned:
1,1,1,1,3
Is this supposed to work in 7.1.3?
-frank