From: Juris Zeltins <juris.zeltins@gmail.com>
To: pgsql-sql@postgresql.org
Subject: pl/pgsql problem with return types
Date: Fri, 11 Mar 2005 12:54:52 +0200
Message-ID: <423178FC.3050107@gmail.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: juris.zeltins@gmail.com
Subject: Re: pl/pgsql problem with return types
In-Reply-To: <423178FC.3050107@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox