Open david-bouyssie opened 3 years ago
Do it like this:
val q1 = quote {
query[Person].filter(p => liftQuery(Set(1, 2)).contains(p.id)).map(_.id)
}
val q2 = quote {
query[Address].filter(a => q1.filter(id => id == a.fk).nonEmpty)
}
run(q2)
// SELECT a.fk, a.street FROM Address a WHERE EXISTS (SELECT p.id FROM Person p WHERE p.id IN (?) AND p.id = a.fk)
Also see my response here: https://github.com/zio/zio-quill/issues/1792#issuecomment-1212707398.
I either need to write a stateless-transform to get this kind of thing to work or remove/deprecate liftQuery(list).contains(column)
in favor of column.inSet(list)
. I strongly prefer the latter but let me know what you think.
Also, I'm making a Twitter poll on this issue to get a sense of where people are at. Everyone interested please have a look here: https://twitter.com/deusaquilus/status/1557949121612357634
Version: "io.getquill" %% "quill-jdbc" % "3.6.1" Scala Version: 2.11.12 Module: quill-jdbc Database: postgres 9.x
Expected behavior
Nested contains should work.
Actual behavior
Exception is thrown
Steps to reproduce the behavior
Note: I didn't use this exact example but it is very similar. I put this example because it is aligned with the documentation.