We believe we have found a bug involving MerginMaps mobile Input.
Summary
Our database/GeoPackage structure requires the use of the UNIQUE constraint on certain fields, specifically for primary/foreign keys. Adding a record to a table in Mergin Maps mobile Input that has a UNIQUE constraint on a field will cause a subsequent sync to fail with a conflict if the data on the server have been changed by QGIS in the meantime.
To Reproduce
We found that this can be replicated in a minimal way using the following steps:
- Create a new project in QGIS using the MerginMaps plugin option
New basic QGIS project
- Modify the
Survey_points.gpkg by adding a UNIQUE constraint to any field
- Sync the project in QGIS
- Download the project in MerginMaps Input - (At this point, QGIS and MerginMaps Input will have the same project in the same version)
- Add a new point to the
Survey layer in QGIS
- Sync the new QGIS point
- Add a new point to the
Survey layer in MerginMaps Input
- Sync the new MerginMaps Input point
- At this point, the conflict will have occurred within MerginMaps Input, you can sync the QGIS project to verify the conflict GeoPackage file
Example Project
We have created a public MerginMaps project with these same steps applied. In this instance, the UNIQUE constraint has been applied to the photo field in the Survey_points table. You can view the project here.
It is worth noting that this issue only occurs when syncing QGIS first, and then syncing MerginMaps Input. If you sync MerginMaps Input first, and then you sync QGIS, the conflict issue does not occur. We have also tried to replicate it between 2 QGIS instances, and 2 MerginMaps Input instances, but neither of those scenarios encountered the conflict issue either.
Software Versions
We have successfully replicated this issue on multiple devices that are using the most up-to-date versions of MerginMaps Input and the MerginMaps QGIS plugin.
- QGIS
3.32.3 for Windows
- Mergin Maps QGIS Plugin
2023.4.1
- Mergin Maps mobile Input
2.4.1 for Android
We believe we have found a bug involving MerginMaps mobile Input.
Summary
Our database/GeoPackage structure requires the use of the
UNIQUEconstraint on certain fields, specifically for primary/foreign keys. Adding a record to a table in Mergin Maps mobile Input that has a UNIQUE constraint on a field will cause a subsequent sync to fail with a conflict if the data on the server have been changed by QGIS in the meantime.To Reproduce
We found that this can be replicated in a minimal way using the following steps:
New basic QGIS projectSurvey_points.gpkgby adding aUNIQUEconstraint to any fieldSurveylayer in QGISSurveylayer in MerginMaps InputExample Project
We have created a public MerginMaps project with these same steps applied. In this instance, the
UNIQUEconstraint has been applied to thephotofield in theSurvey_pointstable. You can view the project here.It is worth noting that this issue only occurs when syncing QGIS first, and then syncing MerginMaps Input. If you sync MerginMaps Input first, and then you sync QGIS, the conflict issue does not occur. We have also tried to replicate it between 2 QGIS instances, and 2 MerginMaps Input instances, but neither of those scenarios encountered the conflict issue either.
Software Versions
We have successfully replicated this issue on multiple devices that are using the most up-to-date versions of MerginMaps Input and the MerginMaps QGIS plugin.
3.32.3for Windows2023.4.12.4.1for Android