Syntactical error with the use of == instead of = for comparison in the WHERE clause. #54608
Closed
2 tasks done
Labels
Bug
Either a bug report, or a bug fix. Let's hope for the latter!
What is the bug or the crash?
Issue Summary:
On a warning message was generated in QGIS due to an erroneous SQL query. The query attempted to retrieve data from the layer_styles table, but it contained a syntactical error with the use of == instead of = for comparison in the WHERE clause. As a result, the query failed to execute, leading to the reported error.
Error Details:
Date and Time: [Date and Time]
Error Level: WARNING
Error Message: Erroneous query: SELECT styleName FROM layer_styles WHERE f_table_catalog='knffis32' AND f_table_schema='kca' AND f_table_name='adm_rks_border' AND f_geometry_column=='geom' AND (type='Polygon' OR type IS NULL) AND styleName='Kufijt Administrative' returned 7 [ERROR: operator does not exist: character varying == unknown
LINE 1: ..._table_name='adm_rks_border' AND f_geometry_column=='geom' A...
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.]
Root Cause:
The root cause of this issue is the use of == for comparison in the SQL query, which is not a valid operator in SQL. In SQL, the correct operator for equality comparison is =.
Impact:
The impact of this error is that the SQL query cannot be executed successfully, and it results in a database error. This may lead to incorrect or missing data in QGIS when attempting to retrieve styles for the specified table and geometry column.
Resolution:
To resolve this issue, the SQL query should be modified to use the correct equality operator (=) instead of ==.
Steps to reproduce the issue
Versions
QGIS version
3.28.10-Firenze
QGIS code revision
e2edb9c
Supported QGIS version
New profile
Additional context
No response
The text was updated successfully, but these errors were encountered: