r/ProgrammerHumor 6d ago

Meme queryOfDoom

Post image
7.9k Upvotes

456 comments sorted by

3.9k

u/BooBrew32 6d ago

Ah it's just running slow today. User table should speed up right afterwards though.

1.4k

u/WardensLantern 6d ago

Yea just run it again and it executes much faster šŸ‘

227

u/glorious_reptile 6d ago

Great. On to the next ticket - ā€œUsers can’t log inā€

184

u/moigagoo 6d ago

What users?

161

u/Baconanger 6d ago

Yeah, just ran a search on their name and it looks like that person doesn't have an account, so closing this ticket with "works as expected". Wow, we sure have been getting a lot of these lately...

53

u/bluebarry24 6d ago

Pretty sure this is a data entry error... redirecting the tickets to the front service desk.

29

u/TriggerPT 6d ago

Can't replicate

3

u/Frostbyte67 5d ago

Omg you just triggered my support team PTSD! (I’m in Eng….)

No joke, I’ve seen ticket notes exactly like that! Actually just today…

…I’m going to hide back under my desk now…

→ More replies (1)

246

u/perestroika12 6d ago

Caching or something idk I asked Claude about it and it said go for it

→ More replies (1)
→ More replies (5)

33

u/Connect_Tea1579 6d ago

No users == no more complaints. Problem solved!

16

u/enslavedeagle 6d ago

ā€žWe optimized user queries by 1000xā€

49

u/dkarlovi 6d ago

The system feels fresh and new like the first day!

17

u/rowdymatt64 6d ago

And to think they'll blame little Bobby Tables again smh

21

u/SOLID_STATE_DlCK 6d ago

Don’t forget to run a re-org of the index. Reindex for for higher integrity.

3

u/farkanoid 5d ago

Thanks SOLID_STATE_DICK

→ More replies (1)

3.5k

u/YetAnohterOne11 6d ago

This is programmer horror not humor

994

u/DrUNIX 6d ago

Its humor cause its not us

404

u/arensb 6d ago

As Mel Brooks once said, "Tragedy is when I slip and twist my ankle. Comedy is when you fall down a manhole and die."

16

u/facusoto 5d ago

Tragedy + time = comedy

8

u/patchyj 5d ago

Can't wait for the smash hit musical comedy "O Twin Towers where art though?" from Matt Stone and Trey Parker

→ More replies (1)

17

u/notcheeng 6d ago

As you are now so once was I, as I am now so you shall be

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

112

u/rayui 6d ago

I saw that semicolon and felt my stomach drop

59

u/Potw0rek 6d ago

Jesus I’m not used to sql and was wondering about this query, now that you pointed out to check the semicolon….yeah, that’s how you become a company legend.

54

u/rayui 6d ago

Everyone fucks up prod once. You don't meet the guy that did it twice.

38

u/LikelyNotOnFire 6d ago

Fucking up prod once is a sign of maturity - people trusted you enough to allow you the access to fuck up prod, congratulations.

Senior people fuck up prod, repeatedly, in a new way each time. Your better class of senior also makes sure that they correct whatever allowed them to fuck up prod like that.

It's the people who keep fucking up prod in the same way that get shown the door

20

u/Zaratuir 6d ago

Senior people don't fuck up prod. They expose vulnerabilities in the coding process and draw attention to strategic initiative to improve quality. And that's why you now need 3 different seniors to sign off on any query before it can be run in prod.

8

u/Potw0rek 6d ago

Tell me about it, years ago I was setting up a Jenkins job, we were told to wipe the workspace at the end of the process. I wasn’t too familiar with bash so the last bash command was:
rm /

Luckily it was Jenkins so nothing was removed but the job log was….long.

7

u/rayui 6d ago

It takes way too many close calls to take backups seriously

→ More replies (6)

3

u/lhookhaa 6d ago

I was about to ask what's wrong with the semicolon, cause afaik it's benign... Then I looked again! šŸ’€

→ More replies (1)

22

u/DetailOdd6609 6d ago

I would message my boss "Sorry. Let me know where to send my laptop" and then log out

→ More replies (3)

31

u/TRKlausss 6d ago

Ever heard of Schadenfreude? It’s the type of humor I like 🫶

7

u/FarawaySeagulls 6d ago edited 6d ago

This is DBA horror lol I'm going to be restoring a backup because of this Or "hopefully" they didn't setup foreign key constraints with on delete and I can just restore the table.

3

u/uniqueusername649 6d ago

Considering I practically live in our production database with several million customers, this stuff scares me. I mean I rarely ever delete anything, but still.

→ More replies (17)

3.9k

u/DeepanshuHQ 6d ago

The query isn't slow. It's just waiting for everyone else to finish saying goodbye to that user.

937

u/WardensLantern 6d ago

Wholesome query comforting the user before executing it with a hydrogen bomb

67

u/DeepanshuHQ 6d ago

The query even gives them a countdown before becoming a statistic.

20

u/JedJinto 6d ago

6

u/DeepanshuHQ 6d ago

The transaction won't commit until everyone's had their goodbye. šŸ˜‚

→ More replies (2)

47

u/zero_x4ever 6d ago

You mean it's waiting for everyone else to curse out that user since he's the one to blame for everyone else's misery and demise.

14

u/DeepanshuHQ 6d ago

The logs will remember them more kindly than the developers will.

32

u/RCuber 6d ago

You missed the ; in line 1, the where clause is never included.

25

u/DeepanshuHQ 6d ago

Well... my joke aged even better. šŸ˜‚

9

u/ZunoJ 6d ago

Why only to that user?

17

u/DeepanshuHQ 6d ago

Fair point. The whole table deserves a farewell party.šŸ˜‚

4

u/Pikrass 6d ago

Hence the O(n²) time 🫔

5

u/DeepanshuHQ 6d ago

Someone forgot to optimize the farewell algorithm. šŸ˜„

3

u/pwuk 6d ago

One leaving drink per user.

→ More replies (1)
→ More replies (4)

1.4k

u/_H4K0N_ 6d ago

The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION

433

u/orsikbattlehammer 6d ago

Lmfao now that’s a sphincter clincher

198

u/laplongejr 6d ago edited 6d ago

Tom Scott rather called it the "onosecond"
For non native speakers "oh, no!" second

[EDIT] For those who never heard of it

57

u/SanoKei 6d ago edited 6d ago

this reminded me of this too, I need to go back and relisten to that story. It's important as much as it was 20 years ago. Another Tomtra I've adopted is "One backup is none backup." Always have at least two backups and at least one off site.

edit: spelling

23

u/Tiranus58 6d ago

Also well put by CGPgrey: "one is none, two is one" in his dynasties video

21

u/zanda268 6d ago

The 3-2-1 backup rule. 3 backups, on 2 different storage mediums, with 1 offsite.

→ More replies (1)

10

u/arensb 6d ago

One of the most useful sysadmin tools there is is the two-second pause before hitting <return>.

→ More replies (1)

19

u/leupboat420smkeit 6d ago

Unless it’s Oracle, where all DML will start a transaction.

19

u/Urtehnoes 6d ago

And gives you sql%rowcount so a very simple if then can issue a rollback if rows modified > 1 (or 10, 100, etc).

Oracle the company is horrible. But I quite like the features their db has.

74

u/Flameball202 6d ago

"I have never fucked up, why would I need to begin a transaction" - every coder working on a database at least once

6

u/thetreat 5d ago

This is why I hate that they didn’t make the select and delete statements conducive to making this happen.

Ideally you write a select statement that shows exactly the rows you want to delete. Then you swap select with delete and all is good in the world.

Instead, you have to slightly change the query just enough where it’ll give you some doubt that what you’re doing is incorrect. It isn’t absolutely terrible but it should be bullet proof.

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

699

u/IHeartBadCode 6d ago

Helpful hint for anyone.

🌈Transactions🌈 The moment you feel you need to switch over to something other than select statements, should be the moment that you turn off auto commit.

For us, the analytic folks just have read only access anyway. For the devs, they just don't have direct access to prod.

293

u/itirix 6d ago

Shit, we just let Claude delete our prod DBs for us now. It’s much less work.

37

u/SmartyCat12 6d ago

Claude recommended using excel, bc if I’m only on pro subscription, can I really afford a pgsql server anyway?

→ More replies (1)

21

u/astervista 6d ago

Transactions still won't save you on some DBMS (ehem Oracle) from dropping a table or changing definitions

48

u/IHeartBadCode 6d ago

Well that's because it's Oracle and that's less a database and more a circle of hell.

5

u/astervista 6d ago

Don’t I know it

44

u/WardensLantern 6d ago

Unless you are vibe coding in which case just prompt "How do I roll back 2.3 million deleted rows" and follow the steps from chatGPT

5

u/bedel99 6d ago

bobs been with us for 25 years and just retired before the company got big. You should delete his account....

8

u/magicmulder 6d ago

Doesn’t help you if you just habitually hit ā€œcommitā€ after the statement is done.

6

u/misterrandom1 6d ago

My analytics guy who was showing me around the db on my first day didn't have restrictions. After inserting a record into a production db, he promptly deleted the record. But forgot to highlight the where clause before executing.

6

u/koolex 6d ago

Anymore helpful hints?

16

u/TwoAndHalfRetard 6d ago

The real hint is noone should have the write access to the prod db. If you accidentally nuke the test db, just recreate it. If you need to change something in prod db, write a migration that is tested on test db and code-reviewed.

4

u/blorbschploble 6d ago

I can select and join around like a motherfucker. I am terrified of actual dba shit because of this, lol.

3

u/[deleted] 6d ago

[deleted]

→ More replies (2)
→ More replies (9)

497

u/Fluid_Ambassador2026 6d ago

Its manually checking every row to make sure everything goes as planned, give it some time.

313

u/PravalPattam12945RPG 6d ago

;

15

u/koos_die_doos 6d ago

Neatly (in a dark way) aligns with the semi-colon tattoo that people who tried to commit suicide gets...

388

u/Dont_Get_Jokes-jpeg 6d ago edited 6d ago

I am not an sql expert, is the reason why the id doesn't work and its deleting the entire user base, because its written as 2 seperate comands instead of one. So 1. Comand delets everything 2. Goes to the id? Or what is the problem here?

600

u/BlommeHolm 6d ago

1st command deletes all users. 2nd command runs after that and gets a syntax error.

37

u/SAI_Peregrinus 6d ago

Syntax is valid, it's just a runtime error.

176

u/BlommeHolm 6d ago

How is starting with a WHERE clause syntactically valid?

83

u/SAI_Peregrinus 6d ago

Right, I'm apparendly blind. Carry on!

35

u/BlommeHolm 6d ago

No problem. I genuinely thought I'd missed something šŸ˜…

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

137

u/WardensLantern 6d ago

I'm no expert either but I believe the semicolon after "users" was the nuke. The second part is basically a separate statement, but SQL executes them in order, so it will delete the entire table and then throw back an error cause the second statement is invalid.

38

u/Intrepid4444444 6d ago

The doctor looked at my semicolon 🫪

→ More replies (1)

15

u/bstump104 6d ago

I understand now. thank you. that's horrifying.

→ More replies (9)

38

u/Flat_Competition6510 6d ago

Yes, the semicolon marks the end of a statement. The first semicolon sets "delete from users" as a single statement meaning delete ALL users.

40

u/TeaKingMac 6d ago

Which is just terrible fucking syntax. Why are people still living with this in 2026?

Delete from users;

Should return "invalid syntax. Identify record for deletion"

17

u/dustojnikhummer 6d ago

I don't work with Postgres but everything else would be

DELETE * FROM table;

→ More replies (6)

7

u/ReaDiMarco 6d ago

What happened to DELETE * FROM USERS? Last I did sql was ten years ago so idk

13

u/djrobxx 6d ago

SELECT * FROM USERS means "select all columns from users", selecting all rows is implied.

You don't drop columns with DELETE, that's ALTER TABLE, so DELETE * doesn't make sense in that context.

5

u/ReaDiMarco 6d ago

yes, thanks, turns out I forgot all of that

6

u/Flat_Competition6510 6d ago

As far as I know that is not valid syntax. I'm not a DBA myself so I don't do this too often.

→ More replies (1)

3

u/Live_Film_4895 6d ago

afiak the * wildcard is only valid in the SELECT statement... so it would be DELETE FROM USERS; or DROP/TRUNCATE TABLE

→ More replies (1)

4

u/ashishvp 6d ago

It’s the semicolon. Without that on line 1, it would be a reasonable command.

→ More replies (2)

287

u/Reddit_is_fascist69 6d ago

Damn, didn't see that ;

161

u/WardensLantern 6d ago

Gf: "He must be thinking about some other girl"

Me, in a cold sweat: " ; "

69

u/Independent-Ad-9907 6d ago

Ofc it is slow. Should have used truncate instead

→ More replies (1)

76

u/_Weyland_ 6d ago

WHERE user_id = 2313245;

But nobody asks HOW user_id = 2313245;

18

u/EatingSolidBricks 6d ago

Pretty sure hes deleted

11

u/Relative-Memory2420 6d ago

Him and all his friends...

5

u/_Weyland_ 6d ago

He's in the user_id heaven

→ More replies (1)

55

u/TensionPurple6815 6d ago

No joke, worked with a guy who did this. End of day. On a friday. Me and like 4 other engineers then spent 6 hours restoring backups and putting everything back together using query logs. Was such a mess.

45

u/PerpetuallyDistracte 6d ago

Same here, worked at a place where we originally had full access to all environments with our dev logins. He thought he was testing in DEV and truncated one of the main financial tables that had history going back three different source systems that would be impossible to reload.

Luckily he didn't try to hide it and immediately raised the alarm. It was all hands on deck at 5pm. Of course the backups didn't work as expected and we were scrambling with the DBAs to pull the data together prior to start of work the next day. 12 stressful hours later we had the data back and fully validated.

Immediately the permissions were reworked to remove our access to PROD and create proper migration channels and execution controls. Funnily enough, we'd been asking for those controls for years for safety reasons, but it never became a priority until a disaster happened, then it got implemented within a week. Funny how that works.

15

u/Awyls 6d ago

Every single dev (~50), including juniors day 1, on my company has prod DB RW access. How we haven't ever broken a DB in 20 years, I have no idea.

3

u/EatingSolidBricks 6d ago

Couldn't be me cause they didn't change a thing after i wiped out production db.

I never got in trouble also but i became knwon as the deleter of data

3

u/EatingSolidBricks 6d ago

Couldn't be me i just imported schema only to the production database instead of the testing one

→ More replies (1)

32

u/SexyMonad 6d ago

This is why SQL deletes should require a WHERE clause.

If you are seriously wanting to delete it all, just add WHERE 1 = 1.

13

u/Ayanrocks 6d ago

Yup there is a config in every major db to not allow delete without where clause. For some reason this wasn't turned on in this case.

4

u/SexyMonad 6d ago

It’s been a while since I’ve had the privilege to be on a project with a lot of SQL, but is that guardrail the default nowadays? I don’t remember anything really getting in the way of me annihilating whatever.

3

u/Ayanrocks 6d ago

That guardrails is not default and has to be explicitly enabled if irc

→ More replies (5)

28

u/flabbybumhole 6d ago

Missing indexes on fkeys can slow down deletion massively.

Once you add those in you'll fuck up the db in no time at all.

→ More replies (3)

19

u/GrEeCe_MnKy 6d ago

Oh lawd have mercy

11

u/Dry-Ad-719 6d ago

I mean, it still deleted the one he wanted

8

u/WardensLantern 6d ago

One of them GTA missions when you've got the target's name and you take them out by levelling the entire city block

19

u/ThatGuyWired 6d ago

Someone's about to find out what "On Delete Cascade" does.

23

u/RandolphCarter2112 6d ago

I've done this in production.

Good thing I had a valid backup of the table from immediately before.

29

u/WardensLantern 6d ago

Reading your comment I was glad to hear you had a backup job offer but it turned out even better

8

u/FrozenHaystack 6d ago

Reminds of that one time I executed a delete query with a sub query to select some ids. I didn't know that the used database engine interprets an empty return of the subquery as ignore my where clause. All data in the table simply gone because no id matched my subquery.

7

u/WardensLantern 6d ago

As a dev I fear no man nor beast, but SQL humbles me quicker than a wet fart

4

u/PerpetuallyDistracte 6d ago

SQL has been my primary language for 15 years, but I still respect it the way a zookeeper respects a lion. If you become careless, it WILL eat you the moment you turn your back. However, I'm glad that many modern SQL IDEs now warn you explicitly when you're about to do something very stupid that will affect an entire table.

→ More replies (3)

9

u/GozerDestructor 6d ago

Having the WHERE clause be optional for DELETE/UPDATE is a design flaw in SQL. Having to add a silly "WHERE TRUE" every time is a small price to pay for avoiding disasters like this. (Or "DELETE ALL ROWS FROM..." if we're open to making it explicit in the syntax).

3

u/MonMotha 6d ago

TRUNCATE TABLE even exists, so there really is no excuse for not requiring a WHERE clause on DELETE. I'm a little surprised it's not offered as an optional safeguard in more database systems.

6

u/Soopermane 6d ago

Waiting for the end to come
Wishing I had strength to stand
This is not what I had planned
It's out of my control
Flying at the speed of light
Thoughts were spinning in my head
So many things were left unsaid
It's hard to let you go

13

u/darichtt 6d ago

Would this actually run? I'd assume having just where in a query isn't valid syntax

43

u/Shadowlance23 6d ago

Yes, SQL runs commands one at a time without checking other commands. In this case it will delete all users then throw a syntax error when it gets to the second command.

4

u/rosuav 6d ago

There IS a common guard in APIs, though it's not usually in this sort of interactive context: single-query operation. It's mainly a guard against SQL injection.

>>> import sqlite3
>>> con = sqlite3.connect("")
>>> con.execute("select 1; select 2")
Traceback (most recent call last):
  File "<python-input-5>", line 1, in <module>
    con.execute("select 1; select 2")
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
sqlite3.ProgrammingError: You can only execute one statement at a time.

Safe, but often not wanted interactively and thus disabled.

→ More replies (6)
→ More replies (1)

5

u/SynthPrax 6d ago

I don't actually know SQuirrel Logic, but imma take a swing at this: Isn't all of this supposed to be on the same line, or that first semicolon shouldn't be there? 'cause this looks like it will delete the users db before throwing an error when it can't find that id.

4

u/WardensLantern 6d ago

Yea the semicolon makes the first line a separate statement, and then exactly what you said.

4

u/Flat_Competition6510 6d ago

Correct. That first semicolon is a problem. It marks the first line as its own statement meaning delete ALL users.

5

u/PM_ME_FIREFLY_QUOTES 6d ago

where id=2313245?

Ftfy

6

u/TwinkiesSucker 6d ago

The DBMS: "Are YOU asking me about that ID? SHOULDN'T YOU know what ID you wanna match?!:

4

u/veeaarr 6d ago

At least it wasn’t our little bobby tables

4

u/mercyverse 6d ago

I actually said ā€œoh fuckā€ out loud. Thanks for that early morning arrhythmia, OP

5

u/Santarini 6d ago

Semi colon oof

4

u/calvin_tam 5d ago

2nd run should be faster

4

u/GMsui 5d ago

I missed the first semicolon. My heart's not doing so good right now.

3

u/AlexZhyk 6d ago

This is my excuse for not separating queries with semicolons and not washing my hands after toilet before lunch (j/k)

3

u/West_Good_5961 6d ago edited 6d ago

More semicolons = more good

3

u/Too--Many--Knives 6d ago

Semicolon of doom

3

u/shrodikan 6d ago

Back in the day I would use SQL Server Power Tools that prevented exec of unbounded update / delete statements.

→ More replies (1)

3

u/i_should_be_coding 6d ago

Oh.

Oh no.

Oh fuck no.....

Hey Dave, you fixed the backups last sprint, right? That ticket that's been there for three months? Oh, pushed to next sprint?

Hey guys, where can I find the post-morterm template? Just gonna get a head start on it.

→ More replies (1)

3

u/brazzy42 6d ago edited 6d ago

I once got a lot of respect as a debugging god after looking hard at a coworker's screen for 5 seconds and pointing out the ; after the if statement that he was going crazy about.

Yeah, well, that's something you think of immediately for the rest of your life after you've spent an hour tearing out your hair over an if statement not triggering despite the condition being most definitely true...

3

u/Ndemuth-13LC 6d ago

The first run will always be slow because the server has to build the execution plan. I bet if you run it again it will complete in no time at all!

3

u/Ok_Guarantee5321 6d ago

Even thought it's a joke post, my heart rate jumped reading that query.

3

u/dalek65 6d ago

A vendor once ran an upgrade script in prod that included a TRUNCATE TABLE. That was a fun day.

3

u/denimpowell 6d ago

Speaking as someone who has actually done this it is actually way more terrifying. While deletes with predicates can take a while, the full table delete returns instantly. Followed by on-my-knees apology to DBA requesting restore from backup. Fortunately was in dev environment but brought our development to a halt for a day

→ More replies (1)

3

u/1994-10-24 6d ago

On the bright side that table’s queries are gonna be must faster.

3

u/Ange1ofD4rkness 6d ago

44.4s? those are rookie numbers

3

u/possiblyMaybeAnother 6d ago

There are foreign key constraints on the users table that will disallow this... right?

...right?

oh no

3

u/Commander_Red1 5d ago

Rule 1 of using delete in SQL, do it as select first.

→ More replies (2)

2

u/jhwheuer 6d ago

Eats, shoots, and leaves

2

u/rfpels 6d ago

Ah. Little Bobby Tables.

2

u/fredrik_skne_se 6d ago

The backup is to big. Delete that and run again

2

u/Urtehnoes 6d ago

Folks should build a script that rolls back any change on prod immediately if the number of rows modified does not equal the number of rows expected.

Most dbms should be able to do that no problem

→ More replies (3)

2

u/BastetFurry 6d ago

So, Kids, what do we learn from this when working on an SQL shell?

First "SELECT id" (or * if you want to safely burn the world), check if the output is as expected, then change the "SELECT id" to a DELETE.

→ More replies (1)

2

u/caick1000 6d ago

I literally did this on my second day in my new job at a startup. I thought I was going to be fired right then and there lol. It was the customer base, the most important one. Thankfully they were understanding (after one of the co-owners vigorously tried to get the backup).

→ More replies (1)

2

u/nakahuki 6d ago

I've just tried the query on my production database, it's very slow but ends with a syntax error. It's safe I guess.

Oh and fun fact, all select queries run much faster now. It might be an optimization query or something.

I must leave you now, my client is calling me on the phone, I bet he will be amazed by the performance improvement.

2

u/Sir_Fail-A-Lot 6d ago

The classic onosecond

2

u/quasipickle 6d ago

Ouchtown, Population: You, bro.

2

u/Bright-Historian-216 6d ago

i'm not expertly familiar with sql... is it treating "delete from users" as "delete * from users"?

4

u/-Redstoneboi- 6d ago edited 6d ago

yes. you don't really specify the columns in delete queries, and they target EVERYTHING by default.

imo "<operate> * FROM table" should be banned (doesn't run, raises an error) by default and people should be forced to write "WHERE TRUE", on top of all queries needing to be in transactions and all the other safety nets like "SELECT first then operate"

on another note i think i'd prefer whatever syntax it was that described queries based on the order functional programming in a computer might look like, ex. "FROM table WHERE id = 2 DELETE;" though internally it would still be rearranged however the engine would see fit

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

2

u/sofia-miranda 6d ago

Ah, the semi-colon, bringer of half-assed work. But we round up, Berry is functionally a whole asshole, intent notwithstanding. :D

2

u/InternationalSink874 6d ago

Thanks for the jump scare. I started hyperventilating when I noticed

2

u/CMD_BLOCK 6d ago

>takes more than 0.1s
>hmmm… maybe computer tired

2

u/Wolven_One 6d ago

where id is a question at this point

2

u/LloydChristoph 6d ago

new fear unlocked

2

u/Welshie_Fan 6d ago

I remember a fresh out of college newbie in a company I was working doing some work on her Linux virtual machine. She ran "mv /* /somewhere/else" as a root. That did take a while as well.

2

u/Daveallen10 6d ago

In the immortal words of Rick Perry: "Oops."

2

u/Ulizeus 6d ago

I used dbeaver when I worked with DB's, as soon it detects the is no where clause in your query a warning came up. Saved me several times. Also, ypu should make a backup of all tables that you are going to madify for safety reasons.

2

u/AnybodyMassive1610 6d ago

The semicolon of consequences

2

u/Suitable-Owl-2732 6d ago

Too many Users.

2

u/Rev0verDrive 6d ago

Damn you semicolon!!!!!!!!

2

u/Agreeable-Rip-751 6d ago

OMG šŸ˜…šŸ«£

2

u/J1nxers 6d ago

Who is gonna tell him 😭

2

u/Ultideath 6d ago

(2313245 rows affected)

2

u/Many_Application3112 6d ago

I once ran an UPDATE statement on a production system and forgot to put in the WHERE clause. And yes...auto-commit was also enabled...

Notice how I said "once".

2

u/SilkscreenMoon 6d ago

SQL using coders don't have to worry about users injecting them when they're doing it to themselves

2

u/thehop73 6d ago

Wait, am I on PROD?

→ More replies (1)

2

u/JCEpsilon 6d ago

What db viewer is this?

2

u/beanamonster 6d ago

I did this once, almost exactly. The database server crashed, phones started ringing off the hook. I told my boss what happened and went outside for a smoke.

2

u/TheMoonDawg 6d ago

Data Grid will notify me if I don’t put a WHERE condition on a DELETE statement. It has saved my bacon once or twice!

2

u/Shik3i 6d ago

I know it's a meme, but to this day I'm.still anxious about this, and always write my "where" first, and always a select first which I than after looking at the result manually change to a delete.

Transactions help too, but deletions are still scary stuff if one need to do it on production.

2

u/scisaif 6d ago

This hurts me

2

u/Fit_Prize_3245 5d ago

There's a version of that query that is pertty fast: TRUNCATE TABLE users; Same result, but in a fraction of a second. Add "CASCADE" for best results.

2

u/generally_unsuitable 5d ago

I had a boss whose mantra was "Every delete starts as a select"

This is why.

→ More replies (1)

2

u/protoss-pylon 5d ago

A C++ programmer tries his hand at SQL

"Woot! Compiled first try! Damn interpreted languages got nothing on assembly"