mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-09 23:15:58 -06:00
Added check to enable/disable Concurrently and Finalize menu of Detach Partition. #6369
This commit is contained in:
parent
6b232ba7e8
commit
c12f229c64
@ -307,7 +307,8 @@ class PartitionsView(BaseTableView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
parent_schema_id=scid,
|
||||
schema_id=row['schema_id'],
|
||||
schema_name=row['schema_name'],
|
||||
description=row['description']
|
||||
description=row['description'],
|
||||
is_detach_pending=row['inhdetachpending']
|
||||
)
|
||||
|
||||
if ptid is not None:
|
||||
|
@ -101,12 +101,24 @@ function(
|
||||
name: 'detach_partition_concurrently', node: 'partition', module: this,
|
||||
applies: ['object', 'context'], callback: 'detach_partition_concurrently',
|
||||
category: gettext('Detach Partition'), priority: 2, label: gettext('Concurrently'),
|
||||
enable: 'canDetach'
|
||||
enable: function(itemData, item) {
|
||||
let treeData = pgBrowser.tree.getTreeNodeHierarchy(item),
|
||||
server = treeData['server'],
|
||||
partition = treeData['partition'];
|
||||
|
||||
return (server && server.version >= 140000 && !partition.is_detach_pending);
|
||||
}
|
||||
},{
|
||||
name: 'detach_partition_finalize', node: 'partition', module: this,
|
||||
applies: ['object', 'context'], callback: 'detach_partition_finalize',
|
||||
category: gettext('Detach Partition'), priority: 2, label: gettext('Finalize'),
|
||||
enable: 'canDetach'
|
||||
enable: function(itemData, item) {
|
||||
let treeData = pgBrowser.tree.getTreeNodeHierarchy(item),
|
||||
server = treeData['server'],
|
||||
partition = treeData['partition'];
|
||||
|
||||
return (server && server.version >= 140000 && partition.is_detach_pending);
|
||||
}
|
||||
},{
|
||||
name: 'count_table_rows', node: 'partition', module: pgBrowser.Nodes['table'],
|
||||
applies: ['object', 'context'], callback: 'count_table_rows',
|
||||
@ -323,12 +335,6 @@ function(
|
||||
return (itemData.tigger_count > 0 && itemData.has_enable_triggers > 0);
|
||||
}
|
||||
},
|
||||
canDetach: function(itemData, item) {
|
||||
let treeData = pgBrowser.tree.getTreeNodeHierarchy(item),
|
||||
server = treeData['server'];
|
||||
|
||||
return (server && server.version >= 140000);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ SELECT rel.oid, rel.relname AS name,
|
||||
substring(pg_catalog.array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_max_age=([0-9]*)') AS toast_autovacuum_freeze_max_age,
|
||||
substring(pg_catalog.array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_table_age=([0-9]*)') AS toast_autovacuum_freeze_table_age,
|
||||
rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, rel.reloftype, typ.typname,
|
||||
typ.typrelid AS typoid, des.description, pg_catalog.pg_get_userbyid(rel.relowner) AS relowner
|
||||
typ.typrelid AS typoid, des.description, pg_catalog.pg_get_userbyid(rel.relowner) AS relowner, inh.inhdetachpending
|
||||
FROM
|
||||
(SELECT * FROM pg_catalog.pg_inherits WHERE inhparent = {{ tid }}::oid) inh
|
||||
LEFT JOIN pg_catalog.pg_class rel ON inh.inhrelid = rel.oid
|
||||
|
Loading…
Reference in New Issue
Block a user