Conversation
zio#3147 made top-level infix queries pass through unwrapped (TopInfixQuery). For case-class results this changes the decode contract: extractors decode positionally in field-declaration order, while the raw SQL (e.g. SELECT *) returns the table's physical column order — decoders silently read neighboring columns when the orders differ. Keep the raw passthrough for single values and tuples (column order is explicit in the same expression) and restore the wrapping query for case-class results, whose explicit projection pins the column order. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Five quill-sql-test cases still asserted the pre-fix unwrapped SQL for case-class infix results. With case-class results now re-wrapped to pin column order for positional decoding, update their expected SQL to the wrapping form the engine produces (values/tuples are unaffected): - SqlIdiomSpec "full infix query" - OracleDialectSpec "No 'AS' aliases" - InfixSpec "use set notation when interpolating liftQuery" - ExpandNestedQueriesSpec "... regular schema" + "... multi-level"
eugkhp
force-pushed
the
fix/top-infix-product-wrap
branch
from
June 19, 2026 00:40
3b4e7e2 to
71253e7
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3403.
Problem
#3147 (
c334986f, released in quill-engine 4.8.6) made top-level infix queries pass through unwrapped (TopInfixQuery). For case-class results this silently changes the decode contract: extractors decode positionally in field-declaration order, while the raw SQL — e.g.SELECT b.* FROM blocked_periods b— returns the table's physical column order (including columns appended by later ALTERs). When the orders differ, decoders read neighboring columns' values: exceptions if types/enum members mismatch, silently wrong data if they don't.Reproduction
Any table whose DDL column order differs from the case class:
The new
SqlQuerySpeccases in this PR encode the contract at the SQL level (sql"SELECT * FROM TestEntity".as[Query[TestEntity]]must stay wrapped).Fix
Raw passthrough remains for single values (one column) and tuples (column order is explicit in the same expression — the #3147 use case). Case-class results keep the wrapping query, whose explicit projection pins column order — the pre-4.8.6 behavior.
Validation
SqlQuerySpec: 92/92, including the existing Improve handling of raw-queries #3147 tuple/value passthrough tests (unchanged) and the two new case-class tests.Single-commit bisection that identified #3147 is documented in #3403.