pl/pgsql problem with return types
От | Juris Zeltins |
---|---|
Тема | pl/pgsql problem with return types |
Дата | |
Msg-id | 423178FC.3050107@gmail.com обсуждение исходный текст |
Ответы |
Re: pl/pgsql problem with return types
|
Список | pgsql-sql |
Hello! i have problem with pl/pgsql function; ==================================================== === ERROR: wrong record type supplied in RETURN NEXT CONTEXT: PL/pgSQL function "tests" line 6 at return next === -- Function: tests(int8) -- DROP FUNCTION tests(int8); CREATE OR REPLACE FUNCTION tests(int8) RETURNS SETOF pages AS $BODY$DECLARE P RECORD; BEGIN FOR P IN select pageid from pages LOOP RETURN NEXT P; END LOOP; RETURN; END;$BODY$ LANGUAGE 'plpgsql' STABLE; ALTER FUNCTION tests(int8) OWNER TO diglat_web; ==================================================== -- Table: pages -- DROP TABLE pages; CREATE TABLE pages ( pageid int8 NOT NULL, ppageid int8 NOT NULL DEFAULT 0, name varchar(100), status int4 DEFAULT 0, CONSTRAINT pages_pkeyPRIMARY KEY (pageid), CONSTRAINT pages_in_pages_fkey FOREIGN KEY (ppageid) REFERENCES pages (pageid) ON UPDATE RESTRICT ON DELETE RESTRICT, CONSTRAINT pages_uniq UNIQUE (pageid, ppageid) ) WITH OIDS; ==================================================== Actualy function is correct... and the same code run successfully on other table.. there is the problem ? Thanks
В списке pgsql-sql по дате отправления: