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_pkey PRIMARY 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
---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]