Bug report #19926

Editing the expression for a SQL layer corrupts the SQL expression

Added by Lars Kellogg-Stedman over 5 years ago. Updated over 5 years ago.

Category:DB Manager
Affected QGIS version:3.2.3 Regression?:No
Operating System:Linux (fedora 28) Easy fix?:No
Pull Request or Patch supplied:No Resolution:duplicate
Crashes QGIS or corrupts data:No Copied to github as #:27750


I have created a layer from a SQL expression. The layer source looks like:

dbname='lic.db' table="(SELECT * FROM \"locations\" join \"pubacc_en\" using (unique_system_identifier) join \"pubacc_am\" using (unique_system_identifier) )" (geom) sql=

If I attempt to edit this layer (right click -> "Update SQL Layer..."), I get the error:

no such table: SELECT * FROM "locations" join "pubacc_en" using (unique_system_identifier) join "pubacc_am" using (unique_system_identifier)

And after acknowledging the error, the SQL expression has been modified to look like:

SELECT * FROM "SELECT * FROM ""locations"" join ""pubacc_en"" using (unique_system_identifier) join ""pubacc_am"" using (unique_system_identifier)

This is obviously invalid.

Related issues

Duplicates QGIS Application - Bug report #19843: Update SQL Layer converts query to table name Closed 2018-09-13


#1 Updated by Alessandro Pasotti over 5 years ago

#2 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to duplicate
  • Status changed from Open to Closed

Also available in: Atom PDF