Fix generation of reverse engineered SQL for Rules. Fixes #4586
BIN
docs/en_US/images/rule_commands.png
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
docs/en_US/images/rule_condition.png
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
docs/en_US/images/rule_definition.png
Executable file → Normal file
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 38 KiB |
BIN
docs/en_US/images/rule_general.png
Executable file → Normal file
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 42 KiB |
BIN
docs/en_US/images/rule_sql.png
Executable file → Normal file
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 124 KiB |
@ -48,3 +48,4 @@ Bug fixes
|
||||
| `Issue #4581 <https://redmine.postgresql.org/issues/4581>`_ - Ensure the comment on a Primary Key constraint can be edited under the Table node.
|
||||
| `Issue #4582 <https://redmine.postgresql.org/issues/4582>`_ - Fix console error when changing kind(SQL/BATCH) for pgAgent job step.
|
||||
| `Issue #4585 <https://redmine.postgresql.org/issues/4585>`_ - Fix double click issue to expand the contents of a cell if the resultset was not editable.
|
||||
| `Issue #4586 <https://redmine.postgresql.org/issues/4586>`_ - Fix generation of reverse engineered SQL for Rules.
|
@ -9,8 +9,8 @@ A PostgreSQL rule allows you to define an additional action that will be
|
||||
performed when a SELECT, INSERT, UPDATE, or DELETE is performed against a table.
|
||||
|
||||
The *Rule* dialog organizes the development of a rule through the *General*,
|
||||
and *Definition* tabs. The *SQL* tab displays the SQL code generated by dialog
|
||||
selections.
|
||||
*Definition*, *Condition*, *Commands* tabs. The *SQL* tab displays the SQL code
|
||||
generated by dialog selections.
|
||||
|
||||
.. image:: images/rule_general.png
|
||||
:alt: Rule dialog general tab
|
||||
@ -36,10 +36,22 @@ Use the fields in the *Definition* tab to write parameters:
|
||||
* Move the *Do Instead* switch to *Yes* indicate that the commands should be
|
||||
executed instead of the original command; if Do Instead specifies *No*, the
|
||||
rule will be invoked in addition to the original command.
|
||||
* Specify a SQL conditional expression that returns a boolean value in the
|
||||
*Condition* editor.
|
||||
* Provide a command in the *Commands* editor that defines the action performed
|
||||
by the rule.
|
||||
|
||||
Click the *Condition* tab to continue.
|
||||
|
||||
.. image:: images/rule_condition.png
|
||||
:alt: Rule dialog condition tab
|
||||
:align: center
|
||||
|
||||
Specify a SQL conditional expression that returns a boolean value in the editor.
|
||||
|
||||
Click the *Commands* tab to continue.
|
||||
|
||||
.. image:: images/rule_commands.png
|
||||
:alt: Rule dialog commands tab
|
||||
:align: center
|
||||
|
||||
Provide a command in the editor that defines the action performed by the rule.
|
||||
|
||||
Click the *SQL* tab to continue.
|
||||
|
||||
|
@ -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?'),
|
||||
|
@ -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 ''
|
||||
|