mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 08:46:49 +02:00
drop aux shadow table on destroy
This commit is contained in:
parent
163654b93a
commit
d6adbc9f56
4 changed files with 37 additions and 6 deletions
12
TODO
12
TODO
|
|
@ -7,10 +7,10 @@
|
||||||
|
|
||||||
# auxiliary columns
|
# auxiliary columns
|
||||||
|
|
||||||
- DELETE and UPDATE support
|
|
||||||
- in xBestIndex, ensure there are no constraints on any aux column
|
|
||||||
- enforce column types, ie STRICT?
|
- enforce column types, ie STRICT?
|
||||||
- NOT NULL?
|
- in xBestIndex, ensure there are no constraints on any aux column
|
||||||
- drop aux shadow table on xDestroy
|
- DELETE and UPDATE support
|
||||||
- perf: INSERT stmt should be cached on vec0_vtab
|
- later:
|
||||||
- perf: LEFT JOIN aux table to rowids query in vec0_cursor for rowid/point stmts, to avoid N lookup queries
|
- NOT NULL?
|
||||||
|
- perf: INSERT stmt should be cached on vec0_vtab
|
||||||
|
- perf: LEFT JOIN aux table to rowids query in vec0_cursor for rowid/point stmts, to avoid N lookup queries
|
||||||
|
|
|
||||||
12
sqlite-vec.c
12
sqlite-vec.c
|
|
@ -4835,6 +4835,18 @@ static int vec0Destroy(sqlite3_vtab *pVtab) {
|
||||||
}
|
}
|
||||||
sqlite3_finalize(stmt);
|
sqlite3_finalize(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(p->numAuxiliaryColumns > 0) {
|
||||||
|
zSql = sqlite3_mprintf("DROP TABLE " VEC0_SHADOW_AUXILIARY_NAME, p->schemaName, p->tableName);
|
||||||
|
rc = sqlite3_prepare_v2(p->db, zSql, -1, &stmt, 0);
|
||||||
|
sqlite3_free((void *)zSql);
|
||||||
|
if ((rc != SQLITE_OK) || (sqlite3_step(stmt) != SQLITE_DONE)) {
|
||||||
|
rc = SQLITE_ERROR;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
sqlite3_finalize(stmt);
|
||||||
|
}
|
||||||
|
|
||||||
stmt = NULL;
|
stmt = NULL;
|
||||||
rc = SQLITE_OK;
|
rc = SQLITE_OK;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,20 @@
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_normal[sqlite_master post drop]
|
||||||
|
OrderedDict({
|
||||||
|
'sql': 'select * from sqlite_master order by name',
|
||||||
|
'rows': list([
|
||||||
|
OrderedDict({
|
||||||
|
'type': 'table',
|
||||||
|
'name': 'sqlite_sequence',
|
||||||
|
'tbl_name': 'sqlite_sequence',
|
||||||
|
'rootpage': 3,
|
||||||
|
'sql': 'CREATE TABLE sqlite_sequence(name,seq)',
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_normal[sqlite_master]
|
# name: test_normal[sqlite_master]
|
||||||
OrderedDict({
|
OrderedDict({
|
||||||
'sql': 'select * from sqlite_master order by name',
|
'sql': 'select * from sqlite_master order by name',
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,11 @@ def test_normal(db, snapshot):
|
||||||
assert exec(db, "select * from v") == snapshot()
|
assert exec(db, "select * from v") == snapshot()
|
||||||
assert vec0_shadow_table_contents(db, "v") == snapshot()
|
assert vec0_shadow_table_contents(db, "v") == snapshot()
|
||||||
|
|
||||||
|
db.execute("drop table v;")
|
||||||
|
assert exec(db, "select * from sqlite_master order by name") == snapshot(
|
||||||
|
name="sqlite_master post drop"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_types(db, snapshot):
|
def test_types(db, snapshot):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue