Fixed SQL for when clause while creating Trigger. Fixes #3837

This commit is contained in:
Aditya Toshniwal 2019-01-16 14:46:34 +05:30 committed by Akshay Joshi
parent dec43d98dc
commit 6bbcaf6b27
7 changed files with 15 additions and 14 deletions

View File

@ -18,3 +18,4 @@ Bug fixes
| `Bug #3475 <https://redmine.postgresql.org/issues/3475>`_ - Fixed execution time to show Hours part for long running queries in Query Tool. | `Bug #3475 <https://redmine.postgresql.org/issues/3475>`_ - Fixed execution time to show Hours part for long running queries in Query Tool.
| `Bug #3693 <https://redmine.postgresql.org/issues/3693>`_ - Proper error should be thrown when server group is created with existing name. | `Bug #3693 <https://redmine.postgresql.org/issues/3693>`_ - Proper error should be thrown when server group is created with existing name.
| `Bug #3695 <https://redmine.postgresql.org/issues/3695>`_ - Ensure long string should be wrap in alertify dialogs. | `Bug #3695 <https://redmine.postgresql.org/issues/3695>`_ - Ensure long string should be wrap in alertify dialogs.
| `Bug #3837 <https://redmine.postgresql.org/issues/3837>`_ - Fixed SQL for when clause while creating Trigger.

View File

@ -25,7 +25,7 @@ CREATE{% if data.is_constraint_trigger %} CONSTRAINT{% endif %} TRIGGER {{ conn|
FOR EACH{% if data.is_row_trigger %} ROW{% else %} STATEMENT{% endif %} FOR EACH{% if data.is_row_trigger %} ROW{% else %} STATEMENT{% endif %}
{% if data.whenclause %} {% if data.whenclause %}
WHEN {{ data.whenclause }}{% endif %} WHEN ({{ data.whenclause }}){% endif %}
{% if data.prosrc is defined and {% if data.prosrc is defined and
(data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL') %}{{ data.prosrc }}{% else %}EXECUTE PROCEDURE {{ data.tfunction }}{% if data.tgargs %}({{ data.tgargs }}){% else %}(){% endif%}{% endif%}; (data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL') %}{{ data.prosrc }}{% else %}EXECUTE PROCEDURE {{ data.tfunction }}{% if data.tgargs %}({{ data.tgargs }}){% else %}(){% endif%}{% endif%};

View File

@ -1,7 +1,6 @@
SELECT t.oid,t.tgname AS name, t.xmin, t.*, relname, CASE WHEN relkind = 'r' THEN TRUE ELSE FALSE END AS parentistable, SELECT t.oid,t.tgname AS name, t.xmin, t.*, relname, CASE WHEN relkind = 'r' THEN TRUE ELSE FALSE END AS parentistable,
nspname, des.description, l.lanname, p.prosrc, p.proname AS tfunction, nspname, des.description, l.lanname, p.prosrc, p.proname AS tfunction,
COALESCE(substring(pg_get_triggerdef(t.oid), 'WHEN (.*) EXECUTE PROCEDURE'), trim(pg_catalog.pg_get_expr(t.tgqual, t.tgrelid), '()') AS whenclause,
substring(pg_get_triggerdef(t.oid), 'WHEN (.*) \\$trigger')) AS whenclause,
-- We need to convert tgargs column bytea datatype to array datatype -- We need to convert tgargs column bytea datatype to array datatype
(string_to_array(encode(tgargs, 'escape'), E'\\000')::text[])[1:tgnargs] AS custom_tgargs, (string_to_array(encode(tgargs, 'escape'), E'\\000')::text[])[1:tgnargs] AS custom_tgargs,
{% if datlastsysoid %} {% if datlastsysoid %}

View File

@ -1,7 +1,6 @@
SELECT t.oid,t.tgname AS name, t.xmin, t.*, relname, CASE WHEN relkind = 'r' THEN TRUE ELSE FALSE END AS parentistable, SELECT t.oid,t.tgname AS name, t.xmin, t.*, relname, CASE WHEN relkind = 'r' THEN TRUE ELSE FALSE END AS parentistable,
nspname, des.description, l.lanname, p.prosrc, p.proname AS tfunction, nspname, des.description, l.lanname, p.prosrc, p.proname AS tfunction,
COALESCE(substring(pg_get_triggerdef(t.oid), 'WHEN (.*) EXECUTE PROCEDURE'), trim(pg_catalog.pg_get_expr(t.tgqual, t.tgrelid),'()') AS whenclause,
substring(pg_get_triggerdef(t.oid), 'WHEN (.*) \\$trigger')) AS whenclause,
-- We need to convert tgargs column bytea datatype to array datatype -- We need to convert tgargs column bytea datatype to array datatype
(string_to_array(encode(tgargs, 'escape'), E'\\000')::text[])[1:tgnargs] AS custom_tgargs, (string_to_array(encode(tgargs, 'escape'), E'\\000')::text[])[1:tgnargs] AS custom_tgargs,
{% if datlastsysoid %} {% if datlastsysoid %}

View File

@ -21,7 +21,7 @@ CREATE{% if data.is_constraint_trigger %} CONSTRAINT{% endif %} TRIGGER {{ conn|
FOR EACH{% if data.is_row_trigger %} ROW{% else %} STATEMENT{% endif %} FOR EACH{% if data.is_row_trigger %} ROW{% else %} STATEMENT{% endif %}
{% if data.whenclause %} {% if data.whenclause %}
WHEN {{ data.whenclause }}{% endif %} WHEN ({{ data.whenclause }}){% endif %}
{% if data.prosrc is defined and {% if data.prosrc is defined and
(data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL') %}{{ data.prosrc }}{% else %}EXECUTE PROCEDURE {{ data.tfunction }}{% if data.tgargs %}({{ data.tgargs }}){% else %}(){% endif%}{% endif%}; (data.lanname == 'edbspl' or data.tfunction == 'Inline EDB-SPL') %}{{ data.prosrc }}{% else %}EXECUTE PROCEDURE {{ data.tfunction }}{% if data.tgargs %}({{ data.tgargs }}){% else %}(){% endif%}{% endif%};

View File

@ -17,11 +17,10 @@ define('pgadmin.node.trigger', [
gettext, url_for, $, _, S, pgAdmin, pgBrowser, Backform, alertify, gettext, url_for, $, _, S, pgAdmin, pgBrowser, Backform, alertify,
SchemaChildTreeNode SchemaChildTreeNode
) { ) {
Backform.CustomSwitchControl = Backform.SwitchControl.extend({ Backform.CustomSwitchControl = Backform.SwitchControl.extend({
template: _.template([ template: _.template([
'<label class="<%=Backform.controlLabelClassName%> custom_switch_label_class"><%=label%></label>', '<label class="control-label pg-el-sm-6 pg-el-12"><%=label%></label>',
'<div class="<%=Backform.controlsClassName%> custom_switch_control_class">', '<div class="pgadmin-controls pg-el-sm-6 pg-el-12">',
' <div class="checkbox">', ' <div class="checkbox">',
' <label>', ' <label>',
' <input type="checkbox" class="<%=extraClasses.join(\' \')%>"', ' <input type="checkbox" class="<%=extraClasses.join(\' \')%>"',
@ -34,7 +33,7 @@ define('pgadmin.node.trigger', [
' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>', ' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
'<% } %>', '<% } %>',
].join('\n')), ].join('\n')),
className: 'pgadmin-control-group form-group col-6', className: 'pgadmin-control-group form-group col-6 row',
}); });
if (!pgBrowser.Nodes['coll-trigger']) { if (!pgBrowser.Nodes['coll-trigger']) {
@ -57,7 +56,7 @@ define('pgadmin.node.trigger', [
label: gettext('Trigger'), label: gettext('Trigger'),
hasSQL: true, hasSQL: true,
hasDepends: true, hasDepends: true,
width: '650px', width: pgBrowser.stdW.sm + 'px',
sqlAlterHelp: 'sql-altertrigger.html', sqlAlterHelp: 'sql-altertrigger.html',
sqlCreateHelp: 'sql-createtrigger.html', sqlCreateHelp: 'sql-createtrigger.html',
dialogHelp: url_for('help.static', {'filename': 'trigger_dialog.html'}), dialogHelp: url_for('help.static', {'filename': 'trigger_dialog.html'}),
@ -391,7 +390,7 @@ define('pgadmin.node.trigger', [
}, },
},{ },{
type: 'nested', control: 'fieldset', mode: ['create','edit', 'properties'], type: 'nested', control: 'fieldset', mode: ['create','edit', 'properties'],
label: gettext('Events'), group: gettext('Events'), label: gettext('Events'), group: gettext('Events'), contentClass: 'row',
schema:[{ schema:[{
id: 'evnt_insert', label: gettext('INSERT'), id: 'evnt_insert', label: gettext('INSERT'),
type: 'switch', mode: ['create','edit', 'properties'], type: 'switch', mode: ['create','edit', 'properties'],

View File

@ -421,6 +421,9 @@
border: $panel-border; border: $panel-border;
border-radius: $card-border-radius; border-radius: $card-border-radius;
background-color: $color-bg-theme; background-color: $color-bg-theme;
fieldset.inline-fieldset {
background: $color-bg-theme;
}
} }
fieldset.inline-fieldset { fieldset.inline-fieldset {