Bug report #21786
Processing toolbox "fix geometries" does not handle array fields
Status: | Open | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Processing/Core | ||
Affected QGIS version: | 3.6.1 | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 29601 |
Description
So I just did "fix geometries" on my PostGiS layer that has array fields, when I deleted the shapes from it and copied the new features back. When I went to save that layer, nothing would save. All I got was simple message log error line saying that arrays had to start with {, and no PostGIS errors.
My PostGIS layer has several fields that are arrays, so I did not know which one it was referring to. Eventually I realised that the fix geometries tool had converted all array fields to simple string fields, so a PostGIS array like '{en,"Kingdom of Bavaria"}' became the literal string "{en, \"Kingdom of Bavaria\"}". When the shapes were copied back to the PostGIS layer, QGIS was still seeing them as strings, not as arrays, and apparently converting them improperly when trying to create the SQL to update the PostGIS layer. I assume the problem was with creating SQL because there were no PostGIS errors, just the ambiguous error about needing the { for an array.
Based on other bugs I have filed having to do with how QGIS handles array fields, it seems to me that whatever redesign of the internals of how a layer and it's attributes are stored in memory, that redesign seems to be faulty at the core as it communicates wrong information to the higher level functions that do things like run the processing tools, like displaying the feature attributes form (arrays are converted to strings, but truncated, #20872), like when trying to update PostGIS layers (nulls getting passed as empty strings, #21460), and now this.
History
#1 Updated by Giovanni Manghi over 5 years ago
- Status changed from Open to Feedback
Is this a problem of the specific tool in the subject, or a general one of any tool in the Processing toolbox?
#2 Updated by Cory Albrecht over 5 years ago
Giovanni Manghi wrote:
Is this a problem of the specific tool in the subject, or a general one of any tool in the Processing toolbox?
The specific tool in the subject.
#3 Updated by Giovanni Manghi over 5 years ago
- Crashes QGIS or corrupts data changed from Yes to No
- Priority changed from High to Normal
- Status changed from Feedback to Open
- Subject changed from Processing toolbox fix geometries does not handle array fields to Processing toolbox "fix geometries" does not handle array fields