Current code always assume that we will work with "main" database which is merely true in real life.
Not only explicit ATTACH will not work with current code, but also VACUUM INTO 't.db' will fail as internally it attaches temp DB with "vacuumed" state.
This PR carefully propagate iDb / zDbSName to vector API and work with provided schema instead of unconditionarl "main".
Context
Current code always assume that we will work with
"main"
database which is merely true in real life.Not only explicit
ATTACH
will not work with current code, but alsoVACUUM INTO 't.db'
will fail as internally it attaches temp DB with "vacuumed" state.This PR carefully propagate
iDb
/zDbSName
to vector API and work with provided schema instead of unconditionarl"main"
.One caveat is that table-valued functions can't be invoked for any schema other then
main
- but this is a restriction of SQLite (https://www.sqlite.org/vtab.html#eponymous_virtual_tables). I guess for now this is fine.Testing