Description
What is the bug or the crash?
Many-to-Many relations have stopped working as of (I think) 3.42. These are relations I have had set up and working in projects for many years, they are not newly made ones.
Relations are set up in the standard way with a pivot table containing only the foreign keys.
Where ids used to be added without error in the pivot table, they now get the wrong data type for attribute fk_id of feature -20: Got QString, expected int
it's attempting to use the string 'autogenerate' instead of the id.
To be clear, this is not about sqlite increment, it's on the new child object the error occurs, not on an unsaved parent object.
I've tried playing around with the data sources settings - transaction modes, evaluating default values - but no setting makes any difference.
I've also tried (just in case) with the id of the child feature layer set to defaults like sqlite_fetch_and_increment, coalesce("id",max("id")+1), and other such workarounds, to no avail.
The weird thing is that even with the id field set to coalesce("id",max("id")+1) as default, it still tries to save it as 'autogenerate', which seems really wierd because it has no business sending that code when the default is coalesce("id",max("id")+1)...
Steps to reproduce the issue
- Create a many-to-many relation with pivot table (I'm using sqlite)
- Add parent, child and pivot tables to project
- Set relations between parent>pivot, and child>pivot
- Add child relation widget to parent layer form
- Open parent layer form, attempt to add child feature
Versions
QGIS version | 3.42.1-Münster |
QGIS code branch | Release 3.42 |
Libraries | |
Qt version | 5.15.16 |
Python version | 3.13.2 |
GDAL version | 3.10.2 |
PROJ version | 9.6.0 |
EPSG Registry database version | v12.004 (2025-03-02) |
GEOS version | 3.13.0-CAPI-1.19.0 (Compiled) 3.13.1-CAPI-1.19.2 (Running) |
SQLite version | 3.49.1 |
PDAL version | 2.8.3 |
PostgreSQL client version | 17.2 |
SpatiaLite version | 5.1.0 |
QWT version | 6.3.0 |
QScintilla2 version | 2.14.1 |
OS version | Manjaro Linux |
Active Python plugins | |
TomBio | 3.4.4 |
pluginbuilder3 | 3.2.1 |
db_manager | 0.1.20 |
processing | 2.12.99 |
grassprovider | 2.12.99 |
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
I can't be absolutely sure when this stopped working, but I completed a project with one such layer working flawlessly a month ago, so it must be recent.