BUG #5117: Table type Function Bug when column dropped - Mailing list pgsql-bugs

From cf of
Subject BUG #5117: Table type Function Bug when column dropped
Date
Msg-id 200910150745.n9F7jQ1h017825@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #5117: Table type Function Bug when column dropped
List pgsql-bugs
The following bug has been logged online:

Bug reference:      5117
Logged by:          cf of
Email address:      ccooffeee@hotmail.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.

pgsql-bugs by date:

Previous
From: Sean Hsien
Date:
Subject: Re: issue with integer nullable column and value 0
Next
From: "Gerhard Leykam"
Date:
Subject: BUG #5118: start-status-insert-fatal