Bug with plpgsql function after drop column ?

From: Stefan Holzheu <stefan(dot)holzheu(at)bayceer(dot)uni-bayreuth(dot)de>
To: ADMIN <pgsql-admin(at)postgresql(dot)org>
Subject: Bug with plpgsql function after drop column ?
Date: 2006-12-20 09:02:22
Message-ID: 4588FC1E.6080709@bayceer.uni-bayreuth.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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
-----------------------------

Browse pgsql-admin by date

  From Date Subject
Next Message Olivier Boissard 2006-12-20 09:37:49 Re: Suggestions needed about how to dump/restore a database
Previous Message Rickard Sjöström 2006-12-20 08:25:01 Re: Upgrading from 7.4 to 8.2