Re:6pm.com's 1.6 million dollar pricing mistake
by tyn on Sunday May 23, 2010 @06:18PM
(#1373175)
An UPDATE sql statement with a forgotten WHERE clause
[ Parent
| on HN ]
It does annoy me that the WHERE clause has to go at the end. I usually end up typing the WHERE clause first when working live on something important.
Same with rm -Rf /foo/bar. There's a moment when pressing enter will do the wrong thing. I usually use relative paths to avoid this, but I have had to repair the damage for someone who actually managed to rm -Rf / by accident due to this.
Re:6pm.com's 1.6 million dollar pricing mistake
by random42 on Monday May 24, 2010 @10:31AM
(#1374699)
That is why I run a ls command before doing rm. (been bitten but accidentally hitting Return key instead of Shift on laptop :()
Also for Update/Delete query I run the equivalent select (rows or count(*) ) query first, just to make sure.
also make sure to write where predicate before completing the whole sql. (The sql does not go through by accidentally hitting enter, before the whole statement is written)
tl;dr - Run read operation before doing write/update/delete operations.
Re:6pm.com's 1.6 million dollar pricing mistake
by robryan on Sunday May 23, 2010 @11:51PM
(#1373731)
Doubt it, I'm really careful with updates and usually I only have a few hours work between me and fixing a mistake like that, not a million dollars. Maybe a certain discount was applying to everything, more likely that every actual price being changed in the db.