Skip to content
Permalink
Browse files

Merge pull request #7966 from elpaso/bugfix-19843-dbmanager-quoted-sql

[dbmanager] Fix Update SQL Layer converts query to table name
  • Loading branch information
elpaso committed Sep 21, 2018
2 parents 936b0c1 + a8bf1b8 commit 1b2d885a03e6969f7ae15a955c8b970a463c502c
Showing with 2 additions and 1 deletion.
  1. +2 −1 python/plugins/db_manager/dlg_sql_layer_window.py
@@ -152,7 +152,8 @@ def __init__(self, iface, layer, parent=None):
match = re.search('^\((SELECT .+ FROM .+)\)$', sql, re.S)
if match:
sql = match.group(1)
if not sql.startswith('(') and not sql.endswith(')'):
# Need to check on table() since the parentheses were removed by the regexp
if not uri.table().startswith('(') and not uri.table().endswith(')'):
schema = uri.schema()
if schema and schema.upper() != 'PUBLIC':
sql = 'SELECT * FROM {0}.{1}'.format(self.db.connector.quoteId(schema), self.db.connector.quoteId(sql))

0 comments on commit 1b2d885

Please sign in to comment.
You can’t perform that action at this time.