Feature rejected by the database is regarded as saved and lost with toggling edit mode
Author: thunwalCreated Sep 17, 2026Updated Sep 17, 2026
LabelsBug
### What is the bug or the crash?
**Summary**
A new feature rejected by the database is regarded as saved and discarded without warning when toggling edit mode. This only affects the transaction mode "Buffered Transaction Groups".
**Detail**
If a new feature breaks a constraint in the database and the user clicks "Save layer edits", QGIS acts as if the save had worked. The error message from the database is shown in the message bar, but:
- no "Commit Errors" dialog appears ("Could not commit changes to layer...")
- the feature is still drawn on the map
- "Save layer edits" is disabled and the layer is no longer marked as modified
If you now toggle edit mode, the feature silently disappears.
**Expected behaviour**
The same as with the local edit buffer:
- "Commit Errors" dialog appears ("Could not commit changes to layer...")
- The edit buffer is kept
### Steps to reproduce the issue
Tested using a GeoPackage with a point layer and a UNIQUE Constraint on one of the fields.
1. Configure your project to use "Buffered Transaction Groups".
3. Toggle editing on.
4. Add a feature, save. Copy the feature, save.
5. The DB reports the constraint violation, "Save layer edits" is disabled, the layer is no longer marked as modified.
6. Toggle editing off.
7. The feature silently disappears.
Variant: Skip step 4 (save). QGIS will prompt you to save in step 6 (toggle editing).
### Versions
I also reproduced this issue using 3.40.9.
### Supported QGIS version
- [x] I'm running a supported QGIS version according to [the roadmap](https://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule).
### New profile
- [x] I tried with a new [QGIS profile](https://docs.qgis.org/latest/en/docs/user_manual/introduction/qgis_configuration.html#working-with-user-profiles)
### No Duplicate of the Issue
- [x] I have verified that there are no existing issues raised related to my problem.
### Additional context
_No response_
| 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 |
Source: qgis/QGIS