In a conversation with my coworker, he mentioned he accidentally deployed a 'naked where clause' into production.
What is a 'naked where clause'?
a naked WHERE clause would refer to something that always returns true
WHERE 1 = 1
This is commonly used on something like a search form where the user can enter one or many values and rather than checking a counter to see if you need to add a WHERE clause you add a generic WHERE clause and build everything up in an AND clause. You can run into issues if you aren't checking to make sure there is at least on AND clause added.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With