News for hackers. Stuff that matters.
Re:An administrator accidentally deleted the production data... by traviscj on Wednesday March 23, 2016 @07:24AM (#11343469)
I am a bit less convinced by this practice. The general consensus seems to be: "oh you can SELECT around after you've done your update and before you commit; the update." But while you're doing that, you might be holding row locks on all the data your update touched, and meanwhile the lock acquisitions in your app are failing, along with whatever that entails. And if you're not doing that and immediately commit;ing, are you gaining anything?
Re:An administrator accidentally deleted the production data... by jsnell on Wednesday March 23, 2016 @07:38AM (#11343525)
When the UPDATE or DELETE finishes it will output the number of rows changed. If that number is much larger than expected, something probably went wrong. So there's a gain even if you don't investigate the results in detail.
Re:An administrator accidentally deleted the production data... by bottled_poe on Wednesday March 23, 2016 @08:02AM (#11343636)
I agree with parent that using transactions is good practice. In general, naked SQL on a production DB is a bad idea - it is not different to running untested coded in a production environment. Why risk it?

Transactions are a sane safeguard if you absolutely must run SQL on your production database.

Re:An administrator accidentally deleted the production data... by MichaelBurge on Wednesday March 23, 2016 @08:05AM (#11343651)
[REMOVED]
Re:An administrator accidentally deleted the production data... by brianwawok on Wednesday March 23, 2016 @08:19AM (#11343726)
This is a lot of manual steps. Why not have migration scripts in your code base. Run them in dev and qa and staging so you know they work. Then you go to prod and are done.

The less manual steps the less mistakes will happen.