Skip to content

fix: let SQLite name the missing column in null_absent_columns - #1914

Merged
abrignoni merged 1 commit into
mainfrom
fix/null-absent-columns-explain
Aug 8, 2026
Merged

fix: let SQLite name the missing column in null_absent_columns#1914
abrignoni merged 1 commit into
mainfrom
fix/null-absent-columns-explain

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

Brings iLEAPP's null_absent_columns() in line with the version proved out in ALEAPP (#1077).

Why the first version needed replacing

I wrote it here first, for Core Data, and it guessed which bare words in a SQL statement were column references — with a rule that only considered names beginning with Z. That is right for iOS stores and useless anywhere else.

The consequence showed up when the helper was ported to ALEAPP: it compiled, passed lint, passed CI, and did nothing at all on the artifacts it had been added for. Only a corpus sweep caught it, because the same no such column lines were still there afterwards.

What it does now

It compiles the query with EXPLAIN and replaces whatever SQLite objects to, repeatedly, until the statement compiles. SQLite owns the syntax, so it names the missing column itself and there is nothing left to guess. Qualified and bare references are handled identically. EXPLAIN compiles without running, so it costs nothing on a large table.

NULL AS <name> aliasing is unchanged — artifacts read rows by name, and a bare NULL renames the output column.

Verification

Behaviour here is unchanged, which is the point. iLEAPP's queries name their columns with a table or alias, and both versions handled those correctly. Full profile runs across all 21 iOS corpora, compared against current main:

artifact/corpus pairs identical 296
gains 0
losses 0
error lines 1 → 1 (the same 8-byte non-plist)

Also checked the six call sites directly against their real databases: photosMetadata 284 rows on the main PhotoData library and 4 on Syndication, threeBars 97, Threema 22 — identical to before.

The baseline was captured from a separate worktree, because a full-artifact sweep was running from the main checkout at the time and would otherwise have picked up this change mid-run.

Companion PRs: DLEAPP #59, RLEAPP #399, VLEAPP #115.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

The first version guessed which bare words in a statement were column
references, using a rule from the Core Data work that only considered names
beginning with Z. That is right for iOS stores and useless elsewhere, and it
failed silently: in ALEAPP it compiled, passed CI, and did nothing at all on the
artifacts it had been added for.

It now compiles the query with EXPLAIN and replaces whatever SQLite objects to,
repeatedly, until it compiles. SQLite owns the syntax, so there is nothing left
to guess, and qualified and bare references behave the same.

Behaviour here is unchanged, which is the point: iLEAPP's queries name their
columns with a table or alias, and both versions handled those. Across all 21
iOS corpora, 296 artifact/corpus pairs identical, no gains, no losses, the same
single error line.

Proved out in ALEAPP PR #1077, where it took a 12-corpus sweep from 45 error
lines to 8.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@abrignoni
abrignoni merged commit 49647be into main Aug 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant