Bug with plpgsql function after drop column ? - Mailing list pgsql-admin

From Stefan Holzheu
Subject Bug with plpgsql function after drop column ?
Date
Msg-id 4588FC1E.6080709@bayceer.uni-bayreuth.de
Whole thread Raw
List 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
-----------------------------

pgsql-admin by date:

Previous
From: Rickard Sjöström
Date:
Subject: Re: Upgrading from 7.4 to 8.2
Next
From: Olivier Boissard
Date:
Subject: Re: Suggestions needed about how to dump/restore a database