Bug report #21545

Values for PostGIS layer JSON field not saved

Added by Cory Albrecht 9 months ago. Updated 9 months ago.

Status:Open
Priority:High
Assignee:-
Category:Data Provider/PostGIS
Affected QGIS version:3.6.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:29361

Description

If I type the following JSON in a text edit widget in the Feature Attributes for a column from a PostGIS layer that is of type JSON and then close the form, when I reopen the form the text widget is empty as if I had never typed anything there.

[
  {
    "$i18n":
      {
        "en": "Colony of Guiana" 
      }
  },
  {
    "$i18n":
      {
        "fr": "Colonie de Guyane" 
      }
  }
]

Same thing for the Attribute Table - type in new value, click the save icon, close the form, reopen, a blank column is shown. The JSON value is seemingly silently discarded as the column the database is set to NULL.

Also same thing when using Field Calculator (JSON text surrounded with ''). Any combination of these for entering and then displaying the column value has the same result when opening again to display - blank.

If I update the database directly, then move the map canvas in QGIS and open the attribute form, the JSON value is there. Cancel, reopen, still there. Make a change in a different field, close, reopen, JSON is gone.

See attached screenshots for example.

Screenshot from 2019-03-10 14-25-58.png - Before edit (127 KB) Cory Albrecht, 2019-03-10 07:28 PM

Screenshot from 2019-03-10 14-26-22.png - After edit (118 KB) Cory Albrecht, 2019-03-10 07:28 PM

History

#1 Updated by Giovanni Manghi 9 months ago

  • Crashes QGIS or corrupts data changed from No to Yes
  • Category changed from Attribute table to Data Provider/PostGIS

Also available in: Atom PDF