this post was submitted on 25 Jun 2023
380 points (99.2% liked)

Programmer Humor

32710 readers
458 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
top 19 comments
sorted by: hot top controversial new old
[–] [email protected] 57 points 2 years ago (2 children)

Don't call it "accidental database deletion". Call it "unannounced live exercise of backup procedure".

[–] [email protected] 3 points 2 years ago

Either that or rapid exodus from the country

[–] c0mbatbag3l 1 points 2 years ago

Call it "buy your cloud engineer a beer"

[–] cashews_win 17 points 2 years ago (1 children)

"I didn't put a WHERE clause in that DELETE statement"

[–] EmasXP 7 points 2 years ago (1 children)

As a side note, DBeaver actually asks for confirmation if it thinks you are about to do something wonky. I think it's quite telling just how common this mistake is. We've all been there

[–] marcos 3 points 2 years ago

Update and delete should require a where clause. You can always use true or 1 = 1, the gain from omitting it is minimal.

The fact that no DBMS ever decided to implement this, not even as an option is quite distressing.

[–] Dasnap 16 points 2 years ago

DB admins rawdogging the prod postgres on a Friday evening.

[–] [email protected] 14 points 2 years ago

I did something like that once, I wasn't very good at SQL but I needed some data, so I logged in into the production database and run my SELECT queries, I didn't change anything so everything was good, or so I thought.

I created a cross product over tables with millions of entries and when it didn't respond I thought it was odd but it was time to go home anyway. On the way home they called me and asked what I did. They had to restart the DB server because once the cache timed out one application after another started failing.

[–] Lemming 11 points 2 years ago (1 children)

Embrace it as you are now officially a developer

[–] MajinBlayze 5 points 2 years ago (1 children)

At some point this is just a rite of passage

[–] [email protected] 6 points 2 years ago

Mine was to format the wrong computer on the first day of my first IT internship. I spent the next six weeks there fixing that oopsie.

[–] [email protected] 9 points 2 years ago

Ouch. Gotta wrap those deletes in a transaction and look before it rolls forward. Lessons learned. Time to see if the backups actually have any data on them.

[–] [email protected] 7 points 2 years ago* (last edited 2 years ago) (1 children)

Sometimes I dream of getting fired for accidentally doing shit like this. Sweet relief...

[–] Dasnap 9 points 2 years ago

Good companies wouldn't fire someone for this because:

  1. There should be processes in place to prevent this, or recover from this, anyway. It's a team/department failure and you would just be the straw that broke the camel's back.

  2. They now know you've experienced this and will hopefully know to never do it again. Bringing in someone else could just reintroduce the issue.

[–] [email protected] 3 points 2 years ago

You just triggered my PTSD

[–] [email protected] 3 points 2 years ago

I did quite a few bad things like that early on. Now I never type UPDATE or DELETE without first doing a SELECT and WHERE. It's easy to convert to a DELETE and UPDATEs tend to effect only a few fields at a time so the extra effort is worth the peace of mind. It's a good habit to form, I can't even think of the last time I did anything horrible.

[–] Quique 2 points 2 years ago

I think I leave ~~early~~ late today. Fixed the title for you 😁