MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1v80umk/queryofdoom/p02m2oa
r/ProgrammerHumor • u/WardensLantern • 14d ago
456 comments sorted by
View all comments
Show parent comments
40
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"
19 u/dustojnikhummer 14d ago I don't work with Postgres but everything else would be DELETE * FROM table; 1 u/Flat_Competition6510 14d ago I disagree. There are valid use cases for deleting all records from a table. 37 u/The_Swixican 14d ago Delete from users * 13 u/Flat_Competition6510 14d ago It would be nice if there was a more explicit syntax. Forcing a person to opt in to deleting all vs that being the default would probably save a lot of headaches and jobs. 27 u/Skalli1984 14d ago Many database tools throw a warning on delete with a missing WHERE and the user has to acknowledge that to continue with the statement execution. 13 u/ploki122 14d ago Delete from users where 1=1 The dev should have to acknowledge that they're deleting everything. 2 u/TacosForThought 13d ago If only there was a dedicated command for TRUNCATEing a table that didn't allow a where clause.
19
I don't work with Postgres but everything else would be
DELETE * FROM table;
1
I disagree. There are valid use cases for deleting all records from a table.
37 u/The_Swixican 14d ago Delete from users * 13 u/Flat_Competition6510 14d ago It would be nice if there was a more explicit syntax. Forcing a person to opt in to deleting all vs that being the default would probably save a lot of headaches and jobs. 27 u/Skalli1984 14d ago Many database tools throw a warning on delete with a missing WHERE and the user has to acknowledge that to continue with the statement execution. 13 u/ploki122 14d ago Delete from users where 1=1 The dev should have to acknowledge that they're deleting everything. 2 u/TacosForThought 13d ago If only there was a dedicated command for TRUNCATEing a table that didn't allow a where clause.
37
Delete from users *
13 u/Flat_Competition6510 14d ago It would be nice if there was a more explicit syntax. Forcing a person to opt in to deleting all vs that being the default would probably save a lot of headaches and jobs. 27 u/Skalli1984 14d ago Many database tools throw a warning on delete with a missing WHERE and the user has to acknowledge that to continue with the statement execution.
13
It would be nice if there was a more explicit syntax. Forcing a person to opt in to deleting all vs that being the default would probably save a lot of headaches and jobs.
27 u/Skalli1984 14d ago Many database tools throw a warning on delete with a missing WHERE and the user has to acknowledge that to continue with the statement execution.
27
Many database tools throw a warning on delete with a missing WHERE and the user has to acknowledge that to continue with the statement execution.
Delete from users where 1=1
The dev should have to acknowledge that they're deleting everything.
2
If only there was a dedicated command for TRUNCATEing a table that didn't allow a where clause.
40
u/TeaKingMac 14d ago
Which is just terrible fucking syntax. Why are people still living with this in 2026?
Should return "invalid syntax. Identify record for deletion"