public inbox for [email protected]
help / color / mirror / Atom feedFrom: Pradip Parkale <[email protected]>
To: Akshay Joshi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin][RM6153]: Add publication and subscription support in Schema Diff.
Date: Mon, 8 Feb 2021 15:01:30 +0530
Message-ID: <CAJ9T6SvAtgMaeKWSyeJUmgkeoPLEQ12sTk0m0HjL8QwZmBfdDQ@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDedjgukXi-nEooKGF-MW5WidaEYBWmHKz2o+092GCKPkw@mail.gmail.com>
References: <CAJ9T6Ss--gC0W-uRKj0BTr2+CWQYMGT3KB4iYv22yijSANdjmg@mail.gmail.com>
<CANxoLDedjgukXi-nEooKGF-MW5WidaEYBWmHKz2o+092GCKPkw@mail.gmail.com>
Hi Akshay,
Please find the updated patch.
On Thu, Feb 4, 2021 at 11:54 AM Akshay Joshi <[email protected]>
wrote:
> Hi Pradip
>
> I haven't started reviewing your patch but seems you haven't written test
> cases for schema diff. Please add and then submit the patch again.
>
> On Wed, Feb 3, 2021 at 9:51 PM Pradip Parkale <
> [email protected]> wrote:
>
>> Hi Hackers,
>>
>> Please find the attached patch for publication and subscription support
>> in Schema Diff.
>>
>> Also, added the dependencies for publication and subscription.
>>
>> --
>> 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*
>
--
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation
Attachments:
[application/octet-stream] RM6153_2.patch (138.1K, 3-RM6153_2.patch)
download | inline diff:
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 3d98f4388..e0d0c0477 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/publications/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/publications/__init__.py
@@ -21,6 +21,8 @@ from pgadmin.utils.ajax import make_json_response, internal_server_error, \
from pgadmin.utils.driver import get_driver
from config import PG_DEFAULT_DRIVER
from pgadmin.tools.schema_diff.compare import SchemaDiffObjectCompare
+from pgadmin.tools.schema_diff.node_registry import SchemaDiffRegistry
+from urllib.parse import unquote
class PublicationModule(CollectionNodeModule):
@@ -153,17 +155,10 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
- This function returns the handler and inline functions for the
selected publication node
- * get_templates(gid, sid, did)
- - This function returns publication templates.
-
* sql(gid, sid, did, pbid):
- This function will generate sql to show it in sql pane for the
selected publication node.
- * dependents(gid, sid, did, pbid):
- - This function get the dependents and return ajax response for the
- publication node.
-
* dependencies(self, gid, sid, did, pbid):
- This function get the dependencies and return ajax response for the
publication node.
@@ -194,7 +189,6 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
'dependency': [{'get': 'dependencies'}],
'dependent': [{'get': 'dependents'}],
'get_tables': [{}, {'get': 'get_tables'}],
- 'get_templates': [{}, {'get': 'get_templates'}],
'delete': [{'delete': 'delete'}, {'delete': 'delete'}]
})
@@ -281,7 +275,8 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
)
status, pname = self.conn.execute_scalar(get_name_sql)
table_sql = render_template(
- "/".join([self.template_path, 'get_tables.sql']),
+ "/".join([self.template_path,
+ self._GET_TABLE_FOR_PUBLICATION]),
pname=pname
)
@@ -412,7 +407,8 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
)
status, pname = self.conn.execute_scalar(get_name_sql)
table_sql = render_template(
- "/".join([self.template_path, 'get_tables.sql']),
+ "/".join([self.template_path,
+ self._GET_TABLE_FOR_PUBLICATION]),
pname=pname
)
@@ -444,6 +440,9 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
try:
data = self._parser_data_input_from_client(data)
+ # unquote the table data
+ data = self.unquote_the_table(data)
+
sql, name = self.get_sql(data, pbid)
# Most probably this is due to error
@@ -465,6 +464,22 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
except Exception as e:
return internal_server_error(errormsg=str(e))
+ def unquote_the_table(self, data):
+ """
+ This function unquote the table value
+ :param data:
+ :return: data
+ """
+ pubtable = []
+
+ # Unquote the values
+ if 'pubtable' in data:
+ for table in data['pubtable']:
+ pubtable.append(unquote(table))
+ data['pubtable'] = pubtable
+
+ return data
+
@check_precondition
def create(self, gid, sid, did):
"""
@@ -495,6 +510,9 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
try:
data = self._parser_data_input_from_client(data)
+ # unquote the table data
+ data = self.unquote_the_table(data)
+
sql = render_template("/".join([self.template_path,
self._CREATE_SQL]),
data=data, conn=self.conn)
@@ -525,7 +543,7 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
return internal_server_error(errormsg=str(e))
@check_precondition
- def delete(self, gid, sid, did, pbid=None):
+ def delete(self, gid, sid, did, pbid=None, only_sql=False):
"""
This function will drop the publication object
@@ -551,6 +569,7 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
"/".join([self.template_path, self._DELETE_SQL]),
pbid=pbid, conn=self.conn
)
+
status, pname = self.conn.execute_scalar(sql)
if not status:
@@ -562,6 +581,10 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
pname=pname, cascade=cascade, conn=self.conn
)
+ # Used for schema diff tool
+ if only_sql:
+ return sql
+
status, res = self.conn.execute_scalar(sql)
if not status:
return internal_server_error(errormsg=res)
@@ -598,6 +621,9 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
except ValueError:
data[k] = v
try:
+ # unquote the table data
+ data = self.unquote_the_table(data)
+
sql, name = self.get_sql(data, pbid)
# Most probably this is due to error
if not isinstance(sql, str):
@@ -637,6 +663,31 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
return data
+ def _get_table_details_to_add_and_delete(self, old_data, data):
+ """
+ This function returns the tables which need to add and delete
+ :param old_data:
+ :param data:
+ :return:
+ """
+ drop_table_data = []
+ add_table_data = []
+ drop_table = False
+ add_table = False
+
+ for table in old_data['pubtable']:
+ if 'pubtable' in data and table not in data['pubtable']:
+ drop_table_data.append(table)
+ drop_table = True
+
+ if 'pubtable' in data:
+ for table in data['pubtable']:
+ if table not in old_data['pubtable']:
+ add_table_data.append(table)
+ add_table = True
+
+ return drop_table, add_table, drop_table_data, add_table_data
+
def get_sql(self, data, pbid=None):
"""
This function will generate sql from model data.
@@ -648,9 +699,6 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
required_args = [
'name'
]
- drop_table = False
- add_table = False
-
if pbid is not None:
sql = render_template(
"/".join([self.template_path, self._PROPERTIES_SQL]), pbid=pbid
@@ -664,20 +712,8 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
old_data = self._get_old_table_data(res['rows'][0]['name'], res)
- drop_table_data = []
-
- add_table_data = []
-
- for table in old_data['pubtable']:
- if 'pubtable' in data and table not in data['pubtable']:
- drop_table_data.append(table)
- drop_table = True
-
- if 'pubtable' in data:
- for table in data['pubtable']:
- if table not in old_data['pubtable']:
- add_table_data.append(table)
- add_table = True
+ drop_table, add_table, drop_table_data, add_table_data = \
+ self._get_table_details_to_add_and_delete(old_data, data)
for arg in required_args:
if arg not in data:
@@ -743,7 +779,7 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
"""
table_sql = render_template(
- "/".join([self.template_path, 'get_tables.sql']),
+ "/".join([self.template_path, self._GET_TABLE_FOR_PUBLICATION]),
pname=pname
)
@@ -854,5 +890,102 @@ class PublicationView(PGChildNodeView, SchemaDiffObjectCompare):
status=200
)
+ def get_dependencies(self, conn, object_id, where=None,
+ show_system_objects=None, is_schema_diff=False):
+ """
+ This function gets the dependencies and returns an ajax response
+ for the publication node.
+ :param conn:
+ :param object_id:
+ :param where:
+ :param show_system_objects:
+ :param is_schema_diff:
+ :return: dependencies result
+ """
+
+ get_name_sql = render_template(
+ "/".join([self.template_path, self._DELETE_SQL]),
+ pbid=object_id, conn=self.conn
+ )
+ status, pname = self.conn.execute_scalar(get_name_sql)
+ table_sql = render_template(
+ "/".join([self.template_path, 'dependencies.sql']),
+ pname=pname
+ )
+ status, res = self.conn.execute_dict(table_sql)
+ if not status:
+ return internal_server_error(errormsg=res)
+
+ dependencies_result = []
+
+ for pub_table in res['rows']:
+ dependencies_result.append(
+ {'type': 'table',
+ 'name': pub_table['pubtable'],
+ 'field': 'normal',
+ 'oid': pub_table['oid']})
+
+ return dependencies_result
+
+ @check_precondition
+ def fetch_objects_to_compare(self, sid, did):
+ """
+ This function will fetch the list of all the event triggers for
+ specified database id.
+
+ :param sid: Server Id
+ :param did: Database Id
+ :return:
+ """
+ res = dict()
+
+ if self.manager.version < 100000:
+ return res
+
+ last_system_oid = 0
+ if self.manager.db_info is not None and did in self.manager.db_info:
+ last_system_oid = (self.manager.db_info[did])['datlastsysoid']
+
+ sql = render_template(
+ "/".join([self.template_path, 'nodes.sql']),
+ datlastsysoid=last_system_oid,
+ showsysobj=self.blueprint.show_system_objects
+ )
+ status, rset = self.conn.execute_2darray(sql)
+ if not status:
+ return internal_server_error(errormsg=rset)
+
+ for row in rset['rows']:
+ status, data = self._fetch_properties(did, row['oid'])
+ if status:
+ res[row['name']] = data
+
+ return res
+
+ def get_sql_from_diff(self, **kwargs):
+ """
+ This function is used to get the DDL/DML statements.
+ :param kwargs:
+ :return:
+ """
+ gid = kwargs.get('gid')
+ sid = kwargs.get('sid')
+ did = kwargs.get('did')
+ oid = kwargs.get('oid')
+ data = kwargs.get('data', None)
+ drop_sql = kwargs.get('drop_sql', False)
+
+ if data:
+ sql, name = self.get_sql(data=data, pbid=oid)
+ else:
+ if drop_sql:
+ sql = self.delete(gid=gid, sid=sid, did=did,
+ pbid=oid, only_sql=True)
+ else:
+ sql = self.sql(gid=gid, sid=sid, did=did, pbid=oid,
+ json_resp=False)
+ return sql
+
+SchemaDiffRegistry(blueprint.node_type, PublicationView, 'Database')
PublicationView.register_node_view(blueprint)
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/sql/default/delete.sql
index 98cb5d0d1..7efb13acf 100644
--- 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/sql/default/delete.sql
@@ -1,6 +1,6 @@
{# ============= Get the publication name using oid ============= #}
{% if pbid %}
- SELECT pubname FROM pg_publication WHERE oid = {{pbid}}::oid;
+SELECT pubname FROM pg_publication WHERE oid = {{pbid}}::oid;
{% endif %}
{# ============= Drop the publication ============= #}
{% if pname %}
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/sql/default/dependencies.sql
new file mode 100644
index 000000000..46399e304
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/dependencies.sql
@@ -0,0 +1,5 @@
+SELECT cl.oid AS oid,
+quote_ident(pgb_table.schemaname)||'.'||quote_ident(pgb_table.tablename) AS pubtable
+FROM pg_publication_tables pgb_table
+LEFT JOIN 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/sql/default/get_all_tables.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/sql/default/get_all_tables.sql
index f5f702503..874cf00eb 100644
--- 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/sql/default/get_all_tables.sql
@@ -1,6 +1,6 @@
SELECT quote_ident(c.table_schema)||'.'||quote_ident(c.table_name) AS table
FROM information_schema.tables c
-where c.table_type = 'BASE TABLE'
+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 IN ('information_schema') ORDER BY 1;
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/sql/default/get_position.sql
index 656f6907f..80914b606 100644
--- 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/sql/default/get_position.sql
@@ -1 +1 @@
-SELECT oid, pubname AS name FROM pg_publication where pubname = '{{ pubname }}';
+SELECT oid, pubname AS name FROM pg_publication WHERE pubname = '{{ pubname }}';
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/sql/default/get_tables.sql
index b18039b9a..1849b65ea 100644
--- 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/sql/default/get_tables.sql
@@ -1 +1,3 @@
-SELECT quote_ident(pgb_table.schemaname)||'.'||quote_ident(pgb_table.tablename) AS pubtable FROM pg_publication_tables pgb_table where pubname = '{{ pname }}' and pgb_table.schemaname NOT LIKE 'pgagent';
+SELECT quote_ident(pgb_table.schemaname)||'.'||quote_ident(pgb_table.tablename)
+AS pubtable FROM pg_publication_tables pgb_table WHERE pubname = '{{ pname }}'
+AND pgb_table.schemaname NOT LIKE 'pgagent';
diff --git a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/__init__.py
index e970e79e9..f2e72207d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/__init__.py
@@ -169,7 +169,7 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
- This function get the dependents and return ajax response for the
subscription node.
- * dependencies(self, gid, sid, did, subid):
+ * dependencies(gid, sid, did, subid):
- This function get the dependencies and return ajax response for the
subscription node.
"""
@@ -379,28 +379,10 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
return True, res['rows'][0]
- @check_precondition
- def dependents(self, gid, sid, did, subid):
- """
- This function gets the dependents and returns an ajax response
- for the view node.
-
- Args:
- gid: Server Group ID
- sid: Server ID
- did: Database ID
- subid: View ID
- """
- dependents_result = self.get_dependents(self.conn, subid)
- return ajax_response(
- response=dependents_result,
- status=200
- )
-
@check_precondition
def statistics(self, gid, sid, did, subid):
"""
- This function gets the dependents and returns an ajax response
+ This function gets the statistics and returns an ajax response
for the view node.
Args:
@@ -418,24 +400,6 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
status=200
)
- @check_precondition
- def dependencies(self, gid, sid, did, subid):
- """
- This function gets the dependencies and returns an ajax response
- for the view node.
-
- Args:
- gid: Server Group ID
- sid: Server ID
- did: Database ID
- subid: View ID
- """
- dependencies_result = self.get_dependencies(self.conn, subid)
- return ajax_response(
- response=dependencies_result,
- status=200
- )
-
@check_precondition
def update(self, gid, sid, did, subid):
"""
@@ -537,7 +501,7 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
return internal_server_error(errormsg=str(e))
@check_precondition
- def delete(self, gid, sid, did, subid=None):
+ def delete(self, gid, sid, did, subid=None, only_sql=False):
"""
This function will drop the subscription object
@@ -575,6 +539,10 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
subname=subname, cascade=cascade, conn=self.conn
)
+ # Used for schema diff tool
+ if only_sql:
+ return sql
+
status, res = self.conn.execute_scalar(sql)
if not status:
return internal_server_error(errormsg=res)
@@ -625,26 +593,32 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
except Exception as e:
return internal_server_error(errormsg=str(e))
- def get_details(self, data, old_data):
+ def get_required_details(self, data, old_data):
"""
This function returns the required data to create subscription
:param data:
- :return:
+ :return:data , old_data
"""
required_args = ['name']
required_connection_args = ['host', 'port', 'username', 'db',
'connect_timeout', 'passfile']
+
+ # Set connection time out to zero if initial set
+ # value is replaced to ''
+ if 'connect_timeout' in data and data['connect_timeout'] == '':
+ data['connect_timeout'] = 0
+
for arg in required_args:
- if arg not in data and arg in old_data:
+ if arg not in data:
data[arg] = old_data[arg]
for arg in required_connection_args:
- if arg not in data and arg in old_data:
- data[arg] = old_data[arg]
+ if arg in data:
+ old_data[arg] = data[arg]
- return data
+ return data, old_data
def get_sql(self, data, subid=None, operation=None):
"""
@@ -655,10 +629,6 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
subid: Subscription ID
"""
- required_args = ['name']
-
- required_connection_args = ['host', 'port', 'username', 'db',
- 'connect_timeout', 'passfile']
if operation == 'msql':
dummy = True
else:
@@ -677,13 +647,7 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
return gone(self._NOT_FOUND_PUB_INFORMATION)
old_data = res['rows'][0]
- for arg in required_args:
- if arg not in data:
- data[arg] = old_data[arg]
-
- for arg in required_connection_args:
- if arg in data:
- old_data[arg] = data[arg]
+ data, old_data = self.get_required_details(data, old_data)
if 'slot_name' in data and data['slot_name'] == '':
data['slot_name'] = 'None'
@@ -702,6 +666,11 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
return sql.strip('\n'), data['name']
def get_connection(self, connection_details):
+ """
+ This function is used to connect to DB and returns the publications
+ :param connection_details:
+ :return: publication list
+ """
passfile = connection_details['passfile'] if \
'passfile' in connection_details and \
@@ -772,13 +741,13 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
def sql(self, gid, sid, did, subid, json_resp=True):
"""
This function will generate sql to show in the sql pane for the
- selected publication node.
+ selected subscription node.
Args:
gid: Server Group ID
sid: Server ID
did: Database ID
- subid: Publication ID
+ subid: Subscription ID
json_resp:
"""
sql = render_template(
@@ -794,8 +763,11 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
# Making copy of output for future use
old_data = dict(res['rows'][0])
- if old_data['slot_name'] is None and 'create_slot' not in old_data:
- old_data['create_slot'] = False
+ old_data['create_slot'] = False
+ if old_data['enabled']:
+ old_data['connect'] = True
+ else:
+ old_data['connect'] = False
sql = render_template("/".join([self.template_path,
self._CREATE_SQL]),
@@ -856,5 +828,104 @@ class SubscriptionView(PGChildNodeView, SchemaDiffObjectCompare):
status=200
)
+ def get_dependencies(self, conn, object_id, where=None,
+ show_system_objects=None, is_schema_diff=False):
+ """
+ This function gets the dependencies and returns an ajax response
+ for the subscription node.
+ :param conn:
+ :param object_id:
+ :param where:
+ :param show_system_objects:
+ :param is_schema_diff:
+ :return: dependencies result
+ """
+
+ get_name_sql = render_template(
+ "/".join([self.template_path, self._DELETE_SQL]),
+ subid=object_id, conn=self.conn
+ )
+ status, subname = self.conn.execute_scalar(get_name_sql)
+ table_sql = render_template(
+ "/".join([self.template_path, 'dependencies.sql']),
+ subname=subname
+ )
+ status, res = self.conn.execute_dict(table_sql)
+ if not status:
+ return internal_server_error(errormsg=res)
+
+ dependencies_result = []
+
+ for publication in res['rows'][0]['pub']:
+ dependencies_result.append(
+ {'type': 'publication',
+ 'name': publication,
+ 'field': 'normal'})
+
+ return dependencies_result
+
+ @check_precondition
+ def fetch_objects_to_compare(self, sid, did):
+ """
+ This function will fetch the list of all the event triggers for
+ specified database id.
+
+ :param sid: Server Id
+ :param did: Database Id
+ :return:
+ """
+ res = dict()
+ if self.manager.version < 100000:
+ return res
+
+ last_system_oid = 0
+ if self.manager.db_info is not None and did in self.manager.db_info:
+ last_system_oid = (self.manager.db_info[did])['datlastsysoid']
+
+ sql = render_template(
+ "/".join([self.template_path, 'nodes.sql']),
+ datlastsysoid=last_system_oid,
+ showsysobj=self.blueprint.show_system_objects,
+ did=did
+ )
+ status, rset = self.conn.execute_2darray(sql)
+ if not status:
+ return internal_server_error(errormsg=rset)
+
+ for row in rset['rows']:
+ status, data = self._fetch_properties(did, row['oid'])
+ if status:
+ res[row['name']] = data
+
+ return res
+
+ def get_sql_from_diff(self, **kwargs):
+ """
+ This function is used to get the DDL/DML statements.
+ :param kwargs:
+ :return:
+ """
+ gid = kwargs.get('gid')
+ sid = kwargs.get('sid')
+ did = kwargs.get('did')
+ oid = kwargs.get('oid')
+ data = kwargs.get('data', None)
+ drop_sql = kwargs.get('drop_sql', False)
+
+ if data:
+ if 'pub' in data and type(data['pub']) == str:
+ # Convert publication details to list
+ data['pub'] = data['pub'].split(',,')
+ sql, name = self.get_sql(data=data, subid=oid)
+ else:
+ if drop_sql:
+ sql = self.delete(gid=gid, sid=sid, did=did,
+ subid=oid, only_sql=True)
+ else:
+ sql = self.sql(gid=gid, sid=sid, did=did, subid=oid,
+ json_resp=False)
+ return sql
+
+SchemaDiffRegistry(blueprint.node_type, SubscriptionView, 'Database')
SubscriptionView.register_node_view(blueprint)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/static/js/subscription.js b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/static/js/subscription.js
index caa084827..6c1b71521 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/static/js/subscription.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/static/js/subscription.js
@@ -77,6 +77,7 @@ define('pgadmin.node.subscription', [
name: undefined,
subowner: undefined,
pubtable: undefined,
+ connect_timeout: undefined,
pub:[],
enabled:true,
create_slot: true,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/alter_maintenance_db.sql b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/alter_maintenance_db.sql
index b341b0935..1a2d6204b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/alter_maintenance_db.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/alter_maintenance_db.sql
@@ -5,4 +5,4 @@
CREATE SUBSCRIPTION test_alter_subscription
CONNECTION 'host=localhost port=5432 user=postgres dbname=edb'
PUBLICATION sample__1
- WITH (enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'remote_apply');
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'remote_apply');
diff --git a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/alter_subscription.sql b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/alter_subscription.sql
index 8010a4959..ce72dfcab 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/alter_subscription.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/alter_subscription.sql
@@ -5,4 +5,4 @@
CREATE SUBSCRIPTION test_alter_subscription
CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres'
PUBLICATION sample__1
- WITH (enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
diff --git a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/alter_sync.sql b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/alter_sync.sql
index 54e678273..03debd0b8 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/alter_sync.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/alter_sync.sql
@@ -5,4 +5,4 @@
CREATE SUBSCRIPTION test_alter_subscription
CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres'
PUBLICATION sample__1
- WITH (enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'remote_apply');
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'remote_apply');
diff --git a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/create_subscription.sql b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/create_subscription.sql
index a7819f196..6548c5f7e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/create_subscription.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/10_plus/create_subscription.sql
@@ -5,4 +5,4 @@
CREATE SUBSCRIPTION test_create_subscription
CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres'
PUBLICATION sample__1
- WITH (enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
diff --git a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/subscription_test_data.json b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/subscription_test_data.json
index 4773557fe..dca2e5a78 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/subscription_test_data.json
+++ b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/subscription_test_data.json
@@ -14,12 +14,12 @@
"subowner": "postgres",
"enabled": false,
"host": "localhost",
- "slot_name": "NONE",
+ "slot_name": "None",
"service": "",
"port": 5432,
"password": "",
"sync": "off",
- "pub": "PLACE_HOLDER"
+ "pub": "[\"sample__1\"]"
},
"mocking_required": false,
"mock_data": {},
@@ -42,12 +42,12 @@
"subowner": "postgres",
"enabled": false,
"host": "localhost",
- "slot_name": "NONE",
+ "slot_name": "None",
"service": "",
"port": 5432,
"password": "",
"sync": "off",
- "pub": "PLACE_HOLDER"
+ "pub": "[\"sample__1\"]"
},
"mocking_required": false,
"mock_data": {},
@@ -70,12 +70,12 @@
"subowner": "postgres",
"enabled": false,
"host": "localhost",
- "slot_name": "NONE",
+ "slot_name": "None",
"service": "",
"port": 5432,
"password": "",
"sync": "off",
- "pub": "PLACE_HOLDER"
+ "pub": "[\"sample__1\"]"
},
"mocking_required": false,
"mock_data": {},
@@ -98,12 +98,12 @@
"subowner": "postgres",
"enabled": false,
"host": "localhost",
- "slot_name": "NONE",
+ "slot_name": "None",
"service": "",
"port": 5432,
"password": "",
"sync": "off",
- "pub": "PLACE_HOLDER"
+ "pub": "[\"sample__1\"]"
},
"mocking_required": true,
"mock_data": {
@@ -128,12 +128,12 @@
"subowner": "postgres",
"enabled": false,
"host": "localhost",
- "slot_name": "NONE",
+ "slot_name": "None",
"service": "",
"port": 5432,
"password": "",
"sync": "off",
- "pub": "PLACE_HOLDER"
+ "pub": "[\"sample__1\"]"
},
"mocking_required": true,
"mock_data": {
diff --git a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/test_subscription_create.py b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/test_subscription_create.py
index 6b80182dd..d558320f4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/test_subscription_create.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/test_subscription_create.py
@@ -59,8 +59,7 @@ class SubscriptionAddTestCase(BaseTestGenerator):
"""This function will subscription."""
self.test_data['name'] = \
"test_subscription_add_%s" % (str(uuid.uuid4())[1:8])
-
- self.test_data['pub'] = """["sample__1"]"""
+ self.test_data['slot_name'] = None
data = self.test_data
if self.is_positive_test:
diff --git a/web/pgadmin/browser/server_groups/servers/templates/depends/pg/11_plus/dependents.sql b/web/pgadmin/browser/server_groups/servers/templates/depends/pg/11_plus/dependents.sql
index 853847f5a..6f2e48288 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/depends/pg/11_plus/dependents.sql
+++ b/web/pgadmin/browser/server_groups/servers/templates/depends/pg/11_plus/dependents.sql
@@ -19,14 +19,13 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
WHEN ftst.oid IS NOT NULL THEN 'Ft'::text
WHEN ext.oid IS NOT NULL THEN 'Ex'::text
WHEN pl.oid IS NOT NULL THEN 'Rs'::text
- WHEN pub_rel.oid IS NOT NULL THEN 'r'::text
ELSE ''
END AS type,
COALESCE(coc.relname, clrw.relname) AS ownertable,
CASE WHEN cl.relname IS NOT NULL AND att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
ELSE COALESCE(cl.relname, co.conname, pr.proname, tg.tgname, ty.typname, la.lanname, rw.rulename, ns.nspname,
fs.srvname, fdw.fdwname, evt.evtname, col.collname, ftsc.cfgname, ftsd.dictname, ftsp.prsname,
- ftst.tmplname, ext.extname, pl.polname, quote_ident(pubns.nspname)||'.'||quote_ident(pubcl.relname))
+ ftst.tmplname, ext.extname, pl.polname)
END AS refname,
COALESCE(nsc.nspname, nso.nspname, nsp.nspname, nst.nspname, nsrw.nspname, colns.nspname, ftscns.nspname,
ftsdns.nspname, ftspns.nspname, ftstns.nspname) AS nspname,
@@ -68,12 +67,9 @@ LEFT JOIN pg_ts_template ftst ON ftst.oid=dep.objid
LEFT JOIN pg_namespace ftstns ON ftst.tmplnamespace=ftstns.oid
LEFT JOIN pg_extension ext ON ext.oid=dep.objid
LEFT JOIN pg_policy pl ON pl.oid=dep.objid
-LEFT JOIN pg_publication_rel pub_rel ON pub_rel.oid = dep.objid
-LEFT JOIN pg_class pubcl ON pubcl.oid = pub_rel.prrelid
-LEFT JOIN pg_namespace pubns ON pubns.oid=pubcl.relnamespace
{{where_clause}} AND
classid IN ( SELECT oid FROM pg_class WHERE relname IN
('pg_class', 'pg_constraint', 'pg_conversion', 'pg_language', 'pg_proc', 'pg_rewrite', 'pg_namespace',
'pg_trigger', 'pg_type', 'pg_attrdef', 'pg_event_trigger', 'pg_foreign_server', 'pg_foreign_data_wrapper',
- 'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension', 'pg_policy', 'pg_subscription', 'pg_publication_rel'))
+ 'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension', 'pg_policy'))
ORDER BY classid, cl.relkind
diff --git a/web/pgadmin/browser/server_groups/servers/templates/depends/pg/12_plus/dependents.sql b/web/pgadmin/browser/server_groups/servers/templates/depends/pg/12_plus/dependents.sql
index 5bac508ae..ef76c885d 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/depends/pg/12_plus/dependents.sql
+++ b/web/pgadmin/browser/server_groups/servers/templates/depends/pg/12_plus/dependents.sql
@@ -19,14 +19,13 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, pg_get_expr(ad.a
WHEN ftst.oid IS NOT NULL THEN 'Ft'::text
WHEN ext.oid IS NOT NULL THEN 'Ex'::text
WHEN pl.oid IS NOT NULL THEN 'Rs'::text
- WHEN pub_rel.oid IS NOT NULL THEN 'r'::text
ELSE ''
END AS type,
COALESCE(coc.relname, clrw.relname) AS ownertable,
CASE WHEN cl.relname IS NOT NULL AND att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
ELSE COALESCE(cl.relname, co.conname, pr.proname, tg.tgname, ty.typname, la.lanname, rw.rulename, ns.nspname,
fs.srvname, fdw.fdwname, evt.evtname, col.collname, ftsc.cfgname, ftsd.dictname, ftsp.prsname,
- ftst.tmplname, ext.extname, pl.polname, quote_ident(pubns.nspname)||'.'||quote_ident(pubcl.relname))
+ ftst.tmplname, ext.extname, pl.polname)
END AS refname,
COALESCE(nsc.nspname, nso.nspname, nsp.nspname, nst.nspname, nsrw.nspname, colns.nspname, ftscns.nspname,
ftsdns.nspname, ftspns.nspname, ftstns.nspname) AS nspname,
@@ -68,12 +67,9 @@ LEFT JOIN pg_ts_template ftst ON ftst.oid=dep.objid
LEFT JOIN pg_namespace ftstns ON ftst.tmplnamespace=ftstns.oid
LEFT JOIN pg_extension ext ON ext.oid=dep.objid
LEFT JOIN pg_policy pl ON pl.oid=dep.objid
-LEFT JOIN pg_publication_rel pub_rel ON pub_rel.oid = dep.objid
-LEFT JOIN pg_class pubcl ON pubcl.oid = pub_rel.prrelid
-LEFT JOIN pg_namespace pubns ON pubns.oid=pubcl.relnamespace
{{where_clause}} AND
classid IN ( SELECT oid FROM pg_class WHERE relname IN
('pg_class', 'pg_constraint', 'pg_conversion', 'pg_language', 'pg_proc', 'pg_rewrite', 'pg_namespace',
'pg_trigger', 'pg_type', 'pg_attrdef', 'pg_event_trigger', 'pg_foreign_server', 'pg_foreign_data_wrapper',
- 'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension', 'pg_policy', 'pg_subscription', 'pg_publication_rel'))
+ 'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension', 'pg_policy'))
ORDER BY classid, cl.relkind
diff --git a/web/pgadmin/browser/server_groups/servers/templates/depends/ppas/11_plus/dependents.sql b/web/pgadmin/browser/server_groups/servers/templates/depends/ppas/11_plus/dependents.sql
index ad70e3b93..b6e368731 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/depends/ppas/11_plus/dependents.sql
+++ b/web/pgadmin/browser/server_groups/servers/templates/depends/ppas/11_plus/dependents.sql
@@ -20,14 +20,13 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, ad.adsrc,
WHEN ext.oid IS NOT NULL THEN 'Ex'::text
WHEN syn.oid IS NOT NULL THEN 'Sy'::text
WHEN pl.oid IS NOT NULL THEN 'Rs'::text
- WHEN pub_rel.oid IS NOT NULL THEN 'r'::text
ELSE ''
END AS type,
COALESCE(coc.relname, clrw.relname) AS ownertable,
CASE WHEN cl.relname IS NOT NULL AND att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
ELSE COALESCE(cl.relname, co.conname, pr.proname, tg.tgname, ty.typname, la.lanname, rw.rulename, ns.nspname,
fs.srvname, fdw.fdwname, evt.evtname, col.collname, ftsc.cfgname, ftsd.dictname, ftsp.prsname,
- ftst.tmplname, ext.extname, syn.synname, pl.polname, quote_ident(pubns.nspname)||'.'||quote_ident(pubcl.relname))
+ ftst.tmplname, ext.extname, syn.synname, pl.polname)
END AS refname,
COALESCE(nsc.nspname, nso.nspname, nsp.nspname, nst.nspname, nsrw.nspname, colns.nspname, ftscns.nspname,
ftsdns.nspname, ftspns.nspname, ftstns.nspname, synns.nspname) AS nspname,
@@ -71,12 +70,10 @@ LEFT JOIN pg_extension ext ON ext.oid=dep.objid
LEFT JOIN pg_synonym syn ON syn.oid=dep.objid
LEFT JOIN pg_namespace synns ON syn.synnamespace=synns.oid
LEFT JOIN pg_policy pl ON pl.oid=dep.objid
-LEFT JOIN pg_publication_rel pub_rel ON pub_rel.oid = dep.objid
-LEFT JOIN pg_class pubcl ON pubcl.oid = pub_rel.prrelid
-LEFT JOIN pg_namespace pubns ON pubns.oid=pubcl.relnamespace
{{where_clause}} AND
classid IN ( SELECT oid FROM pg_class WHERE relname IN
('pg_class', 'pg_constraint', 'pg_conversion', 'pg_language', 'pg_proc', 'pg_rewrite', 'pg_namespace',
'pg_trigger', 'pg_type', 'pg_attrdef', 'pg_event_trigger', 'pg_foreign_server', 'pg_foreign_data_wrapper',
- 'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension', 'pg_policy', 'pg_subscription', 'pg_publication_rel'))
+ 'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension',
+ 'pg_synonym', 'pg_policy'))
ORDER BY classid, cl.relkind
diff --git a/web/pgadmin/browser/server_groups/servers/templates/depends/ppas/12_plus/dependents.sql b/web/pgadmin/browser/server_groups/servers/templates/depends/ppas/12_plus/dependents.sql
index 9b1002b64..c6781827f 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/depends/ppas/12_plus/dependents.sql
+++ b/web/pgadmin/browser/server_groups/servers/templates/depends/ppas/12_plus/dependents.sql
@@ -20,14 +20,13 @@ SELECT DISTINCT dep.deptype, dep.classid, cl.relkind, ad.adbin, pg_get_expr(ad.a
WHEN ext.oid IS NOT NULL THEN 'Ex'::text
WHEN syn.oid IS NOT NULL THEN 'Sy'::text
WHEN pl.oid IS NOT NULL THEN 'Rs'::text
- WHEN pub_rel.oid IS NOT NULL THEN 'r'::text
ELSE ''
END AS type,
COALESCE(coc.relname, clrw.relname) AS ownertable,
CASE WHEN cl.relname IS NOT NULL AND att.attname IS NOT NULL THEN cl.relname || COALESCE('.' || att.attname, '')
ELSE COALESCE(cl.relname, co.conname, pr.proname, tg.tgname, ty.typname, la.lanname, rw.rulename, ns.nspname,
fs.srvname, fdw.fdwname, evt.evtname, col.collname, ftsc.cfgname, ftsd.dictname, ftsp.prsname,
- ftst.tmplname, ext.extname, syn.synname, pl.polname, quote_ident(pubns.nspname)||'.'||quote_ident(pubcl.relname))
+ ftst.tmplname, ext.extname, syn.synname, pl.polname)
END AS refname,
COALESCE(nsc.nspname, nso.nspname, nsp.nspname, nst.nspname, nsrw.nspname, colns.nspname, ftscns.nspname,
ftsdns.nspname, ftspns.nspname, ftstns.nspname, synns.nspname) AS nspname,
@@ -71,13 +70,10 @@ LEFT JOIN pg_extension ext ON ext.oid=dep.objid
LEFT JOIN pg_synonym syn ON syn.oid=dep.objid
LEFT JOIN pg_namespace synns ON syn.synnamespace=synns.oid
LEFT JOIN pg_policy pl ON pl.oid=dep.objid
-LEFT JOIN pg_publication_rel pub_rel ON pub_rel.oid = dep.objid
-LEFT JOIN pg_class pubcl ON pubcl.oid = pub_rel.prrelid
-LEFT JOIN pg_namespace pubns ON pubns.oid=pubcl.relnamespace
{{where_clause}} AND
classid IN ( SELECT oid FROM pg_class WHERE relname IN
('pg_class', 'pg_constraint', 'pg_conversion', 'pg_language', 'pg_proc', 'pg_rewrite', 'pg_namespace',
'pg_trigger', 'pg_type', 'pg_attrdef', 'pg_event_trigger', 'pg_foreign_server', 'pg_foreign_data_wrapper',
'pg_collation', 'pg_ts_config', 'pg_ts_dict', 'pg_ts_parser', 'pg_ts_template', 'pg_extension',
- 'pg_synonym', 'pg_policy', 'pg_subscription', 'pg_publication_rel'))
+ 'pg_synonym', 'pg_policy'))
ORDER BY classid, cl.relkind
diff --git a/web/pgadmin/browser/utils.py b/web/pgadmin/browser/utils.py
index 42342e320..5dd361c28 100644
--- a/web/pgadmin/browser/utils.py
+++ b/web/pgadmin/browser/utils.py
@@ -393,6 +393,7 @@ class PGChildNodeView(NodeView):
_GET_COLUMNS_FOR_TABLE_SQL = 'get_columns_for_table.sql'
_GET_SUBTYPES_SQL = 'get_subtypes.sql'
_GET_EXTERNAL_FUNCTIONS_SQL = 'get_external_functions.sql'
+ _GET_TABLE_FOR_PUBLICATION = 'get_tables.sql'
def get_children_nodes(self, manager, **kwargs):
"""
@@ -638,9 +639,7 @@ class PGChildNodeView(NodeView):
# if type is present in the types dictionary, but it's
# value is None then it requires special handling.
if type_str[0] == 'r':
- if len(type_str) == 1:
- type_name = 'table'
- elif (type_str[1].isdigit() and int(type_str[1]) > 0) or \
+ if (type_str[1].isdigit() and int(type_str[1]) > 0) or \
(len(type_str) > 2 and type_str[2].isdigit() and
int(type_str[2]) > 0):
type_name = 'column'
diff --git a/web/pgadmin/static/js/browser/server_groups/servers/model_validation.js b/web/pgadmin/static/js/browser/server_groups/servers/model_validation.js
index d542aa072..9a78d24aa 100644
--- a/web/pgadmin/static/js/browser/server_groups/servers/model_validation.js
+++ b/web/pgadmin/static/js/browser/server_groups/servers/model_validation.js
@@ -39,12 +39,16 @@ export class ModelValidation {
this.checkForEmpty('db', gettext('Maintenance database must be specified.'));
this.checkForEmpty('username', gettext('Username must be specified.'));
this.checkForEmpty('port', gettext('Port must be specified.'));
- if(!_.isUndefined(pub) && pub.length == 0){
+ if(!_.isUndefined(pub)){
+ if (this.model.isNew())
+ this.checkForEmpty('password', gettext('Password must be specified.'));
this.checkForEmpty('pub', gettext('Publication must be specified.'));
}
} else {
this.checkForEmpty('db', gettext('Maintenance database must be specified.'));
- if(!_.isUndefined(pub) && pub.length == 0){
+ if(!_.isUndefined(pub)){
+ if (this.model.isNew())
+ this.checkForEmpty('password', gettext('Password must be specified.'));
this.checkForEmpty('pub', gettext('Publication must be specified.'));
}
this.clearHostAddressAndDbErrors();
@@ -90,7 +94,7 @@ export class ModelValidation {
let pub = this.model.get('pub'),
errmsg;
- if(!_.isUndefined(pub) && pub.length == 0){
+ if(!_.isUndefined(pub)){
errmsg = gettext('Host name, Address must ' +
'be specified.');
}else{
diff --git a/web/pgadmin/tools/schema_diff/tests/pg/10_plus/source.sql b/web/pgadmin/tools/schema_diff/tests/pg/10_plus/source.sql
index e7affe540..9b54fe88e 100644
--- a/web/pgadmin/tools/schema_diff/tests/pg/10_plus/source.sql
+++ b/web/pgadmin/tools/schema_diff/tests/pg/10_plus/source.sql
@@ -1117,3 +1117,44 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping;
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
OPTIONS (password 'admin123');
+
+-- Publication Script
+CREATE TABLE test_schema_diff.table_for_publication (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE PUBLICATION for_all_table
+ FOR ALL TABLES
+ WITH (publish = 'insert, delete');
+
+CREATE PUBLICATION with_one_table
+ FOR TABLE test_schema_diff.table_for_publication
+ WITH (publish = 'insert, delete');
+
+ALTER PUBLICATION with_one_table
+ RENAME TO with_one_table_alter;
+
+ALTER PUBLICATION with_one_table_alter SET
+ (publish = 'insert, update');
+
+-- Subscription script
+
+CREATE SUBSCRIPTION "subscription_test1"
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
+ PUBLICATION sample_publication
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
+
+ALTER SUBSCRIPTION subscription_test1
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
+
+ALTER SUBSCRIPTION subscription_test1
+ SET (synchronous_commit = 'remote_apply');
+
+ALTER SUBSCRIPTION subscription_test1
+ SET PUBLICATION edb WITH (refresh = false);
+
+ALTER SUBSCRIPTION subscription_test1
+ RENAME TO subscription_test;
+
+DROP SUBSCRIPTION subscription_test;
diff --git a/web/pgadmin/tools/schema_diff/tests/pg/10_plus/target.sql b/web/pgadmin/tools/schema_diff/tests/pg/10_plus/target.sql
index cb982c341..d51563d40 100644
--- a/web/pgadmin/tools/schema_diff/tests/pg/10_plus/target.sql
+++ b/web/pgadmin/tools/schema_diff/tests/pg/10_plus/target.sql
@@ -1062,3 +1062,50 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping
OPTIONS (password 'admin123');
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping;
+
+-- Publication script
+
+CREATE TABLE test_schema_diff.table_for_publication (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE TABLE test_schema_diff.table_for_publication_in_target (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE PUBLICATION for_all_table
+ FOR ALL TABLES
+ WITH (publish = 'insert, delete');
+
+CREATE PUBLICATION with_one_table_in_target
+ FOR TABLE test_schema_diff.table_for_publication_in_target
+ WITH (publish = 'insert, delete');
+
+ALTER PUBLICATION with_one_table_in_target
+ RENAME TO with_one_table_in_target_alter;
+
+ALTER PUBLICATION with_one_table_in_target_alter SET
+ (publish = 'insert, update');
+
+-- Subscription script
+
+CREATE SUBSCRIPTION "subscription_test1_in_target"
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
+ PUBLICATION sample_publication
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ SET (synchronous_commit = 'remote_apply');
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ SET PUBLICATION edb WITH (refresh = false);
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ RENAME TO subscription_test_in_target;
+
+DROP SUBSCRIPTION subscription_test_in_target;
diff --git a/web/pgadmin/tools/schema_diff/tests/pg/11_plus/source.sql b/web/pgadmin/tools/schema_diff/tests/pg/11_plus/source.sql
index 06bee59dd..d121ee539 100644
--- a/web/pgadmin/tools/schema_diff/tests/pg/11_plus/source.sql
+++ b/web/pgadmin/tools/schema_diff/tests/pg/11_plus/source.sql
@@ -1116,3 +1116,46 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping;
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
OPTIONS (password 'admin123');
+
+-- Publication Script
+
+CREATE TABLE test_schema_diff.table_for_publication (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE PUBLICATION for_all_table
+ FOR ALL TABLES
+ WITH (publish = 'insert, delete');
+
+CREATE PUBLICATION with_one_table
+ FOR TABLE test_schema_diff.table_for_publication
+ WITH (publish = 'insert, delete');
+
+ALTER PUBLICATION with_one_table
+ RENAME TO with_one_table_alter;
+
+ALTER PUBLICATION with_one_table_alter SET
+ (publish = 'insert, update, truncate');
+
+-- Subscription script
+
+CREATE SUBSCRIPTION "subscription_test1"
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
+ PUBLICATION sample_publication
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
+
+ALTER SUBSCRIPTION subscription_test1
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
+
+ALTER SUBSCRIPTION subscription_test1
+ SET (synchronous_commit = 'remote_apply');
+
+ALTER SUBSCRIPTION subscription_test1
+ SET PUBLICATION edb WITH (refresh = false);
+
+ALTER SUBSCRIPTION subscription_test1
+ RENAME TO subscription_test;
+
+DROP SUBSCRIPTION subscription_test;
+
diff --git a/web/pgadmin/tools/schema_diff/tests/pg/11_plus/target.sql b/web/pgadmin/tools/schema_diff/tests/pg/11_plus/target.sql
index da4780a8e..479bd9b90 100644
--- a/web/pgadmin/tools/schema_diff/tests/pg/11_plus/target.sql
+++ b/web/pgadmin/tools/schema_diff/tests/pg/11_plus/target.sql
@@ -1061,3 +1061,51 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping
OPTIONS (password 'admin123');
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping;
+
+-- Publication scripts
+
+CREATE TABLE test_schema_diff.table_for_publication (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE TABLE test_schema_diff.table_for_publication_in_target (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE PUBLICATION for_all_table
+ FOR ALL TABLES
+ WITH (publish = 'insert, delete');
+
+CREATE PUBLICATION with_one_table_in_target
+ FOR TABLE test_schema_diff.table_for_publication_in_target
+ WITH (publish = 'insert, delete');
+
+ALTER PUBLICATION with_one_table_in_target
+ RENAME TO with_one_table_in_target_alter;
+
+ALTER PUBLICATION with_one_table_in_target_alter SET
+ (publish = 'insert, update, truncate');
+
+-- Subscription script
+
+CREATE SUBSCRIPTION "subscription_test1_in_target"
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
+ PUBLICATION sample_publication
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ SET (synchronous_commit = 'remote_apply');
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ SET PUBLICATION edb WITH (refresh = false);
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ RENAME TO subscription_test_in_target;
+
+DROP SUBSCRIPTION subscription_test_in_target;
+
diff --git a/web/pgadmin/tools/schema_diff/tests/pg/12_plus/source.sql b/web/pgadmin/tools/schema_diff/tests/pg/12_plus/source.sql
index 415253941..d175de6ad 100644
--- a/web/pgadmin/tools/schema_diff/tests/pg/12_plus/source.sql
+++ b/web/pgadmin/tools/schema_diff/tests/pg/12_plus/source.sql
@@ -1117,3 +1117,53 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping;
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
OPTIONS (password 'admin123');
+
+-- Publication scripts
+
+CREATE TABLE test_schema_diff.table_for_publication (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE TABLE test_schema_diff.table_for_publication_in_target (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE PUBLICATION for_all_table
+ FOR ALL TABLES
+ WITH (publish = 'insert, delete');
+
+CREATE PUBLICATION with_one_table_in_target
+ FOR TABLE test_schema_diff.table_for_publication_in_target
+ WITH (publish = 'insert, delete');
+
+ALTER PUBLICATION with_one_table_in_target
+ OWNER TO managers;
+
+ALTER PUBLICATION with_one_table_in_target
+ RENAME TO with_one_table_in_target_alter;
+
+ALTER PUBLICATION with_one_table_in_target_alter SET
+ (publish = 'insert, update, truncate');
+
+-- Subscription script
+
+CREATE SUBSCRIPTION "subscription_test1"
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
+ PUBLICATION sample_publication
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
+
+ALTER SUBSCRIPTION subscription_test1
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
+
+ALTER SUBSCRIPTION subscription_test1
+ SET (synchronous_commit = 'remote_apply');
+
+ALTER SUBSCRIPTION subscription_test1
+ SET PUBLICATION edb WITH (refresh = false);
+
+ALTER SUBSCRIPTION subscription_test1
+ RENAME TO subscription_test;
+
+DROP SUBSCRIPTION subscription_test;
diff --git a/web/pgadmin/tools/schema_diff/tests/pg/12_plus/target.sql b/web/pgadmin/tools/schema_diff/tests/pg/12_plus/target.sql
index e09e39e36..9554a5fad 100644
--- a/web/pgadmin/tools/schema_diff/tests/pg/12_plus/target.sql
+++ b/web/pgadmin/tools/schema_diff/tests/pg/12_plus/target.sql
@@ -1050,3 +1050,51 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping
OPTIONS (password 'admin123');
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping;
+
+CREATE TABLE test_schema_diff.table_for_publication (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE TABLE test_schema_diff.table_for_publication_in_target (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE PUBLICATION for_all_table
+ FOR ALL TABLES
+ WITH (publish = 'insert, delete');
+
+CREATE PUBLICATION with_one_table_in_target
+ FOR TABLE test_schema_diff.table_for_publication_in_target
+ WITH (publish = 'insert, delete');
+
+ALTER PUBLICATION with_one_table_in_target
+ OWNER TO managers;
+
+ALTER PUBLICATION with_one_table_in_target
+ RENAME TO with_one_table_in_target_alter;
+
+ALTER PUBLICATION with_one_table_in_target_alter SET
+ (publish = 'insert, update, truncate');
+
+-- Subscription script
+
+CREATE SUBSCRIPTION "subscription_test1_in_target"
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
+ PUBLICATION sample_publication
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ SET (synchronous_commit = 'remote_apply');
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ SET PUBLICATION edb WITH (refresh = false);
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ RENAME TO subscription_test_in_target;
+
+DROP SUBSCRIPTION subscription_test_in_target;
diff --git a/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/source.sql b/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/source.sql
index 71544fb71..dc541b16a 100644
--- a/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/source.sql
+++ b/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/source.sql
@@ -1275,3 +1275,46 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping;
CREATE USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping
OPTIONS (password 'admin123');
+
+-- Publication Script
+
+CREATE TABLE test_schema_diff.table_for_publication (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+
+CREATE PUBLICATION for_all_table
+ FOR ALL TABLES
+ WITH (publish = 'insert, delete');
+
+CREATE PUBLICATION with_one_table
+ FOR TABLE test_schema_diff.table_for_publication
+ WITH (publish = 'insert, delete');
+
+ALTER PUBLICATION with_one_table
+ RENAME TO with_one_table_alter;
+
+ALTER PUBLICATION with_one_table_alter SET
+ (publish = 'insert, update');
+
+-- Subscription script
+
+CREATE SUBSCRIPTION "subscription_test1"
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
+ PUBLICATION sample_publication
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
+
+ALTER SUBSCRIPTION subscription_test1
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
+
+ALTER SUBSCRIPTION subscription_test1
+ SET (synchronous_commit = 'remote_apply');
+
+ALTER SUBSCRIPTION subscription_test1
+ SET PUBLICATION edb WITH (refresh = false);
+
+ALTER SUBSCRIPTION subscription_test1
+ RENAME TO subscription_test;
+
+DROP SUBSCRIPTION subscription_test;
diff --git a/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/target.sql b/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/target.sql
index 3fe6b07ea..77a22c5bf 100644
--- a/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/target.sql
+++ b/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/target.sql
@@ -1212,3 +1212,50 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping
OPTIONS (password 'admin123');
CREATE USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping;
+
+-- Publication script
+
+CREATE TABLE test_schema_diff.table_for_publication (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE TABLE test_schema_diff.table_for_publication_in_target (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE PUBLICATION for_all_table
+ FOR ALL TABLES
+ WITH (publish = 'insert, delete');
+
+CREATE PUBLICATION with_one_table_in_target
+ FOR TABLE test_schema_diff.table_for_publication_in_target
+ WITH (publish = 'insert, delete');
+
+ALTER PUBLICATION with_one_table_in_target
+ RENAME TO with_one_table_in_target_alter;
+
+ALTER PUBLICATION with_one_table_in_target_alter SET
+ (publish = 'insert, update');
+
+-- Subscription script
+
+CREATE SUBSCRIPTION "subscription_test1_in_target"
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
+ PUBLICATION sample_publication
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ SET (synchronous_commit = 'remote_apply');
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ SET PUBLICATION edb WITH (refresh = false);
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ RENAME TO subscription_test_in_target;
+
+DROP SUBSCRIPTION subscription_test_in_target;
diff --git a/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/source.sql b/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/source.sql
new file mode 100644
index 000000000..2e0793b36
--- /dev/null
+++ b/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/source.sql
@@ -0,0 +1,1319 @@
+--
+-- enterprisedbQL database dump
+--
+
+-- Dumped from database version 10.7
+-- Dumped by pg_dump version 12beta2
+
+-- Started on 2019-11-01 12:54:15 IST
+
+SET statement_timeout = 0;
+SET lock_timeout = 0;
+SET idle_in_transaction_session_timeout = 0;
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = on;
+SELECT pg_catalog.set_config('search_path', '', false);
+SET check_function_bodies = false;
+SET xmloption = content;
+SET client_min_messages = warning;
+SET row_security = off;
+
+--
+-- TOC entry 17 (class 2615 OID 139770)
+-- Name: test_schema_diff; Type: SCHEMA; Schema: -; Owner: enterprisedb
+--
+
+CREATE SCHEMA test_schema_diff;
+
+
+ALTER SCHEMA test_schema_diff OWNER TO enterprisedb;
+
+SET default_tablespace = '';
+
+
+CREATE EXTENSION btree_gist
+ SCHEMA test_schema_diff;
+
+--
+-- TOC entry 12272 (class 1259 OID 149205)
+-- Name: table_for_partition; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_partition (
+ col1 bigint NOT NULL
+)
+PARTITION BY RANGE (col1);
+
+
+ALTER TABLE test_schema_diff.table_for_partition OWNER TO enterprisedb;
+
+--
+-- TOC entry 12273 (class 1259 OID 149208)
+-- Name: part1; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.part1 (
+ col1 bigint NOT NULL
+);
+ALTER TABLE ONLY test_schema_diff.table_for_partition ATTACH PARTITION test_schema_diff.part1 FOR VALUES FROM ('1') TO ('23');
+
+
+ALTER TABLE test_schema_diff.part1 OWNER TO enterprisedb;
+
+--
+-- TOC entry 12274 (class 1259 OID 149213)
+-- Name: table_for_partition_1; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_partition_1 (
+ col1 bigint
+)
+PARTITION BY RANGE (col1);
+
+
+ALTER TABLE test_schema_diff.table_for_partition_1 OWNER TO enterprisedb;
+
+--
+-- TOC entry 12275 (class 1259 OID 149216)
+-- Name: part3; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.part3 (
+ col1 bigint
+);
+ALTER TABLE ONLY test_schema_diff.table_for_partition_1 ATTACH PARTITION test_schema_diff.part3 FOR VALUES FROM ('1') TO ('10');
+
+
+ALTER TABLE test_schema_diff.part3 OWNER TO enterprisedb;
+
+--
+-- TOC entry 12276 (class 1259 OID 149219)
+-- Name: part4; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.part4 (
+ col1 bigint
+);
+ALTER TABLE ONLY test_schema_diff.table_for_partition_1 ATTACH PARTITION test_schema_diff.part4 FOR VALUES FROM ('11') TO ('20');
+
+
+ALTER TABLE test_schema_diff.part4 OWNER TO enterprisedb;
+
+--
+-- TOC entry 12258 (class 1259 OID 148963)
+-- Name: table_for_column; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_column (
+ col1 bigint NOT NULL,
+ col2 text,
+ col3 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_column OWNER TO enterprisedb;
+
+--
+-- TOC entry 12256 (class 1259 OID 148895)
+-- Name: table_for_constraints; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_constraints (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_constraints OWNER TO enterprisedb;
+
+--
+-- TOC entry 61066 (class 0 OID 0)
+-- Dependencies: 12256
+-- Name: TABLE table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+COMMENT ON TABLE test_schema_diff.table_for_constraints IS 'comments';
+
+
+--
+-- TOC entry 12262 (class 1259 OID 149004)
+-- Name: table_for_identical; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_identical (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_identical OWNER TO enterprisedb;
+
+--
+-- TOC entry 12260 (class 1259 OID 148977)
+-- Name: table_for_index; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_index (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_index OWNER TO enterprisedb;
+
+--
+-- TOC entry 12269 (class 1259 OID 149128)
+-- Name: table_for_primary_key; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_primary_key (
+ col1 integer NOT NULL,
+ col2 text NOT NULL
+);
+
+
+ALTER TABLE test_schema_diff.table_for_primary_key OWNER TO enterprisedb;
+
+--
+-- TOC entry 12264 (class 1259 OID 149024)
+-- Name: table_for_rule; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_rule (
+ col1 bigint NOT NULL,
+ col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_rule OWNER TO enterprisedb;
+
+--
+-- TOC entry 12266 (class 1259 OID 149048)
+-- Name: table_for_trigger; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_trigger (
+ col1 bigint NOT NULL,
+ col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_trigger OWNER TO enterprisedb;
+
+--
+-- TOC entry 56893 (class 2606 OID 148904)
+-- Name: table_for_constraints Exclusion; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_constraints
+ ADD CONSTRAINT "Exclusion" EXCLUDE USING gist (col2 WITH <>) WITH (fillfactor='12') WHERE ((col1 > 1)) DEFERRABLE INITIALLY DEFERRED;
+
+
+--
+-- TOC entry 61067 (class 0 OID 0)
+-- Dependencies: 56893
+-- Name: CONSTRAINT "Exclusion" ON table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+COMMENT ON CONSTRAINT "Exclusion" ON test_schema_diff.table_for_constraints IS 'comments';
+
+
+--
+-- TOC entry 56891 (class 2606 OID 148911)
+-- Name: table_for_constraints check_con; Type: CHECK CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE test_schema_diff.table_for_constraints
+ ADD CONSTRAINT check_con CHECK ((col1 > 10)) NOT VALID;
+
+
+--
+-- TOC entry 61068 (class 0 OID 0)
+-- Dependencies: 56891
+-- Name: CONSTRAINT check_con ON table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+COMMENT ON CONSTRAINT check_con ON test_schema_diff.table_for_constraints IS 'coment';
+
+
+--
+-- TOC entry 56899 (class 2606 OID 148970)
+-- Name: table_for_column table_for_column_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_column
+ ADD CONSTRAINT table_for_column_pkey PRIMARY KEY (col1);
+
+
+--
+-- TOC entry 56895 (class 2606 OID 148902)
+-- Name: table_for_constraints table_for_constraints_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_constraints
+ ADD CONSTRAINT table_for_constraints_pkey PRIMARY KEY (col1);
+
+
+--
+-- TOC entry 56904 (class 2606 OID 148984)
+-- Name: table_for_index table_for_index_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_index
+ ADD CONSTRAINT table_for_index_pkey PRIMARY KEY (col1);
+
+
+--
+-- TOC entry 56913 (class 2606 OID 149135)
+-- Name: table_for_primary_key table_for_primary_key_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_primary_key
+ ADD CONSTRAINT table_for_primary_key_pkey PRIMARY KEY (col1, col2);
+
+
+--
+-- TOC entry 56909 (class 2606 OID 149031)
+-- Name: table_for_rule table_for_rule_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_rule
+ ADD CONSTRAINT table_for_rule_pkey PRIMARY KEY (col1);
+
+
+--
+-- TOC entry 56907 (class 2606 OID 149011)
+-- Name: table_for_identical table_for_table_for_identical_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_identical
+ ADD CONSTRAINT table_for_table_for_identical_pkey PRIMARY KEY (col1);
+
+
+--
+-- TOC entry 56911 (class 2606 OID 149055)
+-- Name: table_for_trigger table_for_trigger_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_trigger
+ ADD CONSTRAINT table_for_trigger_pkey PRIMARY KEY (col1);
+
+
+--
+-- TOC entry 56897 (class 2606 OID 148913)
+-- Name: table_for_constraints unique; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_constraints
+ ADD CONSTRAINT "unique" UNIQUE (col1);
+
+
+--
+-- TOC entry 61069 (class 0 OID 0)
+-- Dependencies: 56897
+-- Name: CONSTRAINT "unique" ON table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+COMMENT ON CONSTRAINT "unique" ON test_schema_diff.table_for_constraints IS 'cmnt';
+
+
+--
+-- TOC entry 56900 (class 1259 OID 149023)
+-- Name: index1; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE INDEX index1 ON test_schema_diff.table_for_index USING btree (col2 varchar_pattern_ops);
+
+
+--
+-- TOC entry 56905 (class 1259 OID 149012)
+-- Name: index_identical; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE INDEX index_identical ON test_schema_diff.table_for_identical USING btree (col2 text_pattern_ops);
+
+
+--
+-- TOC entry 56901 (class 1259 OID 149211)
+-- Name: index_same; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE INDEX index_same ON test_schema_diff.table_for_index USING btree (col2 text_pattern_ops);
+
+
+--
+-- TOC entry 56902 (class 1259 OID 149022)
+-- Name: index_source; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE INDEX index_source ON test_schema_diff.table_for_index USING btree (col2 text_pattern_ops);
+
+
+--
+-- TOC entry 61044 (class 2618 OID 149032)
+-- Name: table_for_rule rule1; Type: RULE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE RULE rule1 AS
+ ON UPDATE TO test_schema_diff.table_for_rule DO INSTEAD NOTHING;
+
+
+--
+-- TOC entry 61070 (class 0 OID 0)
+-- Dependencies: 61044
+-- Name: RULE rule1 ON table_for_rule; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+COMMENT ON RULE rule1 ON test_schema_diff.table_for_rule IS 'comments';
+
+
+--
+-- TOC entry 61045 (class 2618 OID 149033)
+-- Name: table_for_rule rule2; Type: RULE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE RULE rule2 AS
+ ON INSERT TO test_schema_diff.table_for_rule DO NOTHING;
+
+--
+-- TOC entry 12283 (class 1259 OID 347818)
+-- Name: test view; Type: VIEW; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE VIEW test_schema_diff."test view" AS
+ SELECT pg_class.relname,
+ pg_class.relnamespace,
+ pg_class.reltype,
+ pg_class.reloftype,
+ pg_class.relowner,
+ pg_class.relam,
+ pg_class.relfilenode,
+ pg_class.reltablespace,
+ pg_class.relpages,
+ pg_class.reltuples,
+ pg_class.relallvisible,
+ pg_class.reltoastrelid,
+ pg_class.relhasindex,
+ pg_class.relisshared,
+ pg_class.relpersistence,
+ pg_class.relkind,
+ pg_class.relnatts,
+ pg_class.relchecks,
+ pg_class.relhasrules,
+ pg_class.relhastriggers,
+ pg_class.relhassubclass,
+ pg_class.relrowsecurity,
+ pg_class.relforcerowsecurity,
+ pg_class.relispopulated,
+ pg_class.relreplident,
+ pg_class.relispartition,
+ pg_class.relfrozenxid,
+ pg_class.relminmxid,
+ pg_class.relacl,
+ pg_class.reloptions,
+ pg_class.relpartbound
+ FROM pg_class
+ LIMIT 10;
+
+
+ALTER TABLE test_schema_diff."test view" OWNER TO enterprisedb;
+
+--
+-- TOC entry 12286 (class 1259 OID 347832)
+-- Name: test view f; Type: VIEW; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE VIEW test_schema_diff."test view f" WITH (security_barrier='false') AS
+ SELECT 2;
+
+
+ALTER TABLE test_schema_diff."test view f" OWNER TO enterprisedb;
+
+--
+-- TOC entry 61111 (class 0 OID 0)
+-- Dependencies: 12286
+-- Name: VIEW "test view f"; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+COMMENT ON VIEW test_schema_diff."test view f" IS 'cmn';
+
+-- Collation scripts
+CREATE COLLATION test_schema_diff.coll_src
+ FROM pg_catalog."POSIX";
+
+ALTER COLLATION test_schema_diff.coll_src
+ OWNER TO enterprisedb;
+
+COMMENT ON COLLATION test_schema_diff.coll_src
+ IS 'Test Comment';
+
+CREATE COLLATION test_schema_diff.coll_diff
+ (LC_COLLATE = 'POSIX', LC_CTYPE = 'POSIX');
+
+ALTER COLLATION test_schema_diff.coll_diff
+ OWNER TO enterprisedb;
+
+COMMENT ON COLLATION test_schema_diff.coll_diff
+ IS 'Test Comment';
+
+-- FTS Configuration scripts
+CREATE TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_src (
+ COPY=german
+);
+
+ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_src OWNER TO enterprisedb;
+
+COMMENT ON TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_src
+ IS 'Test Comment';
+
+CREATE TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff (
+ PARSER = default
+);
+ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ADD MAPPING FOR asciiword WITH german_stem;
+ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ADD MAPPING FOR email WITH simple;
+ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ADD MAPPING FOR hword WITH dutch_stem;
+
+-- FTS Dictionary scripts
+CREATE TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_src (
+ TEMPLATE = simple,
+ stopwords = 'english'
+);
+
+COMMENT ON TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_src
+ IS 'Test Comment';
+
+CREATE TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_diff (
+ TEMPLATE = simple,
+ stopwords = 'english'
+);
+
+COMMENT ON TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_diff
+ IS 'Test Comment';
+
+-- FTS Parser scripts
+CREATE TEXT SEARCH PARSER test_schema_diff.fts_par_src (
+ START = prsd_start,
+ GETTOKEN = prsd_nexttoken,
+ END = prsd_end,
+ LEXTYPES = prsd_lextype);
+
+COMMENT ON TEXT SEARCH PARSER test_schema_diff.fts_par_src
+ IS 'Test Comment';
+
+CREATE TEXT SEARCH PARSER test_schema_diff.fts_par_diff (
+ START = prsd_start,
+ GETTOKEN = prsd_nexttoken,
+ END = prsd_end,
+ LEXTYPES = prsd_lextype);
+
+COMMENT ON TEXT SEARCH PARSER test_schema_diff.fts_par_diff
+ IS 'Test Comment';
+
+-- FTS Template scripts
+CREATE TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_src (
+ INIT = dispell_init,
+ LEXIZE = dispell_lexize
+);
+
+COMMENT ON TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_src IS 'Test Comment';
+
+CREATE TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_diff (
+ INIT = dispell_init,
+ LEXIZE = dispell_lexize
+);
+
+COMMENT ON TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_diff IS 'Test Comment';
+
+-- Domain and Domain Constraint script
+CREATE DOMAIN test_schema_diff.dom_src
+ AS bigint
+ DEFAULT 100
+ NOT NULL;
+
+ALTER DOMAIN test_schema_diff.dom_src OWNER TO enterprisedb;
+
+ALTER DOMAIN test_schema_diff.dom_src
+ ADD CONSTRAINT con_src CHECK (VALUE <> 100);
+
+CREATE DOMAIN test_schema_diff.dom_cons_diff
+ AS bigint
+ DEFAULT 100
+ NOT NULL;
+
+ALTER DOMAIN test_schema_diff.dom_cons_diff OWNER TO enterprisedb;
+
+ALTER DOMAIN test_schema_diff.dom_cons_diff
+ ADD CONSTRAINT cons_diff_1 CHECK (VALUE <> 50);
+
+ALTER DOMAIN test_schema_diff.dom_cons_diff
+ ADD CONSTRAINT cons_src_only CHECK (VALUE <> 25);
+
+CREATE DOMAIN test_schema_diff.dom_type_diff
+ AS character varying(40)
+ COLLATE pg_catalog."POSIX";
+
+ALTER DOMAIN test_schema_diff.dom_type_diff OWNER TO enterprisedb;
+
+ALTER DOMAIN test_schema_diff.dom_type_diff
+ ADD CONSTRAINT cons1 CHECK (VALUE::text <> 'pgAdmin3'::text);
+
+ALTER DOMAIN test_schema_diff.dom_type_diff
+ ADD CONSTRAINT cons2 CHECK (VALUE::text <> 'pgAdmin4'::text);
+
+COMMENT ON DOMAIN test_schema_diff.dom_type_diff
+ IS 'Test comment';
+
+-- Type Script composite type
+CREATE TYPE test_schema_diff.typ_comp_src AS
+(
+ m1 bit(5),
+ m2 text COLLATE pg_catalog."POSIX"
+);
+ALTER TYPE test_schema_diff.typ_comp_src
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_comp_diff AS
+(
+ m1 numeric(5,2),
+ m3 character varying(30) COLLATE pg_catalog."C"
+);
+ALTER TYPE test_schema_diff.typ_comp_diff
+ OWNER TO enterprisedb;
+COMMENT ON TYPE test_schema_diff.typ_comp_diff
+ IS 'Test Comment';
+GRANT USAGE ON TYPE test_schema_diff.typ_comp_diff TO PUBLIC;
+GRANT USAGE ON TYPE test_schema_diff.typ_comp_diff TO pg_monitor WITH GRANT OPTION;
+GRANT USAGE ON TYPE test_schema_diff.typ_comp_diff TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_comp_diff_no_column AS
+(
+);
+ALTER TYPE test_schema_diff.typ_comp_diff_no_column
+ OWNER TO enterprisedb;
+
+-- Type Script ENUM type
+CREATE TYPE test_schema_diff.typ_enum_src AS ENUM
+ ('test_enum');
+ALTER TYPE test_schema_diff.typ_enum_src
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_enum_diff AS ENUM
+ ('test_enum', 'test_enum_1');
+ALTER TYPE test_schema_diff.typ_enum_diff
+ OWNER TO enterprisedb;
+COMMENT ON TYPE test_schema_diff.typ_enum_diff
+ IS 'Test Comment';
+GRANT USAGE ON TYPE test_schema_diff.typ_enum_src TO pg_monitor WITH GRANT OPTION;
+
+-- Type Script RANGE type
+CREATE TYPE test_schema_diff.typ_range_src AS RANGE
+(
+ SUBTYPE=text,
+ COLLATION = pg_catalog."POSIX",
+ SUBTYPE_OPCLASS = text_ops
+);
+ALTER TYPE test_schema_diff.typ_range_src
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_range_col_diff AS RANGE
+(
+ SUBTYPE=text,
+ COLLATION = pg_catalog."C",
+ SUBTYPE_OPCLASS = text_ops
+);
+ALTER TYPE test_schema_diff.typ_range_col_diff
+ OWNER TO enterprisedb;
+COMMENT ON TYPE test_schema_diff.typ_range_col_diff
+ IS 'Test Comment';
+GRANT USAGE ON TYPE test_schema_diff.typ_range_col_diff TO PUBLIC;
+GRANT USAGE ON TYPE test_schema_diff.typ_range_col_diff TO enterprisedb WITH GRANT OPTION;
+
+CREATE TYPE test_schema_diff.typ_range_subtype_diff AS RANGE
+(
+ SUBTYPE=bpchar,
+ COLLATION = pg_catalog."POSIX"
+);
+ALTER TYPE test_schema_diff.typ_range_subtype_diff
+ OWNER TO enterprisedb;
+
+-- Type Script SHELL type
+CREATE TYPE test_schema_diff.typ_shell_src;
+ALTER TYPE test_schema_diff.typ_shell_src
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_shell_diff;
+ALTER TYPE test_schema_diff.typ_shell_diff
+ OWNER TO enterprisedb;
+COMMENT ON TYPE test_schema_diff.typ_shell_diff
+ IS 'Test Comment';
+
+-- Type script to test when Type is different
+CREATE TYPE test_schema_diff.typ_comp_range_diff AS
+(
+ m1 bigint,
+ m2 text[] COLLATE pg_catalog."POSIX"
+);
+ALTER TYPE test_schema_diff.typ_comp_range_diff
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_comp_enum_diff AS
+(
+ m1 bigint,
+ m2 text[] COLLATE pg_catalog."POSIX"
+);
+ALTER TYPE test_schema_diff.typ_comp_range_diff
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_range_comp_diff AS RANGE
+(
+ SUBTYPE=text,
+ COLLATION = pg_catalog."C",
+ SUBTYPE_OPCLASS = text_ops
+);
+ALTER TYPE test_schema_diff.typ_range_comp_diff
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_range_enum_diff AS RANGE
+(
+ SUBTYPE=text,
+ COLLATION = pg_catalog."C",
+ SUBTYPE_OPCLASS = text_ops
+);
+ALTER TYPE test_schema_diff.typ_range_enum_diff
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_enum_comp_diff AS ENUM
+ ('test_enum', 'test_enum_1');
+ALTER TYPE test_schema_diff.typ_enum_comp_diff
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_enum_range_diff AS ENUM
+ ('test_enum', 'test_enum_1');
+ALTER TYPE test_schema_diff.typ_enum_range_diff
+ OWNER TO enterprisedb;
+
+-- Package script (test_schema_diff only)
+CREATE OR REPLACE PACKAGE test_schema_diff.pkg_src
+IS
+ FUNCTION get_dept_name(p_deptno numeric) RETURN character varying;
+ PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric);
+END pkg_src;
+
+CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_src
+IS
+ FUNCTION get_dept_name(p_deptno numeric) RETURN character varying IS
+ v_dname VARCHAR2(14);
+ BEGIN
+ SELECT dname INTO v_dname FROM dept WHERE deptno = p_deptno;
+ RETURN v_dname;
+ EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ DBMS_OUTPUT.PUT_LINE('Invalid department number ' || p_deptno);
+ RETURN '';
+ END;
+
+ PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric) IS
+ BEGIN
+ INSERT INTO emp(empno, ename, job, sal, hiredate, comm, mgr, deptno)
+ VALUES(p_empno, p_ename, p_job, p_sal,
+ p_hiredate, p_comm, p_mgr, p_deptno);
+ END;
+END pkg_src;
+
+COMMENT ON PACKAGE test_schema_diff.pkg_src
+ IS 'Target';
+
+-- Package script difference in header, acl and comment
+CREATE OR REPLACE PACKAGE test_schema_diff.pkg_header_diff
+IS
+ FUNCTION get_dept_name(p_deptno numeric) RETURN character varying;
+ PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric);
+END pkg_header_diff;
+
+CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_header_diff
+IS
+ FUNCTION get_dept_name(p_deptno numeric) RETURN character varying IS
+ v_dname VARCHAR2(14);
+ BEGIN
+ SELECT dname INTO v_dname FROM dept WHERE deptno = p_deptno;
+ RETURN v_dname;
+ EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ DBMS_OUTPUT.PUT_LINE('Invalid department number ' || p_deptno);
+ RETURN '';
+ END;
+
+ PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric) IS
+ BEGIN
+ INSERT INTO emp(empno, ename, job, sal, hiredate, comm, mgr, deptno)
+ VALUES(p_empno, p_ename, p_job, p_sal,
+ p_hiredate, p_comm, p_mgr, p_deptno);
+ END;
+END pkg_header_diff;
+
+COMMENT ON PACKAGE test_schema_diff.pkg_header_diff
+ IS 'Header Diff';
+
+GRANT EXECUTE ON PACKAGE test_schema_diff.pkg_header_diff TO PUBLIC;
+GRANT EXECUTE ON PACKAGE test_schema_diff.pkg_header_diff TO enterprisedb WITH GRANT OPTION;
+
+-- Package script difference in body, acl and comment
+CREATE OR REPLACE PACKAGE test_schema_diff.pkg_body_diff
+IS
+ PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric);
+END pkg_body_diff;
+
+CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_body_diff
+IS
+ PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric) IS
+ BEGIN
+ DBMS_OUTPUT.PUT_LINE('Before Insert ');
+ INSERT INTO emp(empno, ename, job, sal, hiredate, comm, mgr, deptno)
+ VALUES(p_empno, p_ename, p_job, p_sal,
+ p_hiredate, p_comm, p_mgr, p_deptno);
+ DBMS_OUTPUT.PUT_LINE('After Insert ');
+ END;
+END pkg_body_diff;
+
+-- Synonyms Scripts
+-- Prerequisite for synonyms
+CREATE OR REPLACE FUNCTION test_schema_diff.fun_for_syn()
+RETURNS void
+ LANGUAGE 'plpgsql'
+ VOLATILE
+ COST 100
+
+AS $BODY$BEGIN
+SELECT 1;
+END;$BODY$;
+ALTER FUNCTION test_schema_diff.fun_for_syn()
+ OWNER TO enterprisedb;
+
+CREATE OR REPLACE PROCEDURE test_schema_diff.proc_for_syn()
+ SECURITY DEFINER VOLATILE
+ COST 100
+AS $BODY$BEGIN
+SELECT 1;
+END;$BODY$;
+
+CREATE OR REPLACE PACKAGE test_schema_diff.pkg_for_syn
+IS
+FUNCTION get_dept_name(p_deptno numeric) RETURN character varying;
+END pkg_for_syn;
+CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_for_syn
+IS
+FUNCTION get_dept_name(p_deptno numeric) RETURN character varying IS
+BEGIN
+ RETURN '';
+END;
+END pkg_for_syn;
+
+CREATE TABLE test_schema_diff.table_for_syn
+(
+ id bigint,
+ name text COLLATE pg_catalog."default"
+)
+TABLESPACE pg_default;
+ALTER TABLE test_schema_diff.table_for_syn
+ OWNER to enterprisedb;
+
+CREATE SEQUENCE test_schema_diff.seq_for_syn
+ INCREMENT 5
+ START 1
+ MINVALUE 1
+ MAXVALUE 100
+ CACHE 1;
+ALTER SEQUENCE test_schema_diff.seq_for_syn
+ OWNER TO enterprisedb;
+
+CREATE OR REPLACE SYNONYM test_schema_diff.syn_fun_src
+ FOR test_schema_diff.fun_for_syn;
+
+CREATE OR REPLACE SYNONYM test_schema_diff.syn_pkg_src
+ FOR test_schema_diff.pkg_for_syn;
+
+CREATE OR REPLACE SYNONYM test_schema_diff.syn_proc_src
+ FOR test_schema_diff.proc_for_syn;
+
+CREATE OR REPLACE SYNONYM test_schema_diff.syn_seq_src
+ FOR test_schema_diff.seq_for_syn;
+
+CREATE OR REPLACE SYNONYM test_schema_diff.syn_table_src
+ FOR test_schema_diff.table_for_syn;
+
+CREATE TABLE public.table_for_syn
+(
+ id bigint,
+ name text COLLATE pg_catalog."default"
+)
+TABLESPACE pg_default;
+ALTER TABLE public.table_for_syn
+ OWNER to enterprisedb;
+
+CREATE OR REPLACE SYNONYM test_schema_diff.syn_diff
+ FOR public.table_for_syn;
+
+-- Sequences Script
+CREATE SEQUENCE test_schema_diff.seq_src
+ CYCLE
+ INCREMENT 1
+ START 1
+ MINVALUE 1
+ MAXVALUE 3
+ CACHE 6;
+ALTER SEQUENCE test_schema_diff.seq_src
+ OWNER TO enterprisedb;
+COMMENT ON SEQUENCE test_schema_diff.seq_src
+ IS 'Test Comment';
+GRANT ALL ON SEQUENCE test_schema_diff.seq_src TO PUBLIC;
+GRANT ALL ON SEQUENCE test_schema_diff.seq_src TO enterprisedb;
+
+CREATE SEQUENCE test_schema_diff.seq_diff_comment_acl
+ INCREMENT 1
+ START 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ CACHE 1;
+ALTER SEQUENCE test_schema_diff.seq_diff_comment_acl
+ OWNER TO enterprisedb;
+COMMENT ON SEQUENCE test_schema_diff.seq_diff_comment_acl
+ IS 'Test Comment';
+GRANT ALL ON SEQUENCE test_schema_diff.seq_diff_comment_acl TO PUBLIC;
+GRANT ALL ON SEQUENCE test_schema_diff.seq_diff_comment_acl TO enterprisedb;
+
+CREATE SEQUENCE test_schema_diff.seq_diff_comment_acl_remove
+ INCREMENT 1
+ START 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ CACHE 1;
+ALTER SEQUENCE test_schema_diff.seq_diff_comment_acl_remove
+ OWNER TO enterprisedb;
+
+CREATE SEQUENCE test_schema_diff.seq_diff
+ CYCLE
+ INCREMENT 3
+ START 3
+ MINVALUE 3
+ MAXVALUE 100
+ CACHE 2;
+ALTER SEQUENCE test_schema_diff.seq_diff
+ OWNER TO enterprisedb;
+
+CREATE SEQUENCE test_schema_diff.seq_start_diff
+ INCREMENT 5
+ START 3
+ MINVALUE 3
+ MAXVALUE 20;
+ALTER SEQUENCE test_schema_diff.seq_start_diff
+ OWNER TO enterprisedb;
+
+-- Foreign Data Wrapper to test foreign table
+CREATE FOREIGN DATA WRAPPER test_fdw_for_foreign_table;
+ALTER FOREIGN DATA WRAPPER test_fdw_for_foreign_table
+ OWNER TO enterprisedb;
+
+-- Foreign Server to test foreign table
+CREATE SERVER test_fs_for_foreign_table
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_table;
+ALTER SERVER test_fs_for_foreign_table
+ OWNER TO enterprisedb;
+CREATE SERVER test_fs2_for_foreign_table
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_table;
+ALTER SERVER test_fs2_for_foreign_table
+ OWNER TO enterprisedb;
+
+-- Table to test inheritance in foreign table
+CREATE TABLE public.test_table_for_foreign_table
+(
+ tid bigint NOT NULL,
+ tname text COLLATE pg_catalog."default",
+ CONSTRAINT test_table_for_foreign_table_pkey PRIMARY KEY (tid)
+)
+WITH (
+ OIDS = FALSE
+)
+TABLESPACE pg_default;
+ALTER TABLE public.test_table_for_foreign_table
+ OWNER to enterprisedb;
+
+CREATE FOREIGN TABLE test_schema_diff.ft_src(
+ fid bigint NULL,
+ fname text NULL COLLATE pg_catalog."default"
+)
+ SERVER test_fs_for_foreign_table;
+ALTER FOREIGN TABLE test_schema_diff.ft_src
+ OWNER TO enterprisedb;
+ALTER FOREIGN TABLE test_schema_diff.ft_src
+ ADD CONSTRAINT fcheck CHECK ((fid > 1000)) NO INHERIT;
+COMMENT ON FOREIGN TABLE test_schema_diff.ft_src
+ IS 'Test Comment';
+GRANT INSERT ON TABLE test_schema_diff.ft_src TO PUBLIC;
+GRANT ALL ON TABLE test_schema_diff.ft_src TO enterprisedb;
+
+CREATE FOREIGN TABLE test_schema_diff.ft_diff_col(
+ fid bigint NULL,
+ fname text NULL COLLATE pg_catalog."default",
+ fcity character varying(40) NULL COLLATE pg_catalog."POSIX"
+)
+ SERVER test_fs_for_foreign_table;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_col
+ OWNER TO enterprisedb;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_col
+ ADD CONSTRAINT fcheck CHECK ((fid > 1000)) NO INHERIT;
+COMMENT ON FOREIGN TABLE test_schema_diff.ft_diff_col
+ IS 'Test Comment';
+
+CREATE FOREIGN TABLE test_schema_diff.ft_diff_const(
+ fid bigint NULL,
+ fname text NULL COLLATE pg_catalog."default"
+)
+ SERVER test_fs_for_foreign_table;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_const
+ OWNER TO enterprisedb;
+
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_const
+ ADD CONSTRAINT fcheck CHECK ((fid > 1000)) NO INHERIT;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_const
+ ADD CONSTRAINT fcheck1 CHECK ((fid > 1000)) NO INHERIT NOT VALID;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_const
+ ADD CONSTRAINT fcheck2 CHECK ((fid > 20));
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_const
+ ADD CONSTRAINT fcheck_src CHECK ((fid > 50));
+
+GRANT INSERT ON TABLE test_schema_diff.ft_diff_const TO PUBLIC;
+GRANT ALL ON TABLE test_schema_diff.ft_diff_const TO enterprisedb;
+
+CREATE FOREIGN TABLE test_schema_diff.ft_diff_opt(
+ fid bigint NULL,
+ fname text NULL COLLATE pg_catalog."default"
+)
+ SERVER test_fs_for_foreign_table
+ OPTIONS (opt1 'val1', opt2 'val20', opt_src 'val_src');
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_opt
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN TABLE test_schema_diff.ft_diff_foreign_server(
+ fid bigint NULL,
+ fname text NULL COLLATE pg_catalog."default"
+)
+ SERVER test_fs_for_foreign_table;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_foreign_server
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN TABLE test_schema_diff.ft_diff_foreign_server_1(
+ fid bigint NULL,
+ fname text NULL COLLATE pg_catalog."default"
+)
+ SERVER test_fs_for_foreign_table
+ OPTIONS (opt1 'val1');
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_foreign_server_1
+ OWNER TO enterprisedb;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_foreign_server_1
+ ADD CONSTRAINT cs1 CHECK ((fid > 200)) NO INHERIT;
+
+-- Test for RM #5350
+CREATE TABLE test_schema_diff.events_transactions
+(
+ event_code integer,
+ numerator integer,
+ account_token text COLLATE pg_catalog."default",
+ transaction_dt timestamp without time zone,
+ payment_method integer,
+ payment_pin integer,
+ approval text COLLATE pg_catalog."default",
+ amount integer,
+ file_dt timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
+ file_name character varying(256) COLLATE pg_catalog."default",
+ transfer_dt timestamp without time zone,
+ transaction_type integer
+);
+
+-- Casts script
+CREATE CAST (money AS bigint)
+ WITHOUT FUNCTION
+ AS IMPLICIT;
+
+COMMENT ON CAST (money AS bigint) IS 'money -> bigint';
+
+-- Event Trigger script
+CREATE FUNCTION public.evt_tri_fun()
+ RETURNS event_trigger
+ LANGUAGE 'plpgsql'
+ NOT LEAKPROOF
+AS $BODY$
+BEGIN
+PERFORM 1;
+END;
+$BODY$;
+ALTER FUNCTION public.evt_tri_fun()
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_src ON DDL_COMMAND_START
+ EXECUTE PROCEDURE public.evt_tri_fun();
+COMMENT ON EVENT TRIGGER evt_tri_src
+ IS 'Event Trigger Source';
+ALTER EVENT TRIGGER evt_tri_src
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_event1 ON DDL_COMMAND_START
+ EXECUTE PROCEDURE public.evt_tri_fun();
+ALTER EVENT TRIGGER evt_tri_diff_event1
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_event2 ON DDL_COMMAND_END
+ EXECUTE PROCEDURE public.evt_tri_fun();
+ALTER EVENT TRIGGER evt_tri_diff_event2
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_event3 ON SQL_DROP
+ EXECUTE PROCEDURE public.evt_tri_fun();
+ALTER EVENT TRIGGER evt_tri_diff_event3
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_enable_status1 ON DDL_COMMAND_START
+ EXECUTE PROCEDURE public.evt_tri_fun();
+ALTER EVENT TRIGGER evt_tri_diff_enable_status1
+ DISABLE;
+ALTER EVENT TRIGGER evt_tri_diff_enable_status1
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_enable_status2 ON DDL_COMMAND_START
+ EXECUTE PROCEDURE public.evt_tri_fun();
+ALTER EVENT TRIGGER evt_tri_diff_enable_status2
+ ENABLE REPLICA;
+ALTER EVENT TRIGGER evt_tri_diff_enable_status2
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_enable_status3 ON DDL_COMMAND_START
+ EXECUTE PROCEDURE public.evt_tri_fun();
+ALTER EVENT TRIGGER evt_tri_diff_enable_status3
+ ENABLE ALWAYS;
+ALTER EVENT TRIGGER evt_tri_diff_enable_status3
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_func ON DDL_COMMAND_START
+ EXECUTE PROCEDURE public.evt_tri_fun();
+ALTER EVENT TRIGGER evt_tri_diff_func
+ OWNER TO enterprisedb;
+
+-- Extension script
+CREATE EXTENSION adminpack
+ SCHEMA pg_catalog
+ VERSION "1.1";
+
+-- Language script
+CREATE TRUSTED PROCEDURAL LANGUAGE src_trusted_language
+ HANDLER plpgsql_call_handler
+ INLINE plpgsql_inline_handler
+ VALIDATOR plpgsql_validator;
+ALTER LANGUAGE src_trusted_language
+ OWNER TO enterprisedb;
+COMMENT ON LANGUAGE src_trusted_language
+ IS 'Custom Trusted Language';
+GRANT USAGE ON LANGUAGE src_trusted_language TO PUBLIC;
+GRANT USAGE ON LANGUAGE src_trusted_language TO enterprisedb WITH GRANT OPTION;
+
+CREATE PROCEDURAL LANGUAGE src_proc_language
+ HANDLER plpgsql_call_handler
+ INLINE plpgsql_inline_handler
+ VALIDATOR plpgsql_validator;
+ALTER LANGUAGE src_proc_language
+ OWNER TO enterprisedb;
+COMMENT ON LANGUAGE src_proc_language
+ IS 'Custom Procedural Language';
+
+CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_acl_add
+ HANDLER plpgsql_call_handler
+ INLINE plpgsql_inline_handler
+ VALIDATOR plpgsql_validator;
+ALTER LANGUAGE lan_diff_acl_add
+ OWNER TO enterprisedb;
+GRANT USAGE ON LANGUAGE lan_diff_acl_add TO PUBLIC;
+GRANT USAGE ON LANGUAGE lan_diff_acl_add TO enterprisedb WITH GRANT OPTION;
+
+CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_acl_revoke
+ HANDLER plpgsql_call_handler
+ INLINE plpgsql_inline_handler
+ VALIDATOR plpgsql_validator;
+ALTER LANGUAGE lan_diff_acl_revoke
+ OWNER TO enterprisedb;
+
+CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_type
+ HANDLER plpgsql_call_handler
+ INLINE plpgsql_inline_handler
+ VALIDATOR plpgsql_validator;
+ALTER LANGUAGE lan_diff_type
+ OWNER TO enterprisedb;
+
+CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_inline_validator
+ HANDLER plpgsql_call_handler
+ INLINE prsd_end
+ VALIDATOR pg_stat_reset_single_table_counters;
+ALTER LANGUAGE lan_diff_type
+ OWNER TO enterprisedb;
+
+-- Foreign Data Wrapper Script
+CREATE FOREIGN DATA WRAPPER fdw_src
+ VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER fdw_src
+ OWNER TO enterprisedb;
+COMMENT ON FOREIGN DATA WRAPPER fdw_src
+ IS 'Foreign Data Wrapper';
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_acl_add
+ VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER fdw_diff_acl_add
+ OWNER TO enterprisedb;
+GRANT USAGE ON FOREIGN DATA WRAPPER fdw_diff_acl_add TO PUBLIC;
+GRANT USAGE ON FOREIGN DATA WRAPPER fdw_diff_acl_add TO enterprisedb WITH GRANT OPTION;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_acl_revoke
+ VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER fdw_diff_acl_revoke
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_add_validator
+ VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER fdw_diff_add_validator
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_remove_validator;
+ALTER FOREIGN DATA WRAPPER fdw_diff_remove_validator
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_add_options
+ OPTIONS (debug 'true');
+ALTER FOREIGN DATA WRAPPER fdw_diff_add_options
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_remove_options;
+ALTER FOREIGN DATA WRAPPER fdw_diff_remove_options
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_options
+ OPTIONS (debug 'false');
+ALTER FOREIGN DATA WRAPPER fdw_diff_options
+ OWNER TO enterprisedb;
+
+-- Foreign Server Script
+CREATE FOREIGN DATA WRAPPER test_fdw_for_foreign_server
+ VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER test_fdw_for_foreign_server
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_src
+ TYPE 'PG'
+ VERSION '10'
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server
+ OPTIONS (host '127.0.0.1', port '5432');
+ALTER SERVER fs_src
+ OWNER TO enterprisedb;
+COMMENT ON SERVER fs_src
+ IS 'Foreign Server';
+
+CREATE SERVER fs_diff_acl_add
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_acl_add
+ OWNER TO enterprisedb;
+GRANT USAGE ON FOREIGN SERVER fs_diff_acl_add TO PUBLIC;
+GRANT USAGE ON FOREIGN SERVER fs_diff_acl_add TO enterprisedb WITH GRANT OPTION;
+
+CREATE SERVER fs_diff_acl_revoke
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_acl_revoke
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_diff_type_version_add
+ TYPE 'PG'
+ VERSION '10'
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_type_version_add
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_diff_type_version_remove
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_type_version_remove
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_diff_type_version_modify
+ TYPE 'PG'
+ VERSION '10'
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_type_version_modify
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_diff_options_add
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server
+ OPTIONS (host '127.0.0.1', port '5432');
+ALTER SERVER fs_diff_options_add
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_diff_options_remove
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_options_remove
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_diff_options_modify
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server
+ OPTIONS (host '192.168.1.1', port '8080');
+ALTER SERVER fs_diff_options_modify
+ OWNER TO enterprisedb;
+
+-- User Mapping Script
+CREATE FOREIGN DATA WRAPPER test_fdw_for_user_mapping
+ VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER test_fdw_for_user_mapping
+ OWNER TO enterprisedb;
+
+CREATE SERVER test_fs_for_user_mapping
+ FOREIGN DATA WRAPPER test_fdw_for_user_mapping;
+ALTER SERVER test_fs_for_user_mapping
+ OWNER TO enterprisedb;
+
+CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping;
+
+CREATE USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping
+ OPTIONS (password 'admin123');
+
+-- Publication Script
+
+CREATE TABLE test_schema_diff.table_for_publication (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE PUBLICATION for_all_table
+ FOR ALL TABLES
+ WITH (publish = 'insert, delete');
+
+CREATE PUBLICATION with_one_table
+ FOR TABLE test_schema_diff.table_for_publication
+ WITH (publish = 'insert, delete');
+
+ALTER PUBLICATION with_one_table
+ RENAME TO with_one_table_alter;
+
+ALTER PUBLICATION with_one_table_alter SET
+ (publish = 'insert, update, truncate');
+
+-- Subscription script
+
+CREATE SUBSCRIPTION "subscription_test1"
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
+ PUBLICATION sample_publication
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
+
+ALTER SUBSCRIPTION subscription_test1
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
+
+ALTER SUBSCRIPTION subscription_test1
+ SET (synchronous_commit = 'remote_apply');
+
+ALTER SUBSCRIPTION subscription_test1
+ SET PUBLICATION edb WITH (refresh = false);
+
+ALTER SUBSCRIPTION subscription_test1
+ RENAME TO subscription_test;
+
+DROP SUBSCRIPTION subscription_test;
diff --git a/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/target.sql b/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/target.sql
new file mode 100644
index 000000000..16a549a87
--- /dev/null
+++ b/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/target.sql
@@ -0,0 +1,1261 @@
+--
+-- enterprisedbQL database dump
+--
+
+-- Dumped from database version 10.7
+-- Dumped by pg_dump version 12beta2
+
+-- Started on 2019-11-01 12:55:22 IST
+
+SET statement_timeout = 0;
+SET lock_timeout = 0;
+SET idle_in_transaction_session_timeout = 0;
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = on;
+SELECT pg_catalog.set_config('search_path', '', false);
+SET check_function_bodies = false;
+SET xmloption = content;
+SET client_min_messages = warning;
+SET row_security = off;
+
+--
+-- TOC entry 18 (class 2615 OID 139771)
+-- Name: test_schema_diff; Type: SCHEMA; Schema: -; Owner: enterprisedb
+--
+
+CREATE SCHEMA test_schema_diff;
+
+ALTER SCHEMA test_schema_diff OWNER TO enterprisedb;
+
+SET default_tablespace = '';
+
+CREATE EXTENSION btree_gist
+ SCHEMA test_schema_diff;
+
+--
+-- TOC entry 12250 (class 1259 OID 139938)
+-- Name: MView; Type: MATERIALIZED VIEW; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE MATERIALIZED VIEW test_schema_diff."MView" AS
+ SELECT 'tekst'::text AS text
+ WITH NO DATA;
+
+
+ALTER TABLE test_schema_diff."MView" OWNER TO enterprisedb;
+
+--
+-- TOC entry 12277 (class 1259 OID 149234)
+-- Name: table_for_partition_1; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_partition_1 (
+ col1 bigint
+)
+PARTITION BY RANGE (col1);
+
+
+ALTER TABLE test_schema_diff.table_for_partition_1 OWNER TO enterprisedb;
+
+--
+-- TOC entry 12278 (class 1259 OID 149237)
+-- Name: part3; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.part3 (
+ col1 bigint
+);
+ALTER TABLE ONLY test_schema_diff.table_for_partition_1 ATTACH PARTITION test_schema_diff.part3 FOR VALUES FROM ('13') TO ('56');
+
+
+ALTER TABLE test_schema_diff.part3 OWNER TO enterprisedb;
+
+--
+-- TOC entry 12259 (class 1259 OID 148971)
+-- Name: table_for_column; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_column (
+ col1 bigint,
+ col2 bigint,
+ col4 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_column OWNER TO enterprisedb;
+
+--
+-- TOC entry 12268 (class 1259 OID 149089)
+-- Name: table_for_constraints; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_constraints (
+ col1 integer NOT NULL,
+ col2 text,
+ CONSTRAINT check_con CHECK ((col1 > 30))
+);
+
+
+ALTER TABLE test_schema_diff.table_for_constraints OWNER TO enterprisedb;
+
+--
+-- TOC entry 61066 (class 0 OID 0)
+-- Dependencies: 12268
+-- Name: TABLE table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+COMMENT ON TABLE test_schema_diff.table_for_constraints IS 'comments';
+
+
+--
+-- TOC entry 61067 (class 0 OID 0)
+-- Dependencies: 12268
+-- Name: CONSTRAINT check_con ON table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+COMMENT ON CONSTRAINT check_con ON test_schema_diff.table_for_constraints IS 'coment';
+
+
+--
+-- TOC entry 12257 (class 1259 OID 148960)
+-- Name: table_for_del; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_del (
+);
+
+
+ALTER TABLE test_schema_diff.table_for_del OWNER TO enterprisedb;
+
+--
+-- TOC entry 12271 (class 1259 OID 149172)
+-- Name: table_for_foreign_key; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_foreign_key (
+ col1 integer NOT NULL,
+ col2 "char",
+ col3 bigint
+);
+
+
+ALTER TABLE test_schema_diff.table_for_foreign_key OWNER TO enterprisedb;
+
+--
+-- TOC entry 12263 (class 1259 OID 149013)
+-- Name: table_for_identical; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_identical (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_identical OWNER TO enterprisedb;
+
+--
+-- TOC entry 12261 (class 1259 OID 148986)
+-- Name: table_for_index; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_index (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_index OWNER TO enterprisedb;
+
+--
+-- TOC entry 12270 (class 1259 OID 149144)
+-- Name: table_for_primary_key; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_primary_key (
+ col1 integer NOT NULL,
+ col2 text NOT NULL
+);
+
+
+ALTER TABLE test_schema_diff.table_for_primary_key OWNER TO enterprisedb;
+
+--
+-- TOC entry 12265 (class 1259 OID 149034)
+-- Name: table_for_rule; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_rule (
+ col1 bigint NOT NULL,
+ col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_rule OWNER TO enterprisedb;
+
+--
+-- TOC entry 12267 (class 1259 OID 149066)
+-- Name: table_for_trigger; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE TABLE test_schema_diff.table_for_trigger (
+ col1 bigint NOT NULL,
+ col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_trigger OWNER TO enterprisedb;
+
+
+--
+-- TOC entry 56906 (class 2606 OID 149097)
+-- Name: table_for_constraints Exclusion; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_constraints
+ ADD CONSTRAINT "Exclusion" EXCLUDE USING gist (col2 WITH <>) WITH (fillfactor='15') WHERE ((col1 > 1)) DEFERRABLE INITIALLY DEFERRED;
+
+
+--
+-- TOC entry 61068 (class 0 OID 0)
+-- Dependencies: 56906
+-- Name: CONSTRAINT "Exclusion" ON table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+COMMENT ON CONSTRAINT "Exclusion" ON test_schema_diff.table_for_constraints IS 'comments';
+
+
+--
+-- TOC entry 56910 (class 2606 OID 149176)
+-- Name: table_for_foreign_key table_for_foreign_key_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_foreign_key
+ ADD CONSTRAINT table_for_foreign_key_pkey PRIMARY KEY (col1);
+
+
+--
+-- TOC entry 56897 (class 2606 OID 148993)
+-- Name: table_for_index table_for_index_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_index
+ ADD CONSTRAINT table_for_index_pkey PRIMARY KEY (col1);
+
+
+--
+-- TOC entry 56908 (class 2606 OID 149151)
+-- Name: table_for_primary_key table_for_primary_key_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_primary_key
+ ADD CONSTRAINT table_for_primary_key_pkey PRIMARY KEY (col1);
+
+
+--
+-- TOC entry 56902 (class 2606 OID 149041)
+-- Name: table_for_rule table_for_rule_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_rule
+ ADD CONSTRAINT table_for_rule_pkey PRIMARY KEY (col1);
+
+
+--
+-- TOC entry 56900 (class 2606 OID 149020)
+-- Name: table_for_identical table_for_table_for_identical_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_identical
+ ADD CONSTRAINT table_for_table_for_identical_pkey PRIMARY KEY (col1);
+
+
+--
+-- TOC entry 56904 (class 2606 OID 149073)
+-- Name: table_for_trigger table_for_trigger_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+ALTER TABLE ONLY test_schema_diff.table_for_trigger
+ ADD CONSTRAINT table_for_trigger_pkey PRIMARY KEY (col1);
+
+
+--
+-- TOC entry 56893 (class 1259 OID 148994)
+-- Name: index1; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE INDEX index1 ON test_schema_diff.table_for_index USING btree (col2 text_pattern_ops);
+
+
+--
+-- TOC entry 56894 (class 1259 OID 148995)
+-- Name: index2; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE INDEX index2 ON test_schema_diff.table_for_index USING btree (col2 text_pattern_ops);
+
+
+--
+-- TOC entry 56898 (class 1259 OID 149021)
+-- Name: index_identical; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE INDEX index_identical ON test_schema_diff.table_for_identical USING btree (col2 text_pattern_ops);
+
+
+--
+-- TOC entry 56895 (class 1259 OID 149212)
+-- Name: index_same; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE INDEX index_same ON test_schema_diff.table_for_index USING btree (col2 text_pattern_ops);
+
+
+--
+-- TOC entry 56892 (class 1259 OID 139945)
+-- Name: mview_index; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE INDEX mview_index ON test_schema_diff."MView" USING btree (text text_pattern_ops);
+
+
+--
+-- TOC entry 61045 (class 2618 OID 149042)
+-- Name: table_for_rule rule1; Type: RULE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE RULE rule1 AS
+ ON UPDATE TO test_schema_diff.table_for_rule DO INSTEAD NOTHING;
+
+
+--
+-- TOC entry 61069 (class 0 OID 0)
+-- Dependencies: 61045
+-- Name: RULE rule1 ON table_for_rule; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+COMMENT ON RULE rule1 ON test_schema_diff.table_for_rule IS 'comments';
+
+
+--
+-- TOC entry 61046 (class 2618 OID 149043)
+-- Name: table_for_rule rule2; Type: RULE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE RULE rule2 AS
+ ON UPDATE TO test_schema_diff.table_for_rule DO NOTHING;
+
+
+--
+-- TOC entry 61047 (class 2618 OID 149044)
+-- Name: table_for_rule rule3; Type: RULE; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE RULE rule3 AS
+ ON INSERT TO test_schema_diff.table_for_rule DO NOTHING;
+
+
+--
+-- TOC entry 61050 (class 0 OID 139938)
+-- Dependencies: 12250 61062
+-- Name: MView; Type: MATERIALIZED VIEW DATA; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+REFRESH MATERIALIZED VIEW test_schema_diff."MView";
+
+
+--
+-- TOC entry 12284 (class 1259 OID 347823)
+-- Name: test view; Type: VIEW; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE VIEW test_schema_diff."test view" AS
+ SELECT pg_class.relname,
+ pg_class.relnamespace,
+ pg_class.reltype,
+ pg_class.reloftype,
+ pg_class.relowner,
+ pg_class.relam,
+ pg_class.relfilenode,
+ pg_class.reltablespace,
+ pg_class.relpages,
+ pg_class.reltuples,
+ pg_class.relallvisible,
+ pg_class.reltoastrelid,
+ pg_class.relhasindex,
+ pg_class.relisshared,
+ pg_class.relpersistence,
+ pg_class.relkind,
+ pg_class.relnatts,
+ pg_class.relchecks,
+ pg_class.relhasrules,
+ pg_class.relhastriggers,
+ pg_class.relhassubclass,
+ pg_class.relrowsecurity,
+ pg_class.relforcerowsecurity,
+ pg_class.relispopulated,
+ pg_class.relreplident,
+ pg_class.relispartition,
+ pg_class.relfrozenxid,
+ pg_class.relminmxid,
+ pg_class.relacl,
+ pg_class.reloptions,
+ pg_class.relpartbound
+ FROM pg_class
+ LIMIT 10;
+
+
+ALTER TABLE test_schema_diff."test view" OWNER TO enterprisedb;
+
+--
+-- TOC entry 12285 (class 1259 OID 347828)
+-- Name: test view f; Type: VIEW; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+CREATE VIEW test_schema_diff."test view f" WITH (security_barrier='true') AS
+ SELECT 2;
+
+
+ALTER TABLE test_schema_diff."test view f" OWNER TO enterprisedb;
+
+--
+-- TOC entry 61105 (class 0 OID 0)
+-- Dependencies: 12285
+-- Name: VIEW "test view f"; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb
+--
+
+COMMENT ON VIEW test_schema_diff."test view f" IS 'cmn';
+
+-- Collation scripts
+CREATE COLLATION test_schema_diff.coll_tar
+ FROM pg_catalog."POSIX";
+
+ALTER COLLATION test_schema_diff.coll_tar
+ OWNER TO enterprisedb;
+
+CREATE COLLATION test_schema_diff.coll_diff
+ (LC_COLLATE = 'C', LC_CTYPE = 'C');
+
+ALTER COLLATION test_schema_diff.coll_diff
+ OWNER TO enterprisedb;
+
+-- FTS Configuration scripts
+CREATE TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_tar (
+ COPY=german
+);
+
+ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_tar OWNER TO enterprisedb;
+
+CREATE TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff (
+ PARSER = default
+);
+ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ADD MAPPING FOR asciiword WITH dutch_stem;
+ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ADD MAPPING FOR email WITH simple;
+ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ADD MAPPING FOR hword WITH german_stem;
+
+-- FTS Dictionary scripts
+CREATE TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_tar (
+ TEMPLATE = simple,
+ stopwords = 'english'
+);
+
+CREATE TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_diff (
+ TEMPLATE = simple,
+ stopwords = 'german'
+);
+
+COMMENT ON TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_diff
+ IS 'Comment';
+
+-- FTS Parser scripts
+CREATE TEXT SEARCH PARSER test_schema_diff.fts_par_tar (
+ START = prsd_start,
+ GETTOKEN = prsd_nexttoken,
+ END = prsd_end,
+ LEXTYPES = prsd_lextype);
+
+CREATE TEXT SEARCH PARSER test_schema_diff.fts_par_diff (
+ START = int4_accum,
+ GETTOKEN = inet_gist_penalty,
+ END = btint2sortsupport,
+ LEXTYPES = dispell_init);
+
+COMMENT ON TEXT SEARCH PARSER test_schema_diff.fts_par_diff
+ IS 'Comment';
+
+-- FTS Template scripts
+CREATE TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_tar (
+ INIT = dispell_init,
+ LEXIZE = dispell_lexize
+);
+
+CREATE TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_diff (
+ INIT = dsimple_init,
+ LEXIZE = dsimple_lexize
+);
+
+COMMENT ON TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_diff IS 'Comment';
+
+-- Domain and Domain Constraint script
+CREATE DOMAIN test_schema_diff.dom_tar
+ AS bigint
+ DEFAULT 100
+ NOT NULL;
+
+ALTER DOMAIN test_schema_diff.dom_tar OWNER TO enterprisedb;
+
+ALTER DOMAIN test_schema_diff.dom_tar
+ ADD CONSTRAINT con_tar CHECK (VALUE <> 100);
+
+CREATE DOMAIN test_schema_diff.dom_cons_diff
+ AS bigint
+ DEFAULT 400;
+
+ALTER DOMAIN test_schema_diff.dom_cons_diff OWNER TO enterprisedb;
+
+ALTER DOMAIN test_schema_diff.dom_cons_diff
+ ADD CONSTRAINT cons_diff_1 CHECK (VALUE <> 40);
+
+ALTER DOMAIN test_schema_diff.dom_cons_diff
+ ADD CONSTRAINT cons_tar_only CHECK (VALUE <> 25);
+
+CREATE DOMAIN test_schema_diff.dom_type_diff
+ AS numeric(8,4);
+
+ALTER DOMAIN test_schema_diff.dom_type_diff OWNER TO enterprisedb;
+
+ALTER DOMAIN test_schema_diff.dom_type_diff
+ ADD CONSTRAINT cons1 CHECK (VALUE <> 45::numeric);
+
+ALTER DOMAIN test_schema_diff.dom_type_diff
+ ADD CONSTRAINT cons2 CHECK (VALUE <> 50::numeric);
+
+COMMENT ON DOMAIN test_schema_diff.dom_type_diff
+ IS 'Comment';
+
+-- Type Script composite type
+CREATE TYPE test_schema_diff.typ_comp_tar AS
+(
+ m1 bit(5),
+ m2 text COLLATE pg_catalog."POSIX"
+);
+ALTER TYPE test_schema_diff.typ_comp_tar
+ OWNER TO enterprisedb;
+CREATE TYPE test_schema_diff.typ_comp_diff AS
+(
+ m1 bit(5),
+ m2 text COLLATE pg_catalog."POSIX"
+);
+ALTER TYPE test_schema_diff.typ_comp_diff
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_comp_diff_no_column AS
+(
+ a "char",
+ b "char"
+);
+ALTER TYPE test_schema_diff.typ_comp_diff_no_column
+ OWNER TO enterprisedb;
+
+-- Type Script ENUM type
+CREATE TYPE test_schema_diff.typ_enum_tar AS ENUM
+ ('test_enum');
+ALTER TYPE test_schema_diff.typ_enum_tar
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_enum_diff AS ENUM
+ ('test_enum', 'test_enum_1');
+ALTER TYPE test_schema_diff.typ_enum_diff
+ OWNER TO enterprisedb;
+
+-- Type Script RANGE type
+CREATE TYPE test_schema_diff.typ_range_tar AS RANGE
+(
+ SUBTYPE=text,
+ COLLATION = pg_catalog."POSIX",
+ SUBTYPE_OPCLASS = text_ops
+);
+ALTER TYPE test_schema_diff.typ_range_tar
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_range_col_diff AS RANGE
+(
+ SUBTYPE=text,
+ COLLATION = pg_catalog."POSIX",
+ SUBTYPE_OPCLASS = text_ops
+);
+ALTER TYPE test_schema_diff.typ_range_col_diff
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_range_subtype_diff AS RANGE
+(
+ SUBTYPE=bool,
+ SUBTYPE_OPCLASS = bool_ops
+);
+ALTER TYPE test_schema_diff.typ_range_subtype_diff
+ OWNER TO enterprisedb;
+
+-- Type Script SHELL type
+CREATE TYPE test_schema_diff.typ_shell_tar;
+ALTER TYPE test_schema_diff.typ_shell_tar
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_shell_diff;
+ALTER TYPE test_schema_diff.typ_shell_diff
+ OWNER TO enterprisedb;
+
+-- Type script to test when Type is different
+CREATE TYPE test_schema_diff.typ_comp_range_diff AS RANGE
+(
+ SUBTYPE=text,
+ COLLATION = pg_catalog."C",
+ SUBTYPE_OPCLASS = text_ops
+);
+ALTER TYPE test_schema_diff.typ_comp_range_diff
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_comp_enum_diff AS ENUM
+ ('test_enum', 'test_enum_1');
+ALTER TYPE test_schema_diff.typ_comp_enum_diff
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_range_comp_diff AS
+(
+ m1 bigint,
+ m2 text[] COLLATE pg_catalog."POSIX"
+);
+ALTER TYPE test_schema_diff.typ_range_comp_diff
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_range_enum_diff AS ENUM
+ ('test_enum', 'test_enum_1');
+ALTER TYPE test_schema_diff.typ_range_enum_diff
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_enum_comp_diff AS
+(
+ m1 bigint,
+ m2 text[] COLLATE pg_catalog."POSIX"
+);
+ALTER TYPE test_schema_diff.typ_enum_comp_diff
+ OWNER TO enterprisedb;
+
+CREATE TYPE test_schema_diff.typ_enum_range_diff AS RANGE
+(
+ SUBTYPE=text,
+ COLLATION = pg_catalog."C",
+ SUBTYPE_OPCLASS = text_ops
+);
+ALTER TYPE test_schema_diff.typ_enum_range_diff
+ OWNER TO enterprisedb;
+
+-- Package script (test_schema_diff only)
+CREATE OR REPLACE PACKAGE test_schema_diff.pkg_tar
+IS
+ FUNCTION get_dept_name(p_deptno numeric) RETURN character varying;
+ PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric);
+END pkg_tar;
+
+
+CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_tar
+IS
+ FUNCTION get_dept_name(p_deptno numeric) RETURN character varying IS
+ v_dname VARCHAR2(14);
+ BEGIN
+ SELECT dname INTO v_dname FROM dept WHERE deptno = p_deptno;
+ RETURN v_dname;
+ EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ DBMS_OUTPUT.PUT_LINE('Invalid department number ' || p_deptno);
+ RETURN '';
+ END;
+
+ PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric) IS
+ BEGIN
+ INSERT INTO emp(empno, ename, job, sal, hiredate, comm, mgr, deptno)
+ VALUES(p_empno, p_ename, p_job, p_sal,
+ p_hiredate, p_comm, p_mgr, p_deptno);
+ END;
+END pkg_tar;
+
+COMMENT ON PACKAGE test_schema_diff.pkg_tar
+ IS 'test_schema_diff';
+
+-- Package script difference in header, acl and comment
+CREATE OR REPLACE PACKAGE test_schema_diff.pkg_header_diff
+IS
+ FUNCTION get_dept_name(p_deptno numeric) RETURN character varying;
+END pkg_header_diff;
+
+CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_header_diff
+IS
+ FUNCTION get_dept_name(p_deptno numeric) RETURN character varying IS
+ v_dname VARCHAR2(14);
+ BEGIN
+ SELECT dname INTO v_dname FROM dept WHERE deptno = p_deptno;
+ RETURN v_dname;
+ EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ DBMS_OUTPUT.PUT_LINE('Invalid department number ' || p_deptno);
+ RETURN '';
+ END;
+END pkg_header_diff;
+
+-- Package script difference in body, acl and comment
+CREATE OR REPLACE PACKAGE test_schema_diff.pkg_body_diff
+IS
+ PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric);
+END pkg_body_diff;
+
+CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_body_diff
+IS
+ PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric) IS
+ BEGIN
+ DBMS_OUTPUT.PUT_LINE('Before Insert ');
+ INSERT INTO emp(empno, ename, job, sal, hiredate, comm, mgr, deptno)
+ VALUES(p_empno, p_ename, p_job, p_sal,
+ p_hiredate, p_comm, p_mgr, p_deptno);
+ DBMS_OUTPUT.PUT_LINE('After Insert ');
+ END;
+END pkg_body_diff;
+
+COMMENT ON PACKAGE test_schema_diff.pkg_body_diff
+ IS 'Header Diff';
+
+GRANT EXECUTE ON PACKAGE test_schema_diff.pkg_body_diff TO PUBLIC;
+GRANT EXECUTE ON PACKAGE test_schema_diff.pkg_body_diff TO enterprisedb WITH GRANT OPTION;
+
+-- Synonyms Scripts
+-- Prerequisite for synonyms
+CREATE OR REPLACE FUNCTION test_schema_diff.fun_for_syn()
+RETURNS void
+ LANGUAGE 'plpgsql'
+ VOLATILE
+ COST 100
+
+AS $BODY$BEGIN
+SELECT 1;
+END;$BODY$;
+ALTER FUNCTION test_schema_diff.fun_for_syn()
+ OWNER TO enterprisedb;
+
+CREATE OR REPLACE PROCEDURE test_schema_diff.proc_for_syn()
+ SECURITY DEFINER VOLATILE
+ COST 100
+AS $BODY$BEGIN
+SELECT 1;
+END;$BODY$;
+
+CREATE OR REPLACE PACKAGE test_schema_diff.pkg_for_syn
+IS
+FUNCTION get_dept_name(p_deptno numeric) RETURN character varying;
+END pkg_for_syn;
+CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_for_syn
+IS
+FUNCTION get_dept_name(p_deptno numeric) RETURN character varying IS
+BEGIN
+ RETURN '';
+END;
+END pkg_for_syn;
+
+CREATE TABLE test_schema_diff.table_for_syn
+(
+ id bigint,
+ name text COLLATE pg_catalog."default"
+)
+TABLESPACE pg_default;
+ALTER TABLE test_schema_diff.table_for_syn
+ OWNER to enterprisedb;
+
+CREATE SEQUENCE test_schema_diff.seq_for_syn
+ INCREMENT 5
+ START 1
+ MINVALUE 1
+ MAXVALUE 100
+ CACHE 1;
+ALTER SEQUENCE test_schema_diff.seq_for_syn
+ OWNER TO enterprisedb;
+
+CREATE OR REPLACE SYNONYM test_schema_diff.syn_fun_src
+ FOR test_schema_diff.fun_for_syn;
+
+CREATE OR REPLACE SYNONYM test_schema_diff.syn_pkg_src
+ FOR test_schema_diff.pkg_for_syn;
+
+CREATE OR REPLACE SYNONYM test_schema_diff.syn_proc_src
+ FOR test_schema_diff.proc_for_syn;
+
+CREATE OR REPLACE SYNONYM test_schema_diff.syn_seq_src
+ FOR test_schema_diff.seq_for_syn;
+
+CREATE OR REPLACE SYNONYM test_schema_diff.syn_table_src
+ FOR test_schema_diff.table_for_syn;
+
+CREATE OR REPLACE PROCEDURE public.proc_for_syn()
+ SECURITY DEFINER VOLATILE
+ COST 100
+AS $BODY$BEGIN
+SELECT 1;
+END;$BODY$;
+
+CREATE OR REPLACE SYNONYM test_schema_diff.syn_diff
+ FOR public.proc_for_syn;
+
+-- Sequences Script
+CREATE SEQUENCE test_schema_diff.seq_tar
+ CYCLE
+ INCREMENT 1
+ START 1
+ MINVALUE 1
+ MAXVALUE 3
+ CACHE 6;
+ALTER SEQUENCE test_schema_diff.seq_tar
+ OWNER TO enterprisedb;
+
+CREATE SEQUENCE test_schema_diff.seq_diff_comment_acl
+ INCREMENT 1
+ START 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ CACHE 1;
+
+ALTER SEQUENCE test_schema_diff.seq_diff_comment_acl
+ OWNER TO enterprisedb;
+
+CREATE SEQUENCE test_schema_diff.seq_diff_comment_acl_remove
+ INCREMENT 1
+ START 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ CACHE 1;
+ALTER SEQUENCE test_schema_diff.seq_diff_comment_acl_remove
+ OWNER TO enterprisedb;
+COMMENT ON SEQUENCE test_schema_diff.seq_diff_comment_acl_remove
+ IS 'Test Comment';
+GRANT ALL ON SEQUENCE test_schema_diff.seq_diff_comment_acl_remove TO PUBLIC;
+GRANT ALL ON SEQUENCE test_schema_diff.seq_diff_comment_acl_remove TO enterprisedb;
+
+CREATE SEQUENCE test_schema_diff.seq_diff
+ INCREMENT 5
+ START 3
+ MINVALUE 3
+ MAXVALUE 80
+ CACHE 1;
+
+ALTER SEQUENCE test_schema_diff.seq_diff
+ OWNER TO enterprisedb;
+
+CREATE SEQUENCE test_schema_diff.seq_start_diff
+ INCREMENT 5
+ START 1
+ MINVALUE 1
+ MAXVALUE 20;
+ALTER SEQUENCE test_schema_diff.seq_start_diff
+ OWNER TO enterprisedb;
+
+-- Foreign Data Wrapper to test foreign table
+CREATE FOREIGN DATA WRAPPER test_fdw_for_foreign_table;
+ALTER FOREIGN DATA WRAPPER test_fdw_for_foreign_table
+ OWNER TO enterprisedb;
+
+-- Foreign Server to test foreign table
+CREATE SERVER test_fs_for_foreign_table
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_table;
+ALTER SERVER test_fs_for_foreign_table
+ OWNER TO enterprisedb;
+CREATE SERVER test_fs2_for_foreign_table
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_table;
+ALTER SERVER test_fs2_for_foreign_table
+ OWNER TO enterprisedb;
+
+-- Table to test inheritance in foreign table
+CREATE TABLE public.test_table_for_foreign_table
+(
+ tid bigint NOT NULL,
+ tname text COLLATE pg_catalog."default",
+ CONSTRAINT test_table_for_foreign_table_pkey PRIMARY KEY (tid)
+)
+WITH (
+ OIDS = FALSE
+)
+TABLESPACE pg_default;
+ALTER TABLE public.test_table_for_foreign_table
+ OWNER to enterprisedb;
+
+CREATE FOREIGN TABLE test_schema_diff.ft_tar(
+ fid bigint NULL,
+ fname text NULL COLLATE pg_catalog."default"
+)
+ SERVER test_fs_for_foreign_table;
+ALTER FOREIGN TABLE test_schema_diff.ft_tar
+ OWNER TO enterprisedb;
+ALTER FOREIGN TABLE test_schema_diff.ft_tar
+ ADD CONSTRAINT fcheck CHECK ((fid > 1000)) NO INHERIT;
+COMMENT ON FOREIGN TABLE test_schema_diff.ft_tar
+ IS 'Test Comment';
+GRANT INSERT ON TABLE test_schema_diff.ft_tar TO PUBLIC;
+GRANT ALL ON TABLE test_schema_diff.ft_tar TO enterprisedb;
+
+CREATE FOREIGN TABLE test_schema_diff.ft_diff_col(
+ fid bigint NULL,
+ fname text NOT NULL COLLATE pg_catalog."default"
+)
+ SERVER test_fs_for_foreign_table;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_col
+ OWNER TO enterprisedb;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_col
+ ADD CONSTRAINT fcheck CHECK ((fid > 1000)) NO INHERIT;
+COMMENT ON FOREIGN TABLE test_schema_diff.ft_diff_col
+ IS 'Comment';
+GRANT INSERT ON TABLE test_schema_diff.ft_diff_col TO PUBLIC;
+GRANT ALL ON TABLE test_schema_diff.ft_diff_col TO enterprisedb;
+
+CREATE FOREIGN TABLE test_schema_diff.ft_diff_const(
+ fid bigint NULL,
+ fname text NULL COLLATE pg_catalog."default"
+)
+ SERVER test_fs_for_foreign_table;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_const
+ OWNER TO enterprisedb;
+
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_const
+ ADD CONSTRAINT fcheck CHECK ((fid > 1000)) NO INHERIT;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_const
+ ADD CONSTRAINT fcheck1 CHECK ((fid > 50)) NO INHERIT NOT VALID;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_const
+ ADD CONSTRAINT fcheck2 CHECK ((fid > 20)) NO INHERIT;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_const
+ ADD CONSTRAINT fcheck_tar CHECK ((fid > 50));
+
+GRANT INSERT ON TABLE test_schema_diff.ft_diff_const TO PUBLIC;
+GRANT ALL ON TABLE test_schema_diff.ft_diff_const TO enterprisedb;
+
+CREATE FOREIGN TABLE test_schema_diff.ft_diff_opt(
+ fid bigint NULL,
+ fname text NULL COLLATE pg_catalog."default"
+)
+ SERVER test_fs_for_foreign_table
+ OPTIONS (debug 'true', opt2 'val30', opt_tar 'val_tar');
+
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_opt
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN TABLE test_schema_diff.ft_diff_foreign_server(
+ fid bigint NULL,
+ fname text NULL COLLATE pg_catalog."default"
+)
+ SERVER test_fs2_for_foreign_table;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_foreign_server
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN TABLE test_schema_diff.ft_diff_foreign_server_1(
+ fid bigint NULL,
+ fcity text NULL COLLATE pg_catalog."default"
+)
+ SERVER test_fs2_for_foreign_table
+ OPTIONS (opt1 'val1', opt2 'val2');
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_foreign_server_1
+ OWNER TO enterprisedb;
+ALTER FOREIGN TABLE test_schema_diff.ft_diff_foreign_server_1
+ ADD CONSTRAINT cs2 CHECK ((fid > 200)) NO INHERIT;
+
+-- Test for RM #5350
+CREATE TABLE test_schema_diff.events_transactions
+(
+ event_code integer,
+ numerator integer,
+ account_token text COLLATE pg_catalog."default",
+ transaction_dt timestamp without time zone,
+ payment_method integer,
+ approval text COLLATE pg_catalog."default",
+ amount integer,
+ file_dt timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
+ file_name character varying(256) COLLATE pg_catalog."default",
+ payment_pin integer,
+ transfer_dt timestamp without time zone,
+ transaction_type integer
+);
+
+-- Event Trigger script
+CREATE FUNCTION public.evt_tri_fun()
+ RETURNS event_trigger
+ LANGUAGE 'plpgsql'
+ NOT LEAKPROOF
+AS $BODY$
+BEGIN
+PERFORM 1;
+END;
+$BODY$;
+ALTER FUNCTION public.evt_tri_fun()
+ OWNER TO enterprisedb;
+
+CREATE FUNCTION public.evt_tri_fun2()
+ RETURNS event_trigger
+ LANGUAGE 'plpgsql'
+ NOT LEAKPROOF
+AS $BODY$
+BEGIN
+PERFORM 1;
+END;
+$BODY$;
+ALTER FUNCTION public.evt_tri_fun2()
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_tar ON DDL_COMMAND_START
+ EXECUTE PROCEDURE public.evt_tri_fun();
+COMMENT ON EVENT TRIGGER evt_tri_tar
+ IS 'Event Trigger Source';
+ALTER EVENT TRIGGER evt_tri_tar
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_event1 ON DDL_COMMAND_END
+ EXECUTE PROCEDURE public.evt_tri_fun();
+ALTER EVENT TRIGGER evt_tri_diff_event1
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_event2 ON DDL_COMMAND_START
+ EXECUTE PROCEDURE public.evt_tri_fun();
+ALTER EVENT TRIGGER evt_tri_diff_event2
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_event3 ON DDL_COMMAND_START
+ EXECUTE PROCEDURE public.evt_tri_fun();
+ALTER EVENT TRIGGER evt_tri_diff_event3
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_enable_status1 ON DDL_COMMAND_START
+ EXECUTE PROCEDURE public.evt_tri_fun();
+ALTER EVENT TRIGGER evt_tri_diff_enable_status1
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_enable_status2 ON DDL_COMMAND_START
+ EXECUTE PROCEDURE public.evt_tri_fun();
+ALTER EVENT TRIGGER evt_tri_diff_enable_status2
+ DISABLE;
+ALTER EVENT TRIGGER evt_tri_diff_enable_status2
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_enable_status3 ON DDL_COMMAND_START
+ EXECUTE PROCEDURE public.evt_tri_fun();
+ALTER EVENT TRIGGER evt_tri_diff_enable_status3
+ OWNER TO enterprisedb;
+
+CREATE EVENT TRIGGER evt_tri_diff_func ON DDL_COMMAND_START
+ EXECUTE PROCEDURE public.evt_tri_fun2();
+ALTER EVENT TRIGGER evt_tri_diff_func
+ OWNER TO enterprisedb;
+
+-- Extension script
+CREATE EXTENSION adminpack
+ SCHEMA pg_catalog
+ VERSION "1.0";
+
+-- Language script
+CREATE TRUSTED PROCEDURAL LANGUAGE tar_language
+ HANDLER plpgsql_call_handler
+ INLINE plpgsql_inline_handler
+ VALIDATOR plpgsql_validator;
+ALTER LANGUAGE tar_language
+ OWNER TO enterprisedb;
+GRANT USAGE ON LANGUAGE tar_language TO PUBLIC;
+GRANT USAGE ON LANGUAGE tar_language TO enterprisedb WITH GRANT OPTION;
+
+CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_acl_add
+ HANDLER plpgsql_call_handler
+ INLINE plpgsql_inline_handler
+ VALIDATOR plpgsql_validator;
+ALTER LANGUAGE lan_diff_acl_add
+ OWNER TO enterprisedb;
+
+CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_acl_revoke
+ HANDLER plpgsql_call_handler
+ INLINE plpgsql_inline_handler
+ VALIDATOR plpgsql_validator;
+ALTER LANGUAGE lan_diff_acl_revoke
+ OWNER TO enterprisedb;
+GRANT USAGE ON LANGUAGE lan_diff_acl_revoke TO PUBLIC;
+GRANT USAGE ON LANGUAGE lan_diff_acl_revoke TO enterprisedb WITH GRANT OPTION;
+
+CREATE PROCEDURAL LANGUAGE lan_diff_type
+ HANDLER plpgsql_call_handler
+ INLINE plpgsql_inline_handler
+ VALIDATOR plpgsql_validator;
+ALTER LANGUAGE lan_diff_type
+ OWNER TO enterprisedb;
+
+CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_inline_validator
+ HANDLER plpgsql_call_handler
+ INLINE plpgsql_inline_handler
+ VALIDATOR plpgsql_validator;
+ALTER LANGUAGE lan_diff_type
+ OWNER TO enterprisedb;
+
+-- Foreign Data Wrapper Script
+CREATE FOREIGN DATA WRAPPER fdw_tar
+ VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER fdw_tar
+ OWNER TO enterprisedb;
+COMMENT ON FOREIGN DATA WRAPPER fdw_tar
+ IS 'Foreign Data Wrapper';
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_acl_add
+ VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER fdw_diff_acl_add
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_acl_revoke
+ VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER fdw_diff_acl_revoke
+ OWNER TO enterprisedb;
+GRANT USAGE ON FOREIGN DATA WRAPPER fdw_diff_acl_revoke TO PUBLIC;
+GRANT USAGE ON FOREIGN DATA WRAPPER fdw_diff_acl_revoke TO enterprisedb WITH GRANT OPTION;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_add_validator;
+ALTER FOREIGN DATA WRAPPER fdw_diff_add_validator
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_remove_validator
+ VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER fdw_diff_remove_validator
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_add_options;
+ALTER FOREIGN DATA WRAPPER fdw_diff_add_options
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_remove_options
+ OPTIONS (debug 'true');
+ALTER FOREIGN DATA WRAPPER fdw_diff_remove_options
+ OWNER TO enterprisedb;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_options
+ OPTIONS (debug 'true');
+ALTER FOREIGN DATA WRAPPER fdw_diff_options
+ OWNER TO enterprisedb;
+
+-- Foreign Server Script
+CREATE FOREIGN DATA WRAPPER test_fdw_for_foreign_server
+ VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER test_fdw_for_foreign_server
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_tar
+ TYPE 'PG'
+ VERSION '10'
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server
+ OPTIONS (host '127.0.0.1', port '5432');
+ALTER SERVER fs_tar
+ OWNER TO enterprisedb;
+COMMENT ON SERVER fs_tar
+ IS 'Foreign Server';
+
+CREATE SERVER fs_diff_acl_add
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_acl_add
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_diff_acl_revoke
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_acl_revoke
+ OWNER TO enterprisedb;
+GRANT USAGE ON FOREIGN SERVER fs_diff_acl_revoke TO PUBLIC;
+GRANT USAGE ON FOREIGN SERVER fs_diff_acl_revoke TO enterprisedb WITH GRANT OPTION;
+
+CREATE SERVER fs_diff_type_version_add
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_type_version_add
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_diff_type_version_remove
+ TYPE 'PG'
+ VERSION '10'
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_type_version_remove
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_diff_type_version_modify
+ TYPE 'EPAS'
+ VERSION '11'
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_type_version_modify
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_diff_options_add
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_options_add
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_diff_options_remove
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server
+ OPTIONS (host '127.0.0.1', port '5432');
+ALTER SERVER fs_diff_options_remove
+ OWNER TO enterprisedb;
+
+CREATE SERVER fs_diff_options_modify
+ FOREIGN DATA WRAPPER test_fdw_for_foreign_server
+ OPTIONS (host '127.0.0.1', port '5432');
+ALTER SERVER fs_diff_options_modify
+ OWNER TO enterprisedb;
+
+-- User Mapping Script
+CREATE FOREIGN DATA WRAPPER test_fdw_for_user_mapping
+ VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER test_fdw_for_user_mapping
+ OWNER TO enterprisedb;
+
+CREATE SERVER test_fs_for_user_mapping
+ FOREIGN DATA WRAPPER test_fdw_for_user_mapping;
+ALTER SERVER test_fs_for_user_mapping
+ OWNER TO enterprisedb;
+
+CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping
+ OPTIONS (password 'admin123');
+
+CREATE USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping;
+
+-- Publication script
+
+CREATE TABLE test_schema_diff.table_for_publication (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE TABLE test_schema_diff.table_for_publication_in_target (
+ col1 integer NOT NULL,
+ col2 text
+);
+
+CREATE PUBLICATION for_all_table
+ FOR ALL TABLES
+ WITH (publish = 'insert, delete');
+
+CREATE PUBLICATION with_one_table_in_target
+ FOR TABLE test_schema_diff.table_for_publication_in_target
+ WITH (publish = 'insert, delete');
+
+ALTER PUBLICATION with_one_table_in_target
+ RENAME TO with_one_table_in_target_alter;
+
+ALTER PUBLICATION with_one_table_in_target_alter SET
+ (publish = 'insert, update, truncate');
+
+-- Subscription script
+
+CREATE SUBSCRIPTION "subscription_test1_in_target"
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
+ PUBLICATION sample_publication
+ WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ SET (synchronous_commit = 'remote_apply');
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ SET PUBLICATION edb WITH (refresh = false);
+
+ALTER SUBSCRIPTION subscription_test1_in_target
+ RENAME TO subscription_test_in_target;
+
+DROP SUBSCRIPTION subscription_test_in_target;
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: [pgAdmin][RM6153]: Add publication and subscription support in Schema Diff.
In-Reply-To: <CAJ9T6SvAtgMaeKWSyeJUmgkeoPLEQ12sTk0m0HjL8QwZmBfdDQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox