Getting error "PRAGMA table_info('SpatialIndex'): no such module: VirtualSpatialIndex" on unrelated querry
What happens?
After attaching a SQLite db, whith tables created by Spatialite.
When running a querry, I'm getting the error Invalid Error: Failed to prepare query "PRAGMA table_info('SpatialIndex')": no such module: VirtualSpatialIndex.
Despite the querry not using the 'SpatialIndex' table.
This does not happen when opening the database directly.
The same error also happen with .tables and when querrying a table that does not exist.
To Reproduce
Create SQLite3 db
sqlite3 ducky.db <<EOF
CREATE TABLE IF NOT EXISTS duck (
id INTEGER,
datetime TIMESTAMP,
lat FLOAT,
lon FLOAT,
accuracy FLOAT
);
INSERT INTO duck (id, datetime, lat, lon, accuracy) VALUES (1, '2021-04-16 01:01:01', 10, 20, 1.5);
INSERT INTO duck (id, datetime, lat, lon, accuracy) VALUES (2, '2021-04-16 01:01:01', 11, 21, 5);
INSERT INTO duck (id, datetime, lat, lon, accuracy) VALUES (3, '2021-04-16 01:01:01', 12, 22, 3);
INSERT INTO duck (id, datetime, lat, lon, accuracy) VALUES (4, '2021-04-16 02:01:01', 21, 31, 2.8);
INSERT INTO duck (id, datetime, lat, lon, accuracy) VALUES (5, '2021-04-16 02:01:01', 22, 32, 6);
INSERT INTO duck (id, datetime, lat, lon, accuracy) VALUES (6, '2021-04-16 02:01:01', 23, 33, 7);
EOF
Init Spatialite
spatialite ducky.db <<EOF
SELECT InitSpatialMetaData(1);
SELECT AddGeometryColumn('duck', 'geom', 4326, 'POINT', 'XY');
SELECT CreateSpatialIndex('duck', 'geom');
UPDATE duck SET geom = SetSRID(ST_Point(lon, lat), 4326);
EOF
This works
duckdb ducky.db "SELECT stddev(accuracy) FROM duck;"
This does not work
All these commands result in Invalid Error: Failed to prepare query "PRAGMA table_info('SpatialIndex')": no such module: VirtualSpatialIndex
duckdb <<EOF
ATTACH 'ducky.db' (TYPE SQLITE);
SELECT stddev(accuracy) FROM duck;
EOF
duckdb ducky.db <<EOF
.table
EOF
duckdb ducky.db "SELECT * FROM foo;"
OS:
Ubuntu 22.04 amd64 (WSL2)
SQLite Version:
SQLite 3.37.2, Spatialite 5.0.1
DuckDB Version:
0.10.1
DuckDB Client:
CLI, Python
Full Name:
Hugo Roussel
Affiliation:
Continental
Have you tried this on the latest main branch?
- [X] I agree
Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
- [X] I agree
The same for me!