Unknown column ... in 'where clause' in nested exists
Environment:
scala-2.9.2
squeryl 0.9.5-3 or 0.9.5-2
To reproduce:
Add this test to test/schooldb/SchoolDb.scala (I added it just after VeryVeryNestedExists, which is ignored because of a similar -- possibly the same -- problem):
scala-2.9.2
squeryl 0.9.5-3 or 0.9.5-2
To reproduce:
Add this test to test/schooldb/SchoolDb.scala (I added it just after VeryVeryNestedExists, which is ignored because of a similar -- possibly the same -- problem):
test("selectFromExists"){
val testInstance = sharedTestInstance; import testInstance._
val qStudents = from(students) ((s) => select(s))
val studentsWithAnAddress =
from(qStudents)(s =>
where(exists(from(addresses)((a) =>
where(s.addressId === a.id) select(a))))
select(s)
)
val qAStudentIfHeHasAnAddress =
from(studentsWithAnAddress)(s =>
where(s.name === "Xiao")
select(s)
)
val res = for (s <- qAStudentIfHeHasAnAddress) yield s.name
val expected = List("Xiao")
assert(expected == res, "expected :\n " + expected + "\ngot : \n " + res)
passed('selectFromExists)
}
Leave a comment
on 2012-10-07 18:59 *
By maxime.levesque
This was fixed in the master branch, I added your test case
https://github.com/max-l/Squeryl/commit/e1256e7de7c79ef45ab2328746856e0c7a6272ab
and it runs fine.
I can do a backport on the 0.9.5 branch if you want.
https://github.com/max-l/Squeryl/commit/e1256e7de7c79ef45ab2328746856e0c7a6272ab
and it runs fine.
I can do a backport on the 0.9.5 branch if you want.
on 2012-10-21 15:37 *
By jordi.salvat.i.alabart
Of course it would be welcome, but it's not strictly necessary, since in most (all?) cases it can be worked around work around it by using "id in select id from ..." queries. These are uglier in most cases, but hey.