1) Added SSL support for creating a subscription. Fixes #6201

2) Fixed an issue where the user is not able to create the subscription. Fixes #6230
3) Fixed a couple of issues raised during testing of logical replication.
This commit is contained in:
Pradip Parkale
2021-02-19 14:56:45 +05:30
committed by Akshay Joshi
parent 32197a8405
commit 731ba32e81
16 changed files with 277 additions and 40 deletions

View File

@@ -80,6 +80,7 @@ define('pgadmin.node.publication', [
evnt_update:true,
evnt_truncate:true,
only_table: undefined,
publish_via_partition_root: false,
},
// Default values!
@@ -177,6 +178,20 @@ define('pgadmin.node.publication', [
return false;
},
},{
id: 'publish_via_partition_root', label: gettext('Publish via root?'),
type: 'switch', group: gettext('With'),
extraToggleClasses: 'pg-el-sm-6',
controlLabelClassName: 'control-label pg-el-sm-5 pg-el-12',
controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12',
visible: function(m) {
if(!_.isUndefined(m.node_info) && !_.isUndefined(m.node_info.server)
&& !_.isUndefined(m.node_info.server.version) &&
m.node_info.server.version >= 130000)
return true;
return false;
},
}],
},
],

View File

@@ -2,7 +2,7 @@ SELECT c.oid AS oid, c.pubname AS name,
pubinsert AS evnt_insert, pubupdate AS evnt_update, pubdelete AS evnt_delete, pubtruncate AS evnt_truncate,
puballtables AS all_table,
pga.rolname AS pubowner FROM pg_publication c
JOIN pg_authid pga ON c.pubowner= pga.oid
JOIN pg_roles pga ON c.pubowner= pga.oid
{% if pbid %}
WHERE c.oid = {{ pbid }}
{% endif %}

View File

@@ -0,0 +1,23 @@
{% if data.evnt_delete or data.evnt_update or data.evnt_truncate %}
{% set add_comma_after_insert = 'insert' %}
{% endif %}
{% if data.evnt_truncate %}
{% set add_comma_after_delete = 'delete' %}
{% endif %}
{% if data.evnt_delete or data.evnt_truncate%}
{% set add_comma_after_update = 'update' %}
{% endif %}
{% if data.publish_via_partition_root%}
{% set add_comma_after_truncate = 'truncate' %}
{% endif %}
{### Create PUBLICATION ###}
CREATE PUBLICATION {{ conn|qtIdent(data.name) }}
{% if data.all_table %}
FOR ALL TABLES
{% elif data.pubtable %}
FOR TABLE {% if data.only_table%}ONLY {% endif %}{% for pub_table in data.pubtable %}{% if loop.index != 1 %}, {% endif %}{{ pub_table }}{% endfor %}
{% endif %}
{% if data.evnt_insert or data.evnt_update or data.evnt_delete or data.evnt_truncate %}
WITH (publish = '{% if data.evnt_insert %}insert{% if add_comma_after_insert == 'insert' %}, {% endif %}{% endif %}{% if data.evnt_update %}update{% if add_comma_after_update == 'update' %}, {% endif %}{% endif %}{% if data.evnt_delete %}delete{% if add_comma_after_delete == 'delete' %}, {% endif %}{% endif %}{% if data.evnt_truncate %}truncate{% endif %}', publish_via_partition_root = {{ data.publish_via_partition_root|lower }});
{% endif %}

View File

@@ -0,0 +1,9 @@
SELECT c.oid AS oid, c.pubname AS name,
pubinsert AS evnt_insert, pubupdate AS evnt_update, pubdelete AS evnt_delete, pubtruncate AS evnt_truncate,
puballtables AS all_table,
pubviaroot AS publish_via_partition_root,
pga.rolname AS pubowner FROM pg_publication c
JOIN pg_roles pga ON c.pubowner= pga.oid
{% if pbid %}
WHERE c.oid = {{ pbid }}
{% endif %}

View File

@@ -0,0 +1,48 @@
{% if data.evnt_delete or data.evnt_update or data.evnt_truncate %}
{% set add_comma_after_insert = 'insert' %}
{% endif %}
{% if data.evnt_truncate %}
{% set add_comma_after_delete = 'delete' %}
{% endif %}
{% if data.evnt_delete or data.evnt_truncate%}
{% set add_comma_after_update = 'update' %}
{% endif %}
{### Alter publication owner ###}
{% if data.pubowner %}
ALTER PUBLICATION {{ conn|qtIdent(o_data.name) }}
OWNER TO {{ data.pubowner }};
{% endif %}
{### Alter publication event ###}
{% if (data.evnt_insert is defined and data.evnt_insert != o_data.evnt_insert) or (data.evnt_update is defined and data.evnt_update != o_data.evnt_update) or (data.evnt_delete is defined and data.evnt_delete != o_data.evnt_delete) or (data.evnt_truncate is defined and data.evnt_truncate != o_data.evnt_truncate) %}
ALTER PUBLICATION {{ conn|qtIdent(o_data.name) }} SET
(publish = '{% if data.evnt_insert %}insert{% if add_comma_after_insert == 'insert' %}, {% endif %}{% endif %}{% if data.evnt_update %}update{% if add_comma_after_update == 'update' %}, {% endif %}{% endif %}{% if data.evnt_delete %}delete{% if add_comma_after_delete == 'delete' %}, {% endif %}{% endif %}{% if data.evnt_truncate %}truncate{% endif %}');
{% endif %}
{### Alter publication partition root ###}
{% if data.publish_via_partition_root is defined and data.publish_via_partition_root != o_data.publish_via_partition_root%}
ALTER PUBLICATION {{ conn|qtIdent(o_data.name) }} SET
(publish_via_partition_root = {{ data.publish_via_partition_root|lower }});
{% endif %}
{### Alter drop publication table ###}
{% if drop_table %}
ALTER PUBLICATION {{ conn|qtIdent(o_data.name) }}
DROP TABLE {% if data.only_table%}ONLY {% endif %}{% for pub_table in drop_table_data %}{% if loop.index != 1 %}, {% endif %}{{ pub_table }}{% endfor %};
{% endif %}
{### Alter publication table ###}
{% if add_table %}
ALTER PUBLICATION {{ conn|qtIdent(o_data.name) }}
ADD TABLE {% if data.only_table%}ONLY {% endif %}{% for pub_table in add_table_data %}{% if loop.index != 1 %}, {% endif %}{{ pub_table }}{% endfor %};
{% endif %}
{### Alter publication name ###}
{% if data.name != o_data.name %}
ALTER PUBLICATION {{ conn|qtIdent(o_data.name) }}
RENAME TO {{ conn|qtIdent(data.name) }};
{% endif %}

View File

@@ -3,4 +3,5 @@ FROM information_schema.tables c
WHERE c.table_type = 'BASE TABLE'
AND c.table_schema NOT LIKE 'pg\_%'
AND c.table_schema NOT LIKE 'pgagent'
AND c.table_schema NOT LIKE 'sys'
AND c.table_schema NOT IN ('information_schema') ORDER BY 1;

View File

@@ -2,7 +2,7 @@ SELECT c.oid AS oid, c.pubname AS name,
pubinsert AS evnt_insert, pubupdate AS evnt_update, pubdelete AS evnt_delete,
puballtables AS all_table,
pga.rolname AS pubowner FROM pg_publication c
JOIN pg_authid pga ON c.pubowner= pga.oid
JOIN pg_roles pga ON c.pubowner= pga.oid
{% if pbid %}
where c.oid = {{ pbid }}
{% endif %}