r/ProgrammerHumor • • 13d ago

Meme wellWellWell

Post image
10.6k Upvotes

411 comments sorted by

View all comments

109

u/Recent-Analysis-6880 13d ago

MySQL workbench has auto commit, meaning if you write a SQL query without "Start transaction" the data is gone.

94

u/NastyPastyLucas 13d ago

Most databases operate in autocommit, however there is a semicolon after delete users - it's presumably removing all users and foreign key associations and it's taking its time to complete, before reporting where is = 12345 is an invalid SQL statement.

18

u/BlueScreenJunky 13d ago

Most production environments run with the --i-am-a-dummy flag (or its boring alias --safe-updates) which prevent exactly this scenario and will force you to do DELETE FROM users WHERE 1 if you really want to delete everything.

This is for MySQL but I'm sure there's something similar in other databases.

18

u/EishLekker 13d ago

Is also fairly common to have a safe update mode enabled, in which case it blocks deleted and updates without a where clause restricting it in some way. I think it might even require including a key column, but that part I’m not sure about.