konto usunięte
Temat: Funkcja zwraca setof records...
No a raczej nie zwraca ;)
CREATE OR REPLACE FUNCTION get_path(bigint)
RETURNS SETOF record AS
$BODY$DECLARE
r record;
BEGIN
FOR r IN EXECUTE 'SELECT parent.title
FROM categories AS node,
categories AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
AND node.id = ' || $1 || '
ORDER BY parent.lft ' loop
RETURN next r;
END LOOP;
return;
END$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
Mam tak i dostaję:
ERROR: set-valued function called in context that cannot accept a set
CONTEXT: PL/pgSQL function "get_path" line 10 at RETURN NEXT
jakiś pomysł?