Skip to content
Permalink
Browse files

[db-manager] Allow multiline filters in sql window

Fixes #19956 - Update SQL layer results in invalid SQL expression
  • Loading branch information
elpaso committed Sep 27, 2018
1 parent a1d130a commit 94ded32f4ee548c3fbc798b2fd81fd81c8ca11bf
Showing with 2 additions and 2 deletions.
  1. +2 −2 python/plugins/db_manager/dlg_sql_layer_window.py
@@ -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

0 comments on commit 94ded32

Please sign in to comment.
You can’t perform that action at this time.