sql-review-corrections¶
Date: 2026-09-13. Status: implemented.
Decision. Correct SQL Server bit predicates to is_current = 1. Resolve dated lookups per distinct normalised postcode/address-date pair and join back to original inputs, without an execution-dependent row number; preserve duplicates and null IDs. Test output mappings independently of the generator, including a deliberately swapped quintile/decile regression, every stored edition, selected geographies and own-record context. Clarify the preceding decisions' output contracts and guidance claims without changing postcode linkage policy, source pins or stored data values.
Reason. SQL Server requires a predicate for bit fields and does not materialise CTEs; unordered ROW_NUMBER values are not stable join keys across references. A shared production/test mapping can hide column swaps. Reviewers must distinguish documented guidance, project interpretations and native runtime verification that remains outstanding.
Evidence. Microsoft Learn: bit (Transact-SQL), CASE (Transact-SQL), WITH common_table_expression (Transact-SQL), ROW_NUMBER (Transact-SQL). tests/test_sql_sets.py exercises generated queries in DuckDB; these checks do not establish SQL Server runtime compatibility.