this post was submitted on 06 Nov 2023
1318 points (98.7% liked)

Programmer Humor

32601 readers
558 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] magic_lobster_party@kbin.social 135 points 1 year ago (4 children)

Well at least we got a backup, right?

Right???

[–] andrew@lemmy.stuart.fun 58 points 1 year ago (2 children)

It last ran a week ago and we technically haven't tested it. Just our hot replicas which also just deleted all that data.

[–] TheGreenGolem@lemm.ee 12 points 1 year ago

And of course by now every downstream system replicated AND CACHED that data.

load more comments (1 replies)
[–] Alexstarfire@lemmy.world 10 points 1 year ago (1 children)

Back up? No, we only go forward in this company

load more comments (1 replies)
load more comments (1 replies)
[–] saltnotsugar@lemm.ee 105 points 1 year ago (3 children)

This is what we in the industry refer to as a “big oof.”

[–] IHawkMike@lemmy.world 22 points 1 year ago

I thing the technical term for this is an RGE.

(Resume Generating Event)

[–] ultratiem@lemmy.ca 7 points 1 year ago* (last edited 1 year ago)

But it’s only, like, a handful of rows 🙃

load more comments (1 replies)
[–] MyNameIsRichard@lemmy.ml 72 points 1 year ago (1 children)

It's a good way to wake yourself up in the morning

[–] toxic_cloud@lemmy.world 23 points 1 year ago

Doctors HATE this one simple trick! Lose up to 100% of MyChart data - and KEEP it off!

Can help reduce blood pressure, high cholesterol, weight, height, gender, name and more to NULL! Wake up feeling NULL and NULL!

[–] xmunk@sh.itjust.works 67 points 1 year ago (3 children)

For everyone's sanity, please restrict access to the prod DB to like two people. No company wants that to happen to them, and no developer wants to do that.

[–] HugeCounterargument@lemm.ee 69 points 1 year ago (1 children)

Me applying for any database access ever: “read only. I do not want write. READ ONLY.”

[–] breadsmasher@lemmy.world 33 points 1 year ago (1 children)

Datagrip has an option, and likely other database IDEs do as well - “Connect as READONLY”. Makes me feel a little safer

[–] lobut@lemmy.ca 26 points 1 year ago (1 children)

Just a funny story. All of our devs and even BAs used to have prod access. We all knew this was a bad idea and put in a process of hiring a DBA.

I think in the first two weeks the DBA screwed up prod twice. I can't remember the first mess up but the second he had a lock on the database and then went to lunch.

We eventually hired two awesome DBAs to replace that one but oh boy.

[–] Lionel@endlesstalk.org 14 points 1 year ago

Imagine being hired to help prevent people from fucking something up, only to fuck that thing up in your first week—not once, but twice. You’d think after the first time it wouldn’t happen again…

load more comments (1 replies)
[–] palordrolap@kbin.social 57 points 1 year ago* (last edited 1 year ago) (1 children)

8388409 = 2^23 - 199

I may have noticed this on a certain other aggregator site once upon a time, but I'm still none the wiser as to why.

199 rows kind of makes sense for whatever a legitimate query might have been, but if you're going to make up a number, why 2^23? Why subtract? Am I metaphorically barking up the wrong tree?

Is this merely a mistyping of 8388608 and it was supposed to be ±1 row? Still the wrong (B-)tree?

WHY DO I CARE

[–] driving_crooner@lemmy.eco.br 37 points 1 year ago* (last edited 1 year ago) (2 children)

Are you Ramanujam reborn or a nerd who put every number they found on wolfram alpha?

[–] palordrolap@kbin.social 23 points 1 year ago (1 children)

In a place for programmer humour, you've got to expect there's at least one person who knows their powers of two. (Though I am missing a few these days).

As for considering me to be Ramanujan reborn, if there's any of Srinivasa in here, he's not been given a full deck to work with this time around and that's not very karmic of whichever deity or deities sent him back.

[–] Fuck_u_spez_@sh.itjust.works 12 points 1 year ago (2 children)

I know up to like 2^16 or maybe 2^17 while sufficiently caffeinated. Memorizing up to, or beyond, 2^23 is nerd award worthy.

[–] driving_crooner@lemmy.eco.br 6 points 1 year ago

I know that 2^20 is something more that a million because is the maximum number of rows excel can handle.

load more comments (1 replies)
[–] LastYearsPumpkin@feddit.ch 13 points 1 year ago

Ramanujan reborn - the main protagonist from the Wheel of Maths books.

[–] pomodoro_longbreak@sh.itjust.works 35 points 1 year ago* (last edited 1 year ago) (1 children)

Ah reminds me of the time (back in the LAMP days) when I tried to apply this complicated equation that sales had come up with to our inventory database. This was one of those "just have the junior run it at midnight" type of shops. Anyway, I made a mistake and ended up exactly halving all inventory prices on production. See OP's picture for my face.

In retrospect, I'm thankful for that memory.

[–] Agent641@lemmy.world 11 points 1 year ago* (last edited 1 year ago) (1 children)

Ive had one of those moments. Where you fuck up so bad that your emotions wrap all the way around from panic, through fear, confusion, rage, dread and back to neutral, and you go 'Hmm..."

load more comments (1 replies)
[–] Rhinoshock@lemmy.world 29 points 1 year ago (3 children)

In T-SQL:

BEGIN TRANSACTION

{query to update/delete records}

(If the query returned the expected amount of affected rows)

COMMIT TRANSACTION

(If the query did not return the expected amount of affected rows)

ROLLBACK TRANSACTION

Note: I’ve been told before that this will lock the affected table(s) until the changes made are committed or rolled back, but after looking it up it looks like it depends on a lot of minor details. Just be careful if you use it in production.

[–] jaybone@lemmy.world 7 points 1 year ago (1 children)

Lol why did I have to scroll so far to see ROLLBACK

load more comments (1 replies)
load more comments (2 replies)
[–] kamen@lemmy.world 23 points 1 year ago

This is now the correct database.

[–] fushuan@lemm.ee 23 points 1 year ago (2 children)
[–] Blackmist 20 points 1 year ago (2 children)

I don't understand environments that don't wrap things in transactions by default.

Especially since an update or delete without a where clause is considered valid.

[–] finestnothing@lemmy.world 9 points 1 year ago* (last edited 1 year ago)

I'm a data engineer that occasionally has to work in sql server, I use dbeaver and have our prod servers default to auto-wrap in transactions and I have to push a button and confirm I know it's prod before it commits changes there, it's great and has saved me when I accidentally had a script switch servers. For the sandbox server I don't have that on because the changes there don't matter except for testing, and we can always remake the thing from scratch in a few hours. I haven't had an oppsie yet and I hope to keep that streak

load more comments (1 replies)
load more comments (1 replies)
[–] Sunforged@lemmy.ml 20 points 1 year ago

Legit have nightmares about this.

[–] nuke@yah.lol 18 points 1 year ago

Just hit Ctrl+Z to Undo

[–] meldrik@lemmy.wtf 17 points 1 year ago

This is missing NSFW tag!

[–] erogenouswarzone@lemmy.ml 17 points 1 year ago (2 children)

You can also do this by forgetting a WHERE clause. I know this because I ruined a production database in my early years.

Always write your where before your insert, kids.

load more comments (2 replies)
[–] Rosco@sh.itjust.works 16 points 1 year ago (1 children)

That's what backups are for.

[–] figaro@lemdro.id 36 points 1 year ago (2 children)

Checking the backups... Ah yes, the backup done in August 2017.

Hello boss, I broke the company. I'll see myself out

[–] erogenouswarzone@lemmy.ml 9 points 1 year ago (1 children)

If you don't have apt backups, that is a failure of the process, not yours.

[–] _dev_null@lemmy.zxcvn.xyz 7 points 1 year ago

Plot twist, they were also the one responsible for developing the backup process.

[–] Rosco@sh.itjust.works 8 points 1 year ago (2 children)

You should take it upon yourself to make regular backups in case you fuck up really bad. I had an intern that deleted everything on its fifth day, luckily l was automatically making backups two times a day, so it was fine.

[–] TheSlad@sh.itjust.works 10 points 1 year ago (3 children)

Why would an intern be allowed anywhere near prod DB? Do you not have lower environments?

load more comments (3 replies)
load more comments (1 replies)
[–] Naomikho@monyet.cc 15 points 1 year ago* (last edited 1 year ago)

I actually screwed up twice on dev environment. Luckily the second case was salvageable without using data from an old backup(I wasn't given one that time) and I managed to sweep it up fast.

I started testing my queries super carefully after the first incident, but I was too tired once that I forgot to restrict the update scope for testing and screwed up again.

[–] threelonmusketeers@sh.itjust.works 14 points 1 year ago* (last edited 1 year ago)

'content' :)

Whenever SQL databases come up, I always think of this video from one of the greatest 'content' creators in history.

[–] SzethFriendOfNimi@lemmy.world 13 points 1 year ago* (last edited 1 year ago) (2 children)

Transactions are your friend here

Begin transaction;

Then

Your sql here

Double/triple check the messages/console for results. Look good?

Commit;

Worried?

Rollback;

Just be sure to mind your transaction logs for long running queries and by all things holy be sure you’re not doing this to a live db with a ton of transactions since you’re basically pausing any updates until the commit or rollback on the affected tables

[–] xmunk@sh.itjust.works 16 points 1 year ago* (last edited 1 year ago) (1 children)

This makes it safer but like... don't run queries on production outside emergencies ever.

That transaction frame, depending on your specific DB, may cause severe performance side effects.

Look, the safe approach is to write it into something, PR it, get it reviewed, and then run it as part of a structured deployment process.

load more comments (1 replies)
load more comments (1 replies)
[–] derfl007@lemmy.wtf 12 points 1 year ago

oopsie daisy moment

[–] TangledHyphae@lemmy.world 10 points 1 year ago* (last edited 1 year ago) (3 children)

Looks like little bobby tables is at it again. (edit: for reference: https://xkcd.com/327/)

Edit #2: For lemmy app users: https://xkcd.com/327

And thanks to @Gestrid@lemmy.ca for the correction.

load more comments (3 replies)
[–] Tenthrow@lemmy.world 8 points 1 year ago

This is giving me PTSD

load more comments
view more: next ›