walker: flag LIKE on a numeric column (ADR-0027 Amendment 1)

LIKE is a text-pattern match; against a numeric column (int,
real, decimal, serial) it runs but is almost never intended.
predicate_warnings now emits a WARNING for it, spanned at the
target column. New Type::is_numeric; catalog key
diagnostic.like_numeric; ADR-0027 gains "Amendment 1" and the
adr/README index line is updated per the index-upkeep rule.

bool and the text-/blob-backed types are deliberately not
flagged — see the amendment for the rationale.

3 walker tests (int, decimal NOT LIKE, text-column clean).
1108 passing, clippy clean.
This commit is contained in:
claude@clouddev1
2026-05-19 09:28:43 +00:00
parent 3912fb5a9b
commit 437b2f2e91
6 changed files with 139 additions and 5 deletions
+1
View File
@@ -39,6 +39,7 @@
pub const KEYS_AND_PLACEHOLDERS: &[(&str, &[&str])] = &[
// ---- Pre-submit diagnostics (ADR-0027) ----
("diagnostic.eq_null", &[]),
("diagnostic.like_numeric", &["column", "type"]),
("diagnostic.type_mismatch", &["column", "type"]),
("diagnostic.unknown_column", &["name", "table"]),
("diagnostic.unknown_table", &["name"]),
+2
View File
@@ -469,6 +469,8 @@ diagnostic:
# runs, but the comparison is very likely not intended.
type_mismatch: "`{column}` is {type} — this comparison uses a value of a different type"
eq_null: "`= NULL` is never true — use `IS NULL` or `IS NOT NULL`"
# ADR-0027 Amendment 1: LIKE is a text-pattern match.
like_numeric: "`{column}` is {type} — `LIKE` is a text-pattern match, not a {type} comparison"
# ---- Project lifecycle event notes -----------------------------------
project: