Bug report #18244

Updated by Giovanni Manghi over 3 years ago

*new description:*

open db manager
connect to a db
open SQL window
make a query like SELECT * FROM schema.table
add result to project as SQL layer
right click on SQL layer and choose "update SQL layer"
and error will show like:

relation "SELECT * FROM schema.table
" does not exist

works ok on 2.18

*old description:*
I add a layer by connecting to postgis. When using "Update SQL layer..." a dialog opens with the expected query: SELECT * FROM "kopavogur"."byggingar".
Now I modify the query in the dialog so that it reads: SELECT * FROM "kopavogur"."byggingar" where id<100
I click execute and it works fine. I click Update and the filtered data is correctly shown on the canvas.
Now when I want to modify the query again by selecting "Update SQL layer..." DB Manager opens with the following error message:
relation "SELECT * FROM "kopavogur"."byggingar" where id<100
" does not exist
LINE 1: SELECT * FROM "SELECT * FROM ""kopavogur"".""byggingar"" whe...
When I close the error dialog, the query has been modified to read:
SELECT * FROM "SELECT * FROM ""kopavogur"".""byggingar"" where id<100
Error messages persist if I try to modify the query.