Fork me on GitHub
#honeysql
<
2022-08-07
>
namenu07:08:18

I'm using honeysql with mysql. every now and then I get fatal runtime errors caused by misused 'where in' form. the arguments passed into in must not empty, but in reality, this check easily be omitted. Whenever this happens, I terribly miss the non-empty type. I wonder how others handle this case?

👍 3
namenu08:08:43

idea: what if we replace where-in with logical false when the argument is empty?

seancorfield18:08:30

Since it's impossible to know whether this is a programming error or intended to be either a logical false or a logical true, there's :checking so you can get an exception from HoneySQL itself.

namenu02:08:08

but logically A ⊂ ∅ is always , so isn't that irrelevant to the programmer's intent?

seancorfield03:08:06

I can construct a SQL statement with a join over an IN condition that will likely give you an "unexpected" result if IN () produced false -- so you're much safer getting an exception.