BUG #1278: PL/pgSQL: ROWTYPE does not care for droped columns

Поиск
Список
Период
Сортировка
Искать

BUG #1278: PL/pgSQL: ROWTYPE does not care for droped columns

От:
"PostgreSQL Bugs List" <pgsql-bugs@postgresql.org>
Дата:
The following bug has been logged online:

Bug reference:      1278
Logged by:          Michael Howitz

Email address:      mh+postgres@gocept.com

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.

Re: BUG #1278: PL/pgSQL: ROWTYPE does not care for droped columns

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"PostgreSQL Bugs List"  writes:
> This code works correct in 7.4.1-dbExperts but also fails in 
> 7.3.4-dbExperts. 

As you say, this has been fixed in 7.4.  We considered the fix not
a suitable candidate for back-patching into older releases.

			regards, tom lane
FAQ