mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
Merge pull request #7966 from elpaso/bugfix-19843-dbmanager-quoted-sql
[dbmanager] Fix Update SQL Layer converts query to table name
This commit is contained in:
commit
1b2d885a03
@ -152,7 +152,8 @@ class DlgSqlLayerWindow(QWidget, Ui_Dialog):
|
|||||||
match = re.search('^\((SELECT .+ FROM .+)\)$', sql, re.S)
|
match = re.search('^\((SELECT .+ FROM .+)\)$', sql, re.S)
|
||||||
if match:
|
if match:
|
||||||
sql = match.group(1)
|
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()
|
schema = uri.schema()
|
||||||
if schema and schema.upper() != 'PUBLIC':
|
if schema and schema.upper() != 'PUBLIC':
|
||||||
sql = 'SELECT * FROM {0}.{1}'.format(self.db.connector.quoteId(schema), self.db.connector.quoteId(sql))
|
sql = 'SELECT * FROM {0}.{1}'.format(self.db.connector.quoteId(schema), self.db.connector.quoteId(sql))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user