4 ms·
Agreed, I've long been thinking that DELETE should require a WHERE clause. If you really want to just delete everything, just do WHERE 1=1.
by magicalhippo 2y ago
Agreed, I've long been thinking that DELETE should require a WHERE clause.
If you really want to just delete everything, just do WHERE 1=1.
- buro9 2y agoUPDATEs should require a WHERE clause too. At which point we could just say all SQL should have a WHERE clause.
- jaredsohn 2y agoI think SELECTs without WHERE clauses are fine
- marcosdumay 2y agoBut requiring them is fine too. Even more on Postrges, that has booleans.
- ahoka 2y agoAnd queries should start with WHERE.
- awestroke 2y agoFROM, then WHERE, then SELECT
- hamandcheese 2y agoThis is the way.
- Jabbles 2y agoPipe Syntax In SQL https://research.google/pubs/sql-has-problems-we-can-fix-them-pipe-syntax-in-sql/ https://research.google/pubs/sql-has-problems-we-can-fix-the... https://news.ycombinator.com/item?id=41338877 https://news.ycombinator.com/item?id=41338877
- deleted 2y ago[deleted]
- yen223 2y agoIt would be nice if there was a psql option that would warn you if you're about to do any kind of update, delete or insert without doing a BEGIN; (You could always set autocommit=false, which forces you to explicitly commit or rollback every action, but that has its own baggage)
- deleted 2y ago[deleted]