mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure invalid options can't be selected on triggers on views. Fixes #2945
This commit is contained in:
parent
90629da524
commit
49dfd6fe31
@ -7,7 +7,7 @@ SELECT t.oid,t.tgname AS name, t.xmin, t.*, relname, CASE WHEN relkind = 'r' THE
|
|||||||
{% if datlastsysoid %}
|
{% if datlastsysoid %}
|
||||||
(CASE WHEN t.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_trigger,
|
(CASE WHEN t.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_trigger,
|
||||||
{% endif %}
|
{% endif %}
|
||||||
(CASE WHEN tgconstraint != 0::OID THEN true ElSE false END) AS is_constarint,
|
(CASE WHEN tgconstraint != 0::OID THEN true ElSE false END) AS is_constraint_trigger,
|
||||||
(CASE WHEN tgenabled = 'O' THEN true ElSE false END) AS is_enable_trigger
|
(CASE WHEN tgenabled = 'O' THEN true ElSE false END) AS is_enable_trigger
|
||||||
FROM pg_trigger t
|
FROM pg_trigger t
|
||||||
JOIN pg_class cl ON cl.oid=tgrelid
|
JOIN pg_class cl ON cl.oid=tgrelid
|
||||||
|
@ -249,8 +249,9 @@ define('pgadmin.node.trigger', [
|
|||||||
group: gettext('Definition'),
|
group: gettext('Definition'),
|
||||||
disabled: function(m) {
|
disabled: function(m) {
|
||||||
// Disabled if table is a partitioned table.
|
// Disabled if table is a partitioned table.
|
||||||
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') && m.node_info.table.is_partitioned)
|
_.has(m.node_info.table, 'is_partitioned') && m.node_info.table.is_partitioned) ||
|
||||||
|
_.indexOf(Object.keys(m.node_info), 'view') != -1)
|
||||||
{
|
{
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
m.set('is_constraint_trigger', false);
|
m.set('is_constraint_trigger', false);
|
||||||
@ -258,6 +259,8 @@ define('pgadmin.node.trigger', [
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return m.inSchemaWithModelCheck.apply(this, [m]);
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
id: 'tgdeferrable', label: gettext('Deferrable?'),
|
id: 'tgdeferrable', label: gettext('Deferrable?'),
|
||||||
@ -486,10 +489,6 @@ define('pgadmin.node.trigger', [
|
|||||||
},{
|
},{
|
||||||
id: 'is_sys_trigger', label: gettext('System trigger?'), cell: 'string',
|
id: 'is_sys_trigger', label: gettext('System trigger?'), cell: 'string',
|
||||||
type: 'switch', disabled: 'inSchemaWithModelCheck', mode: ['properties']
|
type: 'switch', disabled: 'inSchemaWithModelCheck', mode: ['properties']
|
||||||
},{
|
|
||||||
id: 'is_constarint', label: gettext('Constraint?'), cell: 'string',
|
|
||||||
type: 'switch', disabled: 'inSchemaWithModelCheck', mode: ['properties'],
|
|
||||||
group: gettext('Definition')
|
|
||||||
},{
|
},{
|
||||||
id: 'description', label: gettext('Comment'), cell: 'string',
|
id: 'description', label: gettext('Comment'), cell: 'string',
|
||||||
type: 'multiline', mode: ['properties', 'create', 'edit'],
|
type: 'multiline', mode: ['properties', 'create', 'edit'],
|
||||||
|
Loading…
Reference in New Issue
Block a user