Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field Calculator cannot update certain PostGIS tables #19808

Closed
qgib opened this issue Nov 3, 2014 · 16 comments
Closed

Field Calculator cannot update certain PostGIS tables #19808

qgib opened this issue Nov 3, 2014 · 16 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions

Comments

@qgib
Copy link
Contributor

qgib commented Nov 3, 2014

Author Name: Thomas Kandler (Thomas Kandler)
Original Redmine Issue: 11538
Affected QGIS version: 2.6.0
Redmine category:field_calculator


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 issue(s): #18374 (relates), #19836 (relates), #20140 (duplicates)
Redmine related issue(s): 9844, 11574, 11932


@qgib
Copy link
Contributor Author

qgib commented Nov 3, 2014

Author Name: Giovanni Manghi (@gioman)


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


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Nov 3, 2014

Author Name: Thomas Kandler (Thomas Kandler)


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.

@qgib
Copy link
Contributor Author

qgib commented Nov 3, 2014

Author Name: Giovanni Manghi (@gioman)


  • status_id was changed from Feedback to Open
  • version was changed from 2.4.0 to 2.6.0

@qgib
Copy link
Contributor Author

qgib commented Nov 3, 2014

Author Name: Giovanni Manghi (@gioman)


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?


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Nov 4, 2014

Author Name: Thomas Kandler (Thomas Kandler)


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?

@qgib
Copy link
Contributor Author

qgib commented Nov 5, 2014

Author Name: Giovanni Manghi (@gioman)


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?

@qgib
Copy link
Contributor Author

qgib commented Nov 7, 2014

Author Name: Thomas Kandler (Thomas Kandler)


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")
</pre

On a side note: the FieldPyculator Plugin does work - even on those PostGIS tables the normal Field Calculator is not able to handle.



@qgib
Copy link
Contributor Author

qgib commented Nov 8, 2014

Author Name: Giovanni Manghi (@gioman)


  • status_id was changed from Feedback to Open
  • category_id was changed from Attribute table to Field calculator
  • subject was changed from Field Calculator Update Column to Field Calculator cannot update PostGIS tables

@qgib
Copy link
Contributor Author

qgib commented Nov 8, 2014

Author Name: Giovanni Manghi (@gioman)


Thomas Kandler wrote:

Yes, 2.6 is also afflicted.

are previous qgis releases affected?

@qgib
Copy link
Contributor Author

qgib commented Nov 8, 2014

Author Name: Giovanni Manghi (@gioman)


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Nov 8, 2014

Author Name: Thomas Kandler (Thomas Kandler)


Giovanni Manghi wrote:

are previous qgis releases affected?

Thomas Kandler wrote:

Starting with 2.4 the bug pops up.

@qgib
Copy link
Contributor Author

qgib commented Nov 8, 2014

Author Name: Giovanni Manghi (@gioman)


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?

@qgib
Copy link
Contributor Author

qgib commented Nov 8, 2014

Author Name: Thomas Kandler (Thomas Kandler)


Giovanni Manghi wrote:

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

Yes, exactly.

@qgib
Copy link
Contributor Author

qgib commented Nov 8, 2014

Author Name: Giovanni Manghi (@gioman)


  • subject was changed from Field Calculator cannot update PostGIS tables to Field Calculator cannot update certain PostGIS tables
  • status_id was changed from Feedback to Open
  • priority_id was changed from Normal to Severe/Regression

@qgib
Copy link
Contributor Author

qgib commented Nov 10, 2014

Author Name: Giovanni Manghi (@gioman)


see also #19836, probably the same issue.

@qgib
Copy link
Contributor Author

qgib commented Feb 12, 2015

Author Name: Jürgen Fischer (@jef-n)


fixed in 3294505


  • resolution was changed from to fixed/implemented
  • status_id was changed from Open to Closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions
Projects
None yet
Development

No branches or pull requests

1 participant