r/ProgrammerHumor • • Oct 14 '25

Advanced neverForget

Post image
14k Upvotes

616 comments sorted by

View all comments

4.2k

u/Spillz-2011 Oct 14 '25

If there’s no danger how do you get the rush. Don’t tell me you use transactions.

1.3k

u/BoBSMITHtheBR Oct 14 '25

What’s the fun if you use Transactions? Might as well wear a seat belt.

447

u/Spillz-2011 Oct 14 '25

Do you know some people look both ways before crossing the street? Sky diving costs money anyone can get that rush for free.

171

u/[deleted] Oct 14 '25

Jump without a chute and you'll be skydiving for the rest of your life.

43

u/[deleted] Oct 14 '25

They say he died doing what he loved… having his organs blended together and mixed with his bones.

17

u/[deleted] Oct 14 '25

Famous last words: "hey wtf that's my backpaSPLAT"

70

u/marcodave Oct 14 '25

If you haven't died at least once you haven't even lived

→ More replies (1)

9

u/mickaelbneron Oct 14 '25

You should cross a busy street in Vietnam someday. You'll feel that rush. You can Google videos of it if you want a preview.

→ More replies (3)
→ More replies (3)

152

u/HildartheDorf Oct 14 '25

I use transactions.

You write begin transaction

You write commit

Then you go up and write the update/delete.

93

u/CharlieKiloAU Oct 14 '25

You comment out the COMMIT though, right.... right?

50

u/Forzyr Oct 14 '25

Anakin stare

20

u/Rare_Ad_649 Oct 14 '25

I put a rollback, the change it to a commit later

17

u/nater416 Oct 14 '25

Yeah, if you don't rollback or commit it will lock the table. Ask me how I know 😂

17

u/Rare_Ad_649 Oct 14 '25

I know how you know, I once left a window open with an open transaction on a production server, no one could do anything

15

u/DC38x Oct 14 '25

Honestly their fault for trying to do stuff tbh

→ More replies (1)
→ More replies (2)
→ More replies (2)

13

u/code_monkey_001 Oct 14 '25

I just drop in the following snippet
--DELETE FROM
SELECT TOP 10 * FROM

WHERE

that way whatever I type into the gap as the table name will throw an error until I complete the WHERE, and even then will just give me rows validating the WHERE logic until I swap the commenting between the first and second lines.

→ More replies (2)

61

u/5t4t35 Oct 14 '25

Ye only pussies use transaction fuck it run it on the production server just to see if it works live

28

u/GraciaEtScientia Oct 14 '25

And if it doesn't work call it an "Interesting data point" but that more "data points" will need to be gathered to make any real determination of who is really to blame for prod being down now.

18

u/GeneralQuinky Oct 14 '25

Yeah just call up the DB guy afterwards and say "hey you guys have backups right"

12

u/5t4t35 Oct 14 '25

They say yes and shows you a .docx file in microsoft word

28

u/anomalous_cowherd Oct 14 '25

db_backup.sql 0 bytes 1 Jan 2018

13

u/DarthSatoris Oct 14 '25

Just reading that has increased my blood pressure.

6

u/Top-Basil9280 Oct 14 '25

I actually got a shiver down my spine reading that.

6

u/tehfrod Oct 14 '25

Did that at my first real job. I was "too busy" to learn the company's... what did they call it? "source control system"? after we were acquired.

After all, I keep a copy of the source code on a mapped server drive. It's perfectly safe.

blows away local copy before copying down from server

copy from server fails

Weird. I guess I wasn't in the local source directory? Oh well.

Changes directory, blows away local copy before copying down from server

realizes that step 1 occurred on the mapped server drive

"Uh, hi, is this IT? Ok... Just wondering, do y'all happen to run nightly backups on the file server?"

→ More replies (3)

19

u/catom3 Oct 14 '25

I remember working on Oracle years ago. And we had pleeeenty of triggers on tables. We had a simple task to update one record, which was not updated due to the logic error. We also didn't want any DB trigger to run when performing that update.

So... The dev prepared a standard anonymous PL/SQL block with commands like BEGIN DISABLE ALL TRIGGERS; UPDATE foo SET bar = 'dummy'; ENABLE ALL TRIGGERS; END

The dev opened a transaction and ran it, just to test it. The dev noticed their missing WHERE clause and rollbacked the transaction.

Ooppps. All records changed their bar column to value from this update. Wait? Why?

Ohhhhh... Oracle's DISABLE/ENABLE TRIGGERS statement is not really transactional and always makes an implicit commiy for you.

Of course, I don't want to be dismissive and I agree with you. Just that running everything within a transaction isn't a silver bullet either.

Worth stating that the application design was definitely not helpful. Neither were the practices of testing such SQLs on a real, production, live database. :)

→ More replies (4)
→ More replies (16)