You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current behavior of column pruning removes a column from all queries and subqueries where it is not used. For example:
caseclassPerson(id:Int, name:String, other:Int)
run { query[Person].map(p => (p.id, p.name, p.other)).map(t => (t._1, t._2)) }
// SELECT p.id, p.name FROM person p
Note that this behavior happens even with nested queries:
run { query[Person].map(p => (p.id, p.name, p.other)).nested.map(t => (t._1, t._2)) }
// SELECT p.id, p.name FROM (SELECT x.id, x.name FROM person x) AS p
The same behavior occurs with infixes:
run { query[Person].map(p => (p.id, p.name, infix"foobar${p.other}")).map(t => (t._1, t._2)) }
// SELECT p.id, p.name FROM person p
While this kind of behavior should be fine for pure infixes, infixes such as rank and distinct on totally break by this behavior:
run { query[Person].map(p => (infix"DISTINCT ON (${p.other})".as[Int], p.name, p.id)).map(t => (t._2, t._3)) }
// SELECT p.name, p.id FROM person p
In general, it seems that for impure-infixes, the assumption that the infix clause can be pruned with the containing column is incorrect. The SQL normalization needs to be changed accordingly.
@getquill/maintainers
The text was updated successfully, but these errors were encountered:
Version: (e.g.
3.4.4-SNAPSHOT
)Module: (e.g.
quill-sql
)Database: (e.g.
ALL
)The current behavior of column pruning removes a column from all queries and subqueries where it is not used. For example:
Note that this behavior happens even with nested queries:
The same behavior occurs with infixes:
While this kind of behavior should be fine for pure infixes, infixes such as
rank
anddistinct on
totally break by this behavior:In general, it seems that for impure-infixes, the assumption that the infix clause can be pruned with the containing column is incorrect. The SQL normalization needs to be changed accordingly.
@getquill/maintainers
The text was updated successfully, but these errors were encountered: