I'm trying a model which did work with QGIS 3.12 but don't in QGIS 3.16. In this model, two vector layers are merged by the algorithm native:mergevectorlayers
. In the new version if a field of similar type but with a smaller size is given as first element, an error message appears:
Feature could not be written to
Merged_062872d0_f531_40e7_8e55_cd911e6e91f4: Could not store attribute
"NATURE": String of length 25 exceeds maximum field length (20)
I can't control which element is given in first during the merge processing. I just know that two vector layers have same fields. I can't select specific fields as is done in this answer Merge Vector Layers fails in QGIS.
Has anyone had the same issue?
Best Answer
You need to match the lenghts of your fields. To achieve that, go to Processing -> Refactor Fields
Select you layer with the too short field as input, map it to your "longer" layer and run it. The resulting layer should be mergeable with your original "long" layer.