Bug report #21786

Processing toolbox "fix geometries" does not handle array fields

Added by Cory Albrecht over 5 years ago. Updated over 5 years ago.

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.

Screenshot from 2019-04-07 23-17-34.png (253 KB) Cory Albrecht, 2019-04-08 05:17 AM

Screenshot from 2019-04-07 23-16-21.png (259 KB) Cory Albrecht, 2019-04-08 05:17 AM

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

Also available in: Atom PDF