this post was submitted on 02 Mar 2024
571 points (98.0% liked)

Programmer Humor

32718 readers
278 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 85 points 9 months ago (3 children)

I always run my queries in a script that will automatically rollback if the number of rows changed isn't one. If I have to change multiple rows I should probably ask myself what am I doing.

[–] [email protected] 84 points 9 months ago

Damn that’s a good idea. Going to write that down, put it in the to do list, and regret not dosing it.

[–] [email protected] 36 points 9 months ago* (last edited 9 months ago) (1 children)

I always start a session with disabling auto commit (note, I could add it to my settings, but then it would backfire that one time my settings don't execute, so I'm making it a habit to type it out every time, first thing I connect)

BTW: what kind of genius decides that auto commit should be enabled by default?

[–] [email protected] 10 points 9 months ago

That's a good idea too. I'll have to look into that.

[–] [email protected] 1 points 9 months ago* (last edited 9 months ago)

Or at least run it in the test database first.

Or run your updates/deletes as select first.