Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#5394 closed defect (fixed)

Improve ExecuteSQL() implementation in GPKG

Reported by: Jukka Rahkonen Owned by: warmerdam
Priority: normal Milestone: 2.0.0
Component: default Version: unspecified
Severity: normal Keywords:
Cc: pramsey

Description

Indexes are essential for databases and GeoPackage is a database. However, it is not possible to add an index into GPKG with GDAL.

ogrinfo index_test.gpkg -dialect sqlite -sql "create index test_idx on test_table (attr)"
 INFO: Open of `index_test.gpkg'
       using driver `GPKG' successful.
 ERROR 1: In ExecuteSQL(): sqlite3_prepare(create index test_idx on test_table (attr)):
 no such table: main.test_table

Similar implementation of ExecuteSQL() than in GDAL SQLite driver should make this work. There may be other useful SQL commands which do not work at the moment and they should be checked at the same. VACUUM is naturally the next candidate but I believe it works already. This one does not work:

ogrinfo index_test.gpkg -dialect sqlite -sql "alter table test_table add column foo"

Also creating the "foo" column with Sqlite3 leads to an error. GPKG driver believes that the column has a data type "geometry". That error can be prevented by an explicit command

sqlite3> alter table test_table add column foo text

Change History (3)

comment:1 by Even Rouault, 10 years ago

trunk r27085 "GPKG: implement ExecuteSQL() for commands (but SELECT are still handled by generic ExecuteSQL() code) (#5394)"

comment:2 by Even Rouault, 10 years ago

Milestone: 2.0
Resolution: fixed
Status: newclosed

trunk r27324 "GPKG: make SELECT expressions passed to ExecuteSQL() be evaluated by SQLite"

comment:3 by Even Rouault, 9 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.