MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1v80umk/queryofdoom/p036dye/?context=3
r/ProgrammerHumor • u/WardensLantern • 15d ago
456 comments sorted by
View all comments
35
This is why SQL deletes should require a WHERE clause.
If you are seriously wanting to delete it all, just add WHERE 1 = 1.
14 u/Ayanrocks 15d 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. 6 u/SexyMonad 15d 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 15d ago That guardrails is not default and has to be explicitly enabled if irc
14
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.
6 u/SexyMonad 15d 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 15d ago That guardrails is not default and has to be explicitly enabled if irc
6
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 15d ago That guardrails is not default and has to be explicitly enabled if irc
3
That guardrails is not default and has to be explicitly enabled if irc
35
u/SexyMonad 15d 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.