BUG #5117: Table type Function Bug when column dropped

From: "cf of" <ccooffeee(at)hotmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5117: Table type Function Bug when column dropped
Date: 2009-10-15 07:45:26
Message-ID: 200910150745.n9F7jQ1h017825@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5117
Logged by: cf of
Email address: ccooffeee(at)hotmail(dot)com
PostgreSQL version: 8.4 (maybe all)
Operating system: Linux
Description: Table type Function Bug when column dropped
Details:

create table test_table
(
key1 integer,
key2 integer,
key3 integer
);

CREATE OR REPLACE FUNCTION test_function()
RETURNS SETOF test_table AS
$BODY$
DECLARE
_Ret RECORD;
BEGIN
FOR _Ret IN
Select * From test_table
LOOP
RETURN NEXT _Ret;
END LOOP;
END;
$BODY$
LANGUAGE 'plpgsql';

insert into test_table values( 1, 1, 1 );
insert into test_table values( 2, 2, 2 );
insert into test_table values( 3, 3, 3 );
insert into test_table values( 4, 4, 4 );

alter table test_table drop column key3;

select * from test_function();
ERROR: wrong record type supplied in RETURN NEXT
DETAIL: Number of returned columns (2) does not match expected column
count (3).
CONTEXT: PL/pgSQL function "test_function" line 7 at RETURN NEXT

Thx.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Gerhard Leykam 2009-10-15 13:36:26 BUG #5118: start-status-insert-fatal
Previous Message Sean Hsien 2009-10-15 00:07:57 Re: issue with integer nullable column and value 0