Bug report #20202
DB Manager: Pyhon error when importing from PostGIS to GPKG with drag and drop
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | Alessandro Pasotti | ||
Category: | DB Manager | ||
Affected QGIS version: | 3.4.0 | Regression?: | Yes |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | worksforme |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 28023 |
Description
create a GPKG
in DB manager try to import in this GPKG a PostGIS layer using drag and drop
after the options dialog shows, when clicking "ok":
Traceback (most recent call last):
File "/usr/share/qgis/python/plugins/db_manager/dlg_import_vector.py", line 370, in accept
self.db.connector.createSpatialIndex((schema, table), geom)
File "/usr/share/qgis/python/plugins/db_manager/db_plugins/gpkg/connector.py", line 782, in createSpatialIndex
res = self._fetchOne(sql)
File "/usr/share/qgis/python/plugins/db_manager/db_plugins/gpkg/connector.py", line 80, in _fetchOne
sql_lyr = self.gdal_ds.ExecuteSQL(sql)
File "/usr/lib/python3/dist-packages/osgeo/gdal.py", line 1966, in ExecuteSQL
return _gdal.Dataset_ExecuteSQL(self, *args, **kwargs)
RuntimeError: Unknown layer name
History
#1 Updated by Giovanni Manghi about 6 years ago
The same operations is ok with Spatialite.
#2 Updated by Giovanni Manghi about 6 years ago
Despite the error the layers seems to be imported anyway.
#3 Updated by Alessandro Pasotti about 6 years ago
No errors here, can you share data and project?
#4 Updated by Alessandro Pasotti about 6 years ago
- Assignee set to Alessandro Pasotti
#5 Updated by Giovanni Manghi about 6 years ago
Alessandro Pasotti wrote:
No errors here, can you share data and project?
I will but I will be able only later today.
#6 Updated by Giovanni Manghi about 6 years ago
- Priority changed from Normal to High
- Regression? changed from No to Yes
- Affected QGIS version changed from 3.3(master) to 3.4.0
Alessandro Pasotti wrote:
No errors here, can you share data and project?
it happens when the option "create spatial index" is enabled in the import dialog.
If that option is enabled along with the "replace destination table" (to overwrite an existing table) the error changes:
Traceback (most recent call last):
File "/usr/share/qgis/python/plugins/db_manager/dlg_import_vector.py", line 370, in accept
self.db.connector.createSpatialIndex((schema, table), geom)
File "/usr/share/qgis/python/plugins/db_manager/db_plugins/gpkg/connector.py", line 782, in createSpatialIndex
res = self._fetchOne(sql)
File "/usr/share/qgis/python/plugins/db_manager/db_plugins/gpkg/connector.py", line 80, in _fetchOne
sql_lyr = self.gdal_ds.ExecuteSQL(sql)
File "/usr/lib/python3/dist-packages/osgeo/gdal.py", line 1966, in ExecuteSQL
return _gdal.Dataset_ExecuteSQL(self, *args, **kwargs)
RuntimeError: Spatial index already existing
#7 Updated by Giovanni Manghi about 6 years ago
also, when doing import operations, if there are broken connections to gpkg datasources errors like #20238 keep popping out.
#8 Updated by Alessandro Pasotti about 6 years ago
- Resolution set to worksforme
- Status changed from Open to Closed
Sorry, still no errors here.