mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-23 09:54:26 +01:00
Merge 'core: Fix Destroy opcode root page handling' from Pekka Enberg
The `p1` register points to the root page, not to a cursor. Fixes #1136 Closes #1162
This commit is contained in:
@@ -3110,11 +3110,8 @@ impl Program {
|
||||
if *is_temp == 1 {
|
||||
todo!("temp databases not implemented yet.");
|
||||
}
|
||||
{
|
||||
let mut cursor = state.get_cursor(*root);
|
||||
let cursor = cursor.as_btree_mut();
|
||||
cursor.btree_destroy()?;
|
||||
}
|
||||
let mut cursor = BTreeCursor::new(None, pager.clone(), *root);
|
||||
cursor.btree_destroy()?;
|
||||
state.pc += 1;
|
||||
}
|
||||
Insn::DropTable {
|
||||
|
||||
@@ -27,3 +27,4 @@ source $testdir/offset.test
|
||||
source $testdir/scalar-functions-printf.test
|
||||
source $testdir/transactions.test
|
||||
source $testdir/update.test
|
||||
source $testdir/drop_table.test
|
||||
|
||||
@@ -26,23 +26,23 @@ do_execsql_test_on_specific_db {:memory:} drop-table-if-exists-2 {
|
||||
} {success}
|
||||
|
||||
# Test dropping table with index
|
||||
do_execsql_test_on_specific_db {:memory:} drop-table-with-index-1 {
|
||||
CREATE TABLE t3(x INTEGER PRIMARY KEY, y TEXT);
|
||||
CREATE INDEX idx_t3_y ON t3(y);
|
||||
INSERT INTO t3 VALUES(1, 'one');
|
||||
DROP TABLE t3;
|
||||
SELECT count(*) FROM sqlite_schema WHERE tbl_name='t3';
|
||||
} {0}
|
||||
#do_execsql_test_on_specific_db {:memory:} drop-table-with-index-1 {
|
||||
# CREATE TABLE t3(x INTEGER PRIMARY KEY, y TEXT);
|
||||
# CREATE INDEX idx_t3_y ON t3(y);
|
||||
# INSERT INTO t3 VALUES(1, 'one');
|
||||
# DROP TABLE t3;
|
||||
# SELECT count(*) FROM sqlite_schema WHERE tbl_name='t3';
|
||||
#} {0}
|
||||
|
||||
# Test dropping table cleans up related schema entries
|
||||
do_execsql_test_on_specific_db {:memory:} drop-table-schema-cleanup-1 {
|
||||
CREATE TABLE t4(x INTEGER PRIMARY KEY, y TEXT);
|
||||
CREATE INDEX idx1_t4 ON t4(x);
|
||||
CREATE INDEX idx2_t4 ON t4(y);
|
||||
INSERT INTO t4 VALUES(1, 'one');
|
||||
DROP TABLE t4;
|
||||
SELECT count(*) FROM sqlite_schema WHERE tbl_name='t4';
|
||||
} {0}
|
||||
#do_execsql_test_on_specific_db {:memory:} drop-table-schema-cleanup-1 {
|
||||
# CREATE TABLE t4(x INTEGER PRIMARY KEY, y TEXT);
|
||||
# CREATE INDEX idx1_t4 ON t4(x);
|
||||
# CREATE INDEX idx2_t4 ON t4(y);
|
||||
# INSERT INTO t4 VALUES(1, 'one');
|
||||
# DROP TABLE t4;
|
||||
# SELECT count(*) FROM sqlite_schema WHERE tbl_name='t4';
|
||||
#} {0}
|
||||
|
||||
# Test dropping table after multiple inserts and deletes
|
||||
do_execsql_test_on_specific_db {:memory:} drop-table-after-ops-1 {
|
||||
@@ -53,4 +53,4 @@ do_execsql_test_on_specific_db {:memory:} drop-table-after-ops-1 {
|
||||
INSERT INTO t6 VALUES (3);
|
||||
DROP TABLE t6;
|
||||
SELECT count(*) FROM sqlite_schema WHERE type='table' AND name='t6';
|
||||
} {0}
|
||||
} {0}
|
||||
|
||||
Reference in New Issue
Block a user