Skip to content

Commit

Permalink
[db-manager] Allow multiline filters in sql window
Browse files Browse the repository at this point in the history
Fixes #19956 - Update SQL layer results in invalid SQL expression
  • Loading branch information
elpaso committed Sep 27, 2018
1 parent a1d130a commit 94ded32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/plugins/db_manager/dlg_sql_layer_window.py
Expand Up @@ -145,11 +145,11 @@ def __init__(self, iface, layer, parent=None):
# First the SQL from QgsDataSourceUri table
sql = uri.table()
if uri.keyColumn() == '_uid_':
match = re.search('^\(SELECT .+ AS _uid_,\* FROM \((.*)\) AS _subq_.+_\s*\)$', sql, re.S)
match = re.search(r'^\(SELECT .+ AS _uid_,\* FROM \((.*)\) AS _subq_.+_\s*\)$', sql, re.S | re.X)
if match:
sql = match.group(1)
else:
match = re.search('^\((SELECT .+ FROM .+)\)$', sql, re.S)
match = re.search(r'^\((SELECT .+ FROM .+)\)$', sql, re.S | re.X)
if match:
sql = match.group(1)
# Need to check on table() since the parentheses were removed by the regexp
Expand Down

0 comments on commit 94ded32

Please sign in to comment.