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

Opening processing algorithm from history with Postgres input causes error #45403

Closed
1 of 2 tasks
aroche opened this issue Oct 5, 2021 · 2 comments · Fixed by #45426
Closed
1 of 2 tasks

Opening processing algorithm from history with Postgres input causes error #45403

aroche opened this issue Oct 5, 2021 · 2 comments · Fixed by #45426
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

@aroche
Copy link
Contributor

aroche commented Oct 5, 2021

What is the bug or the crash?

When trying to open an algorithm from the processing history dialog and that algorithm used a Postgres table with the option "selected features only", an error occurs :

SyntaxError: invalid syntax 
Traceback (most recent call last):
  File "C:\Users/AUGUST~1.ROC/DOWNLO~1/PROGRA~1/OSGEO4W/apps/qgis/./python/plugins\processing\gui\HistoryDialog.py", line 183, in executeAlgorithm
    exec(script)
  File "", line 5
    processing.execAlgorithmDialog("native:buffer", {'INPUT':QgsProcessingFeatureSourceDefinition('dbname='mydb' host=localhost port=5432 sslmode=disable authcfg=0h04410 key='id' srid=2154 type=Point checkPrimaryKeyUnicity='1' table="public"."wt_detail" (geom) sql=not refused and status in ('in operation', 'construction in progress')', selectedFeaturesOnly=True, featureLimit=-1, geometryCheck=QgsFeatureRequest.GeometryAbortOnInvalid),'DISTANCE':10,'SEGMENTS':5,'END_CAP_STYLE':0,'JOIN_STYLE':0,'MITER_LIMIT':2,'DISSOLVE':False,'OUTPUT':'TEMPORARY_OUTPUT'})

                                                                                                           ^
SyntaxError: invalid syntax

It seems that when the input is treated as QgsProcessingFeatureSourceDefinition, the data source name is not escaped properly in the log.

Steps to reproduce the issue

  1. Open a PostgreSQL table
  2. select some features
  3. run a processing algorithm on that layer (e.g. buffer) with the "only selected features" checked
  4. Open the history processing dialog
  5. Open the last run algorithm

Versions

<style type="text/css"> p, li { white-space: pre-wrap; } </style>
Version de QGIS 3.20.0-Odense Révision du code decaadb
Qt version 5.15.2
Python version 3.9.5
GDAL/OGR version 3.3.0
PROJ version 8.0.1
EPSG Registry database version v10.018 (2021-04-02)
GEOS version 3.9.1-CAPI-1.14.2
SQLite version 3.35.2
PDAL version 2.3.0
PostgreSQL client version 13.0
SpatiaLite version 5.0.1
QWT version 6.1.3
QScintilla2 version 2.11.5
OS version Windows 10 Version 1809
       
Active Python plugins changeDataSourcefrench_locator_filterGo2NextFeature3profiletoolSpreadsheetLayersStreetViewvaluetoolViewshedAnalysisdb_managerprocessing

Also tested in 3.16

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

No response

@aroche aroche added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Oct 5, 2021
@gioman gioman added the Processing Relating to QGIS Processing framework or individual Processing algorithms label Oct 5, 2021
@gioman
Copy link
Contributor

gioman commented Oct 5, 2021

3.20.0-Odense

@aroche this is a bit outdated, can you check with the latest point release?

@aroche
Copy link
Contributor Author

aroche commented Oct 5, 2021

I've just tested with 3.20.3, with the same problem.

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.

3 participants