Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

gpkg_ogr_contents.feature_count can not be updated when started with empty table #11274

Open
andreglauser opened this issue Nov 14, 2024 · 0 comments · May be fixed by #11275
Open

gpkg_ogr_contents.feature_count can not be updated when started with empty table #11274

andreglauser opened this issue Nov 14, 2024 · 0 comments · May be fixed by #11275
Assignees

Comments

@andreglauser
Copy link

andreglauser commented Nov 14, 2024

What is the bug?

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.

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.

SELECT 
	feature_count + 1 
FROM gpkg_ogr_contents
WHERE lower(table_name) = lower('new_table')

Versions and provenance

Windows 11
GDAL 3.9.3, released 2024/10/07
QGIS 3.34 and 3.40

Additional context

No response

@rouault rouault self-assigned this Nov 14, 2024
rouault added a commit to rouault/gdal that referenced this issue Nov 14, 2024
rouault added a commit to rouault/gdal that referenced this issue Nov 14, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants