GDAL/OGR processing algorithms may silently output incorrect result if an input is a vector "memory" layer with a "fid" column #57343
Labels
Bug
Either a bug report, or a bug fix. Let's hope for the latter!
Processing
Relating to QGIS Processing framework or individual Processing algorithms
What is the bug or the crash?
When a vector "memory / scratch" layer is used as an input of a GDAL/OGR processing algorithm, then the vector memory layer is always normally automatically exported to a GeoPackage layer file (see #32082) before using it as input of the underlying GDAL/OGR external program.
In such case, if the memory layer has a "fid" column and if more than 1 features in such layer has the same value in such field, then the feature after the first one have the same value in the "fid" column will be quite silently discarded and the GDAL/OGR processing algorithm will output incorrect result without any warning message or error message is displayed in the processing algorithm log.
Only the OGR tab of the Log Messages panel will contain the warning message
WARNING Feature creation error (OGR error: failed to execute insert : UNIQUE constraint failed: INPUT.fid)
, but such message will be almost totally unnoticed by the user and in any case it doesn't gives any clue on what's going wrong.Steps to reproduce the issue
click on "Select All Features", then "Copy Features", then "Paste Features As" -> Temporary Scratch Layer", then OK: a new memory layer named "Pasted" is created
execute the GDAL processing algorithm "Buffer vectors" using the "Pasted" memory layer as the Input Layer and "geom" as "Geometry column name".
see the resulting "Buffer" layer containing the buffer of 1 point instead of the buffers of both the 2 points and no warning or error logged in the processing algorithm's log
Versions
QGIS 3.36.2 / QGIS 3.34.6
QGIS version
3.36.2-Maidenhead
QGIS code revision
6d25052
Qt version
5.15.13
Python version
3.12.3
GDAL/OGR version
3.8.5
PROJ version
9.4.0
EPSG Registry database version
v11.004 (2024-02-24)
GEOS version
3.12.1-CAPI-1.18.1
SQLite version
3.45.1
PDAL version
2.6.3
PostgreSQL client version
16.2
SpatiaLite version
5.1.0
QWT version
6.2.0
QScintilla2 version
2.14.1
OS version
Windows 10 Version 1903
Active Python plugins
db_manager
0.1.20
grassprovider
2.12.99
MetaSearch
0.3.6
processing
2.12.99
Supported QGIS version
New profile
Additional context
See: #57341.
The text was updated successfully, but these errors were encountered: