Fix generation of reverse engineered SQL for Rules. Fixes #4586

This commit is contained in:
Akshay Joshi
2019-08-12 14:27:02 +05:30
parent a51de78292
commit 35bbee3023
9 changed files with 27 additions and 12 deletions

View File

@@ -180,13 +180,15 @@ define('pgadmin.node.rule', [
},
{
id: 'condition', label: gettext('Condition'),
type: 'text', group: gettext('Definition'),
control: Backform.SqlFieldControl,
type: 'text', group: gettext('Condition'),
tabPanelCodeClass: 'sql-code-control',
control: Backform.SqlCodeControl,
},
{
id: 'statements', label: gettext('Commands'),
type: 'text', group: gettext('Definition'),
control: Backform.SqlFieldControl,
type: 'text', group: gettext('Commands'),
tabPanelCodeClass: 'sql-code-control',
control: Backform.SqlCodeControl,
},
{
id: 'system_rule', label: gettext('System rule?'),

View File

@@ -423,7 +423,7 @@ def parse_rule_definition(res):
instead = True if instead_data is not None else False
# Parse data for condition
condition_match = re.search(r"(?:WHERE)\s+(.*)\s+(?:DO)", data_def)
condition_match = re.search(r"(?:WHERE)\s+([\s\S]*)\s+(?:DO)", data_def)
condition_data = condition_match.group(1) \
if condition_match is not None else None
condition = condition_data if condition_data is not None else ''