mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
1) Disable Fill Factor and Has OIDs control for the partitioned table.
2) Added reloptions for the partitions and partitioned table.
This commit is contained in:
@@ -716,11 +716,17 @@ function(
|
||||
},{
|
||||
id: 'fillfactor', label: gettext('Fill factor'), type: 'int',
|
||||
mode: ['create', 'edit'], min: 10, max: 100,
|
||||
disabled: 'inSchema',group: gettext('Advanced'),
|
||||
group: gettext('Advanced'),
|
||||
disabled: function(m) {
|
||||
if(m.get('is_partitioned')) {
|
||||
return true;
|
||||
}
|
||||
return m.inSchema();
|
||||
},
|
||||
},{
|
||||
id: 'relhasoids', label: gettext('Has OIDs?'), cell: 'switch',
|
||||
type: 'switch', mode: ['properties', 'create', 'edit'],
|
||||
disabled: 'inSchema', group: gettext('Advanced'),
|
||||
disabled: true, group: gettext('Advanced'),
|
||||
},{
|
||||
id: 'relpersistence', label: gettext('Unlogged?'), cell: 'switch',
|
||||
type: 'switch', mode: ['properties', 'create', 'edit'],
|
||||
|
||||
@@ -777,7 +777,13 @@ define('pgadmin.node.table', [
|
||||
},{
|
||||
id: 'fillfactor', label: gettext('Fill factor'), type: 'int',
|
||||
mode: ['create', 'edit'], min: 10, max: 100,
|
||||
disabled: 'inSchema', group: gettext('advanced'),
|
||||
group: gettext('advanced'),
|
||||
disabled: function(m) {
|
||||
if(m.get('is_partitioned')) {
|
||||
return true;
|
||||
}
|
||||
return m.inSchema();
|
||||
},
|
||||
},{
|
||||
id: 'relhasoids', label: gettext('Has OIDs?'), cell: 'switch',
|
||||
type: 'switch', mode: ['properties', 'create', 'edit'],
|
||||
|
||||
@@ -21,6 +21,29 @@ CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE {{conn|qtIdent(data
|
||||
{{ data.partition_value }}{% if data.is_partitioned is defined and data.is_partitioned %}
|
||||
|
||||
PARTITION BY {{ data.partition_scheme }}{% endif %}
|
||||
{% if data.fillfactor or data.autovacuum_custom or data.autovacuum_enabled or data.toast_autovacuum or data.toast_autovacuum_enabled or (data.autovacuum_enabled and data.vacuum_table|length > 0) or (data.toast_autovacuum_enabled and data.vacuum_toast|length > 0) %}
|
||||
{% set add_comma = false%}
|
||||
|
||||
WITH (
|
||||
{% if data.fillfactor %}{% set add_comma = true%}
|
||||
FILLFACTOR = {{ data.fillfactor }}{% endif %}{% if data.autovacuum_custom %}
|
||||
{% if add_comma %},
|
||||
{% endif %}
|
||||
autovacuum_enabled = {% if data.autovacuum_enabled %}TRUE{% else %}FALSE{% endif %}{% set add_comma = true%}{% endif %}{% if data.toast_autovacuum %}
|
||||
{% if add_comma %},
|
||||
{% endif %}
|
||||
toast.autovacuum_enabled = {% if data.toast_autovacuum_enabled %}TRUE{% else %}FALSE{% endif %}
|
||||
{% endif %}{% if data.autovacuum_enabled and data.vacuum_table|length > 0 %}
|
||||
{% for opt in data.vacuum_table %}{% if opt.name and opt.value %}
|
||||
,
|
||||
{{opt.name}} = {{opt.value}}{% endif %}
|
||||
{% endfor %}{% endif %}{% if data.toast_autovacuum_enabled and data.vacuum_toast|length > 0 %}
|
||||
{% for opt in data.vacuum_toast %}{% if opt.name and opt.value %}
|
||||
,
|
||||
toast.{{opt.name}} = {{opt.value}}{% endif %}
|
||||
{% endfor %}{% endif %}
|
||||
|
||||
){% endif %}
|
||||
{### SQL for Tablespace ###}
|
||||
{% if data.spcname %}
|
||||
|
||||
|
||||
@@ -20,6 +20,29 @@ CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE {{conn|qtIdent(data
|
||||
{{ data.partition_value }}{% if data.is_partitioned is defined and data.is_partitioned %}
|
||||
|
||||
PARTITION BY {{ data.partition_scheme }}{% endif %}
|
||||
{% if data.fillfactor or data.autovacuum_custom or data.autovacuum_enabled or data.toast_autovacuum or data.toast_autovacuum_enabled or (data.autovacuum_enabled and data.vacuum_table|length > 0) or (data.toast_autovacuum_enabled and data.vacuum_toast|length > 0) %}
|
||||
{% set add_comma = false%}
|
||||
|
||||
WITH (
|
||||
{% if data.fillfactor %}{% set add_comma = true%}
|
||||
FILLFACTOR = {{ data.fillfactor }}{% endif %}{% if data.autovacuum_custom %}
|
||||
{% if add_comma %},
|
||||
{% endif %}
|
||||
autovacuum_enabled = {% if data.autovacuum_enabled %}TRUE{% else %}FALSE{% endif %}{% set add_comma = true%}{% endif %}{% if data.toast_autovacuum %}
|
||||
{% if add_comma %},
|
||||
{% endif %}
|
||||
toast.autovacuum_enabled = {% if data.toast_autovacuum_enabled %}TRUE{% else %}FALSE{% endif %}
|
||||
{% endif %}{% if data.autovacuum_enabled and data.vacuum_table|length > 0 %}
|
||||
{% for opt in data.vacuum_table %}{% if opt.name and opt.value %}
|
||||
,
|
||||
{{opt.name}} = {{opt.value}}{% endif %}
|
||||
{% endfor %}{% endif %}{% if data.toast_autovacuum_enabled and data.vacuum_toast|length > 0 %}
|
||||
{% for opt in data.vacuum_toast %}{% if opt.name and opt.value %}
|
||||
,
|
||||
toast.{{opt.name}} = {{opt.value}}{% endif %}
|
||||
{% endfor %}{% endif %}
|
||||
|
||||
){% endif %}
|
||||
{### SQL for Tablespace ###}
|
||||
{% if data.spcname %}
|
||||
|
||||
|
||||
@@ -1137,14 +1137,19 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
partitions_oid['created'] = created
|
||||
partitions_oid['attached'] = attached
|
||||
|
||||
icon = self.get_icon_css_class(res['rows'][0])
|
||||
|
||||
if 'relkind' in res['rows'][0] and \
|
||||
res['rows'][0]['relkind'] == 'p':
|
||||
is_partitioned = True
|
||||
if 'is_partitioned' in res['rows'][0]:
|
||||
is_partitioned = res['rows'][0]['is_partitioned']
|
||||
else:
|
||||
is_partitioned = False
|
||||
|
||||
# If partitioned_table_name in result set then get partition
|
||||
# icon css class else table icon.
|
||||
if 'partitioned_table_name' in res['rows'][0]:
|
||||
res['rows'][0]['is_sub_partitioned'] = is_partitioned
|
||||
icon = self.get_partition_icon_css_class(res['rows'][0])
|
||||
else:
|
||||
icon = self.get_icon_css_class(res['rows'][0])
|
||||
|
||||
return jsonify(
|
||||
node=self.blueprint.generate_browser_node(
|
||||
tid,
|
||||
|
||||
Reference in New Issue
Block a user