Function working in PostgreSQL 8.3.6 and not in 7.4.8

Поиск
Список
Период
Сортировка
От
Тема Function working in PostgreSQL 8.3.6 and not in 7.4.8
Дата
Msg-id 200904112241.6352@centrum.cz
обсуждение исходный текст
Ответы Re: Function working in PostgreSQL 8.3.6 and not in 7.4.8  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
Hello,

I've created this function:
CREATE OR REPLACE FUNCTION subcategories(int) RETURNS setof int AS '
DECLARE
    -- declarations
    category        ALIAS FOR $1;
    category_current    record;
BEGIN
    -- function body
    RETURN QUERY SELECT category as my_output;
    FOR category_current IN SELECT id FROM is_categories WHERE id_parent=category AND status=''1'' LOOP
        RETURN QUERY SELECT category_current.id as my_output UNION SELECT * FROM subcategories(category_current.id);
    END LOOP;
END;
' LANGUAGE plpgsql;

It works well on my development machine with PostgreSQL 8.3.6 (return subcategories, as its name suggests).

This query on a server where there's 7.4.8 installed:
SELECT id FROM is_categories WHERE id_parent=1 AND status='1';
does return two rows (as it should), but:
SELECT * FROM subcategories(1);
returns none and there's no error message either.

It's my second function in pg/plsql I've created and I don't really know why there are no results being returned in
7.4.8.

Any ideas are appreciated.

Thanks in advance. :)

Regards,

Peter Slapansky



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

Предыдущее
От: "Rupinder.Singh"
Дата:
Сообщение: Re: Time-based trigger/procedure
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Function working in PostgreSQL 8.3.6 and not in 7.4.8