UPDATE - Column order guaranteed?
Posted in 1995
Topics: Triggers, Constraints & Referential Integrity
Hi All...
Simple Q for you all.
In the following UPDATE statment fragment:
UPDATE table set col1=col2, col2=col3, col3=0
Is this update GUARANTEED to be in the order I presented? Is there
any chance of the assignments happening out of sequence? (Is my intent
clear? Doing a sort of bucket roll here...)
Sure, it WORKS this way in my tests.
Sure, it seems logical to think that it would always work this way.
Sure, you all do it...but do you KNOW?
I can't seem to find anything in the Informix manuals that says this
behavior will ALWAYS happen. Maybe it's in the SQL standard that these
assignments are serialized as presented, but I don't happen to have a
copy of the standard handy.
For all I know, it's just a convenient side effect. The Trigger manuals
document that multiple update triggers happen in column order, but
there isn't anything anywhere that states what's going to happen here.
Maybe the updates are happening in column order as well.
It's seems like common sense would dicate, but we're talking computers
and Informix here. Their common sense clearly differs from mine, from
time to time. For all I know in OnLine 9.x they're going to allow table
partitioning by column as well and "subtley change some engine
behaviors". What a hoot that change would be to track down.
This is really digusting because I have ONE statement in my ninety
gazillion lines of code for this current application that does this. I
could easily serialize it myself with two updates and be done with it.
The second update would go zingy fast because everything is cached up
the ying-yang and I'm hitting one whole row.
If the assignment order changes, or is inherently undefined and JUST
HAPPENS to work all the way up until the application hits "The Busy
Season" then I get a phone call:
"Why are our numbers suddenly completely hosed?"
"Ummm...."
"We need these numbers fixed immediately."
"Well, I was kind of out the door to catch my non-refundable flight
to Hawaii..."
"And it seems the rest of the seasons numbers are also a mess..."
"I have a snorkeling reservation, too..."
So, anyway, just for the sake of curiosity, will that UPDATE ALWAYS
work as intended?
Thanx!
--
Will Hartung - Hermosa Beach, Lower Left Coast. vfr750@netcom.com
1990 VFR750 - VFR=Very Red "Ho, HaHa, Dodge, Parry, Spin, HA! THRUST!"
1993 Explorer - Cage? Hell, it's a prison. -D. Duck