The following bug has been logged online:

Bug reference:      1278
Logged by:          Michael Howitz

Email address:      [EMAIL PROTECTED]

PostgreSQL version: 7.3.7

Operating system:   2.6.8-gentoo-r3

Description:        PL/pgSQL: ROWTYPE does not care for droped columns

Details: 

IF you drop a column on a Table which is accessed via a PL/pgSQL-Function 
using tablename%ROWTYPE you get an Error. It seems that ROWTYPE does not 
take care about droped columns. 

Example in code:

CREATE TABLE test (
  id SERIAL,
  start_date DATE,
  testing INTEGER);

INSERT INTO test (start_date, testing) VALUES ('2003-05-03', 1);

SELECT * from test;
-- test.id will be 1

ALTER TABLE test DROP COLUMN start_date;

CREATE OR REPLACE FUNCTION dcTest(INTEGER) RETURNS INTEGER AS
'
    DECLARE
        tid ALIAS FOR $1;
        test_rec test%ROWTYPE;
    BEGIN
        SELECT INTO test_rec *
            FROM test
            WHERE id = tid;
        RETURN test_rec.testing;
    END;
' LANGUAGE 'plpgsql';

SELECT dcTest(1);

gives the following Error:
WARNING:  plpgsql: ERROR during compile of dctest near line 0
ERROR:  cache lookup for type 0 of test.........pg.dropped.2........ failed

This code works correct in 7.4.1-dbExperts but also fails in 
7.3.4-dbExperts. 



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to