Bug report #11538

Field Calculator cannot update certain PostGIS tables

Added by Thomas Kandler about 10 years ago. Updated over 9 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:-
Category:Field calculator
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

Description

Steps:
  • 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.


Related issues

Related to QGIS Application - Bug report #9844: postgis: if owner is a group it is not possible to add/re... Closed 2014-03-24
Related to QGIS Application - Bug report #11574: regression: field calculator not updating PostGIS layers Closed 2014-11-05
Duplicates QGIS Application - Bug report #11932: update selected features via field calculator doesn't wor... Closed 2015-01-01

History

#1 Updated by Giovanni Manghi about 10 years ago

  • Status changed from Open to Feedback

does it happen on qgis 2.6? if not with shapes, what formats are affected?

#2 Updated by Thomas Kandler about 10 years ago

Yes, 2.6 is also afflicted.

Regarding the formats: Postgres Database with PostGIS extension, geometry column is filled with (Single) Polygons in WKB format. I hope, I understood your question correctly.

#3 Updated by Giovanni Manghi about 10 years ago

  • Status changed from Feedback to Open
  • Affected QGIS version changed from 2.4.0 to 2.6.0

#4 Updated by Giovanni Manghi about 10 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 about 10 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

OIDS=FALSE

May this be of any relevance?

#6 Updated by Giovanni Manghi about 10 years ago

May this be of any relevance?

not sure, what happens if instead you import a vector using one of the standard tools (db manager, spit, shp2pgsql, ogr2ogr, etc.) and then edit it and do the above operation?

#7 Updated by Thomas Kandler almost 10 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.

#8 Updated by Giovanni Manghi almost 10 years ago

  • Status changed from Feedback to Open
  • Category changed from Attribute table to Field calculator
  • Subject changed from Field Calculator Update Column to Field Calculator cannot update PostGIS tables

#9 Updated by Giovanni Manghi almost 10 years ago

Thomas Kandler wrote:

Yes, 2.6 is also afflicted.

are previous qgis releases affected?

#10 Updated by Giovanni Manghi almost 10 years ago

  • Status changed from Open to Feedback

#11 Updated by Thomas Kandler almost 10 years ago

Giovanni Manghi wrote:

are previous qgis releases affected?

Thomas Kandler wrote:

Starting with 2.4 the bug pops up.

#12 Updated by Giovanni Manghi almost 10 years ago

Thomas Kandler wrote:

Starting with 2.4 the bug pops up.

so before qgis 2.4 (qgis <= 2.2) it was ok in the same conditions, right?

#13 Updated by Thomas Kandler almost 10 years ago

Giovanni Manghi wrote:

so before qgis 2.4 (qgis <= 2.2) it was ok in the same conditions, right?

Yes, exactly.

#14 Updated by Giovanni Manghi almost 10 years ago

  • Subject changed from Field Calculator cannot update PostGIS tables to Field Calculator cannot update certain PostGIS tables
  • Status changed from Feedback to Open
  • Priority changed from Normal to Severe/Regression

#15 Updated by Giovanni Manghi almost 10 years ago

see also #11574, probably the same issue.

#16 Updated by Jürgen Fischer over 9 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

fixed in 32945058

Also available in: Atom PDF