Ensure that some fields should be disabled for the trigger in edit mode. Fixes #4639

Fixed illegal argument issue in the trigger for EPAS servers. Fixes #5799
pull/37/head
Pradip Parkale 2020-10-20 16:18:34 +05:30 committed by Akshay Joshi
parent 7b9504bdfb
commit 3413a42af4
3 changed files with 24 additions and 14 deletions

View File

@ -18,6 +18,7 @@ Housekeeping
Bug fixes Bug fixes
********* *********
| `Issue #4639 <https://redmine.postgresql.org/issues/4639>`_ - Ensure that some fields should be disabled for the trigger in edit mode.
| `Issue #5858 <https://redmine.postgresql.org/issues/5858>`_ - Ensure that search object functionality works with case insensitive string. | `Issue #5858 <https://redmine.postgresql.org/issues/5858>`_ - Ensure that search object functionality works with case insensitive string.
| `Issue #5895 <https://redmine.postgresql.org/issues/5895>`_ - Fixed an issue where the suffix for Toast table size is not visible in the Statistics tab. | `Issue #5895 <https://redmine.postgresql.org/issues/5895>`_ - Fixed an issue where the suffix for Toast table size is not visible in the Statistics tab.
| `Issue #5911 <https://redmine.postgresql.org/issues/5911>`_ - Ensure that macros should be run on the older version of Safari and Chrome. | `Issue #5911 <https://redmine.postgresql.org/issues/5911>`_ - Ensure that macros should be run on the older version of Safari and Chrome.

View File

@ -209,6 +209,9 @@ define('pgadmin.node.trigger', [
deps: ['is_constraint_trigger'], deps: ['is_constraint_trigger'],
disabled: function(m) { disabled: function(m) {
// Disabled if table is a partitioned table. // Disabled if table is a partitioned table.
if (!m.isNew())
return true;
if (_.has(m, 'node_info') && _.has(m.node_info, 'table') && if (_.has(m, 'node_info') && _.has(m.node_info, 'table') &&
_.has(m.node_info.table, 'is_partitioned') && _.has(m.node_info.table, 'is_partitioned') &&
m.node_info.table.is_partitioned && m.node_info.server.version < 110000 m.node_info.table.is_partitioned && m.node_info.server.version < 110000
@ -367,6 +370,8 @@ define('pgadmin.node.trigger', [
}, },
control: 'select2', select2: { allowClear: false, width: '100%' }, control: 'select2', select2: { allowClear: false, width: '100%' },
disabled: function(m) { disabled: function(m) {
if (!m.isNew())
return true;
// If contraint trigger is set to True then only enable it // If contraint trigger is set to True then only enable it
var is_constraint_trigger = m.get('is_constraint_trigger'); var is_constraint_trigger = m.get('is_constraint_trigger');
if(!m.inSchemaWithModelCheck.apply(this, [m])) { if(!m.inSchemaWithModelCheck.apply(this, [m])) {
@ -399,7 +404,7 @@ define('pgadmin.node.trigger', [
controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12', controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12',
disabled: function(m) { disabled: function(m) {
var evn_insert = m.get('evnt_insert'); var evn_insert = m.get('evnt_insert');
if (!_.isUndefined(evn_insert) && m.node_info['server']['server_type'] == 'ppas') if (!_.isUndefined(evn_insert) && m.node_info['server']['server_type'] == 'ppas' && m.isNew())
return false; return false;
return m.inSchemaWithModelCheck.apply(this, [m]); return m.inSchemaWithModelCheck.apply(this, [m]);
}, },
@ -412,7 +417,7 @@ define('pgadmin.node.trigger', [
controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12', controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12',
disabled: function(m) { disabled: function(m) {
var evn_update = m.get('evnt_update'); var evn_update = m.get('evnt_update');
if (!_.isUndefined(evn_update) && m.node_info['server']['server_type'] == 'ppas') if (!_.isUndefined(evn_update) && m.node_info['server']['server_type'] == 'ppas' && m.isNew())
return false; return false;
return m.inSchemaWithModelCheck.apply(this, [m]); return m.inSchemaWithModelCheck.apply(this, [m]);
}, },
@ -425,13 +430,13 @@ define('pgadmin.node.trigger', [
controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12', controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12',
disabled: function(m) { disabled: function(m) {
var evn_delete = m.get('evnt_delete'); var evn_delete = m.get('evnt_delete');
if (!_.isUndefined(evn_delete) && m.node_info['server']['server_type'] == 'ppas') if (!_.isUndefined(evn_delete) && m.node_info['server']['server_type'] == 'ppas' && m.isNew())
return false; return false;
return m.inSchemaWithModelCheck.apply(this, [m]); return m.inSchemaWithModelCheck.apply(this, [m]);
}, },
},{ },{
id: 'evnt_truncate', label: gettext('TRUNCATE'), id: 'evnt_truncate', label: gettext('TRUNCATE'),
type: 'switch', group: gettext('Events'), type: 'switch', group: gettext('Events'),deps: ['is_row_trigger', 'is_constraint_trigger'],
extraToggleClasses: 'pg-el-sm-6', extraToggleClasses: 'pg-el-sm-6',
controlLabelClassName: 'control-label pg-el-sm-5 pg-el-12', controlLabelClassName: 'control-label pg-el-sm-5 pg-el-12',
controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12', controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12',
@ -439,18 +444,19 @@ define('pgadmin.node.trigger', [
var is_constraint_trigger = m.get('is_constraint_trigger'), var is_constraint_trigger = m.get('is_constraint_trigger'),
is_row_trigger = m.get('is_row_trigger'), is_row_trigger = m.get('is_row_trigger'),
server_type = m.node_info['server']['server_type']; server_type = m.node_info['server']['server_type'];
if(!m.inSchemaWithModelCheck.apply(this, [m])) { if (is_row_trigger == true){
// We will enabale truncate only for EDB PPAS setTimeout(function(){
// and both triggers row & constarint are set to false m.set('evnt_truncate', false);
return (server_type !== 'ppas' || },10);
_.isUndefined(is_constraint_trigger) ||
_.isUndefined(is_row_trigger) ||
is_constraint_trigger !== false ||
is_row_trigger !== false);
} else {
// Disable it
return true; return true;
} }
if (server_type === 'ppas' &&
!_.isUndefined(is_constraint_trigger) &&
!_.isUndefined(is_row_trigger) &&
is_constraint_trigger === false && m.isNew())
return false;
return m.inSchemaWithModelCheck.apply(this, [m]);
}, },
}], }],
},{ },{
@ -588,6 +594,8 @@ define('pgadmin.node.trigger', [
}, },
// Disable/Enable Transition tables // Disable/Enable Transition tables
disableTransition: function(m) { disableTransition: function(m) {
if (!m.isNew())
return true;
var flag = false, var flag = false,
evnt = null, evnt = null,
name = this.name, name = this.name,

View File

@ -105,6 +105,7 @@ def get_trigger_function_and_columns(conn, data, tid,
# with schema name. # with schema name.
if data['lanname'] == 'edbspl': if data['lanname'] == 'edbspl':
data['tfunction'] = 'Inline EDB-SPL' data['tfunction'] = 'Inline EDB-SPL'
data['tgargs'] = None
else: else:
SQL = render_template("/".join( SQL = render_template("/".join(
[template_path, 'get_triggerfunctions.sql']), [template_path, 'get_triggerfunctions.sql']),