Bug report #21714

Exported GeoPackages have wrong field definitions

Added by Anita Graser over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:Alessandro Pasotti
Category:Data Provider
Affected QGIS version:3.7(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:29530

Description

Fields created for string values are set to length=255 even if they contain much longer texts:

To reproduce:

  1. Load lakes.shp from QGIS sample data
  2. Export to CSV, adding geom as WKT
  3. Export CSV layer to GeoPackage -> The resulting field definitions are shown in the following screenshot

The resulting GeoPackage is problematic. Due to the wrong field definitions, e.g. the data cannot be imported into PostGIS using DBManager:

Error 6
Feature write errors:
Creation error for features from #0 to #0. Provider errors was: 
PostGIS error while adding features: FEHLER:  Wert zu lang für Typ character varying(255)

Only 0 of 15 features written.

fields.PNG (46.8 KB) Anita Graser, 2019-03-31 01:42 PM


Related issues

Duplicated by QGIS Application - Bug report #21840: Geopackage - wrong string length Closed 2019-04-12

Associated revisions

Revision 013bdf94
Added by Alessandro Pasotti over 5 years ago

Fix wrong field length in file writer

fixes #21714

History

#1 Updated by Alessandro Pasotti over 5 years ago

  • Assignee set to Alessandro Pasotti

#2 Updated by Alessandro Pasotti over 5 years ago

  • Resolution set to fixed/implemented
  • Pull Request or Patch supplied changed from No to Yes
  • Status changed from Open to In Progress

#3 Updated by Alessandro Pasotti over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

#4 Updated by Alessandro Pasotti over 5 years ago

Also available in: Atom PDF