dbTalk Databases Forums  

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

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1278: PL/pgSQL: ROWTYPE does not care for droped columns in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
PostgreSQL Bugs List
 
Posts: n/a

Default [BUGS] BUG #1278: PL/pgSQL: ROWTYPE does not care for droped columns - 10-04-2004 , 06:34 AM







The following bug has been logged online:

Bug reference: 1278
Logged by: Michael Howitz

Email address: mh+postgres (AT) gocept (DOT) 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.



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

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #1278: PL/pgSQL: ROWTYPE does not care for droped columns - 10-04-2004 , 09:23 AM






"PostgreSQL Bugs List" <pgsql-bugs (AT) postgresql (DOT) org> writes:
Quote:
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

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.