Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDAL/OGR processing algorithms may silently output incorrect result if an input is a vector "memory" layer with a "fid" column #57343

Closed
2 tasks done
agiudiceandrea opened this issue May 5, 2024 · 0 comments · Fixed by #57522
Assignees
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

Comments

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented May 5, 2024

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

  1. import the "vector" layer vector.zip in a new project: it contains the two following points (note the same value in the "fid" column)
wkt_geom fid Field1
Point (620625 4552564) 1 A
Point (620725 4552512) 1 B
  1. 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

  2. execute the GDAL processing algorithm "Buffer vectors" using the "Pasted" memory layer as the Input Layer and "geom" as "Geometry column name".
    image

  3. 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
    image

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

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

See: #57341.

@agiudiceandrea agiudiceandrea added Processing Relating to QGIS Processing framework or individual Processing algorithms Bug Either a bug report, or a bug fix. Let's hope for the latter! labels May 5, 2024
@elpaso elpaso self-assigned this May 22, 2024
elpaso added a commit to elpaso/QGIS that referenced this issue May 22, 2024
Errors were silently ignored, they are now shown to the user.

Fix qgis#57343
nyalldawson pushed a commit that referenced this issue May 22, 2024
Errors were silently ignored, they are now shown to the user.

Fix #57343
qgis-bot pushed a commit that referenced this issue May 22, 2024
Errors were silently ignored, they are now shown to the user.

Fix #57343
nyalldawson pushed a commit that referenced this issue May 23, 2024
Errors were silently ignored, they are now shown to the user.

Fix #57343
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants