Fix computation of argv_index in best_index

The `filter` methods for extensions affected by this fix expect arguments
to be passed in a specific order. For example, `generate_series` assumes
that if the `start` argument exists, it is always passed to `filter`
first. If `start` does not exist, then `stop` is passed first — but
`stop` must never come before `start`.

Previously, this was not guaranteed: `best_index` relied on constraints
being passed in the order matching `filter`'s expectations.
This commit is contained in:
Piotr Rzysko
2025-07-31 09:18:55 +02:00
parent c465ce6e7b
commit 6a4cf02a90
4 changed files with 394 additions and 55 deletions

View File

@@ -320,6 +320,10 @@ def _test_series(limbo: TestTursoShell):
"SELECT * FROM generate_series WHERE start = 1 AND stop = 10;",
lambda res: res == "1\n2\n3\n4\n5\n6\n7\n8\n9\n10",
)
limbo.run_test_fn(
"SELECT * FROM generate_series WHERE stop = 10 AND start = 1;",
lambda res: res == "1\n2\n3\n4\n5\n6\n7\n8\n9\n10",
)
limbo.run_test_fn(
"SELECT * FROM generate_series(1, 10) WHERE value < 5;",
lambda res: res == "1\n2\n3\n4",