What it does wrong
Expression-derived CTE output columns don't surface the real column read inside the expression.
;WITH OrderTotals AS (
SELECT CustomerId, SUM(Amount) AS 'Total' FROM dbo.Orders GROUP BY CustomerId
)
SELECT OT.[Total] FROM OrderTotals OT
'Total' is a computed expression (SUM(Amount)), not a passthrough of a real dbo.Orders column — there is no single source column to bind the name Total to, and SPXray correctly refuses to invent a physical column called Total on dbo.Orders (never-invent holds, this part already passes). What it does not yet do is look inside the expression and note that Amount is a real column being read.
Why it matters
A migration report under-counts which columns a procedure actually touches whenever they're wrapped in an aggregate or expression — Amount genuinely is read from dbo.Orders, but the report won't say so.
Test
Pinned as a strict-xfail: tests/test_known_limitations.py::test_KL5_expression_derived_cte_output_not_resolved.
Why this needs the AST backend
Extracting the operand out of SUM(Amount) (or CASE WHEN x THEN y END, or any arbitrary expression) needs real expression parsing, not a simple AS-binding regex. Part of the planned v1.2 AST backend (see README roadmap).
What it does wrong
Expression-derived CTE output columns don't surface the real column read inside the expression.
'Total'is a computed expression (SUM(Amount)), not a passthrough of a realdbo.Orderscolumn — there is no single source column to bind the nameTotalto, and SPXray correctly refuses to invent a physical column calledTotalondbo.Orders(never-invent holds, this part already passes). What it does not yet do is look inside the expression and note thatAmountis a real column being read.Why it matters
A migration report under-counts which columns a procedure actually touches whenever they're wrapped in an aggregate or expression —
Amountgenuinely is read fromdbo.Orders, but the report won't say so.Test
Pinned as a strict-xfail:
tests/test_known_limitations.py::test_KL5_expression_derived_cte_output_not_resolved.Why this needs the AST backend
Extracting the operand out of
SUM(Amount)(orCASE WHEN x THEN y END, or any arbitrary expression) needs real expression parsing, not a simpleAS-binding regex. Part of the planned v1.2 AST backend (see README roadmap).