|
That's a nice UPDATE statement you've got there...
Would be a shame if it were to be executed...
Without a WHERE clause
Nothing serious, but still a PITA.
I was about to delete that statement, but hit F5 instead of backspace
|
|
|
|
|
Argh! NOOOOO! ROLLBACK! Rollback! rollback, please...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Been there, done that. Nothing quite as unnerving as seeing 847 rows affected when you only expected 1. Fortunately it was something like adding a quantity of 5 to an existing value, so I could just reverse it.
|
|
|
|
|
Whenever doing insert\update\delete I always write the WHERE clause first
|
|
|
|
|
INSERT ... WHERE ...
Interesting.
Do you get a lot of success with that?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
Interesting, I always write my insert/update/delete statements with a WHERE 1=0 clause first, so even if I have a moment of sheer stupid and run it, chances are less likely it will work. After that, I add AND then the actual clause.
Trying to get people around here to wrap their insert/update/deletes in a rollback/commit block is like pulling teeth. Seriously, what do you expect the change to be? If it doesn't match that something went wrong.
|
|
|
|
|
I did, but I wanted to change the UPDATE Table... to SELECT * FROM TABLE... So I highlighted the query without the WHERE clause and wanted to delete it... With F5
|
|
|
|
|
ditto. But when using MySql (which I do for about 50% of my projects, Sql Server the other 50%) I usually use MySql Workbench; this has an option ("Safe updates") that prevents execution of update queries without a where clause. (Though it accepts WHERE 1=1 for when you really want to update everything).
|
|
|
|
|
Couple of weeks ago, but, as they used to say: "saved by the skin of my teeth"
Was working on code that produces SQL par rowsets by interpreting SQL table schema. Anyway, I was working on a version of the table that was named the same, but with an _test. I wanted to clear it of data, except the first record. DELETE FROM and then the moment of horror. My _test table wasn't empty. The production table was. Literally hundreds of reports and dozens of applications are totally dependent upon this table.
But, as it would happen, somehow a miracle was pre-planned. Literally the night before, my boss created an archive table. All the deleted records were moved to it. The several minutes of horror were soothed with a little bit of delete, rename, and then recreating that archive . . . just in case I want to drive myself to drink again, some day.* Amazingly, quick enough (although it seemed to take forever) that no one even called IT or put in a support request.
* Yes, there are backups, but until that could be brought to bare, a major panic was imminent, much yelling, screaming, gnashing of teeth, and then the bad stuff would start.
** This is only the second time in about 15 years I popped a production table. It was all much less essential that first time.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
W∴ Balboos wrote: * This is only the second time in about 15 years I popped a production table. It was all much less essential that first time. With some equipment[^] you get no second chance.
The language is JavaScript. that of Mordor, which I will not utter here
This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a f***ing golf cart.
"I don't know, extraterrestrial?"
"You mean like from space?"
"No, from Canada."
If software development were a circus, we would all be the clowns.
|
|
|
|
|
Many many years ago we had a word for that . . . . . . . . . . ooops!
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
We had something like that hanging right above those consoles:
A soldier sitting at a radar console and you can see a missile launching outside the window. He holds a telephone and asks: "How do you say 'sorry, my fault' in Russian?"
The language is JavaScript. that of Mordor, which I will not utter here
This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a f***ing golf cart.
"I don't know, extraterrestrial?"
"You mean like from space?"
"No, from Canada."
If software development were a circus, we would all be the clowns.
|
|
|
|
|
I wrote an SQL-Generator for that, so every DB Model has it and the Generator creates the statements. This saves my a55
Rules for the FOSW ![ ^]
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
Unless selecting, always start your SQL script with "START TRANSACTION".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: always start your SQL script with "START TRANSACTION". That's like jumping out of a plane with a parachute on, just in case you need it. Real men don't need it.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
My rule of thumb is to create the select statement and run it before changing it to delete or update. That, however, only works if (1) I count on my thumbes, and (2) type the write table name. Everything could seem OK. (even with your Transaction wrap) until just a little bit later.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
W∴ Balboos wrote: Everything could seem OK. It is not relevant how things seem.
You validate before you commit. You cannot assume, one must validate. Seriously, paranoia pays.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yeah, I usually do this.
Of course that doesn't work when you have some text selected (which I had) for deletion, but hit F5 instead
Luckily we had a backup (well, not so lucky as we make those daily) and I was able to undo the harm without anyone even reporting the issue
|
|
|
|
|
Silly human.
AI would've never made this mistake.
You are replaceable. The robots are coming! The robots are coming!
|
|
|
|
|
AI's have the ability to make millions of mistakes per second.
I won't even code that many instructions in my life
|
|
|
|
|
Easy mistake, since the F5 key is right next to the Del key ... oh wait.
Been there and done that, though. The feeling when you just realize you've just deleted the whole company's timecard entries? Like jumping out of an airplane. Thank goodness for frequent (15-minute intervals) log backups.
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
Trapped | CommitStrip[^]
Vi was as much fun - no universal CTRL+F4 for us early adopters!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Been there, stuck in input mode, and it took some time to escape.
|
|
|
|
|
:w!
Damn, I meant :q!
sccs get program.c
Tap-tap-tappety-tap
Damn! Wrong again!
:w!
redo from start
98.4% of statistics are made up on the spot.
|
|
|
|