You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`SELECT Id FROM Users` against a schema declaring `id`/`users` was
reported as missing. SQL dialects vary on case-sensitivity (Postgres
folds to lower, ANSI to upper, BigQuery is strict, etc.) and the
case mismatch produces noisy false positives, so default to ASCII
case-insensitive comparisons throughout.
Implementation:
- schema/sql introduces a `lc()` helper and case-folds every name it
inserts into the `tables` map (CREATE TABLE, CREATE VIEW, CTAS,
ALTER TABLE add/drop/rename column, qualified twins, the bare key).
- Lookup sites case-fold their input before consulting the map:
asserts::is_relation_in_schema, table_ref::resolve_table_columns,
column_in_relation, and INSERT/UPDATE column-list checks.
- For the borrowed-`&str` extras map (CTE / derived-table aliases
tied to AST lifetimes), case-insensitive lookups via three small
helpers in asserts: extras_contains, extras_get, set_contains_ci.
- resolve_qualified now compares `rel.qualifier()` to the user's
qualifier with `eq_ignore_ascii_case`.
Error messages preserve the user's original casing — `Column \`BOGUS\`
not found in table \`users\`` — only matching is folded.
Quoted-vs-unquoted distinction (`"Id"` vs `id` in Postgres) is not
modeled; sqlshield treats both as the same identifier. Per-dialect
folding rules can layer on top later.
Schema module's `sql` is now `pub(crate)` so the `lc` helper can be
imported from validation. Otherwise unchanged.
8 tests cover lower-vs-upper schemas, mixed-case qualifiers, CTE
references, ALTER TABLE, schema-qualified tables, INSERT target
column lists, and a confirmatory test that genuinely missing columns
still error (with the original casing in the message).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments