Skip to content

Commit 1b2d885

Browse files
authoredSep 21, 2018
Merge pull request #7966 from elpaso/bugfix-19843-dbmanager-quoted-sql
[dbmanager] Fix Update SQL Layer converts query to table name
2 parents 936b0c1 + a8bf1b8 commit 1b2d885

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎python/plugins/db_manager/dlg_sql_layer_window.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ def __init__(self, iface, layer, parent=None):
152152
match = re.search('^\((SELECT .+ FROM .+)\)$', sql, re.S)
153153
if match:
154154
sql = match.group(1)
155-
if not sql.startswith('(') and not sql.endswith(')'):
155+
# Need to check on table() since the parentheses were removed by the regexp
156+
if not uri.table().startswith('(') and not uri.table().endswith(')'):
156157
schema = uri.schema()
157158
if schema and schema.upper() != 'PUBLIC':
158159
sql = 'SELECT * FROM {0}.{1}'.format(self.db.connector.quoteId(schema), self.db.connector.quoteId(sql))

0 commit comments

Comments
 (0)
Please sign in to comment.