rea/tests/boundary/sqlite
Dragolone 94072364c7
fix(sqlite): keep triggers whose declaration spells the table in another case (#2807)
* fix(sqlite): keep triggers whose declaration spells the table in another case

SQLite stores a trigger's target in sqlite_schema.tbl_name exactly as
written in CREATE TRIGGER and resolves it by ASCII case folding, while an
index stores the table's own name. The selected_table scope filtered
tbl_name with COLLATE BINARY, so a trigger declared ON users for table
Users was omitted while the schema still reported complete. Match
dependents with COLLATE NOCASE, and report each trigger's table as the
stored table or view name so the selected-table contract still holds.

* fix(sqlite): refuse an inexact table before the case-folded schema scan

With the NOCASE expansion, a selection such as users for table Users
expanded the stored table's declarations before readRows reported the
missing exact name, so large trigger definitions could surface as an
output-limit failure instead of the selection error. Check the exact
table name against PRAGMA table_list first and share the selection
failure with readRows.

* fix(sqlite): fold dependent names only for a row-selectable table

An exact view, virtual or possible shadow table passed the exact-name
guard, so the NOCASE scan could still expand a differently cased trigger
past the reply budget before readRows refused the selection. Fold case
only when the selection is an ordinary table that is not a possible
shadow table, and keep the exact filter otherwise so every refused
selection fails as it did before the case-folding change.

* fix(sqlite): resolve trigger tables without folding unrelated names

The stored-name lookup case-folded every PRAGMA table_list name up front,
so a selected-table inspection of a tiny table paid for large unrelated
identifiers. A selected-table scan only returns the selected table's
dependents, so report the selected name directly; other scopes use an
exact stored name when one matches and fold the stored names once, only
when a trigger spells its target differently.

* perf(sqlite): fold each table name once when matching shadow parents

The extracted shadow-parent helper folded the table name inside the find
callback, once per unresolved virtual table, and the selected table was
checked both before and during the schema scan. Fold the name once per
call as before, and reuse the selected table's result in the scan.
2026-10-13 22:37:47 +08:00
..
sqliteDatabaseCleanup.test.ts feat(sqlite): inspect offline snapshots with selective evidence (#2271) 2026-10-12 18:33:23 +00:00
sqliteDatabaseDescriptorCleanup.test.ts feat(sqlite): inspect offline snapshots with selective evidence (#2271) 2026-10-12 18:33:23 +00:00
sqliteDatabaseInspection.test.ts fix(sqlite): keep triggers whose declaration spells the table in another case (#2807) 2026-10-13 22:37:47 +08:00
sqliteDatabaseProvider.test.ts fix(sqlite): classify a missing database path as an invalid value (#2775) 2026-10-13 21:48:39 +08:00
sqliteDatabaseSnapshot.test.ts feat(sqlite): inspect offline snapshots with selective evidence (#2271) 2026-10-12 18:33:23 +00:00