Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group