public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin][RM6367]: [SQL] Save button enabled on opening edit table dialog pg 9.5.
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin][RM6367]: [SQL] Save button enabled on opening edit table dialog pg 9.5.
@ 2021-04-10 07:26 Pradip Parkale <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Pradip Parkale @ 2021-04-10 07:26 UTC (permalink / raw)
To: pgadmin-hackers
Hi Hackers,
Please find the attached patch for # 6367 [SQL] Save button enabled on
opening edit table dialog pg 9.5.
--
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation
Attachments:
[application/octet-stream] RM6367.patch (17.1K, 3-RM6367.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
index 9cf9cf451..2234b2ddf 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
@@ -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;
}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/10_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/10_plus/update.sql
new file mode 100644
index 000000000..f42b1c7d4
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/10_plus/update.sql
@@ -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 %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/update.sql
index e9f7c6211..dc1e6d619 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/update.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/update.sql
@@ -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 %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/update.sql
index c0da37b11..a90c3a6e1 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/update.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/update.sql
@@ -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 %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/update.sql
index 9c4b576ee..0aaf9acce 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/update.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/update.sql
@@ -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 %}
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin][RM6367]: [SQL] Save button enabled on opening edit table dialog pg 9.5.
@ 2021-04-12 06:16 Akshay Joshi <[email protected]>
parent: Pradip Parkale <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Akshay Joshi @ 2021-04-12 06:16 UTC (permalink / raw)
To: Pradip Parkale <[email protected]>; +Cc: pgadmin-hackers
Thanks, patch applied.
On Sat, Apr 10, 2021 at 12:57 PM Pradip Parkale <
[email protected]> wrote:
> Hi Hackers,
>
> Please find the attached patch for # 6367 [SQL] Save button enabled on
> opening edit table dialog pg 9.5.
>
> --
> Thanks & Regards,
> Pradip Parkale
> Software Engineer | EnterpriseDB Corporation
>
--
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2021-04-12 06:16 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-04-10 07:26 [pgAdmin][RM6367]: [SQL] Save button enabled on opening edit table dialog pg 9.5. Pradip Parkale <[email protected]>
2021-04-12 06:16 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox