You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When editing both geometry and field values of a PostGIS feature at the same time, if the edit fails due to a Postgres constraint violation (or any other Postgres error), the next time I try and save a valid geometry and attribute edit I get the following error:
Could not commit changes to layer ...
Errors:
Provider errors:
PostGIS error while changing attributes: ERROR: prepared statement "updatefeature" already exists
Edits to just geometry or just attribute values save, but edits involving both will continue to fail with this error until either QGIS is restarted or the layer is removed and re-added.
I'm not entirely sure but, having poked around in qgspostgresprovider.cpp, it looks like there may be a missing "DEALLOCATE updatefeature" in QgsPostgresProvider::changeFeatures after the rollback (line 3508).
Steps to reproduce the issue
Start editing a PostGIS layer with a NOT NULL constraint on one of its fields (uncheck enforce not null constraint).
Change a feature's geometry and set it's field value to NULL (so as to cause the postgres error).
Try to save layer edits (get the expected constraint violation error).
Stop editing and discard edits.
Start editing again and change (any) feature's geometry and field value to something valid.
Save layer edits (get prepared statement "updatefeature" already exists error).
Versions
Tested on QGIS 3.16.8, Postgres 10
Supported QGIS version
I'm running a supported QGIS version according to the roadmap.
New profile
I tried with a new QGIS profile
Additional context
No response
The text was updated successfully, but these errors were encountered:
sicasley
added
the
Bug
Either a bug report, or a bug fix. Let's hope for the latter!
label
Sep 16, 2021
What is the bug or the crash?
When editing both geometry and field values of a PostGIS feature at the same time, if the edit fails due to a Postgres constraint violation (or any other Postgres error), the next time I try and save a valid geometry and attribute edit I get the following error:
Edits to just geometry or just attribute values save, but edits involving both will continue to fail with this error until either QGIS is restarted or the layer is removed and re-added.
I'm not entirely sure but, having poked around in qgspostgresprovider.cpp, it looks like there may be a missing "DEALLOCATE updatefeature" in QgsPostgresProvider::changeFeatures after the rollback (line 3508).
Steps to reproduce the issue
Versions
Tested on QGIS 3.16.8, Postgres 10
Supported QGIS version
New profile
Additional context
No response
The text was updated successfully, but these errors were encountered: