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

regression: field calculator not updating PostGIS layers #19836

Closed
qgib opened this issue Nov 5, 2014 · 22 comments
Closed

regression: field calculator not updating PostGIS layers #19836

qgib opened this issue Nov 5, 2014 · 22 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 5, 2014

Author Name: Gavin Fleming (@gubuntu)
Original Redmine Issue: 11574
Affected QGIS version: 2.6.0
Redmine category:field_calculator


Try to update a field in a (remote) PostGIS layer using the field calculator and no visible change occurs, neither does the layer pick up that there are any changes to save.

I have tested this on the same record from the same database and it works in 2.4 and fails in 2.6 and master.

The one that does not work in 2.6 but does work in 2.4 happens to be on a remote host and PostgreSQL 9.1, PostGIS 2.1

2.6 however does work on local host PostgreSQL 9.3 PostGIS 2.1.

The expression I used was simply assigning a new string in ''


Related issue(s): #19808 (relates)
Redmine related issue(s): 11538


@qgib
Copy link
Contributor Author

qgib commented Nov 5, 2014

Author Name: Giovanni Manghi (@gioman)


Just tested here, both on Linux and Windows, qgis 2.6/master using a remote postgis server, no issues: changes shows immediately in the table of attributes (unless you reordered one of the fields, known issue and regression) and saving edits works fine (close and reopen the table and new values are there).


  • category_id was configured as Data Provider/PostGIS
  • status_id was changed from Open to Feedback
  • version was changed from 2.6.0 to master

@qgib
Copy link
Contributor Author

qgib commented Nov 5, 2014

Author Name: Gavin Fleming (@gubuntu)


  • category_id removed Data Provider/PostGIS
  • version was changed from master to 2.6.0

@qgib
Copy link
Contributor Author

qgib commented Nov 5, 2014

Author Name: Gavin Fleming (@gubuntu)


several users on windows working on the same database in an office LAN environment have reported the same issue. I just tested and confirmed it on Linux over the Internet.

@qgib
Copy link
Contributor Author

qgib commented Nov 5, 2014

Author Name: Giovanni Manghi (@gioman)


Gavin Fleming wrote:

several users on windows working on the same database in an office LAN environment have reported the same issue. I just tested and confirmed it on Linux over the Internet.

may be an issue with the permissions in the database?


  • version was changed from 2.6.0 to master

@qgib
Copy link
Contributor Author

qgib commented Nov 5, 2014

Author Name: Gavin Fleming (@gubuntu)


no I tested as superuser on the same layer filtered to one record. The only difference was the QGIS version.


  • version was changed from master to 2.6.0

@qgib
Copy link
Contributor Author

qgib commented Nov 5, 2014

Author Name: Giovanni Manghi (@gioman)


Gavin Fleming wrote:

no I tested as superuser on the same layer filtered to one record. The only difference was the QGIS version.

as I cannot replicate in any way i leave this open so others would be able to give it a try and leave feedback.

PS
If it affects master and it affects editing of PostGIS layers please leave the proper tags.


  • version was changed from 2.6.0 to master
  • category_id was configured as Data Provider/PostGIS
  • status_id was changed from Feedback to Open

@qgib
Copy link
Contributor Author

qgib commented Nov 5, 2014

Author Name: Tim Sutton (Tim Sutton)


Giovanni Manghi wrote:

Gavin Fleming wrote:

no I tested as superuser on the same layer filtered to one record. The only difference was the QGIS version.

as I cannot replicate in any way i leave this open so others would be able to give it a try and leave feedback.

PS
If it affects master and it affects editing of PostGIS layers please leave the proper tags.

I was able to replicate here against Gavin's db. Under QGIS 2.6 the following simple expression fails to update existing field:

"type" + ')'

Under 2.4 this works:

"type" || ')'

@qgib
Copy link
Contributor Author

qgib commented Nov 5, 2014

Author Name: Gavin Fleming (@gubuntu)


  • category_id removed Data Provider/PostGIS
  • version was changed from master to 2.6.0

@qgib
Copy link
Contributor Author

qgib commented Nov 5, 2014

Author Name: Tim Sutton (Tim Sutton)


I just tested using the python API:

l = iface.activeLayer()
exp = QgsExpression('"type" + \\')\\'')
f = l.getFeatures()
for feat in f:
    value = exp.evaluate(feat)
    print value

And that works fine, so the issue must lie in the caclulator itself.

@qgib
Copy link
Contributor Author

qgib commented Nov 5, 2014

Author Name: Giovanni Manghi (@gioman)


I was able to replicate here against Gavin's db. Under QGIS 2.6 the following simple expression fails to update existing field:

[...]

Under 2.4 this works:

[...]

so it is just this particular expression (concatenation with the "+") that fails or any expression fails?

and then: it fails on any database or just one? and what about other formats?

I tested here on local and remote databases, with qgis 2.6 and master and both ways to do concatenation (|| and +) are working as expected from the field calculator.

@qgib
Copy link
Contributor Author

qgib commented Nov 5, 2014

Author Name: Gavin Fleming (@gubuntu)


the concatenation is a red herring :-) - any expression fails. Remote vs local might be a red herring too.
2.4 works on shapefiles, postgresql 9.1 and postgresql 9.3
2.6 works on shpefiles, postgresql 9.3 but NOT postgresql 9.1

@qgib
Copy link
Contributor Author

qgib commented Nov 6, 2014

Author Name: Giovanni Manghi (@gioman)


2.6 works on shpefiles, postgresql 9.3 but NOT postgresql 9.1

I does not seems postgresql version either. I just installed postgresql 9.1/postgis 2 and tested with qgis 2.6 and all works as expected.


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Nov 8, 2014

Author Name: Giovanni Manghi (@gioman)


Tim Sutton wrote:

I just tested using the python API:

[...]

And that works fine, so the issue must lie in the caclulator itself.

is this #19808

the same issue?


  • category_id was configured as Field calculator

@qgib
Copy link
Contributor Author

qgib commented Nov 9, 2014

Author Name: Gavin Fleming (@gubuntu)


It does seem to be the same or related issue. I tested this one again and noticed the extra field that gets created as mentioned in #19808, which I hadn't noticed before.

@qgib
Copy link
Contributor Author

qgib commented Nov 20, 2014

Author Name: Wille Marcel (Wille Marcel)


I have the same issue. When I open the table of attributes, choose to just show the selected items and modify a field value using the toolbar of the table of attributes dialog, it works fine. But when I open the field calculator dialog and try to modify some values, it didn't apply the modifications.

Tim Sutton wrote:

I just tested using the python API:

[...]

And that works fine, so the issue must lie in the caclulator itself.

@qgib
Copy link
Contributor Author

qgib commented Nov 20, 2014

Author Name: Giovanni Manghi (@gioman)


Wille Marcel wrote:

I have the same issue. When I open the table of attributes, choose to just show the selected items and modify a field value using the toolbar of the table of attributes dialog, it works fine. But when I open the field calculator dialog and try to modify some values, it didn't apply the modifications.

always? or just in same situation as #19808?

because for normally imported vectors then is works as expected...

@qgib
Copy link
Contributor Author

qgib commented Nov 20, 2014

Author Name: Wille Marcel (Wille Marcel)


Only with postgis. When editing vector files it works properly.

Giovanni Manghi wrote:

Wille Marcel wrote:

I have the same issue. When I open the table of attributes, choose to just show the selected items and modify a field value using the toolbar of the table of attributes dialog, it works fine. But when I open the field calculator dialog and try to modify some values, it didn't apply the modifications.

always? or just in same situation as #19808?

because for normally imported vectors then is works as expected...

@qgib
Copy link
Contributor Author

qgib commented Nov 20, 2014

Author Name: Giovanni Manghi (@gioman)


Wille Marcel wrote:

Only with postgis.

yes, but the ticket I linked to you is about (and this one too) is about postgis tables (layers) created in a specific way. If you import a vector (shape, whatever) into postgis using qgis (db manager, browser. etc), shp2pgsql, ogr2ogr, etc. then this does not happens, or at least I can't confirm in any test I made so far.

@qgib
Copy link
Contributor Author

qgib commented Nov 20, 2014

Author Name: Wille Marcel (Wille Marcel)


I tried it in a OSM database created with osm2pgsql and in a database with all the vectors created using qgis. In both the error occurs.

Giovanni Manghi wrote:

Wille Marcel wrote:

Only with postgis.

yes, but the ticket I linked to you is about (and this one too) is about postgis tables (layers) created in a specific way. If you import a vector (shape, whatever) into postgis using qgis (db manager, browser. etc), shp2pgsql, ogr2ogr, etc. then this does not happens, or at least I can't confirm in any test I made so far.

@qgib
Copy link
Contributor Author

qgib commented Nov 20, 2014

Author Name: Giovanni Manghi (@gioman)


Wille Marcel wrote:

I tried it in a OSM database created with osm2pgsql and in a database with all the vectors created using qgis. In both the error occurs.

can you attach a dump of one of the table that has the issue?

@qgib
Copy link
Contributor Author

qgib commented Feb 12, 2015

Author Name: Gavin Fleming (@gubuntu)


appears to be fixed in master. The value updates in the table, detects that there are changes and saves, i.e. as expected. Database and PostGIS version and test data are the same as those that had this issue with 2.6 and earlier versions of master.

@qgib
Copy link
Contributor Author

qgib commented Feb 13, 2015

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


fixed in 3294505


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

@qgib qgib added 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 labels May 25, 2019
@qgib qgib closed this as completed May 25, 2019
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