diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/publications/__init__.py index 0b323ccfe..7d2cc37b3 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/__init__.py @@ -72,7 +72,7 @@ class PublicationModule(CollectionNodeModule): did: Database Id """ if self.has_nodes( - sid, did, + sid, did, base_template_path=PublicationView.BASE_TEMPLATE_PATH): yield self.generate_browser_collection_node(did) @@ -168,7 +168,7 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare): _NOT_FOUND_PUB_INFORMATION = \ gettext("Could not find the publication information.") node_type = blueprint.node_type - BASE_TEMPLATE_PATH = "publications/sql/#{0}#" + BASE_TEMPLATE_PATH = 'publications/{0}/#{1}#/sql' parent_ids = [ {'type': 'int', 'id': 'gid'}, @@ -226,9 +226,8 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare): self.manager = self.driver.connection_manager(kwargs['sid']) self.conn = self.manager.connection(did=kwargs['did']) # Set the template path for the SQL scripts - self.template_path = ( - self.BASE_TEMPLATE_PATH.format(self.manager.version) - ) + self.template_path = self.BASE_TEMPLATE_PATH.format( + self.manager.server_type, self.manager.version) return f(*args, **kwargs) @@ -798,12 +797,10 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare): """ res = [] - sql = render_template("/".join([self.template_path, - 'get_all_schemas.sql']), - show_sys_objects=self.blueprint. - show_system_objects, - server_type=self.manager.server_type - ) + sql = render_template( + "/".join([self.template_path, 'get_all_schemas.sql']), + conn=self.conn + ) status, rset = self.conn.execute_2darray(sql) if not status: return internal_server_error(errormsg=rset) @@ -1124,5 +1121,4 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare): return sql -# SchemaDiffRegistry(blueprint.node_type, PublicationView, 'Database') PublicationView.register_node_view(blueprint) diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.ui.js b/web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.ui.js index 29fe4c9ca..6628ce151 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.ui.js +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.ui.js @@ -284,7 +284,7 @@ export default class PublicationSchema extends BaseUISchema { { id: 'pubtable_names', label: gettext('Tables'), cell: 'string', type: (state)=>{ - let table= (!_.isUndefined(state?.pubtable_names) && state?.pubtable_names.length > 0) && state?.pubtable_names; + let table= (!_.isUndefined(state?.pubtable_names) && state?.pubtable_names.length > 0) ? state?.pubtable_names : []; return { type: 'select', options: table, @@ -298,7 +298,7 @@ export default class PublicationSchema extends BaseUISchema { id: 'pubtable', label: this.version < 150000 ? gettext('Tables') : gettext(''), type: this.version < 150000 ? 'select' : 'collection', controlProps: this.version < 150000 ? { allowClear: true, multiple: true, creatable: true } : null, - options: this.version < 150000 ? this.fieldOptions.allTables : null, + options: this.version < 150000 ? this.fieldOptions.allTables : [], group: this.version < 150000 ? gettext('Definition') : gettext('Tables'), mode: ['edit', 'create'], deps: ['all_table'], disabled: obj.isAllTable, schema: this.version < 150000 ? null : this.paramSchema, uniqueCol: this.version < 150000 ? null : ['table_name'], diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/11_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/11_plus/sql/create.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/11_plus/create.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/11_plus/sql/create.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/11_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/11_plus/sql/properties.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/11_plus/properties.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/11_plus/sql/properties.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/13_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/13_plus/sql/create.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/13_plus/create.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/13_plus/sql/create.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/13_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/13_plus/sql/properties.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/13_plus/properties.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/13_plus/sql/properties.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/13_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/13_plus/sql/update.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/13_plus/update.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/13_plus/sql/update.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/15_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/15_plus/sql/create.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/15_plus/create.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/15_plus/sql/create.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/15_plus/sql/get_all_schemas.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/15_plus/sql/get_all_schemas.sql new file mode 100644 index 000000000..afb54eda7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/15_plus/sql/get_all_schemas.sql @@ -0,0 +1,9 @@ +{% import 'catalog/pg/macros/catalogs.sql' as CATALOGS %} +SELECT + nsp.nspname +FROM + pg_catalog.pg_namespace nsp +WHERE + nspname NOT LIKE E'pg\\_%' AND + NOT ({{ CATALOGS.LIST('nsp') }}) +ORDER BY nspname; diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/15_plus/get_pub_schemas.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/15_plus/sql/get_pub_schemas.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/15_plus/get_pub_schemas.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/15_plus/sql/get_pub_schemas.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/15_plus/get_tables.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/15_plus/sql/get_tables.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/15_plus/get_tables.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/15_plus/sql/get_tables.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/15_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/15_plus/sql/update.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/15_plus/update.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/15_plus/sql/update.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/count.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/count.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/count.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/count.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/create.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/create.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/create.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/delete.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/delete.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/delete.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/delete.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/dependencies.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/dependencies.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/dependencies.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/dependencies.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/get_all_columns.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/get_all_columns.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/get_all_columns.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/get_all_columns.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/get_all_tables.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/get_all_tables.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/get_all_tables.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/get_all_tables.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/get_position.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/get_position.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/get_position.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/get_position.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/get_tables.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/get_tables.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/get_tables.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/get_tables.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/nodes.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/nodes.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/nodes.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/properties.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/properties.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/properties.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/update.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/update.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/update.sql rename to web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/update.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/11_plus/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/11_plus/sql/create.sql new file mode 100644 index 000000000..babd09faa --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/11_plus/sql/create.sql @@ -0,0 +1,20 @@ +{% 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 %} +{### 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 %}'); +{% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/11_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/11_plus/sql/properties.sql new file mode 100644 index 000000000..00b4d4e1e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/11_plus/sql/properties.sql @@ -0,0 +1,8 @@ +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_catalog.pg_publication c +JOIN pg_catalog.pg_roles pga ON c.pubowner= pga.oid +{% if pbid %} + WHERE c.oid = {{ pbid }} +{% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/13_plus/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/13_plus/sql/create.sql new file mode 100644 index 000000000..4f574127e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/13_plus/sql/create.sql @@ -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 %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/13_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/13_plus/sql/properties.sql new file mode 100644 index 000000000..186aeb279 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/13_plus/sql/properties.sql @@ -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_catalog.pg_publication c +JOIN pg_catalog.pg_roles pga ON c.pubowner= pga.oid +{% if pbid %} + WHERE c.oid = {{ pbid }} +{% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/13_plus/sql/update.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/13_plus/sql/update.sql new file mode 100644 index 000000000..4995d92b7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/13_plus/sql/update.sql @@ -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 {{ conn|qtIdent(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 %} + + + + diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/create.sql new file mode 100644 index 000000000..a85e735ee --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/create.sql @@ -0,0 +1,26 @@ +{% 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 or data.pubschema %} + FOR {% if data.pubtable %}TABLE {% if data.only_table%}ONLY {% endif %}{% for pub_table in data.pubtable %}{% if loop.index != 1 %}, {% endif %}{{pub_table['table_name']}}{% if pub_table['columns'] %} ({% for column in pub_table['columns'] %}{% if loop.index != 1 %}, {% endif %}{{column}}{% endfor %}){% endif %}{% if pub_table['where'] %} WHERE ({{pub_table['where']}}){% endif %}{% endfor %}{% endif %}{% if data.pubtable and data.pubschema %},{% endif %} +{% if data.pubschema %} + TABLES IN SCHEMA {% for pub_schema in data.pubschema %}{% if loop.index != 1 %}, {% endif %}{{ pub_schema }}{% endfor %} +{% endif %} + +{% 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 %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/get_all_schemas.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/get_all_schemas.sql new file mode 100644 index 000000000..c6229e7ce --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/get_all_schemas.sql @@ -0,0 +1,10 @@ +{% import 'catalog/ppas/macros/catalogs.sql' as CATALOGS %} +SELECT + nsp.nspname +FROM + pg_catalog.pg_namespace nsp +WHERE + nsp.nspparent = 0 AND + nspname NOT LIKE 'pg!_%' escape '!' AND + NOT ({{ CATALOGS.LIST('nsp') }}) +ORDER BY nspname; diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/get_pub_schemas.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/get_pub_schemas.sql new file mode 100644 index 000000000..d6def061a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/get_pub_schemas.sql @@ -0,0 +1,4 @@ +SELECT n.nspname AS sname +FROM pg_catalog.pg_publication_namespace pubnsp +JOIN pg_catalog.pg_namespace n ON pubnsp.pnnspid = n.oid +WHERE pnpubid = {{pbid}} :: oid; \ No newline at end of file diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/get_tables.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/get_tables.sql new file mode 100644 index 000000000..ca3d718e6 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/get_tables.sql @@ -0,0 +1,6 @@ +SELECT pg_catalog.quote_ident(n.nspname) || '.' || pg_catalog.quote_ident(cls.relname) AS table_name, + (SELECT array_agg(attname) FROM pg_attribute att WHERE attrelid = prel.prrelid AND attnum IN (SELECT unnest(prattrs) FROM pg_publication_rel WHERE oid = prel.oid ) ) AS columns, + pg_catalog.pg_get_expr(prel.prqual, prel.prrelid) AS where + FROM pg_publication_rel prel + JOIN pg_class cls ON cls.oid = prel.prrelid + JOIN pg_catalog.pg_namespace n ON cls.relnamespace = n.oid WHERE prel.prpubid = {{pbid}} :: oid; diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/update.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/update.sql new file mode 100644 index 000000000..4a8c02149 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/15_plus/sql/update.sql @@ -0,0 +1,67 @@ +{% 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 {{ conn|qtIdent(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['table_name'] or pub_table }}{% endfor %}; + +{% endif %} + +{### Alter drop publication schema ###} +{% if drop_schema %} +ALTER PUBLICATION {{ conn|qtIdent(o_data.name) }} + DROP TABLES IN SCHEMA {% for pub_schema in drop_schema_data %}{% if loop.index != 1 %}, {% endif %}{{ pub_schema }}{% endfor %}; + +{% endif %} + +{### Alter update publication table ###} +{% if update_table %} +ALTER PUBLICATION {{ conn|qtIdent(o_data.name) }} + SET TABLE {% for pub_table in update_table_data %}{% if loop.index != 1 %}, TABLE {% endif %}{{ pub_table['table_name'] or pub_table }}{% if pub_table['columns'] %} ({% for column in pub_table['columns'] %}{% if loop.index != 1 %}, {% endif %}{{ column }}{% endfor %}){% endif %}{% if pub_table['where'] %} WHERE ({{pub_table['where']}}){% endif %}{% 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['table_name'] or pub_table }}{% if pub_table['columns'] %} ({% for column in pub_table['columns'] %}{% if loop.index != 1 %}, {% endif %}{{ column }}{% endfor %}){% endif %}{% if pub_table['where'] %} WHERE ({{pub_table['where']}}){% endif %}{% endfor %}; + +{% endif %} + +{### Alter add publication schema ###} +{% if add_schema %} +ALTER PUBLICATION {{ conn|qtIdent(o_data.name) }} + ADD TABLES IN SCHEMA {% for pub_schema in add_schema_data %}{% if loop.index != 1 %}, {% endif %}{{ pub_schema }}{% 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 %} \ No newline at end of file diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/count.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/count.sql new file mode 100644 index 000000000..43e890c01 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/count.sql @@ -0,0 +1,2 @@ +SELECT COUNT(*) +FROM pg_catalog.pg_publication c diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/create.sql new file mode 100644 index 000000000..4eb493f16 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/create.sql @@ -0,0 +1,16 @@ +{% if data.evnt_delete or data.evnt_update or data.evnt_truncate %} +{% set add_comma_after_insert = 'insert' %} +{% endif %} +{% if data.evnt_delete or data.evnt_truncate%} +{% set add_comma_after_update = 'update' %} +{% endif %} +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{% endif %}'); +{% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/delete.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/delete.sql new file mode 100644 index 000000000..3b7af0764 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/delete.sql @@ -0,0 +1,8 @@ +{# ============= Get the publication name using oid ============= #} +{% if pbid %} +SELECT pubname FROM pg_catalog.pg_publication WHERE oid = {{pbid}}::oid; +{% endif %} +{# ============= Drop the publication ============= #} +{% if pname %} +DROP PUBLICATION IF EXISTS {{ conn|qtIdent(pname) }}{% if cascade %} CASCADE{% endif%}; +{% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/dependencies.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/dependencies.sql new file mode 100644 index 000000000..d08ab9b47 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/dependencies.sql @@ -0,0 +1,5 @@ +SELECT cl.oid AS oid, +pg_catalog.quote_ident(pgb_table.schemaname)||'.'||pg_catalog.quote_ident(pgb_table.tablename) AS pubtable +FROM pg_catalog.pg_publication_tables pgb_table +LEFT JOIN pg_catalog.pg_class cl ON pgb_table.tablename = cl.relname +WHERE pubname = '{{ pname }}' AND pgb_table.schemaname NOT LIKE 'pgagent'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_all_columns.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_all_columns.sql new file mode 100644 index 000000000..54f4720aa --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_all_columns.sql @@ -0,0 +1,7 @@ +SELECT + pg_catalog.quote_ident(attname) as column +FROM + pg_attribute +WHERE + attrelid = '{{ tid }}' :: regclass + and attstattarget =-1; \ No newline at end of file diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_all_tables.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_all_tables.sql new file mode 100644 index 000000000..717445730 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_all_tables.sql @@ -0,0 +1,15 @@ +SELECT + pg_catalog.quote_ident(c.table_schema)|| '.' || pg_catalog.quote_ident(c.table_name) AS table, + ( + pg_catalog.quote_ident(c.table_schema)|| '.' || pg_catalog.quote_ident(c.table_name) + ):: regclass :: oid as tid +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; \ No newline at end of file diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_position.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_position.sql new file mode 100644 index 000000000..5d2d25009 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_position.sql @@ -0,0 +1 @@ +SELECT oid, pubname AS name FROM pg_catalog.pg_publication WHERE pubname = '{{ pubname }}'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_tables.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_tables.sql new file mode 100644 index 000000000..8cf5f2099 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_tables.sql @@ -0,0 +1,4 @@ +SELECT pg_catalog.quote_ident(n.nspname) || '.' || pg_catalog.quote_ident(cls.relname) AS table_name + FROM pg_publication_rel prel + JOIN pg_class cls ON cls.oid = prel.prrelid + JOIN pg_catalog.pg_namespace n ON cls.relnamespace = n.oid WHERE prel.prpubid = {{pbid}} :: oid; diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/nodes.sql new file mode 100644 index 000000000..14ea2e4fe --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/nodes.sql @@ -0,0 +1,6 @@ +SELECT oid , pubname AS name +FROM pg_catalog.pg_publication +{% if schema_diff %} +WHERE CASE WHEN (SELECT COUNT(*) FROM pg_catalog.pg_depend + WHERE objid = oid AND deptype = 'e') > 0 THEN FALSE ELSE TRUE END +{% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/properties.sql new file mode 100644 index 000000000..8be36e1a8 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/properties.sql @@ -0,0 +1,8 @@ +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_catalog.pg_publication c +JOIN pg_catalog.pg_roles pga ON c.pubowner= pga.oid +{% if pbid %} + where c.oid = {{ pbid }} +{% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/update.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/update.sql new file mode 100644 index 000000000..0593ec409 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/update.sql @@ -0,0 +1,42 @@ +{% 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 {{ conn|qtIdent(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 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 %} + + + + diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/15_plus/get_all_schemas.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/15_plus/get_all_schemas.sql deleted file mode 100644 index fa5a34cbf..000000000 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/15_plus/get_all_schemas.sql +++ /dev/null @@ -1,5 +0,0 @@ -select nspname from pg_catalog.pg_namespace c WHERE - c.nspname NOT LIKE 'pg\_%' - AND c.nspname NOT IN ('information_schema') -ORDER BY - 1; diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/publication_test_data.json b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/publication_test_data.json index ddfd20ca4..a4be79d28 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/publication_test_data.json +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/publication_test_data.json @@ -11,7 +11,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": true, "pubtable": "", "pubschema": "" @@ -34,7 +34,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "" @@ -58,7 +58,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "", "pubschema": "PLACE_HOLDER" @@ -83,7 +83,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "PLACE_HOLDER" @@ -108,7 +108,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "" @@ -133,7 +133,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "" @@ -159,7 +159,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "" @@ -185,7 +185,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "PLACE_HOLDER" @@ -210,7 +210,7 @@ "evnt_update": true, "evnt_delete": false, "evnt_truncate": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": true, "pubtable": "", "pubschema": "" @@ -231,7 +231,7 @@ "evnt_update": true, "evnt_delete": false, "evnt_truncate": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": true, "pubtable": "", "pubschema": "" @@ -256,7 +256,7 @@ "evnt_update": true, "evnt_delete": false, "evnt_truncate": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": true, "pubtable": "", "pubschema": "" @@ -439,7 +439,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "", "pubschema": "", @@ -464,7 +464,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "", "pubschema": "" @@ -488,7 +488,7 @@ "evnt_delete": "PLACE_HOLDER", "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "", "pubschema": "" @@ -512,7 +512,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "", "pubschema": "" @@ -539,7 +539,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "", "pubschema": "" @@ -563,7 +563,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "", @@ -588,7 +588,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "", @@ -613,7 +613,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "", @@ -638,7 +638,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "", @@ -665,7 +665,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "", @@ -690,7 +690,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "", @@ -715,7 +715,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "", @@ -740,7 +740,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "", @@ -765,7 +765,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "", @@ -790,7 +790,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "", @@ -815,7 +815,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "PLACE_HOLDER", @@ -841,7 +841,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "", @@ -866,7 +866,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "", @@ -891,7 +891,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "PLACE_HOLDER", "pubschema": "", @@ -917,7 +917,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "", "pubschema": "", @@ -943,7 +943,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "", "pubschema": "PLACE_HOLDER", @@ -969,7 +969,7 @@ "evnt_delete": false, "evnt_truncate": false, "publish_via_partition_root": false, - "pubowner": "postgres", + "pubowner": "PLACE_HOLDER", "all_table": false, "pubtable": "", "pubschema": "PLACE_HOLDER", diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_create.py b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_create.py index 247dc0102..942b4021e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_create.py +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_create.py @@ -33,6 +33,7 @@ class PublicationsAddTestCase(BaseTestGenerator): self.server_id = schema_info["server_id"] self.db_id = schema_info["db_id"] self.schema_name = schema_info["schema_name"] + self.test_data['pubowner'] = self.server['username'] self.server_version = schema_info["server_version"] if self.server_version < 99999: diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put.py b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put.py index 4d529e794..0e7268765 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put.py +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put.py @@ -35,6 +35,8 @@ class PublicationUpdateTestCase(BaseTestGenerator): self.server_id = schema_info["server_id"] self.db_id = schema_info["db_id"] self.server_version = schema_info["server_version"] + self.test_data['pubowner'] = self.server['username'] + if self.server_version < 99999: self.skipTest( "Logical replication is not supported " diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_add_schema.py b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_add_schema.py index 5aadfdc37..7ddf7e5e6 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_add_schema.py +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_add_schema.py @@ -30,6 +30,8 @@ class PublicationUpdateAddSchemaTestCase(BaseTestGenerator): self.server_id = schema_info["server_id"] self.db_id = schema_info["db_id"] self.server_version = schema_info["server_version"] + self.test_data['pubowner'] = self.server['username'] + if self.server_version < 99999: self.skipTest( "Logical replication is not supported " diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_add_table.py b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_add_table.py index de40f6717..601efc99b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_add_table.py +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_add_table.py @@ -31,6 +31,8 @@ class PublicationUpdateAddTableTestCase(BaseTestGenerator): self.db_id = schema_info["db_id"] self.server_version = schema_info["server_version"] self.schema_name = schema_info["schema_name"] + self.test_data['pubowner'] = self.server['username'] + if self.server_version < 99999: self.skipTest( "Logical replication is not supported " diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_drop_schema.py b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_drop_schema.py index 21f192879..d67e9499d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_drop_schema.py +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_drop_schema.py @@ -32,6 +32,8 @@ class PublicationUpdateDropSchemaTestCase(BaseTestGenerator): self.server_id = schema_info["server_id"] self.db_id = schema_info["db_id"] self.server_version = schema_info["server_version"] + self.test_data['pubowner'] = self.server['username'] + if self.server_version < 99999: self.skipTest( "Logical replication is not supported " diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_drop_table.py b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_drop_table.py index 25cf30d0e..ee8366d0a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_drop_table.py +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_drop_table.py @@ -33,6 +33,7 @@ class PublicationUpdateDropTableTestCase(BaseTestGenerator): self.db_id = schema_info["db_id"] self.server_version = schema_info["server_version"] self.schema_name = schema_info["schema_name"] + self.test_data['pubowner'] = self.server['username'] if self.server_version < 99999: self.skipTest( diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_update_schema.py b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_update_schema.py index 4b2858d18..96bb1b737 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_update_schema.py +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_update_schema.py @@ -32,6 +32,8 @@ class PublicationUpdateSchemaUpdateTestCase(BaseTestGenerator): self.server_id = schema_info["server_id"] self.db_id = schema_info["db_id"] self.server_version = schema_info["server_version"] + self.test_data['pubowner'] = self.server['username'] + if self.server_version < 99999: self.skipTest( "Logical replication is not supported " diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_update_table.py b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_update_table.py index 45834d55c..f0a861d2b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_update_table.py +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/tests/test_publication_put_update_table.py @@ -35,6 +35,7 @@ class PublicationUpdateTableUpdateTestCase(BaseTestGenerator): self.db_id = schema_info["db_id"] self.server_version = schema_info["server_version"] self.schema_name = schema_info["schema_name"] + self.test_data['pubowner'] = self.server['username'] if self.server_version < 99999: self.skipTest( diff --git a/web/regression/javascript/components/FormComponents.spec.js b/web/regression/javascript/components/FormComponents.spec.js index 21386ce3c..ab07979ac 100644 --- a/web/regression/javascript/components/FormComponents.spec.js +++ b/web/regression/javascript/components/FormComponents.spec.js @@ -534,7 +534,7 @@ describe('FormComponents', ()=>{ setTimeout(()=>{ expect(onChange).toHaveBeenCalled(); done(); - }, 100); + }, 1000); }); it('accessibility', ()=>{