From: Stefan Holzheu <stefan.holzheu@bayceer.uni-bayreuth.de>
To: ADMIN <pgsql-admin@postgresql.org>
Subject: Bug with plpgsql function after drop column ?
Date: Wed, 20 Dec 2006 10:02:22 +0100
Message-ID: <4588FC1E.6080709@bayceer.uni-bayreuth.de> (raw)
Hi
I just encountered a reproducable bug with plpgsql function "return
next" after drop column:
create table test (
id int not null primary key
);
insert into test values (1);
create or replace function get_test(int)
returns setof test
as 'declare
rec record;
begin
for rec in select * from test where id=$1 loop
return next rec;
end loop;
return;
end;'
Language 'plpgsql';
select * from get_test(1);
alter table test add name text;
select * from get_test(1);
/*
FEHLER: wrong record type supplied in RETURN NEXT
KONTEXT: PL/pgSQL function "get_test" line 5 at return next
works after recreate of function
*/
alter table test drop column name;
select * from get_test(1);
/*
FEHLER: wrong record type supplied in RETURN NEXT
KONTEXT: PL/pgSQL function "get_test" line 5 at return next
DOES NOT works after recreate of function!!!!!!
PostgreSQL 8.1.3
Workaround is to drop/recreate the table or (what was easier in our
case) dump/restore database. Is it a known known?
Regards
Stefan Holzheu
--
-----------------------------
Dr. Stefan Holzheu
Tel.: 0921/55-5720
Fax.: 0921/55-5709
BayCEER
EDV und Datenbanken
Universitaet Bayreuth
D-95440 Bayreuth
-----------------------------
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: stefan.holzheu@bayceer.uni-bayreuth.de
Subject: Re: Bug with plpgsql function after drop column ?
In-Reply-To: <4588FC1E.6080709@bayceer.uni-bayreuth.de>
References: <4588FC1E.6080709@bayceer.uni-bayreuth.de>
* 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