Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 1b2d885
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/plugins/db_manager/dlg_sql_layer_window.py
Expand Up @@ -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))
Expand Down

0 comments on commit 1b2d885

Please sign in to comment.