What is the bug or the crash?
With the geometry check "Is valid" enabled on a layer, an invalid feature is written to the database anyway.
This is contrary to the QGIS Documentation, which states: "Immediately after any geometry modification, failures in these checks are reported to the user in the Geometry validation panel. As long as a check is failing, it is not possible to save the layer".
Depending on the project transaction mode, the feedback to the user differs (see steps to reproduce). The behaviour should not differ as to per my opinion, and I expect it to be as follows:
- When creating/modifying: Geometry validation panel opens, listing validation error(s)
- When saving layer edits: Reject save and show message bar (I'd prefer WARN over INFO)
Steps to reproduce the issue
With the project transaction mode set to "Automatic transaction groups", saving a self-intersecting polygon triggers the following behaviour:
- blue message bar "Geometry check: Geometry errors have been found. Please fix the errors before saving the layer."
- error(s) listed in the Geometry validation panel
- "Save layer edits" button still enabled, and the layer still marked as modified
- when toggling editing, "Discard" does not remove the polygon.
With the project transaction mode set to "Buffered transaction groups", saving a self-intersecting polygon triggers the following behaviour:
- no message bar
- error(s) listed in the Geometry validation panel
- "Save layer edits" disabled, and the layer no longer marked as modified
- when toggling editing, no "Discard" option.
Versions
I reproduced the issue with 3.40.9 and 4.2.1.
| QGIS-Version | 4.2.1-Belém do Pará |
| QGIS-Codeversion | f229b86a9c1 |
| |
| Bibliotheken |
| Qt-Version | 6.11.1 |
| Python-Version | 3.12.13 |
| GDAL-Version | 3.13.2 — Iowa City |
| PROJ-Version | 9.8.1 |
| EPSG-Registraturdatenbankversion | () |
| GEOS-Version | 3.14.1-CAPI-1.20.5 |
| SFCGAL-Version | 2.3.0 |
| GeographicLib-Version | 2.7.0 |
| SQLite-Version | 3.53.4 |
| PDAL-Version | 2.10.0 |
| PostgreSQL-Client-Version | 18.4 |
| SpatiaLite-Version | 5.1.0 |
| QWT-Version | 6.3.0 |
| QScintilla2-Version | 2.14.1 |
| OpenGL-Version | 4.3 (Kompatibilitätsprofil), Intel(R) Iris(R) Xe Graphics |
| BS-Version | Windows 11 Version 24H2 |
| |
| Aktive Python-Erweiterungen |
| QgisModelBaker | v8.3.10 |
| db_manager | 0.1.20 |
| linking_relation_editor | v1.5.0 |
| processing | 2.12.99 |
| solocator | 2.0.0 |
Supported QGIS version
New profile
No Duplicate of the Issue
Additional context
Probably related to #67468
What is the bug or the crash?
With the geometry check "Is valid" enabled on a layer, an invalid feature is written to the database anyway.
This is contrary to the QGIS Documentation, which states: "Immediately after any geometry modification, failures in these checks are reported to the user in the Geometry validation panel. As long as a check is failing, it is not possible to save the layer".
Depending on the project transaction mode, the feedback to the user differs (see steps to reproduce). The behaviour should not differ as to per my opinion, and I expect it to be as follows:
Steps to reproduce the issue
With the project transaction mode set to "Automatic transaction groups", saving a self-intersecting polygon triggers the following behaviour:
With the project transaction mode set to "Buffered transaction groups", saving a self-intersecting polygon triggers the following behaviour:
Versions
I reproduced the issue with 3.40.9 and 4.2.1.
Supported QGIS version
New profile
No Duplicate of the Issue
Additional context
Probably related to #67468