recursive text construction in plpgsql?

Поиск
Список
Период
Сортировка
От Frank Miles
Тема recursive text construction in plpgsql?
Дата
Msg-id Pine.A41.4.33.0109071534300.83830-100000@mead1.u.washington.edu
обсуждение исходный текст
Ответы Re: recursive text construction in plpgsql?
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: Brett Schwarz
Дата:
Сообщение: Re: Problem w/ dumping huge table and no disk space
Следующее
От: David Ford
Дата:
Сообщение: Re: Problem w/ dumping huge table and no disk space