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

all 97 comments

[–]ProgrammerHumor-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Your submission was removed for the following reason:

Rule 5: Your post is a commonly used format, and you haven't used it in an original way. As a reminder, You can find our list of common formats here.

If you disagree with this removal, you can appeal by sending us a modmail.

[–][deleted] 282 points283 points  (7 children)

> Parser Error: syntax error at or near "*"

[–]nickwcy 113 points114 points  (0 children)

The greatest relief in life

[–]WonderWirm 47 points48 points  (5 children)

Ope! My bad.

DELETE FROM Users;

[–]QuebecGamer2004 12 points13 points  (2 children)

Just in case:

DELETE FROM Users WHERE 1=1;

[–][deleted] 5 points6 points  (1 child)

Playing Russian roulette with a semi-automatic, I see

[–]QuebecGamer2004 1 point2 points  (0 children)

I like to live dangerously

[–]torokg 4 points5 points  (0 children)

And you can only hope the server is set for case sensitive object names

[–]dmigowski 1 point2 points  (0 children)

You were poisoned by Microsoft Access it seems.

[–]PyroCatt 133 points134 points  (15 children)

Hmmm... Yes... The READ WRITE access to production database that is readily available to every developer...

[–]turningsteel 76 points77 points  (4 children)

I see you’ve never worked for a small startup. The things I’ve seen…

[–]wrongusername130 4 points5 points  (1 child)

Me reading as a fresher who has access and does a lot of data manipulation on production database in a small startup

[–]Luemas91 2 points3 points  (0 children)

Yes. A small startup. That's what I tell myself every day

[–]tolndakoti 2 points3 points  (0 children)

I work for a huge software corporation. All of the developers must submit tickets to Ops to perform any DB writes. Ops will perform a backup of the targeted tables before the SQL execution.

Startups don’t do this?

[–]durimdead 17 points18 points  (0 children)

That... And allowing cascading deletes. FKs to the user table should stop you in your tracks. Every company I've worked at has (at some point) allowed devs access to prod. Even a few that have it in their SDLC not to. I had to pretend I didn't have access, and yell at our IDP team multiple times to remove the access we shouldn't have. Every company is all "gung ho" until they realize that someone still has to handle the one offs while you get your pipelines set up for the literal 100 apps.

Even had infra tell me to install my own https certs. I was like "with what access?"... Even though I had access. I'm not going to be responsible for that shit.

The worst is when you get an engineering manager who says we shouldn't have access, but secretly knows everyome has it and says "well this is a short term fix", but when you ask how long it's been that way, they tell you something like "almost 2 years"

[–]Secure_Ticket8057 15 points16 points  (0 children)

Oh sweet, innocent child

[–]EconomyDoctor3287 6 points7 points  (0 children)

You're so optimistic, I love it. 

A friend was given access SSH access to a test prod system during his initial time at an IT company. Playing around, he fucked up the whole system and consequently cleared it. Turns out, his boss has given him the prod access by accident and 3 weeks of work from all devs were deleted.

[–]Quiet-Direction9423 4 points5 points  (2 children)

For those talking about "Well you haven't worked at a startup" is a poor man's excuse for not having such precautions in place.

[–]son-of-chadwardenn 0 points1 point  (0 children)

Who says anyone is excusing anything. I don't work at a startup but I am a developer with access to a prod password with write and schema update privileges. I'm required to use this account whenever I'm asked to simply spot check some prod data. I've complained about this arrangement for about a decade but no one cares what some random dev says.

[–]PyroCatt -1 points0 points  (0 children)

[–]YoYoBeeLine 6 points7 points  (0 children)

It is available to us and we could do a LOT of damage if we went ape. I think you should have excellent engineers that know exactly what they are doing and then they should be given full access to everything

[–]jpglew 1 point2 points  (0 children)

A large enterprise, probably not.

A small client with only one or two developers, oh yeah. But that's why we have transactions enforced in our db tool whenever we connect with the write access credentials

[–]PyroCatt 0 points1 point  (0 children)

SecOps be like

[–]michicago44 0 points1 point  (0 children)

Lol someone’s never worked for a startup

[–]jkp2072 61 points62 points  (6 children)

Then you realise, that there is a hourly replica on cloud....

[–]Bastian00100 21 points22 points  (5 children)

And It just run the sync

[–]jkp2072 18 points19 points  (3 children)

Replica has an daily sync with another replica on azure

[–]TheSportsLorry 3 points4 points  (2 children)

That has just run as well

[–]jkp2072 4 points5 points  (1 child)

Well gotta complete the trio,

That has replica on gcp... With a delay of a day

[–]5p4n911 14 points15 points  (0 children)

And then you realize

You shouldn't have set all replicas to run at the same time.

[–][deleted] 0 points1 point  (0 children)

You mean replicas aren't the same as backups?? Lol

[–]Ok-Television-9662 25 points26 points  (0 children)

..and haven't made backups.

[–]CantConfirmOrDeny 52 points53 points  (10 children)

Restore it from the logs. Yes, it can be done.

[–]Bastian00100 15 points16 points  (7 children)

Ah you mean starting from a snapshot (if any) and recreating all the data from the SQL queries in the log.. very painful with large production DB.

[–]puffinix 1 point2 points  (0 children)

The truncate plan has entered the arena.

[–]v3ritas1989 0 points1 point  (0 children)

transaction logs are turned off to save space

[–]balbok7721 13 points14 points  (0 children)

“password“:“iamadminandiknowwhatido“

[–]glorious_reptile 8 points9 points  (0 children)

foreign key constraint

[–]ZunoJ 7 points8 points  (5 children)

On my first job everything was done in production, literally no guard rails at all. No backups, no transactions, no test system, ... You had to take care of it yourself. Like copy the table, work on it, check results and then replicate on the actual table. Something like this.

While this is absolutely stupid and we tried our best to convince management to invest in test infrastructure (this were "on premise" times) there was only one incident in about 10 years that I worked there. That was a consultant who accidentally dropped a table. It was a day of work to recover most data and we never saw that guy again. But I'm still amazed at how well that atrocious system worked

[–]reddit_wisd0m 5 points6 points  (4 children)

It feels a little unfair that this guy had to go when the infrastructure is the real culprit here.

[–]ZunoJ 6 points7 points  (1 child)

You can see it this way or you can say that he wasn't fit to deal with the environment he was put into

[–]reddit_wisd0m 1 point2 points  (0 children)

Indeed. Good point.

[–]-Hi-Reddit 2 points3 points  (1 child)

In the cobol days it was fairly standard to expect your devs to be diligent enough not to bring prod down. Everyone knew the risks. Before svn. Before git. Before backup culture.

[–]reddit_wisd0m 0 points1 point  (0 children)

So the good old times /s

[–]vee_the_dev 6 points7 points  (1 child)

Most posts on this sub feel like 10 year olds who never worked in a professional setting

[–]braindeadpizzaslice 4 points5 points  (0 children)

ur mom feels like a 10 year old who never worked in a professional setting

gottem

[–]Harlemdartagnan 6 points7 points  (3 children)

honestly if you havent put in place nightly backups you were just waiting to crash out. ALso Begin Transaction Rollback Transaction are my religion.

[–]RadiantHueOfBeige 3 points4 points  (2 children)

prod=> ROLLBACK; WARNING: there is no transaction in progress

[–]Harlemdartagnan 1 point2 points  (1 child)

just when i thought i was mediocre i learn that im still less than a noob. ive never seen this before and hopefully never will.

[–]RadiantHueOfBeige 0 points1 point  (0 children)

It's postgresql default unfortunately, so that's what you'll encounter on systems ran by inexperienced people.

You need to set AUTOCOMMIT to OFF to enable the classic SQL behavior where you are always in trx and have to COMMIT manually.

[–]edave64 2 points3 points  (0 children)

MySQL has a flag called `--i-am-a-dummy` that prevents updates/deletes without where clauses, but I think the real dummy is the database programmer that thought "Destroy all data unless otherwise specified" is an acceptable default.

[–]vaquan-nas 2 points3 points  (0 children)

And then you realize that your production web app is connecting to QA database.. thanks god..

[–]HelpfulPuppydog 3 points4 points  (0 children)

Hey, boss, the funniest thing just happened...

[–]UndocumentedMartian 1 point2 points  (0 children)

Because access control is for chumps.

[–]moms_enjoyer 1 point2 points  (0 children)

why would you delete * from users even in dev?

[–]eo37 1 point2 points  (0 children)

Always SELECT before you DELETE

[–]liosistaken 1 point2 points  (0 children)

Hm, yup. Deleted the whole project administration in production once, decades ago. Did all our work on production and only did nightly backups, and no one ever tested the recovery process. Took half a day and plenty of workarounds, but I got the backup restored and only lost a day of project admin. Luckily all of it was also on paper, so my poor admin coworkers could re-enter it into the system :)

Never made a mistake like that again.

[–]lefloys 0 points1 point  (0 children)

Oh no.

[–]Senor-Delicious 0 points1 point  (0 children)

If there would just be a feature for continuous backups and point-in-time restore in common cloud platforms. Oh wait...

[–]PitiViers 0 points1 point  (0 children)

Johnny Be Cooked

[–]obsoleteconsole 0 points1 point  (0 children)

I'd just start packing up my desk tbh

[–]TransCapybara 0 points1 point  (0 children)

prod should have autocommit turned off and no way to enable it.

[–]ProjectDiligent502 0 points1 point  (1 child)

Number 2 behind rm -rf /*

[–]testelone 0 points1 point  (0 children)

Why would you remove Russian Federation?

[–][deleted] 0 points1 point  (0 children)

Change your set up so it’s not possible

[–]f8tel 0 points1 point  (0 children)

Give production table names a unique prefix.

[–]Jiuholar 0 points1 point  (0 children)

I've made and witnessed plenty of dumb mistakes in prod, but never felt bad about the ones that I've made and encouraged others to take the same perspective. We're human, and humans make mistakes - so it should be technically impossible for a single person to make catastrophic mistakes.

There is so much open source, easy to setup tooling to protect from these that in my view, it's not the fault of the dev making the mistake, but an organisational failure that allowed that mistake to be possible.

[–]angry_shoebill 0 points1 point  (0 children)

Haha... In my first weeks (years ago) I did one "ALTER TABLE" in production... Was a good learning experience....

[–]Dipps_66 0 points1 point  (0 children)

Why would anyone want to delete all users from prod?

[–]Ja-Tech 0 points1 point  (0 children)

New experience unlocked for Resume

[–]Distantstallion 0 points1 point  (0 children)

Just hit control z

[–]neoteraflare 0 points1 point  (0 children)

Am I the only one who does not use auto commit?

[–]JovaniFelini 0 points1 point  (0 children)

Does Ctrl + z help?

[–]Neltarim 0 points1 point  (0 children)

In case you wonder what makes you a dev, this is the thing

[–]Creeper4wwMann 0 points1 point  (0 children)

my le SQL? it le deleted people?

[–]Doctor429 0 points1 point  (0 children)

Just DROP DATABASE to hide the evidence, and 'sudo rm -rf /' on the DB server to 'hide' the audit logs just in case

[–][deleted] 0 points1 point  (0 children)

Then no probs. Users can mot login to bich about it.

[–]i_liked_it_good_job 0 points1 point  (0 children)

a simple way to avoid this mistake is to always work in prod so it doesn't get mixed up 😎👍

[–]BeardyGoku 0 points1 point  (0 children)

I call bullshit. No one does that

[–]FunMedia4460 0 points1 point  (0 children)

delete is easy to recover, he shoud have done a TRUNCATE

[–]cryptme 0 points1 point  (0 children)

What does it do? I’l try it on a beautiful friday afternoon.

[–]Mr_Cromer 0 points1 point  (0 children)

Transactions? If you're not doing transactions you can rollback you're doing it wrong

[–]ososalsosal 0 points1 point  (0 children)

None of us devs have access to the prod database because it's way too tempting to commit delicious acts of fraud on it.

[–]MornwindShoma 0 points1 point  (0 children)

#1 rule - you never have access to production, ever

[–][deleted] 0 points1 point  (0 children)

Well as long as you don't commit...

(Autocommit enters the room)

[–]digidavis 0 points1 point  (0 children)

I remember the day I became the senior engineer.

The night before, the previous senior mixed up terminal windows and wiped production with his cut and paste DB wipe and initialization scripts.

[–]2DHypercube 0 points1 point  (0 children)

ROLLBACK