Fix panic on CREATE VIRTUAL TABLE IF NOT EXISTS by halting VM properly

Fixes a runtime panic caused by failing to halt the virtual machine
after executing CREATE VIRTUAL TABLE IF NOT EXISTS.

Previously resulted in:
thread 'main' panicked at core/vdbe/mod.rs:408:52:
index out of bounds: the len is 3 but the index is 3
This commit is contained in:
Piotr Rzysko 2025-05-11 21:19:26 +02:00
parent fdffbc9534
commit d5984445a9
2 changed files with 12 additions and 0 deletions

View file

@ -593,6 +593,11 @@ def test_create_virtual_table():
lambda res: "× Parse error: Table t1 already exists" == res,
"create virtual table fails if virtual table with the same name already exists",
)
limbo.run_test_fn(
"CREATE VIRTUAL TABLE IF NOT EXISTS t1 USING kv_store;",
null,
"create virtual table with IF NOT EXISTS succeeds",
)
limbo.debug_print("CREATE TABLE t2 (col INTEGER);")
limbo.run_test_fn(
@ -600,6 +605,11 @@ def test_create_virtual_table():
lambda res: "× Parse error: Table t2 already exists" == res,
"create virtual table fails if regular table with the same name already exists",
)
limbo.run_test_fn(
"CREATE VIRTUAL TABLE IF NOT EXISTS t2 USING kv_store;",
null,
"create virtual table with IF NOT EXISTS succeeds",
)
limbo.debug_print("CREATE VIRTUAL TABLE t3 USING kv_store;")
limbo.run_test_fn(