Fixed an issue where the Save button is enabled by default when open the table's properties dialog on PG 9.5. Fixes #6367

This commit is contained in:
Pradip Parkale 2021-04-12 11:36:16 +05:30 committed by Akshay Joshi
parent 098ab9e428
commit 0ed47fcd2b
6 changed files with 278 additions and 43 deletions

View File

@ -33,5 +33,6 @@ Bug fixes
| `Issue #6338 <https://redmine.postgresql.org/issues/6338>`_ - Added missing dependency 'xdg-utils' for the desktop packages in RPM and Debian.
| `Issue #6344 <https://redmine.postgresql.org/issues/6344>`_ - Fixed cannot unpack non-iterable response object error when selecting any partition.
| `Issue #6356 <https://redmine.postgresql.org/issues/6356>`_ - Mark the Apache HTTPD config file as such in the web DEB and RPM packages.
| `Issue #6367 <https://redmine.postgresql.org/issues/6367>`_ - Fixed an issue where the Save button is enabled by default when open the table's properties dialog on PG 9.5.
| `Issue #6375 <https://redmine.postgresql.org/issues/6375>`_ - Fixed an issue where users are unable to see data of the partitions using the View/Edit data option.
| `Issue #6376 <https://redmine.postgresql.org/issues/6376>`_ - Fixed an issue where a connection warning should be displayed on the user clicks on explain or explain analyze and the database server is disconnected from the browser tree.

View File

@ -486,7 +486,7 @@ define('pgadmin.node.table', [
visible: function(m) {
if(!_.isUndefined(m.node_info) && !_.isUndefined(m.node_info.server)
&& !_.isUndefined(m.node_info.server.version) &&
m.node_info.server.version >= 90500)
m.node_info.server.version >= 90600)
return true;
return false;
@ -494,7 +494,7 @@ define('pgadmin.node.table', [
disabled: function(m) {
if(!_.isUndefined(m.node_info) && !_.isUndefined(m.node_info.server)
&& !_.isUndefined(m.node_info.server.version) &&
m.node_info.server.version < 90500)
m.node_info.server.version < 90600)
return true;
return m.inSchema();
@ -507,12 +507,17 @@ define('pgadmin.node.table', [
visible: function(m) {
if(!_.isUndefined(m.node_info) && !_.isUndefined(m.node_info.server)
&& !_.isUndefined(m.node_info.server.version) &&
m.node_info.server.version >= 90500)
m.node_info.server.version >= 90600)
return true;
return false;
},
disabled: function(m) {
if(!_.isUndefined(m.node_info) && !_.isUndefined(m.node_info.server)
&& !_.isUndefined(m.node_info.server.version) &&
m.node_info.server.version < 90600)
return true;
if (m.get('rlspolicy')){
return false;
}

View File

@ -0,0 +1,269 @@
{% import 'macros/schemas/security.macros' as SECLABEL %}
{% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
{% import 'macros/variable.macros' as VARIABLE %}
{#####################################################}
{## Rename table ##}
{#####################################################}
{% if data.name and data.name != o_data.name %}
ALTER TABLE {{conn|qtIdent(o_data.schema, o_data.name)}}
RENAME TO {{conn|qtIdent(data.name)}};
{% endif %}
{#####################################################}
{## Change table schema ##}
{#####################################################}
{% if data.schema and data.schema != o_data.schema %}
ALTER TABLE {{conn|qtIdent(o_data.schema, data.name)}}
SET SCHEMA {{conn|qtIdent(data.schema)}};
{% endif %}
{#####################################################}
{## Change table owner ##}
{#####################################################}
{% if data.relowner and data.relowner != o_data.relowner %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
OWNER TO {{conn|qtIdent(data.relowner)}};
{% endif %}
{#####################################################}
{## Update Inherits table definition ##}
{#####################################################}
{% if data.coll_inherits_added|length > 0 %}
{% for val in data.coll_inherits_added %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
INHERIT {{val}};
{% endfor %}
{% endif %}
{% if data.coll_inherits_removed|length > 0 %}
{% for val in data.coll_inherits_removed %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
NO INHERIT {{val}};
{% endfor %}
{% endif %}
{#####################################################}
{## Change hasOID attribute of table ##}
{#####################################################}
{% if data.relhasoids is defined and data.relhasoids != o_data.relhasoids %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
SET {% if data.relhasoids %}WITH{% else %}WITHOUT{% endif %} OIDS;
{% endif %}
{#####################################################}
{## Change tablespace ##}
{#####################################################}
{% if data.spcname and data.spcname != o_data.spcname %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
SET TABLESPACE {{conn|qtIdent(data.spcname)}};
{% endif %}
{#####################################################}
{## change fillfactor settings ##}
{#####################################################}
{% if data.fillfactor and data.fillfactor != o_data.fillfactor %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
SET (FILLFACTOR={{data.fillfactor}});
{% elif (data.fillfactor == '' or data.fillfactor == None) and data.fillfactor != o_data.fillfactor %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
RESET (FILLFACTOR);
{% endif %}
{###############################}
{## 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,
autovacuum_analyze_scale_factor,
autovacuum_analyze_threshold,
autovacuum_freeze_max_age,
autovacuum_vacuum_cost_delay,
autovacuum_vacuum_cost_limit,
autovacuum_vacuum_scale_factor,
autovacuum_vacuum_threshold,
autovacuum_freeze_min_age,
autovacuum_freeze_table_age
);
{% else %}
{% if (data.autovacuum_enabled in ('t', 'f') and data.autovacuum_enabled != o_data.autovacuum_enabled) or has_vacuum_set %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} SET (
{% if data.autovacuum_enabled in ('t', 'f') and data.autovacuum_enabled != o_data.autovacuum_enabled %}
autovacuum_enabled = {% if data.autovacuum_enabled == 't' %}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 is defined %}
{{opt.name}} = {{opt.value}}{% if not loop.last %},
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
);
{% endif %}
{% if (data.autovacuum_enabled == 'x' and data.autovacuum_enabled != o_data.autovacuum_enabled) or has_vacuum_reset %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} RESET (
{% if data.autovacuum_enabled =='x' and data.autovacuum_enabled != o_data.autovacuum_enabled %}
autovacuum_enabled{% if has_vacuum_reset %},
{% endif %}
{% endif %}
{% if has_vacuum_reset %}
{% for opt in data.vacuum_table.reset_values %}{% if opt.name %}
{{opt.name}}{% if not loop.last %},
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
);
{% endif %}
{% endif %}
{#####################################################}
{## Enable Row Level Security Policy on table ##}
{#####################################################}
{% if data.rlspolicy %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
ENABLE ROW LEVEL SECURITY;
{% elif data.rlspolicy is defined and data.rlspolicy != o_data.rlspolicy%}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
DISABLE ROW LEVEL SECURITY;
{% endif %}
{#####################################################}
{## Force Enable Row Level Security Policy on table ##}
{#####################################################}
{% if data.forcerlspolicy %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
FORCE ROW LEVEL SECURITY;
{% elif data.forcerlspolicy is defined and data.forcerlspolicy != o_data.forcerlspolicy%}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
NO FORCE ROW LEVEL SECURITY;
{% endif %}
{#####################################}
{## 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,
toast.autovacuum_freeze_max_age,
toast.autovacuum_vacuum_cost_delay,
toast.autovacuum_vacuum_cost_limit,
toast.autovacuum_vacuum_scale_factor,
toast.autovacuum_vacuum_threshold,
toast.autovacuum_freeze_min_age,
toast.autovacuum_freeze_table_age,
toast.autovacuum_analyze_threshold,
toast.autovacuum_analyze_scale_factor
);
{% else %}
{% if (data.toast_autovacuum_enabled in ('t', 'f') and data.toast_autovacuum_enabled != o_data.toast_autovacuum_enabled) or has_vacuum_toast_set %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} SET (
{% if data.toast_autovacuum_enabled in ('t', 'f') and data.toast_autovacuum_enabled != o_data.toast_autovacuum_enabled %}
toast.autovacuum_enabled = {% if data.toast_autovacuum_enabled == 't' %}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 is defined %}
toast.{{opt.name}} = {{opt.value}}{% if not loop.last %},
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
);
{% endif %}
{% if (data.toast_autovacuum_enabled == 'x' and data.toast_autovacuum_enabled != o_data.toast_autovacuum_enabled) or has_vacuum_toast_reset %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} RESET (
{% if data.toast_autovacuum_enabled == 'x' and data.toast_autovacuum_enabled != o_data.toast_autovacuum_enabled %}
toast.autovacuum_enabled{% if has_vacuum_toast_reset %},
{% endif %}
{% endif %}
{% if has_vacuum_toast_reset %}
{% for opt in data.vacuum_toast.reset_values %}{% if opt.name %}
toast.{{opt.name}}{% if not loop.last %},
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
);
{% endif %}
{% endif %}
{#####################################################}
{## Change table comments ##}
{#####################################################}
{% if data.description is defined and data.description != o_data.description %}
COMMENT ON TABLE {{conn|qtIdent(data.schema, data.name)}}
IS {{data.description|qtLiteral}};
{% endif %}
{#####################################################}
{## Update table Privileges ##}
{#####################################################}
{% if data.relacl %}
{% if 'deleted' in data.relacl %}
{% for priv in data.relacl.deleted %}
{{ PRIVILEGE.UNSETALL(conn, 'TABLE', priv.grantee, data.name, data.schema) }}
{% endfor %}
{% endif %}
{% if 'changed' in data.relacl %}
{% for priv in data.relacl.changed %}
{% if priv.grantee != priv.old_grantee %}
{{ PRIVILEGE.UNSETALL(conn, 'TABLE', priv.old_grantee, data.name, data.schema) }}
{% else %}
{{ PRIVILEGE.UNSETALL(conn, 'TABLE', priv.grantee, data.name, data.schema) }}
{% endif %}
{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}
{% endfor %}
{% endif %}
{% if 'added' in data.relacl %}
{% for priv in data.relacl.added %}
{{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.schema) }}
{% endfor %}
{% endif %}
{% endif %}
{#####################################################}
{## Update table SecurityLabel ##}
{#####################################################}
{% if data.seclabels and data.seclabels|length > 0 %}
{% set seclabels = data.seclabels %}
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
{% for r in seclabels.deleted %}
{{ SECLABEL.UNSET(conn, 'TABLE', data.name, r.provider, data.schema) }}
{% endfor %}
{% endif %}
{% if 'added' in seclabels and seclabels.added|length > 0 %}
{% for r in seclabels.added %}
{{ SECLABEL.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }}
{% endfor %}
{% endif %}
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
{% for r in seclabels.changed %}
{{ SECLABEL.SET(conn, 'TABLE', data.name, r.provider, r.label, data.schema) }}
{% endfor %}
{% endif %}
{% endif %}
{#####################################################}
{## Change replica identity ##}
{#####################################################}
{% if data.replica_identity and data.replica_identity != o_data.replica_identity %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} REPLICA IDENTITY {{data.replica_identity }};
{% endif %}

View File

@ -289,9 +289,3 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
{% if data.replica_identity and data.replica_identity != o_data.replica_identity %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} REPLICA IDENTITY {{data.replica_identity }};
{% endif %}
{#####################################################}
{## Change replica identity ##}
{#####################################################}
{% if data.replica_identity and data.replica_identity != o_data.replica_identity %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} REPLICA IDENTITY {{data.replica_identity }};
{% endif %}

View File

@ -282,9 +282,3 @@ COMMENT ON TABLE {{conn|qtIdent(data.schema, data.name)}}
{% if data.replica_identity and data.replica_identity != o_data.replica_identity %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} REPLICA IDENTITY {{data.replica_identity }};
{% endif %}
{#####################################################}
{## Change replica identity ##}
{#####################################################}
{% if data.replica_identity and data.replica_identity != o_data.replica_identity %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} REPLICA IDENTITY {{data.replica_identity }};
{% endif %}

View File

@ -126,28 +126,6 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} RESET (
{% endif %}
{% endif %}
{#####################################################}
{## Enable Row Level Security Policy on table ##}
{#####################################################}
{% if data.rlspolicy %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
ENABLE ROW LEVEL SECURITY;
{% elif data.rlspolicy is defined and data.rlspolicy != o_data.rlspolicy%}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
DISABLE ROW LEVEL SECURITY;
{% endif %}
{#####################################################}
{## Force Enable Row Level Security Policy on table ##}
{#####################################################}
{% if data.forcerlspolicy %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
FORCE ROW LEVEL SECURITY;
{% elif data.forcerlspolicy is defined and data.forcerlspolicy != o_data.forcerlspolicy%}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
NO FORCE ROW LEVEL SECURITY;
{% endif %}
{#####################################}
{## Toast table AutoVacuum settings ##}
@ -268,9 +246,3 @@ COMMENT ON TABLE {{conn|qtIdent(data.schema, data.name)}}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} REPLICA IDENTITY {{data.replica_identity }};
{% endif %}
{#####################################################}
{## Change replica identity ##}
{#####################################################}
{% if data.replica_identity and data.replica_identity != o_data.replica_identity %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}} REPLICA IDENTITY {{data.replica_identity }};
{% endif %}