dbTalk Databases Forums  

Re: [HACKERS] [BUGS] ALTER TABLE table RENAME COLUMN x TO y

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


Discuss Re: [HACKERS] [BUGS] ALTER TABLE table RENAME COLUMN x TO y in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [HACKERS] [BUGS] ALTER TABLE table RENAME COLUMN x TO y - 08-11-2003 , 05:31 PM






Tom Lane wrote:
Quote:
"Donald Fraser" <demolish (AT) cwgsy (DOT) net> writes:
When issuing the following type of command:
ALTER TABLE table RENAME COLUMN x TO y
The column name change is not cascading through to RULEs on a VIEW.

More specifically, INSERTs and UPDATEs contained in rules don't have
their target column names adjusted. This is because the "resname"
fields in their targetlists contain the original column names, and
those fields are actually looked at to determine the target columns.

I think this behavior is vestigial, and we could both simplify the code
and make it RENAME-proof by using just the "resno" fields to determine
the target columns. "resname" would then have just one purpose: to
carry the "AS" alias of targetlist entries in SELECTs. There is already
code in ruleutils.c to allow "resname" to be overridden by the current
column name of a view (thus handling RENAME applied to the view itself),
and I don't think "resname" is user-visible in any other way.

Anyone see a problem with this plan?

I regard this as something we should fix for 7.4, mainly because if you
Oh, man, you are reaching with that one, but I like it. :-)

Quote:
use --enable-cassert then the backend actually dumps core when trying to
execute the outdated rule (there are Asserts in there that notice the
resname mismatch).
--
Bruce Momjian | http://candle.pha.pa.us
pgman (AT) candle (DOT) pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(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.