Expected CASE facts are assertions only.
Honest by construction
Expected CASE facts are assertions only.
compiler is source of truth \text{compiler is source of truth} compiler is source of truth
Render checked rows
The guarded CASE expression renders 4 output rows after recomputation.
checked rows = 4 \text{checked rows}=4 checked rows = 4
CASE-expression examples are tiny finite row transforms with SQL-style TRUE/FALSE/UNKNOWN logic; SQL dialect completeness, type coercion, optimizer behavior, indexing, and product claims are out of scope.
Honest by construction: base rows name score status Ada 90 active Bea 40 active Cal NULL active Dee 70 paused
CASE branch evaluation source values evaluations result resultSource 0 [Ada, 90, active] [{branch:0, truth:TRUE, chosen:yes}, {branch:1, truth:TRUE, chosen:no}] high branch 0 1 [Bea, 40, active] [{branch:0, truth:FALSE, chosen:no}, {branch:1, truth:FALSE, chosen:no}] low ELSE 2 [Cal, NULL, active] [{branch:0, truth:UNKNOWN, chosen:no}, {branch:1, truth:UNKNOWN, chosen:no}] low ELSE 3 [Dee, 70, paused] [{branch:0, truth:FALSE, chosen:no}, {branch:1, truth:TRUE, chosen:yes}] mid branch 1
CASE output rows name score status bucket Ada 90 active high Bea 40 active low Cal NULL active low Dee 70 paused mid
CASE facts fact value inputRowCount 4 branchCount 2 outputRowCount 4 firstTrueRows 2 elseRows 2 nullElseRows 0 unknownSkipped 2 rowOrder source_order
Try to tamper
Wrong expected facts, derived sidecars, duplicate aliases, missing columns, bools, floats, and invalid comparisons fail closed.
tamper rejected \text{tamper rejected} tamper rejected
Summary
The book shows exact finite CASE behavior only; product SQL behavior is outside the model.
scoped CASE model \text{scoped CASE model} scoped CASE model