Skip to content

test(sqlite): add regression test for ORDER BY + LIMIT nullability (#4147)#4223

Open
barry3406 wants to merge 1 commit intolaunchbadge:mainfrom
barry3406:fix/sqlite-nullable-order-by
Open

test(sqlite): add regression test for ORDER BY + LIMIT nullability (#4147)#4223
barry3406 wants to merge 1 commit intolaunchbadge:mainfrom
barry3406:fix/sqlite-nullable-order-by

Conversation

@barry3406
Copy link
Copy Markdown
Contributor

Adds a regression test for #4147query_as! incorrectly inferred TEXT NOT NULL as nullable when the query included ORDER BY ... LIMIT.

The root cause was that ORDER BY + LIMIT routes data through an ephemeral sorter table, and the old explain analysis lost NOT NULL constraints through the round-trip. This is already fixed on main (the 0.9 explain rewrite handles it correctly), but there was no test covering this specific combination.

The new test verifies:

  • NOT NULL columns stay NOT NULL with ORDER BY + LIMIT
  • Multiple NOT NULL columns preserve constraints with ORDER BY DESC + large LIMIT
  • Nullable columns remain nullable (no false negatives)

All 30 describe tests pass.

Covers the scenario from launchbadge#4147 where ORDER BY + LIMIT routes data
through an ephemeral sorter table. Verifies NOT NULL columns keep
their constraint, and nullable columns stay nullable.

This already passes on main (the 0.9 explain rewrite fixed it),
but there was no test guarding against regression.
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