Files
turso/postgres/parser
Pekka Enberg f0a1b0e6ac Merge 'core, sqlite/parser: reject LIMIT and ORDER BY on DELETE and UPDATE' from Pekka Enberg
Turso accepted DELETE/UPDATE ... LIMIT unconditionally, while a default
SQLite build only allows it with SQLITE_ENABLE_UPDATE_DELETE_LIMIT.
Worse, the support was a half-implementation: LIMIT/OFFSET executed but
ORDER BY ... LIMIT was rejected at translate time, so the upstream
wherelimit tests ran and failed spuriously instead of skipping.
Remove the order_by/limit fields from the DELETE and UPDATE AST nodes so
the parser stops consuming those clauses. The trailing token then fails
the normal end-of-statement check and produces the same `near "LIMIT":
syntax error` as stock sqlite3. Stripping the AST fields also removes
all the dead LIMIT plumbing from the translator, planner, optimizer, and
emitters.
Mark the update_delete_limit capability as unavailable in the upstream
conformance harness, and make its simplified ifcapable propagate return
codes so tests using `ifcapable !x { finish_test; return }` actually
skip. wherelimit.test and wherelimit2.test now skip themselves exactly
as they do on default sqlite3 builds.
Tests: new delete-update-limit-rejected.sqltest passes against both
tursodb and stock sqlite3 with no skip markers; parser regression test;
CLI tests rewritten to assert rejection.
Fixes #6076

Closes #8315
2026-08-11 10:41:01 +03:00
..
…
…
…
…
…