Skip to content

Commit a8bf1b8

Browse files
committed
[dbmanager] Fix Update SQL Layer converts query to table name
Fixes #19843
1 parent f208191 commit a8bf1b8

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)