mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed SQL for when clause while creating Trigger. Fixes #3837
This commit is contained in:
parent
dec43d98dc
commit
6bbcaf6b27
@ -17,4 +17,5 @@ Bug fixes
|
||||
| `Bug #3453 <https://redmine.postgresql.org/issues/3453>`_ - Fixed SQL for foreign table options.
|
||||
| `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 #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.
|
@ -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 %}
|
||||
{% if data.whenclause %}
|
||||
|
||||
WHEN {{ data.whenclause }}{% endif %}
|
||||
WHEN ({{ data.whenclause }}){% endif %}
|
||||
|
||||
{% 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%};
|
||||
|
@ -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,
|
||||
nspname, des.description, l.lanname, p.prosrc, p.proname AS tfunction,
|
||||
COALESCE(substring(pg_get_triggerdef(t.oid), 'WHEN (.*) EXECUTE PROCEDURE'),
|
||||
substring(pg_get_triggerdef(t.oid), 'WHEN (.*) \\$trigger')) AS whenclause,
|
||||
trim(pg_catalog.pg_get_expr(t.tgqual, t.tgrelid), '()') AS whenclause,
|
||||
-- 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,
|
||||
{% if datlastsysoid %}
|
||||
|
@ -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,
|
||||
nspname, des.description, l.lanname, p.prosrc, p.proname AS tfunction,
|
||||
COALESCE(substring(pg_get_triggerdef(t.oid), 'WHEN (.*) EXECUTE PROCEDURE'),
|
||||
substring(pg_get_triggerdef(t.oid), 'WHEN (.*) \\$trigger')) AS whenclause,
|
||||
trim(pg_catalog.pg_get_expr(t.tgqual, t.tgrelid),'()') AS whenclause,
|
||||
-- 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,
|
||||
{% if datlastsysoid %}
|
||||
|
@ -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 %}
|
||||
{% if data.whenclause %}
|
||||
|
||||
WHEN {{ data.whenclause }}{% endif %}
|
||||
WHEN ({{ data.whenclause }}){% endif %}
|
||||
|
||||
{% 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%};
|
||||
@ -29,4 +29,4 @@ CREATE{% if data.is_constraint_trigger %} CONSTRAINT{% endif %} TRIGGER {{ conn|
|
||||
{% if data.description %}
|
||||
COMMENT ON TRIGGER {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(data.schema, data.table) }}
|
||||
IS {{data.description|qtLiteral}};
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
@ -17,11 +17,10 @@ define('pgadmin.node.trigger', [
|
||||
gettext, url_for, $, _, S, pgAdmin, pgBrowser, Backform, alertify,
|
||||
SchemaChildTreeNode
|
||||
) {
|
||||
|
||||
Backform.CustomSwitchControl = Backform.SwitchControl.extend({
|
||||
template: _.template([
|
||||
'<label class="<%=Backform.controlLabelClassName%> custom_switch_label_class"><%=label%></label>',
|
||||
'<div class="<%=Backform.controlsClassName%> custom_switch_control_class">',
|
||||
'<label class="control-label pg-el-sm-6 pg-el-12"><%=label%></label>',
|
||||
'<div class="pgadmin-controls pg-el-sm-6 pg-el-12">',
|
||||
' <div class="checkbox">',
|
||||
' <label>',
|
||||
' <input type="checkbox" class="<%=extraClasses.join(\' \')%>"',
|
||||
@ -34,7 +33,7 @@ define('pgadmin.node.trigger', [
|
||||
' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
|
||||
'<% } %>',
|
||||
].join('\n')),
|
||||
className: 'pgadmin-control-group form-group col-6',
|
||||
className: 'pgadmin-control-group form-group col-6 row',
|
||||
});
|
||||
|
||||
if (!pgBrowser.Nodes['coll-trigger']) {
|
||||
@ -57,7 +56,7 @@ define('pgadmin.node.trigger', [
|
||||
label: gettext('Trigger'),
|
||||
hasSQL: true,
|
||||
hasDepends: true,
|
||||
width: '650px',
|
||||
width: pgBrowser.stdW.sm + 'px',
|
||||
sqlAlterHelp: 'sql-altertrigger.html',
|
||||
sqlCreateHelp: 'sql-createtrigger.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'],
|
||||
label: gettext('Events'), group: gettext('Events'),
|
||||
label: gettext('Events'), group: gettext('Events'), contentClass: 'row',
|
||||
schema:[{
|
||||
id: 'evnt_insert', label: gettext('INSERT'),
|
||||
type: 'switch', mode: ['create','edit', 'properties'],
|
||||
|
@ -421,6 +421,9 @@
|
||||
border: $panel-border;
|
||||
border-radius: $card-border-radius;
|
||||
background-color: $color-bg-theme;
|
||||
fieldset.inline-fieldset {
|
||||
background: $color-bg-theme;
|
||||
}
|
||||
}
|
||||
|
||||
fieldset.inline-fieldset {
|
||||
|
Loading…
Reference in New Issue
Block a user