setof type and later table bug??

From: "Sergiusz Michalski" <boss(at)sergenet(dot)prv(dot)pl>
To: pgsql-bugs(at)postgresql(dot)org
Subject: setof type and later table bug??
Date: 2003-08-23 08:42:07
Message-ID: bi79c8$nm4$1@nemesis.news.tpi.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi!
Guys please help me, it this example I create function sergi() thats return
a rows, and everything is OK, function works well, but
if I execute a SQL query : ALTER TABLE DUPA DROP COLUMN nazwa; or everything
using ALTER TABLE, my function
crashes and error is sth. like query type and function type do not match !
What's it??? How to solve it withought reloading table.

Is it a bug????

PZDR;
Sergiusz.

CREATE TABLE dupa (id int NOT NULL, nazwa varchar(44) NOT NULL, primary
key(id) );
INSERT INTO dupa VALUES(1, 'a');
INSERT INTO dupa VALUES(2, 'b');
INSERT INTO dupa VALUES(3, 'c');
INSERT INTO dupa VALUES(4, 'd');
INSERT INTO dupa VALUES(5, 'e');
INSERT INTO dupa VALUES(6, 'f');
INSERT INTO dupa VALUES(7, 'g');
INSERT INTO dupa VALUES(8, 'h');

CREATE OR REPLACE FUNCTION sergi()
RETURNS SETOF DUPA
AS '
DECLARE
rec RECORD;
BEGIN
FOR rec IN SELECT * FROM DUPA LOOP
RETURN NEXT rec; /* Each RETURN NEXT command returns a row */
END LOOP;
RETURN;
END;
' LANGUAGE 'plpgsql';

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Creager 2003-08-23 14:08:25 contrib-global.mk and sql.in question
Previous Message Robert Creager 2003-08-23 04:46:15 Re: contrib-global.mk and sql.in question