-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question regarding SQLite STRICT tables #644
Comments
From a quick testing, STRICT table won't be usable with GeoPackage Totaly unusable for feature tables, given that GeoPackage uses custom geometry types
It could still be used for attribute tables, but not if they use BOOLEAN, FLOAT, TINYINT, SMALLINT, MEDIUMINT, DOUBLE, DATE, DATETIME, TEXT(n) or BLOB(n) data types. So what is left is just INT, INTEGER, REAL, TEXT and BLOB. Quite restrictive... |
You could actually achieve the equivalent of the STRICT behaviour by using the SQLite3 typeof() function in CHECK constraints (cf https://www.sqlite.org/lang_corefunc.html), which should work accross all existing SQLite3 verions (typeof() was introduced in 2002 in sqlite 2.5.2 according to https://www.sqlite.org/changes.html). The downsides would probably a longer insertion time as evaluation of CHECK is going to be more costly than built-in STRICT functionality e.g.
For geometry blobs, it might also be possible with something more advanced, by inspecting bytes 9 to 13 to get the geometry type (and byte 8 to get the endianness). (I've done things like that, and even a bit more advanced, like patching the SRID of blobs like in https://github.com/OSGeo/gdal/blob/master/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp#L6195) |
@rouault Thanks for the testing and the feedback! |
@heidivanparys agreed that we can close this now. |
From https://sqlite.org/stricttables.html
Does this have influence on the GeoPackage specification? Taking into account #594 and related issues?
The text was updated successfully, but these errors were encountered: