Version: 4.6.0Module: quill-jdbc-zioDatabase: postgresScala version: 3.3.0, also present in Scala 2
Incorrectly generated query for Flat Joins with outer filter
object QuillContext extends PostgresZioJdbcContext(NamingStrategy(SnakeCase, PostgresEscape))
import QuillContext._
case class File(fileKey: Long, fileCategoryKey: Int)
case class FileCategory(fileCategoryKey: Int)
run {
(for {
f <- query[File]
fc <- query[FileCategory].join(fc => fc.fileCategoryKey == f.fileCategoryKey)
} yield (f.fileKey, fc.fileCategoryKey))
.filter(_._1 == 1) // FIXME - this is causing the problem
}
Expected sql result
SELECT f."file_key" AS _1, fc."file_category_key" AS _2
FROM "file" f
INNER JOIN "file_category" fc ON fc."file_category_key" = f."file_category_key"
WHERE fc."file_category_key" = f."file_category_key" AND f."file_key" = 1;
Actual sql result
See WHERE fc."_1" = 1; should be fc."file_category_key" ...
SELECT f."file_key" AS _1, fc."file_category_key" AS _2
FROM "file" f
INNER JOIN "file_category" fc ON fc."file_category_key" = f."file_category_key"
WHERE fc."_1" = 1;
Version:
4.6.0
Module:quill-jdbc-zio
Database:postgres
Scala version:3.3.0
, also present in Scala 2Incorrectly generated query for Flat Joins with outer filter
Expected sql result
Actual sql result
See
WHERE fc."_1" = 1;
should befc."file_category_key" ...
Steps to reproduce the behavior
https://scastie.scala-lang.org/FdasL5taSv63PcXy6um9EA
Workaround - correctly working for other join variations:
@getquill/maintainers