Bug report #20092
GeoPackage SQL issues in DB Manager
|Affected QGIS version:||3.5(master)||Regression?:||Yes|
|Operating System:||Windows 7 64bits, Linux||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||27914|
DB Manager issues with GPKG geometries on perfectly valid GeoPackage files (made by QGIS or ogr2ogr).
The following SQL queries fail in DB Manager
( but succeed in DB Browser 4 SQLite with EnableGpkgAmphibiousMode ) :
SELECT AsWKT(geom) FROM mypolygon;
--> returns NULL ; should return: MULTIPOLYGON(...
SELECT ST_Area(geom) FROM mypolygon;
--> returns NULL ; should return numeric
SELECT isvalid(geom) FROM mypolygon;
--> returns -1 (which means: UNKNOWN) ; should return 0 or 1
#1 Updated by Antoine Fonoxo almost 4 years ago
Here is a clarification about DB Manager:
These queries fail in the "GeoPackage" section. But it works in the "Virtual Layers" section of DB Manager:
SELECT ST_Area(geometry) FROM mypolygon;
But you can't make an UPDATE or INSERT by "Virtual Layers"...
And I tested the same queries with ogrinfo (bundled with QGIS 2.18): no problem with geom functions.
#2 Updated by Alexandre Neto almost 4 years ago
- Operating System changed from Windows 7 64bits to Windows 7 64bits, Linux
I am seeing this kind of problems also on QGIS 3.2.3 on linux.
In my case the layers were imported using Save as selected tool in QGIS. When I try to get something from the geom column it always return NULL. Still, I can still load the layer and visualize the layer fine on QGIS.