Closed
Description
Not sure if it's by design or a bug but...
Trying to run db.selectFrom('person').selectAll().where('id', 'in', [])
causes an invalid SQL (see image below👇 the ()
part is invalid).
Now obviously, this query doesn't make a lot of sense, and you can simply assume there would be 0 rows returned, but IMO ot. makes sense when in the TypeScript context, and also SQL generating library that creates an invalid SQL is a bit weird. The ways I think we can overcome this "issue" really depends on the philosophy Kysely is based on:
- Leave it as is (Although I would suggest updating the docs to explain this non-trivial case)
- Throwing a runtime error
- replacing it with some sort of false statement (like
IN (null)
which should be equivalent)
Let me know what you guys think...