mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix custom autovacuum configuration for Materialized Views. Fixes #4110
This commit is contained in:
parent
fe6e5e3c45
commit
d286bada5c
@ -67,3 +67,4 @@ Bug fixes
|
||||
| `Bug #4100 <https://redmine.postgresql.org/issues/4100>`_ - Ensure sequences can be created with increment, start, minimum and maximum options set.
|
||||
| `Bug #4105 <https://redmine.postgresql.org/issues/4105>`_ - Fix an issue where JSON data would not be rendered in the Query Tool.
|
||||
| `Bug #4109 <https://redmine.postgresql.org/issues/4109>`_ - Ensure View/Materialized View node should be visible after updating any property.
|
||||
| `Bug #4110 <https://redmine.postgresql.org/issues/4110>`_ - Fix custom autovacuum configuration for Materialized Views.
|
@ -81,10 +81,11 @@ define('pgadmin.node.schema', [
|
||||
var grid = self.grid = new Backgrid.Grid({
|
||||
columns: self.grid_columns,
|
||||
collection: self.model.get(self.field.get('name')),
|
||||
className: 'backgrid table-bordered table-noouter-border table-hover',
|
||||
className: 'backgrid table table-bordered table-noouter-border table-hover',
|
||||
});
|
||||
|
||||
// render grid
|
||||
self.$el.addClass('mb-0');
|
||||
self.$el.append($(gridBody).append(grid.render().$el));
|
||||
|
||||
return self;
|
||||
@ -158,6 +159,14 @@ define('pgadmin.node.schema', [
|
||||
disabled: function(m) {
|
||||
if(!m.top.inSchema.apply(this, [m]) &&
|
||||
m.get('autovacuum_custom') == true) {
|
||||
|
||||
// If reloptions is null then set the autovacuum_enabled to true.
|
||||
if (!_.isUndefined(m.get('reloptions')) &&
|
||||
_.isNull(m.get('reloptions'))) {
|
||||
setTimeout(function() {
|
||||
m.set('autovacuum_enabled', true);
|
||||
}, 10);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -167,6 +176,22 @@ define('pgadmin.node.schema', [
|
||||
}, 10);
|
||||
return true;
|
||||
},
|
||||
control: Backform.SwitchControl.extend({
|
||||
onChange: function() {
|
||||
Backform.SwitchControl.prototype.onChange.apply(this, arguments);
|
||||
|
||||
let m = this.model;
|
||||
// If value of autovacuum_enabled is false and reloptions is null
|
||||
// then we should set the value of autovacuum_custom to false, as
|
||||
// there is no query to run.
|
||||
if (!m.get('autovacuum_enabled') && !_.isUndefined(m.get('reloptions'))
|
||||
&& _.isNull(m.get('reloptions'))) {
|
||||
setTimeout(function() {
|
||||
m.set('autovacuum_custom', false);
|
||||
}, 10);
|
||||
}
|
||||
},
|
||||
}),
|
||||
},{
|
||||
id: 'vacuum_table', label: '',
|
||||
model: Backform.VacuumTableModel, editable: false, type: 'collection',
|
||||
@ -222,6 +247,15 @@ define('pgadmin.node.schema', [
|
||||
// If in schema & in create mode then enable it
|
||||
if(!m.top.inSchema.apply(this, [m]) &&
|
||||
m.get('toast_autovacuum') === true) {
|
||||
|
||||
// If reloptions is null then set the autovacuum_enabled to true.
|
||||
if (!_.isUndefined(m.get('toast_reloptions')) &&
|
||||
_.isNull(m.get('toast_reloptions'))) {
|
||||
setTimeout(function() {
|
||||
m.set('toast_autovacuum_enabled', true);
|
||||
}, 10);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -233,6 +267,22 @@ define('pgadmin.node.schema', [
|
||||
}
|
||||
return true;
|
||||
},
|
||||
control: Backform.SwitchControl.extend({
|
||||
onChange: function() {
|
||||
Backform.SwitchControl.prototype.onChange.apply(this, arguments);
|
||||
|
||||
let m = this.model;
|
||||
// If value of autovacuum_enabled is false and reloptions is null
|
||||
// then we should set the value of autovacuum_custom to false, as
|
||||
// there is no query to run.
|
||||
if (!m.get('toast_autovacuum_enabled') && !_.isUndefined(m.get('toast_reloptions'))
|
||||
&& _.isNull(m.get('toast_reloptions'))) {
|
||||
setTimeout(function() {
|
||||
m.set('toast_autovacuum', false);
|
||||
}, 10);
|
||||
}
|
||||
},
|
||||
}),
|
||||
},{
|
||||
id: 'vacuum_toast', label: '',
|
||||
model: Backform.VacuumTableModel, type: 'collection', editable: function(m) {
|
||||
|
@ -33,9 +33,9 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS autovacuum_enabled,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS autovacuum_analyze_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS autovacuum_freeze_min_age,
|
||||
@ -44,9 +44,9 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS toast_autovacuum_enabled,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS toast_autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS toast_autovacuum_analyze_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS toast_autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS toast_autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS toast_autovacuum_freeze_min_age,
|
||||
@ -58,8 +58,8 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
typ.typrelid AS typoid,
|
||||
(CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
|
||||
-- Added for pgAdmin4
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
(CASE WHEN array_length(rel.reloptions, 1) > 0 THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN array_length(tst.reloptions, 1) > 0 AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
NULL AS seclabels,
|
||||
(CASE WHEN rel.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_table,
|
||||
-- Added for partition table
|
||||
|
@ -30,9 +30,9 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS autovacuum_enabled,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS autovacuum_analyze_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS autovacuum_freeze_min_age,
|
||||
@ -41,9 +41,9 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS toast_autovacuum_enabled,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS toast_autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS toast_autovacuum_analyze_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS toast_autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS toast_autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS toast_autovacuum_freeze_min_age,
|
||||
@ -55,8 +55,8 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
typ.typrelid AS typoid,
|
||||
(CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
|
||||
-- Added for pgAdmin4
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
(CASE WHEN array_length(rel.reloptions, 1) > 0 THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN array_length(tst.reloptions, 1) > 0 AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
|
||||
(SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE sl1.objoid=rel.oid AND sl1.objsubid=0) AS seclabels,
|
||||
(CASE WHEN rel.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_table,
|
||||
|
@ -30,9 +30,9 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS autovacuum_enabled,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS autovacuum_analyze_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS autovacuum_freeze_min_age,
|
||||
@ -41,9 +41,9 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS toast_autovacuum_enabled,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS toast_autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS toast_autovacuum_analyze_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS toast_autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS toast_autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS toast_autovacuum_freeze_min_age,
|
||||
@ -55,8 +55,8 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
typ.typrelid AS typoid,
|
||||
(CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
|
||||
-- Added for pgAdmin4
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
(CASE WHEN array_length(rel.reloptions, 1) > 0 THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN array_length(tst.reloptions, 1) > 0 AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
|
||||
(SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE sl1.objoid=rel.oid AND sl1.objsubid=0) AS seclabels,
|
||||
(CASE WHEN rel.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_table,
|
||||
|
@ -30,9 +30,9 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS autovacuum_enabled,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS autovacuum_analyze_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS autovacuum_freeze_min_age,
|
||||
@ -41,9 +41,9 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS toast_autovacuum_enabled,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS toast_autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS toast_autovacuum_analyze_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS toast_autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS toast_autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS toast_autovacuum_freeze_min_age,
|
||||
@ -56,8 +56,8 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
typ.typrelid AS typoid,
|
||||
(CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
|
||||
-- Added for pgAdmin4
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
(CASE WHEN array_length(rel.reloptions, 1) > 0 THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN array_length(tst.reloptions, 1) > 0 AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
|
||||
(SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE sl1.objoid=rel.oid AND sl1.objsubid=0) AS seclabels,
|
||||
(CASE WHEN rel.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_table
|
||||
|
@ -29,9 +29,9 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS autovacuum_enabled,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS autovacuum_analyze_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS autovacuum_freeze_min_age,
|
||||
@ -40,9 +40,9 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS toast_autovacuum_enabled,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS toast_autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS toast_autovacuum_analyze_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS toast_autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS toast_autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS toast_autovacuum_freeze_min_age,
|
||||
@ -55,8 +55,8 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
|
||||
typ.typrelid AS typoid,
|
||||
(CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
|
||||
-- Added for pgAdmin4
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
(CASE WHEN array_length(rel.reloptions, 1) > 0 THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN array_length(tst.reloptions, 1) > 0 AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
|
||||
(SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE sl1.objoid=rel.oid AND sl1.objsubid=0) AS seclabels,
|
||||
(CASE WHEN rel.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_table
|
||||
|
@ -32,9 +32,9 @@ FROM (
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS autovacuum_enabled,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS autovacuum_analyze_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS autovacuum_freeze_min_age,
|
||||
@ -43,9 +43,9 @@ FROM (
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS toast_autovacuum_enabled,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS toast_autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS toast_autovacuum_analyze_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS toast_autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS toast_autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS toast_autovacuum_freeze_min_age,
|
||||
@ -57,8 +57,8 @@ FROM (
|
||||
typ.typrelid AS typoid,
|
||||
(CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
|
||||
-- Added for pgAdmin4
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
(CASE WHEN array_length(rel.reloptions, 1) > 0 THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN array_length(tst.reloptions, 1) > 0 AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
|
||||
ARRAY[]::varchar[] AS seclabels,
|
||||
(CASE WHEN rel.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_table
|
||||
|
@ -69,6 +69,12 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
|
||||
{###############################}
|
||||
{## Table AutoVacuum settings ##}
|
||||
{###############################}
|
||||
{% if data.vacuum_table is defined and data.vacuum_table.set_values|length > 0 %}
|
||||
{% set has_vacuum_set = true %}
|
||||
{% endif %}
|
||||
{% if data.vacuum_table is defined and data.vacuum_table.reset_values|length > 0 %}
|
||||
{% set has_vacuum_reset = true %}
|
||||
{% endif %}
|
||||
{% if o_data.autovacuum_custom and data.autovacuum_custom == false %}
|
||||
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} RESET (
|
||||
autovacuum_enabled,
|
||||
@ -82,27 +88,30 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} RESET (
|
||||
autovacuum_freeze_min_age,
|
||||
autovacuum_freeze_table_age
|
||||
);
|
||||
{% elif data.autovacuum_enabled != o_data.autovacuum_enabled %}
|
||||
{% if data.autovacuum_enabled and o_data.autovacuum_enabled == false %}
|
||||
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} SET (
|
||||
autovacuum_enabled = true{% elif data.autovacuum_enabled == false and o_data.autovacuum_enabled %}
|
||||
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} SET (
|
||||
autovacuum_enabled = false{% endif %}
|
||||
{% if (data.autovacuum_enabled or o_data.autovacuum_enabled )and data.vacuum_table and data.vacuum_table.changed|length > 0 %}
|
||||
{% for opt in data.vacuum_table.changed %}{% if opt.name and opt.value %}
|
||||
{% if flag or (data.autovacuum_enabled and o_data.autovacuum_enabled == false) or (data.autovacuum_enabled == false and o_data.autovacuum_enabled) %}
|
||||
,
|
||||
{% else %}
|
||||
{% if data.autovacuum_enabled is defined or has_vacuum_set %}
|
||||
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} SET (
|
||||
{% set flag = true %}
|
||||
{% if data.autovacuum_enabled is defined and data.autovacuum_enabled != o_data.autovacuum_enabled %}
|
||||
autovacuum_enabled = {% if data.autovacuum_enabled %}true{% else %}false{% endif %}{% if has_vacuum_set %},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if has_vacuum_set %}
|
||||
{% for opt in data.vacuum_table.set_values %}{% if opt.name and opt.value %}
|
||||
{{opt.name}} = {{opt.value}}{% if not loop.last %},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{{opt.name}} = {{opt.value}}{% endif %}
|
||||
{% if loop.index == data.vacuum_table.changed|length and (flag or (data.autovacuum_enabled and o_data.autovacuum_enabled == false) or (data.autovacuum_enabled == false and o_data.autovacuum_enabled))%}
|
||||
|
||||
);
|
||||
{% endif %}
|
||||
{% if has_vacuum_reset %}
|
||||
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} RESET (
|
||||
{% for opt in data.vacuum_table.reset_values %}{% if opt.name %}
|
||||
{{opt.name}}{% if not loop.last %},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% elif (data.autovacuum_enabled and o_data.autovacuum_enabled == false) or (data.autovacuum_enabled == false and o_data.autovacuum_enabled) %}
|
||||
|
||||
);
|
||||
{% endif %}
|
||||
@ -110,6 +119,12 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} SET (
|
||||
{#####################################}
|
||||
{## Toast table AutoVacuum settings ##}
|
||||
{#####################################}
|
||||
{% if data.vacuum_toast is defined and data.vacuum_toast.set_values|length > 0 %}
|
||||
{% set has_vacuum_toast_set = true %}
|
||||
{% endif %}
|
||||
{% if data.vacuum_toast is defined and data.vacuum_toast.reset_values|length > 0 %}
|
||||
{% set has_vacuum_toast_reset = true %}
|
||||
{% endif %}
|
||||
{% if o_data.toast_autovacuum and data.toast_autovacuum == false %}
|
||||
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} RESET (
|
||||
toast.autovacuum_enabled,
|
||||
@ -123,27 +138,30 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} RESET (
|
||||
toast.autovacuum_analyze_threshold,
|
||||
toast.autovacuum_analyze_scale_factor
|
||||
);
|
||||
{% elif data.toast_autovacuum_enabled != o_data.toast_autovacuum_enabled %}
|
||||
{% if data.toast_autovacuum_enabled and o_data.toast_autovacuum_enabled == false %}
|
||||
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} SET (
|
||||
toast.autovacuum_enabled = true{% elif data.toast_autovacuum_enabled == false and o_data.toast_autovacuum_enabled %}
|
||||
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} SET (
|
||||
toast.autovacuum_enabled = false{% endif %}
|
||||
{% if (data.toast_autovacuum_enabled or o_data.toast_autovacuum_enabled )and data.vacuum_toast and data.vacuum_toast.changed|length > 0 %}
|
||||
{% for opt in data.vacuum_toast.changed %}{% if opt.name and opt.value %}
|
||||
{% if flag or (data.toast_autovacuum_enabled and o_data.toast_autovacuum_enabled == false) or (data.toast_autovacuum_enabled == false and o_data.toast_autovacuum_enabled) %}
|
||||
,
|
||||
{% else %}
|
||||
{% if data.toast_autovacuum_enabled is defined or has_vacuum_toast_set %}
|
||||
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} SET (
|
||||
{% set flag = true %}
|
||||
{% if data.toast_autovacuum_enabled is defined and data.toast_autovacuum_enabled != o_data.toast_autovacuum_enabled %}
|
||||
toast.autovacuum_enabled = {% if data.toast_autovacuum_enabled %}true{% else %}false{% endif %}{% if has_vacuum_toast_set %},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if has_vacuum_toast_set %}
|
||||
{% for opt in data.vacuum_toast.set_values %}{% if opt.name and opt.value %}
|
||||
toast.{{opt.name}} = {{opt.value}}{% if not loop.last %},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
toast.{{opt.name}} = {{opt.value}}{% endif %}
|
||||
{% if loop.index == data.vacuum_toast.changed|length and (flag or (data.toast_autovacuum_enabled and o_data.toast_autovacuum_enabled == false) or (data.toast_autovacuum_enabled == false and o_data.toast_autovacuum_enabled))%}
|
||||
|
||||
);
|
||||
{% endif %}
|
||||
{% if has_vacuum_toast_reset %}
|
||||
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} RESET (
|
||||
{% for opt in data.vacuum_toast.reset_values %}{% if opt.name %}
|
||||
toast.{{opt.name}}{% if not loop.last %},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% elif (data.toast_autovacuum_enabled and o_data.toast_autovacuum_enabled == false) or (data.toast_autovacuum_enabled == false and o_data.toast_autovacuum_enabled) %}
|
||||
|
||||
);
|
||||
{% endif %}
|
||||
@ -198,4 +216,4 @@ COMMENT ON TABLE {{conn|qtIdent(data.schema, data.name)}}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
@ -38,9 +38,9 @@ FROM (
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS autovacuum_enabled,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS autovacuum_analyze_threshold,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS autovacuum_freeze_min_age,
|
||||
@ -49,9 +49,9 @@ FROM (
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)') = 'true')
|
||||
THEN true ELSE false END) AS toast_autovacuum_enabled,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS toast_autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_threshold=([0-9]*)') AS toast_autovacuum_analyze_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS toast_autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_vacuum_cost_limit=([0-9]*)') AS toast_autovacuum_vacuum_cost_limit,
|
||||
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_min_age=([0-9]*)') AS toast_autovacuum_freeze_min_age,
|
||||
@ -63,8 +63,8 @@ FROM (
|
||||
typ.typrelid AS typoid,
|
||||
(CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
|
||||
-- Added for pgAdmin4
|
||||
(CASE WHEN (substring(array_to_string(rel.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_enabled=([a-z|0-9]*)'))::boolean AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
(CASE WHEN array_length(rel.reloptions, 1) > 0 THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN array_length(tst.reloptions, 1) > 0 AND rel.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum,
|
||||
|
||||
ARRAY[]::varchar[] AS seclabels,
|
||||
(CASE WHEN rel.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_table,
|
||||
|
@ -1712,6 +1712,11 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
set(data['coll_inherits'])
|
||||
)
|
||||
|
||||
# Update the vacuum table settings.
|
||||
self.update_vacuum_settings('vacuum_table', old_data, data)
|
||||
# Update the vacuum toast table settings.
|
||||
self.update_vacuum_settings('vacuum_toast', old_data, data)
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, 'update.sql']),
|
||||
o_data=old_data, data=data, conn=self.conn
|
||||
@ -2454,3 +2459,34 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
return costrnt["idxname"]
|
||||
|
||||
return None
|
||||
|
||||
def update_vacuum_settings(self, vacuum_key, old_data, data):
|
||||
"""
|
||||
This function iterate the vacuum and vacuum toast table and create
|
||||
two new dictionaries. One for set parameter and another for reset.
|
||||
|
||||
:param vacuum_key: Key to be checked.
|
||||
:param old_data: Old data
|
||||
:param data: New data
|
||||
:return:
|
||||
"""
|
||||
|
||||
# Iterate vacuum table
|
||||
if vacuum_key in data and 'changed' in data[vacuum_key] \
|
||||
and vacuum_key in old_data:
|
||||
set_values = []
|
||||
reset_values = []
|
||||
for data_row in data[vacuum_key]['changed']:
|
||||
for old_data_row in old_data[vacuum_key]:
|
||||
if data_row['name'] == old_data_row['name']:
|
||||
if data_row['value'] is not None:
|
||||
set_values.append(data_row)
|
||||
elif data_row['value'] is None and \
|
||||
'value' in old_data_row:
|
||||
reset_values.append(data_row)
|
||||
|
||||
if len(set_values) > 0:
|
||||
data[vacuum_key]['set_values'] = set_values
|
||||
|
||||
if len(reset_values) > 0:
|
||||
data[vacuum_key]['reset_values'] = reset_values
|
||||
|
@ -1595,6 +1595,21 @@ class MViewNode(ViewNode, VacuumSettings):
|
||||
for item in result['vacuum_toast'] if
|
||||
'value' in item.keys() and item['value'] is not None]
|
||||
|
||||
if 'autovacuum_custom' in result and result['autovacuum_custom']:
|
||||
vacuum_table.append(
|
||||
{
|
||||
'name': 'autovacuum_enabled',
|
||||
'value': str(result['autovacuum_enabled'])
|
||||
}
|
||||
)
|
||||
if 'toast_autovacuum' in result and result['toast_autovacuum']:
|
||||
vacuum_table.append(
|
||||
{
|
||||
'name': 'toast.autovacuum_enabled',
|
||||
'value': str(result['toast_autovacuum_enabled'])
|
||||
}
|
||||
)
|
||||
|
||||
# add vacuum_toast dict to vacuum_data only if
|
||||
# toast's autovacuum is enabled
|
||||
if (
|
||||
|
@ -29,11 +29,11 @@ SELECT
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_analyze_threshold=([0-9]*)') AS autovacuum_analyze_threshold,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
@ -49,11 +49,11 @@ SELECT
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS toast_autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_analyze_threshold=([0-9]*)') AS toast_autovacuum_analyze_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS toast_autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
@ -66,10 +66,8 @@ SELECT
|
||||
FROM 'autovacuum_freeze_table_age=([0-9]*)') AS toast_autovacuum_freeze_table_age,
|
||||
c.reloptions AS reloptions, tst.reloptions AS toast_reloptions,
|
||||
(CASE WHEN c.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
|
||||
(CASE WHEN (substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_enabled=([a-z|0-9]*)')) = 'true' THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_enabled=([a-z|0-9]*)')) = 'true' THEN true ELSE false END) AS toast_autovacuum
|
||||
(CASE WHEN array_length(c.reloptions, 1) > 0 THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN array_length(tst.reloptions, 1) > 0 AND c.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum
|
||||
FROM
|
||||
pg_class c
|
||||
LEFT OUTER JOIN pg_namespace nsp on nsp.oid = c.relnamespace
|
||||
|
@ -79,8 +79,7 @@ REFRESH MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} WITH{{ ' NO
|
||||
(data.toast_autovacuum is defined and data.toast_autovacuum|lower == 'false')
|
||||
) %}
|
||||
{% if data.autovacuum_custom|lower == 'false' %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
RESET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
|
||||
autovacuum_enabled,
|
||||
autovacuum_vacuum_threshold,
|
||||
autovacuum_analyze_threshold,
|
||||
@ -108,8 +107,7 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
|
||||
|
||||
{% endif %}
|
||||
{% if data.toast_autovacuum|lower == 'false' %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
RESET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
|
||||
toast.autovacuum_enabled,
|
||||
toast.autovacuum_vacuum_threshold,
|
||||
toast.autovacuum_analyze_threshold,
|
||||
@ -139,8 +137,7 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
|
||||
{% else %}
|
||||
{% if data['vacuum_data']['reset']|length == 0 and
|
||||
data['vacuum_data']['changed']|length == 0 and data['settings']|length > 0 %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
SET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} SET(
|
||||
{% for field in data['settings'] %}
|
||||
{{ field }} = {{ data['settings'][field]|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
|
||||
{% endfor %}
|
||||
@ -148,8 +145,7 @@ SET(
|
||||
|
||||
{% endif %}
|
||||
{% if(data['vacuum_data']['changed']|length > 0) %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }}
|
||||
SET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
|
||||
{% for field in data['vacuum_data']['changed'] %}
|
||||
{% if field.value != None %}
|
||||
{{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
|
||||
@ -158,8 +154,7 @@ SET(
|
||||
);
|
||||
{% endif %}
|
||||
{% if data['vacuum_data']['reset']|length > 0 %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
RESET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
|
||||
{% for field in data['vacuum_data']['reset'] %}
|
||||
{{ field.name }}{% if not loop.last %},{% endif %}{{ '\r' }}
|
||||
{% endfor %}
|
||||
|
@ -29,11 +29,11 @@ SELECT
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_analyze_threshold=([0-9]*)') AS autovacuum_analyze_threshold,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
@ -49,11 +49,11 @@ SELECT
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS toast_autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_analyze_threshold=([0-9]*)') AS toast_autovacuum_analyze_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS toast_autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
@ -66,10 +66,8 @@ SELECT
|
||||
FROM 'autovacuum_freeze_table_age=([0-9]*)') AS toast_autovacuum_freeze_table_age,
|
||||
c.reloptions AS reloptions, tst.reloptions AS toast_reloptions,
|
||||
(CASE WHEN c.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
|
||||
(CASE WHEN (substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_enabled=([a-z|0-9]*)')) = 'true' THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_enabled=([a-z|0-9]*)')) = 'true' THEN true ELSE false END) AS toast_autovacuum
|
||||
(CASE WHEN array_length(c.reloptions, 1) > 0 THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN array_length(tst.reloptions, 1) > 0 AND c.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum
|
||||
FROM
|
||||
pg_class c
|
||||
LEFT OUTER JOIN pg_namespace nsp on nsp.oid = c.relnamespace
|
||||
|
@ -79,8 +79,7 @@ REFRESH MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} WITH{{ ' NO
|
||||
(data.toast_autovacuum is defined and data.toast_autovacuum|lower == 'false')
|
||||
) %}
|
||||
{% if data.autovacuum_custom|lower == 'false' %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
RESET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
|
||||
autovacuum_enabled,
|
||||
autovacuum_vacuum_threshold,
|
||||
autovacuum_analyze_threshold,
|
||||
@ -108,8 +107,7 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
|
||||
|
||||
{% endif %}
|
||||
{% if data.toast_autovacuum|lower == 'false' %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
RESET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
|
||||
toast.autovacuum_enabled,
|
||||
toast.autovacuum_vacuum_threshold,
|
||||
toast.autovacuum_analyze_threshold,
|
||||
@ -139,8 +137,7 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
|
||||
{% else %}
|
||||
{% if data['vacuum_data']['reset']|length == 0 and
|
||||
data['vacuum_data']['changed']|length == 0 and data['settings']|length > 0 %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
SET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} SET(
|
||||
{% for field in data['settings'] %}
|
||||
{{ field }} = {{ data['settings'][field]|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
|
||||
{% endfor %}
|
||||
@ -148,8 +145,7 @@ SET(
|
||||
|
||||
{% endif %}
|
||||
{% if(data['vacuum_data']['changed']|length > 0) %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }}
|
||||
SET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
|
||||
{% for field in data['vacuum_data']['changed'] %}
|
||||
{% if field.value != None %}
|
||||
{{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
|
||||
@ -158,8 +154,7 @@ SET(
|
||||
);
|
||||
{% endif %}
|
||||
{% if data['vacuum_data']['reset']|length > 0 %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
RESET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
|
||||
{% for field in data['vacuum_data']['reset'] %}
|
||||
{{ field.name }}{% if not loop.last %},{% endif %}{{ '\r' }}
|
||||
{% endfor %}
|
||||
|
@ -29,11 +29,11 @@ SELECT
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_analyze_threshold=([0-9]*)') AS autovacuum_analyze_threshold,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(c.reloptions, ',')
|
||||
@ -49,11 +49,11 @@ SELECT
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_threshold=([0-9]*)') AS toast_autovacuum_vacuum_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
FROM 'autovacuum_vacuum_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_vacuum_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_analyze_threshold=([0-9]*)') AS toast_autovacuum_analyze_threshold,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_analyze_scale_factor=([0-9]*[.][0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
FROM 'autovacuum_analyze_scale_factor=([0-9]*[.]?[0-9]*)') AS toast_autovacuum_analyze_scale_factor,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_vacuum_cost_delay=([0-9]*)') AS toast_autovacuum_vacuum_cost_delay,
|
||||
substring(array_to_string(tst.reloptions, ',')
|
||||
@ -66,10 +66,8 @@ SELECT
|
||||
FROM 'autovacuum_freeze_table_age=([0-9]*)') AS toast_autovacuum_freeze_table_age,
|
||||
c.reloptions AS reloptions, tst.reloptions AS toast_reloptions,
|
||||
(CASE WHEN c.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
|
||||
(CASE WHEN (substring(array_to_string(c.reloptions, ',')
|
||||
FROM 'autovacuum_enabled=([a-z|0-9]*)')) = 'true' THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN (substring(array_to_string(tst.reloptions, ',')
|
||||
FROM 'autovacuum_enabled=([a-z|0-9]*)')) = 'true' THEN true ELSE false END) AS toast_autovacuum
|
||||
(CASE WHEN array_length(c.reloptions, 1) > 0 THEN true ELSE false END) AS autovacuum_custom,
|
||||
(CASE WHEN array_length(tst.reloptions, 1) > 0 AND c.reltoastrelid != 0 THEN true ELSE false END) AS toast_autovacuum
|
||||
FROM
|
||||
pg_class c
|
||||
LEFT OUTER JOIN pg_namespace nsp on nsp.oid = c.relnamespace
|
||||
|
@ -79,8 +79,7 @@ REFRESH MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} WITH{{ ' NO
|
||||
(data.toast_autovacuum is defined and data.toast_autovacuum|lower == 'false')
|
||||
) %}
|
||||
{% if data.autovacuum_custom|lower == 'false' %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
RESET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
|
||||
autovacuum_enabled,
|
||||
autovacuum_vacuum_threshold,
|
||||
autovacuum_analyze_threshold,
|
||||
@ -108,8 +107,7 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
|
||||
|
||||
{% endif %}
|
||||
{% if data.toast_autovacuum|lower == 'false' %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
RESET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
|
||||
toast.autovacuum_enabled,
|
||||
toast.autovacuum_vacuum_threshold,
|
||||
toast.autovacuum_analyze_threshold,
|
||||
@ -139,8 +137,7 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
|
||||
{% else %}
|
||||
{% if data['vacuum_data']['reset']|length == 0 and
|
||||
data['vacuum_data']['changed']|length == 0 and data['settings']|length > 0 %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
SET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} SET(
|
||||
{% for field in data['settings'] %}
|
||||
{{ field }} = {{ data['settings'][field]|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
|
||||
{% endfor %}
|
||||
@ -148,8 +145,7 @@ SET(
|
||||
|
||||
{% endif %}
|
||||
{% if(data['vacuum_data']['changed']|length > 0) %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }}
|
||||
SET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
|
||||
{% for field in data['vacuum_data']['changed'] %}
|
||||
{% if field.value != None %}
|
||||
{{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
|
||||
@ -158,8 +154,7 @@ SET(
|
||||
);
|
||||
{% endif %}
|
||||
{% if data['vacuum_data']['reset']|length > 0 %}
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
|
||||
RESET(
|
||||
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
|
||||
{% for field in data['vacuum_data']['reset'] %}
|
||||
{{ field.name }}{% if not loop.last %},{% endif %}{{ '\r' }}
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user