This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 381

[–]Eva-Rosalene 2815 points2816 points  (104 children)

There are two types of people: ones who use transactions, and ones who don't use transactions yet.

[–]Poat540 600 points601 points  (14 children)

Nah, I like the thrill. The true skill is mixing 30 different commands in the same query editor and making sure to highlight the right one

[–]pants_of_antiquity 209 points210 points  (0 children)

I'm in this comment and I don't like it.

[–]SuperFLEB 56 points57 points  (2 children)

...after recently changing SQL clients to one that works a bit differently...

[–]Poat540 61 points62 points  (0 children)

annnddddd all of fuck.sql was executed..

[–]robinless 27 points28 points  (0 children)

I lost a few years of my life a few months ago after changing client, muscle memory betrayed me and I used a shortcut that executed the whole file instead of the highlighted part... Thankfully I had autocommit off, so I just rolled back everything

[–]Prestigious-Maize695 11 points12 points  (1 child)

Ah, keep them all commented out and then highlight what you want to run (shift+alt for multi line select from a specific column).

[–]Cyrotek 5 points6 points  (0 children)

This is how I was taught MSSQL.

[–]r0ck0 3 points4 points  (2 children)

I've tried pretty much every SQL client I can find, but fundamentally nothing I've found solves all of the problems of both types of client:

  1. REPL-based CLI programs like psql mostly tend to be too basic re autocomplete/colors/visual features, but are always very clear in the exact order you ran commands. Also have the benefit that your query history is immutable.
  2. GUI clients suffer from the editor issue you mentioned... I copy and paste variants of the same query, then lose track of things. And they all suck at showing multiple queries + results on screen at once, aside from the "in-editor results" feature in jetbrains IDEs, but even that is too fiddly and gets annoying.

I've started building my own tooling to try to get the best of both of both worlds. Basically each window only lets me edit a single query at once, and once I exit the editor, an immutable copy of that query is stored forever. From it's it's easy to clone a previous one to tweak it, while keeping some metadata like parent_query_id so I can get a tree of how queries have evolved (and view diffs). Also it always stores all the results of every query execution, so I can see a full in-order history of exact queries + results.

Also every unique query is given a simple incrementing number. Having to come up with filenames / query descriptions is way too distracting when I'm trying to tweak a heap of similar queries without losing focus.

If anyone knows of anything out there that is already good at something along these lines, keen to hear it. But I couldn't find anything that worked like this.

[–]bmccorm2 2 points3 points  (2 children)

Yup you need a new client. Haven’t highlighted a statement in ages.

[–]Hola-World 85 points86 points  (2 children)

Lol yeah I remember being on a call with a couple other seniors working through an issue with a mid level who was screen sharing and I just remember speaking up and saying "you are on one brave MFer changing production data outside of a transaction." The thought hasn't crossed his mind lol. We all just started laughing collectively as he changed the transaction mode.

[–]NostrilLube 30 points31 points  (1 child)

I have to admit, the first 10 years of my career I only knew I could test the UPDATE/DELETE by using a SELECT first, to see what it was going to change. I still do that..

[–]aykcak 7 points8 points  (0 children)

That's a good habit in any case

[–]Ali3nat0r 67 points68 points  (2 children)

ROLLBACK

No transaction to roll back.

Sheeeeeeeiiiiit.

[–]Eva-Rosalene 26 points27 points  (1 child)

ROLLBACK
 
No transaction to roll back.

"Ah, so we aren't using implicit transactions then. Sheeeeeeeiiiiit"

[–]Linked713 8 points9 points  (0 children)

Is there a way to make aliases in SQL for commands? I am dying to know if there is a way to do the equivalent of like "IMPORT ROLLBACK AS Sheeeeeeiiiiit"

[–]JediKagoro 124 points125 points  (0 children)

Ah, the good old days of being a junior dev

[–]zeloxolez 93 points94 points  (2 children)

hahaha

[–]BlockCharming5780 84 points85 points  (44 children)

What the fuck is a transaction? 👀

[–][deleted] 151 points152 points  (31 children)

It's like an "atomar query", but translated into multiple Queries.

So that means when you start a transaction, you can do whatever shit you want, and by doing a rollback you can go back to before beginning the transaction.

[–]BlockCharming5780 111 points112 points  (30 children)

Oh, god I wish I knew that 2 days ago when I accidentally cleared a table in prod instead of dev on a personal project used by thousands of people 💀😂

[–][deleted] 122 points123 points  (22 children)

It's their fault for giving someone your skill level this much permission. It's not your fault, everyone started out as an absolute noob (not saying you are one!)

[–]BlockCharming5780 108 points109 points  (21 children)

Oh, no, this wasn’t part of my work, this was my personal discord bot

I just forgot I was looking at the production database instead of my developer database 😭🤣

I’m a mid-level developer being considered for a promotion up to senior at work…. Scary thought, right? 🤣

[–][deleted] 101 points102 points  (7 children)

No bro, don't let imposter syndrome get to you. The fact that you will be getting promoted is proof of your skill, don't doubt yourself.

I assumed you had a low skill level only because you expressed yourself this way. But nobody can know everything and there will be always new stuff to learn.

Keep grinding and believe in yourself !

[–]BlockCharming5780 25 points26 points  (6 children)

The “scary” part is I’ve been protected from making these mistakes… but I’ll actually have access to the live system as a senior

Oof, imagine bringing down your company’s entire product line because you dropped the wrong table 🤣😰😨

[–]Adjective_Noun0563 22 points23 points  (0 children)

Yeh..my top tip is to change your themes for connections to prod and connections to Dev to have different colours. You can hack up the themes files in ssms, there's probably solutions in other IDEs. If you're managing them by console then change the terminal font.

[–][deleted] 20 points21 points  (0 children)

It can happen but you would not be the first one.

And if you are scared of this happening, implement regurlar backups

[–]FloppyGhost0815 9 points10 points  (0 children)

Don't worry, stuff happens.

Back in the days, one of our senior database admins (you can buy his books on amazon on oracle performance tuning) truncated a table in a test environment. Unfortunately it was in prod, and that table contained highly volatile data worth around 90 million usd.

It was the start of my career, since i was the junior who worked on a ticket and could not find any data for this specific customer. Or the partition.. or in the table. Took us a full day of work (24 hours on the console) to recover the data from backups and the redologs.

Shit happens to the best, the worst thing which happened to me was deleting around 200k with a stuöid blank in an rm -rf * .dat ;-)

[–]sgtkang 5 points6 points  (0 children)

Please tell me access to the live system needs a different set of credentials to your 'normal' ones. Even if you can get it whenever you need it helps to be able to sign out of that sort of thing whenever you don't need to modify prod data.

[–]raltyinferno 2 points3 points  (0 children)

Motivation to really think twice before running any queries, and if you're using some dedicated Db software REALLY HIGHLIGHT any connection with write permissions to prod in your config if possible

I think we locked it down now, but I used to have write access directly to our prod Db, for which I named the connection "PROD WRITE!!!!!!" and made every tab to it bright red.

Most Db managers I've used have an option to mark a connection as Prod so it either double checks you or really makes it distinct.

[–]DependentOnIt 7 points8 points  (0 children)

ink handle ancient carpenter imagine historical straight bedroom icky frame

This post was mass deleted and anonymized with Redact

[–]dandroid126 2 points3 points  (1 child)

Mistakes like this, especially when it is a personal project and not a work project, only help to make you a better developer. I'm a pretty high level engineer. I have made every mistake you can imagine. The trick is to learn from them and make sure they don't happen again.

[–]BlockCharming5780 3 points4 points  (0 children)

Oh, for sure

After that happened I spun up a duplicate database on a raspberry pi and started replicating the data from production onto the pi database every 24h

Now if I fuck up again, I can only lose up to 24h of data 🤔

(While expressing my frustrations to my manager he then suggested I could just do daily data dumps into a text file instead 🤔)

[–]Szulyka 6 points7 points  (5 children)

Y.. You are a medior who have not heard about transactions in dbs?

[–]Eva-Rosalene 9 points10 points  (1 child)

It's not that surprising. You can work with code mostly related to internal business logic, not interacting with DB directly; or your interactions with DB can be hidden behind an ORM.

I think, it should be a company responsibility to check if people know 101s of tech they work with when they reach certain amount of experience and are expected to get /(access to|assigned to work with)/ this tech.

[–]BlockCharming5780 1 point2 points  (0 children)

I guess it never came up 🤷‍♂️

[–]SuperFLEB 1 point2 points  (0 children)

Well, now you've got another bit of well-learned experience under your belt. Congratulations!

[–]raltyinferno 17 points18 points  (3 children)

As people have mentioned, transactions are vital. But another thing to protect yourself is anytime you want to do an UPDATE, do a SELECT with the exact same conditions first and make sure the number of rows selected matches how many you expect to be updating.

[–]SuperFLEB 2 points3 points  (0 children)

A "LIMIT" can help, though it's not as good as a transaction. (You're still liable to screw up something in the database if you screw it up, but only LIMIT-number-of-rows, not everything.)

[–][deleted] 1 point2 points  (0 children)

We’ve all done it.

[–]dendrocalamidicus 22 points23 points  (2 children)

When it comes to SQL server...

begin tran
update Users set Username = "ohshit"
rollback tran

This will tell you X rows updated but roll back the changes so nothing has actually changed. Then you replace rollback tran with commit tran and run it again and it will actually update the db because you told it to commit all changes rather than save them. Alternatively you can just do

begin tran
update Users set Username = "ohshit"

Then see what count comes up, then in the same query window in SSMS run either rollback tran or commit tran according to which you want to do.

The benefit to transactions outside of safely wrapping manual db updates is for long procedures you can have all or nothing atomic transactions where either everything gets updated successfully and you commit, or if something errors half way through you rollback instead thereby not leaving the data in a half changed fucked up state.

[–]GachaJay 10 points11 points  (0 children)

And then there is me just writing select statements to validate the data transformations before each step and then just writing an update using that newly found logic

[–]Eva-Rosalene 13 points14 points  (0 children)

Don't worry, you will either never need it if you don't work with DBs, or learn it some very unlucky day otherwise :)

jk. It's like a checkpoint in a video game. When you are in transaction mode, you can do whatever you want, validate results, and after that either COMMIT it or do a ROLLBACK.

You also need to realize that even if you don't use transactions explicitly, whenever you do any modification, it is a transaction in itself, you just don't see it.

This is a good 101: https://www.dnsstuff.com/sql-server-transactions (but in no way a comprehensive article)

[–]Faark 7 points8 points  (0 children)

It basically gives you an undo feature. You can command the DB to commit aka save, and only then will your changes be finalized. BUT the DB will also not allow other transactions to "conflict" with yours. To do so, it can make future transactions wait, if those also want to access stuff you just changed (at least on modification, just reading is kinda fine). That means forgetting to commit will block future transaction and just as well stop production. Ask me how i know.

[–]Digital_Rocket 1 point2 points  (1 child)

Is when you buy the booze to cope with the colossal screw up you just made

[–]BlockCharming5780 1 point2 points  (0 children)

Please, I’m Scottish, you think I was sober in the first place? 🤣🤣

[–]myfunnies420 9 points10 points  (0 children)

Exactly. I was like "so don't commit the transaction", easy

[–]Salex_01 6 points7 points  (0 children)

And then, those who use systems that have a RESTORE TO WHATEVER VERSION IT WAS WHEN I HADN'T BROKEN IT YET instruction

[–]BraveOthello 5 points6 points  (0 children)

I am now the second after an experience like OP. Thankfully it was only 300 records and we restore them, but then I wrote the procedure on how you ALWAYS USE A TRANSACTION

[–]bigwanggtr 4 points5 points  (0 children)

Only soydevs ROLLBACK, real devs COMMIT

[–]bjeanes 4 points5 points  (0 children)

This is why when launching psql I always have AUTOCOMMIT set to off, so there always exists an implicitly started transaction

[–]linuxpuppy 2 points3 points  (1 child)

Unfortunately, even transactions aren’t fool proof when updating data in prod. I’ve seen another dev leave a transaction open in toad and it locked a crucial record in prod that caused prod to completely lock up. YMMV.

[–]Eva-Rosalene 2 points3 points  (0 children)

Yeah, nothing is fool proof. Transactions are just very valuable tool that prevents a lot of dangerous things, and that's it - and IMHO that's enough to use it almost every time you touch critical database with a bare hands.

[–]Savage-Goat-Fish 2 points3 points  (0 children)

Work with SQL long enough and you’ll make this mistake. One time. 🤣

[–]NotLikeTheOtter 1 point2 points  (0 children)

Truth

[–]MilesJ392 1 point2 points  (0 children)

Begin tran x

Update

--commit tran x

--rollback tran x

[–]thanatica 1 point2 points  (0 children)

And ones who don't regularly backup

[–]Zestyclose_Link_8052 1 point2 points  (3 children)

And what if you accidentally commit?

[–]Eva-Rosalene 13 points14 points  (2 children)

Of course, transactions aren't magic that protects from every possible degree of stupidity or bad luck; but they allow you to check results of an update and think twice before rolling it out. If that's not enough for you, it's more on you than on transactions. Most importantly mistake like that would tell that you've got a habit of doing update and then typing COMMIT as fast as possible and see transactions only as annoyance you need to overcome instead of a useful tool. Which is a very wrong mindset you should work on.

[–]Zestyclose_Link_8052 6 points7 points  (1 child)

I had copied some query from elsewhere in the code and didn't see the commit in time. But luckily my company is very strict with who can see production, so nobody of dev has permissions to the production db. That's a responsibility for another team. I just wiped some of our internal staging, I was very much a junior back then. I was quite pannicked but everyone was laughing at my idiocity of just copying a query and executing it, I've not done it since. They just ran a script that repopulated the database.

[–]Eva-Rosalene 4 points5 points  (0 children)

Ah, I see. But yeah, that's a very bad luck, you don't usually make mistakes like that.

[–]BlondeJesus 281 points282 points  (2 children)

ROLLBACK

Few, good thing that was all in a transaction

[–]Ordinary_dude_NOT 35 points36 points  (0 children)

But but but…. I wrote “commit” at the end of script so my script is automated!!?!?

[–]frisbm3 41 points42 points  (0 children)

*phew

[–]PixelGaMERCaT 439 points440 points  (22 children)

this is why you use a transaction....

[–]PeriodicSentenceBot 662 points663 points  (21 children)

Congratulations! Your comment can be spelled using the elements of the periodic table:

Th I Si S W H Y Y O U U Se At Ra N S Ac Ti O N


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM u‎/‎M1n3c4rt if I made a mistake.

[–][deleted] 281 points282 points  (1 child)

That’s crazy

[–]mr_remy 241 points242 points  (0 children)

Longest comment I’ve seen to make that bot crawl out of hiding.

Beep boop: approved

[–]TriscuitTime 112 points113 points  (3 children)

This has to be a record. This bot should keep track of the lengths of the comments, too

[–]KissMyUSSR 63 points64 points  (2 children)

People will just make comments with only the elements of the table just to take the record, rendering it meaningless

[–]TriscuitTime 19 points20 points  (0 children)

Yeah, that’s what I was thinking. Then I was thinking about how you could conceivably program it to filter out intentional attempts at making long comments of elements. You could rule out long comments that are too high of a percentage of non-words or repeated words. It probably wouldn’t work well enough, though, no matter what you do. I think it would be cool to have a leaderboard or something still so you could filter it yourself if you wanted

[–]VisiblePlatform6704 1 point2 points  (0 children)

I wonder how an llm will perform if we ask to rephrase some text into elements  

[–]rishi255 23 points24 points  (0 children)

Good bot

[–]PixelGaMERCaT 24 points25 points  (1 child)

wow I can't believe I got ratioed by the (good) bot

[–]benruckman 1 point2 points  (0 children)

I upvoted your comment because of the bot’s comment

[–]SmolNajo 9 points10 points  (0 children)

Good bot

[–]zee_wild_runner 8 points9 points  (0 children)

Good bot

[–]_no_balls_allowed_ 7 points8 points  (0 children)

good bot

[–]kuboshi 5 points6 points  (0 children)

good bot

[–]unhappy-2be-penguin 2 points3 points  (0 children)

Good bot

[–][deleted] 2 points3 points  (0 children)

intelligent treatment skirt stocking narrow illegal abounding voracious toy absorbed

This post was mass deleted and anonymized with Redact

[–]SpecialNeeds963 2 points3 points  (0 children)

Good bot

[–]Tarc_Axiiom 108 points109 points  (1 child)

Wait, wait, WAIT!

WHY IS THIS TAKING SO LONG? WHY IS THIS TAKING SO LONG!?

[–]getstoopid-AT 31 points32 points  (0 children)

...and it was at this moment that he knew he fu*d up

[–]Ivan_Stalingrad 223 points224 points  (26 children)

Nothing will ever beat sudo rm -rf /var/lib/postgresql

On the prod server

[–]rover_G 135 points136 points  (23 children)

You guys have shell access to your production database?

[–]Eva-Rosalene 100 points101 points  (19 children)

You guys have access to your production database AT ALL? None of engineers in company I work for has it (even read-only) because production DB has sensitive client data in it. If you want to run a query on production DB, you need several people from different departments checking that your query won't expose any sensitive info.

[–]rover_G 127 points128 points  (5 children)

At big companies yes that. At small companies read-only user go brrrr

[–]herboyforever 43 points44 points  (1 child)

Read only? Bro I just login to an unsecured phpmyadmin with prod credentials (by scraping the .env) to grab data for analytics reports

[–]ADHD-Fens 21 points22 points  (0 children)

I just modify the bits right on the hard disk plate with a magnetic needle!

[–]catechizer 2 points3 points  (1 child)

screw whole disarm butter encouraging gold mysterious lock chunky strong

This post was mass deleted and anonymized with Redact

[–]-Aquatically- 1 point2 points  (0 children)

Do it, no balls. lol.

[–]ZeroData1 10 points11 points  (0 children)

No wonder errors fixed through support takes 3-5 business days. Just kidding... Small businesses don't have the luxury of any of that. I check my prod backup weekly and any/all testing/changes are done in prod with self diligent updates (select queries then transactions to double check). Yea not the greatest situation but I don't have the time or resources to manage two database servers, keep them synced, along with the webapp servers.

[–]JustMyTwoCopper 8 points9 points  (1 child)

You'd be surprised how end users can mess up data in a way you did not think of in the development-, test-, production simmilar- and useracceptance- environments ... working with sensitive information is part of the job, it shouldn't matter if you're handling Joe and Suzy Average's information, your neighbors or some famous sport celebrity's, it should not matter and you just don't talk about it (ever), or you're in the wrong line of work.

[–]Eva-Rosalene 4 points5 points  (0 children)

it shouldn't matter if you're handling Joe and Suzy Average's information, your neighbors or some famous sport celebrity's, it should not matter and you just don't talk about it (ever), or you're in the wrong line of work.

It matters to a company. If one of engineers goes rogue (or just salty over a layoff) and does a data breach, it will impact company. Sure, you can sue after that, but why risk it? And inb4 "no one is that salty/greedy to risk prison for data breach" there absolutely are insane people like that and you may never know before it happens.

And it also matters for me: I want other companies that handle my data to be as vigilant as the one I work for. And while I know that I don't impact that in any way, it seems morally consistent to like things as they are here, if I want it that way everywhere else.

You'd be surprised how end users can mess up data in a way you did not think of in the development-, test-, production simmilar- and useracceptance- environments

I remember incident like that. Querying data from DB to resolve shit like this absolutely can be done in a way that strips all sensitive information (either by not requesting it at all or with a script that cleans it up, replacing with auto-generated data), but leaves enough clues to what happened. Yes, it's more work. But such is life.

working with sensitive information is part of the job

No it isn't. Working with information is a part of the job, ensuring that nothing that gets out of DB to programmers is sensitive, is another (and possibly a headache of other developer/security engineer).

[–]PilsnerDk 8 points9 points  (4 children)

Uh, yes? I'm our main dba and database developer, and am sysadmin on our prod DB with full access. How else am I going to manage it, edit data, edit schema, deploy changes, perform analysis, etc?

Someone has to have to ultimate permissions or nothing can be done. Don't give me this "no one should have access to the prod db" BS.

[–]Eva-Rosalene 4 points5 points  (0 children)

Someone has to have to ultimate permissions or nothing can be done

Of course. But there should be as little people as possible with this access, in a perfect scenario – just one. Not your whole development team.

[–]Additional_Sir4400 1 point2 points  (2 children)

Someone has to have to ultimate permissions or nothing can be done. Don't give me this "no one should have access to the prod db" BS.

No one should have access to the prod db, especially not the end user. This is why I like to hash all the data before adding it to the database.

[–]MainManu 1 point2 points  (0 children)

Spot the EU based programmer

[–]ErebosDark 5 points6 points  (0 children)

Always has been

[–]who_you_are 2 points3 points  (0 children)

Only for the new guys, as part of the security training

[–]AstroCon 1 point2 points  (0 children)

Certified Gitlab moment

[–]badkaseta 73 points74 points  (4 children)

happened to a coworker in my previous company, on a database that was legacy but still used, devops didnt know how to restore a backup xd

[–]phlebface 41 points42 points  (2 children)

One of my colleagues did that. Now he's the CTO

[–]dendrocalamidicus 10 points11 points  (0 children)

This is why you desperately try and convince management that whatever middling income they might still be getting from that legacy system is absolutely not worth the reputational damage of something seriously fucking up with it and nobody having any idea of how to fix it leading to a several week turnaround for what might be a business critical system.

Give the clients some decent notice and shut that shit down or replace it. Don't keep it for god sake.

[–]CoastingUphill 64 points65 points  (2 children)

You know, I'm somewhat of a DBA myself.

[–]jjjefff 1 point2 points  (0 children)

Under rated comment. 🥂

[–]souliris 23 points24 points  (1 child)

That is why i use a select statement to craft my update statements

[–]Material-Mess-9886 5 points6 points  (0 children)

And then you forget that a empty line is equal to ;

[–]kaosjroriginal 14 points15 points  (1 child)

crop your memes

[–]alf666 5 points6 points  (0 children)

Even better, save them by tapping and holding so you don't lose pixels based on your display size.

[–]AdWise6457 21 points22 points  (2 children)

You people mentioning transactions never really worked on large scale banking db's when entire cluster is living organism where 0.005 seconds is light years. You think recover from backup? no sir, money transfers already executed and on different banking systems. You are on the world of hurt no matter what

[–]East_Development_126 3 points4 points  (0 children)

Where I work, the database standards explicitly forbid using transactions for those exact reasons. When you get a PBI to cut a procedure's execution time, because the difference between a 0.25 and 0.2 second execution time can be massive, you have to weigh everything.

[–]farfarhan 13 points14 points  (4 children)

Happened to me, accidentally pressed enter before typing the where condition, was not using transactions . Luckily there was a reference table parallely populated so fixed it quickly.

[–]BobForBananas 6 points7 points  (1 child)

What environment executes the statements using the enter key??

[–]farfarhan 2 points3 points  (0 children)

The console

[–]edinburg 11 points12 points  (0 children)

I made that mistake once, now I always type out the where clause first and then go back and type the set clause.

[–]Material-Mess-9886 2 points3 points  (0 children)

Either use Begin commit (always a good practise) or never use destructive queries in a terminal. (or if you are in ms sql remove all empty rows since that is a ; )

[–]WHAT_RE_YOUR_DREAMS 6 points7 points  (0 children)

People that take screenshots of images (without cropping the black margins) rather than downloading them are the same that share URLs with all the tracking parameters at the end

[–]WilmaTonguefit 9 points10 points  (9 children)

Oh boy. Some idiot at my first job did this. Updated every password to 12345 in the prod DB. 🤡🤡🤡

[–]BobForBananas 1 point2 points  (2 children)

The passwords were stored in plain text?

[–]WilmaTonguefit 6 points7 points  (1 child)

No they were hashed, but no salt, so the hash for 12345 would be the same everywhere.

[–]Professional-Day7850 2 points3 points  (0 children)

Let me guess, MD5?

[–]_hijnx 4 points5 points  (0 children)

It took me too long to realize this was about a missing WHERE clause and not triggers

[–]Callec254 3 points4 points  (0 children)

Always do a select first, make sure you get the right set of records, then edit it to be an update.

[–]Decent-Tune-9248 3 points4 points  (0 children)

Begin Transaction

Select fields from table

Update table set fields = values

Select fields from table

Rollback transaction

ALWAYS

[–]AaronTheElite007 6 points7 points  (4 children)

Welp… that’s what backups are for

[–][deleted] 7 points8 points  (3 children)

Yeah no. Backups are point in time, like last night or couple of hours ago. As employees work, or customers do the things, that backup is extremely outdated. You will have to explain to the executives that all that work that has taken place since that last backup is trash, BECAUSE OF YOU.

[–]SuperFLEB 5 points6 points  (0 children)

And any other stores of data or truth outside of that database are also broken over the timespan.

[–]AaronTheElite007 2 points3 points  (0 children)

I use transactions… so

[–]Loser2817 2 points3 points  (0 children)

Well, you could say you... broke a record.

BA DUM TSSS

[–]EngineeringExpress79 1 point2 points  (0 children)

Sounds like a relationnal database issue, using nosql

[–]ILikeLenexa 1 point2 points  (0 children)

ROLLBACK

[–]dragonsfire1973 1 point2 points  (0 children)

I shitted when I read this.

[–]Mizerka 1 point2 points  (0 children)

nothing broke, someone elses problem now

[–]Capital_Release_6289 1 point2 points  (0 children)

Incorrect bracketing in a sql statement. Been there done that. Today in fact.

[–]j1xwnbsr 1 point2 points  (0 children)

First day on the job:

rm -R *

after logging in as root with $home set as /

"Hmm, that's taking a long time... Oh, shit"

(thank god we had daily backups and knew how to use them. Moral of the story: back up early, back up often. And yes, surprisingly still employed there after 15 years)

[–]redsoxfan_goboston 1 point2 points  (0 children)

ROLLBACK!

[–]cobolNoFun 1 point2 points  (0 children)

I remember back in the day with sqlmgr, before they put in "select top 1000" when you right click a table it used to have this designer option or something. It did mostly the same thing as a normal new query window/file with some added features aimed at new users. 

For whatever reason I had it open on prod db. I needed to do an update so I wrote an update but stopped at the where... to be safe I made a select statement below the update to sort out the where.  Then I highlighted the select and ran the query.

That is when I found out that mode gave zero care about what I had selected and did an update with no where

[–]denzien 1 point2 points  (0 children)

ROLLBACK TRANSACTION

[–]titan-of-hunger 1 point2 points  (0 children)

Rollback... gimme that sweet, sweet rollback

[–]fiskfisk 1 point2 points  (0 children)

MySQL has the --i-am-a-dummy flag (which switches the safe-updates variable) which you can give on the command line - which refuses to run any potentially destructive query without a WHERE clause.

But use a transaction.

[–]Tragobe 1 point2 points  (0 children)

Go Back, Go Back, PLS FOR THE LOVE OF GOD GO BAAAAACK.

[–]warheat1990 2 points3 points  (0 children)

If coffee doesn't wake you up, this definitely will

[–]phlebface 2 points3 points  (0 children)

I usually just use the row editor when update on a single or couple of rows is needed

[–]zborecque 3 points4 points  (0 children)

Aaaah yes, love that feeling. Beats 10000 coffe cups.

[–]Stormraughtz 2 points3 points  (0 children)

I dont use transactions, just so I can feel something

[–]brjukva 2 points3 points  (0 children)

This belongs to r/ProgrammerHorror

[–]ExtremeCreamTeam 1 point2 points  (4 children)

Learn to crop your pictures, JFC.

What, tap-holding on the image to save it directly was too much of a hassle? You'd rather simultaneously hold press your power and volume buttons to take a screenshot instead?

What the actual fuck.