If a table is created empty and features are added afterwards gpkg_ogr_contents.feature_count can not be updated because NULL + 1 results to "NULL"
In a GPKG the column feature_count of the table gpkg_ogr_contents is created with a default of NULL. For new tables triggers are created to manage gpkg_ogr_contents.feature_count with ..SET feature_count = feature_count + 1... In case the existing value of feature_count is NULL the triggers are not able to increment the number from NULL to 1.
What is the bug?
If a table is created empty and features are added afterwards
gpkg_ogr_contents.feature_count
can not be updated becauseNULL + 1
results to "NULL"In a GPKG the column
feature_count
of the tablegpkg_ogr_contents
is created with a default ofNULL
. For new tables triggers are created to managegpkg_ogr_contents.feature_count
with..SET feature_count = feature_count + 1..
. In case the existing value offeature_count
is NULL the triggers are not able to increment the number from NULL to 1.Steps to reproduce the issue
With QGIS: Create a Geopackage with an new layer. Add some features. Check the data of gpkg_ogr_contents.
With follwing example for the table "new_table" the behaviour can be simulated.
Versions and provenance
Windows 11 GDAL 3.9.3, released 2024/10/07 QGIS 3.34 and 3.40
Additional context
No response