I'm using scalaquery to connect to both oracle and postgres servers. This behaviour is occuring for both Oracle and Postgres, but it's only valid (and still incorrect) SQL in Postgres.
At some point, I'm running a query in scalaquery of the form:
row.foo.bind == parameter.foo || row.foo inSetBind parameter.foo.children
Parameter is a trait, which is known to have a foo in it.
The problem here is that out of the ~100 queries run, scala-query only generates the correct SQL once, of the form
...
WHERE row.foo = ? or row.foo in (?, ?, ?, ?, ?)
...
Most of the time it instead generates
...
WHERE row.foo = ? or false
...
Why is this happening inconsistently, is it a bug (I assume it is), and how do I work around it?
It turns out that the query was looking at an empty set, because parameter.foo had no childen in most cases.
Given that WHERE row.foo IN ()
is not valid SQL, it was instead written out as false
.
This still leaves the issue of false
being generated despite the code being targeted at oracle DB, but the root cause has now been cleared up.