Bug report #11538
Field Calculator cannot update certain PostGIS tables
|Affected QGIS version:||2.6.0||Regression?:||No|
|Operating System:||Windows||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||19808|
- open PostGIS table with geometry
- enable editing
- select a few features
- open attribute table, click on Field calculator
- check "Update existing field", select column to update
- enter a value in the "Expression" field
- click OK
QGIS will not update the column but rather append a new (unnamed) column at the end of the attribute table which holds the value for any row in the table. The problem does not occur when working with .shp files.
#4 Updated by Giovanni Manghi over 5 years ago
- Status changed from Open to Feedback
Just tested on PostGIS layers (polygon and multipolygon) of my own and cannot replicate the issue. Does it happens on any layer you edit? or just specific ones? what postgre/postgis versions are you using? Did you noticed the same issue also in older qgis releases?
#5 Updated by Thomas Kandler over 5 years ago
Postgres 9.3.1 & PostGIS 2.1.0
Does happen on any layer (both, containing (multi) geometries and no geometries). We can use the same database on QGIS 2.2 with the field calculator working fine. Starting with 2.4 the bug pops up.
Tables are created with
May this be of any relevance?
#7 Updated by Thomas Kandler over 5 years ago
Imported a table with DB Manager Import Tool -> Field Calculator works fine. What could be a possible cause of this behaviour?
When comparing the tables with and without Field Calculator Error, the only difference are quotation marks on the primary key in the table which was imported using DB Manager.
CONSTRAINT some_pkey PRIMARY KEY (objectid) CONSTRAINT some_other_pkey PRIMARY KEY ("ID")On a side note: the FieldPyculator Plugin does work - even on those PostGIS tables the normal Field Calculator is not able to handle.