From 3be22219481e7a0cb852ff7eef9eb24f56e338f7 Mon Sep 17 00:00:00 2001
From: Akshay Joshi <akshay.joshi@enterprisedb.com>
Date: Thu, 27 Jun 2024 13:18:26 +0530
Subject: [PATCH] Ensure that pgAdmin 4 is compatible with PostgreSQL v17.
 #7537

---
 docs/en_US/release_notes_8_10.rst             |   30 +
 web/config.py                                 |    8 +-
 .../pg/default/sql/get_all_columns.sql        |    2 +-
 .../ppas/default/sql/get_all_columns.sql      |    2 +-
 .../collations/sql/17_plus/properties.sql     |   10 +
 .../sql/default/create.sql                    |    2 +-
 .../foreign_tables/sql/default/create.sql     |    2 +-
 .../templates/columns/sql/12_plus/create.sql  |    2 +-
 .../templates/columns/sql/14_plus/create.sql  |    2 +-
 .../templates/columns/sql/16_plus/create.sql  |    2 +-
 .../templates/columns/sql/default/create.sql  |    2 +-
 .../templates/tables/sql/11_plus/create.sql   |    2 +-
 .../templates/tables/sql/12_plus/create.sql   |    2 +-
 .../templates/tables/sql/14_plus/create.sql   |    2 +-
 .../templates/tables/sql/16_plus/create.sql   |    2 +-
 .../templates/tables/sql/default/create.sql   |    2 +-
 .../databases/sql/17_plus/get_ctypes.sql      |    8 +
 .../databases/sql/17_plus/get_icu_locale.sql  |    1 +
 .../databases/sql/17_plus/properties.sql      |   41 +
 .../schema_diff/tests/pg/17_plus/source.sql   | 1161 +++++++++++++++
 .../schema_diff/tests/pg/17_plus/target.sql   | 1094 ++++++++++++++
 .../schema_diff/tests/ppas/17_plus/source.sql | 1315 +++++++++++++++++
 .../schema_diff/tests/ppas/17_plus/target.sql | 1256 ++++++++++++++++
 web/pgadmin/utils/constants.py                |    6 +
 .../utils/versioned_template_loader.py        |    3 +-
 .../pg_utilities_backup_restore_test.py       |    5 +-
 27 files changed, 4947 insertions(+), 18 deletions(-)
 create mode 100644 docs/en_US/release_notes_8_10.rst
 create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collations/sql/17_plus/properties.sql
 create mode 100644 web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/17_plus/get_ctypes.sql
 create mode 100644 web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/17_plus/get_icu_locale.sql
 create mode 100644 web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/17_plus/properties.sql
 create mode 100644 web/pgadmin/tools/schema_diff/tests/pg/17_plus/source.sql
 create mode 100644 web/pgadmin/tools/schema_diff/tests/pg/17_plus/target.sql
 create mode 100644 web/pgadmin/tools/schema_diff/tests/ppas/17_plus/source.sql
 create mode 100644 web/pgadmin/tools/schema_diff/tests/ppas/17_plus/target.sql

diff --git a/docs/en_US/release_notes_8_10.rst b/docs/en_US/release_notes_8_10.rst
new file mode 100644
index 00000000000..13c953a66f7
--- /dev/null
+++ b/docs/en_US/release_notes_8_10.rst
@@ -0,0 +1,30 @@
+************
+Version 8.10
+************
+
+Release date: 2024-07-25
+
+This release contains a number of bug fixes and new features since the release of pgAdmin 4 v8.9.
+
+Supported Database Servers
+**************************
+**PostgreSQL**: 12, 13, 14, 15, and 16
+
+**EDB Advanced Server**: 12, 13, 14, 15, and 16
+
+Bundled PostgreSQL Utilities
+****************************
+**psql**, **pg_dump**, **pg_dumpall**, **pg_restore**: 16.3
+
+
+New features
+************
+
+
+Housekeeping
+************
+
+  | `Issue #7537 <https://github.com/pgadmin-org/pgadmin4/issues/7537>`_ -  Ensure that pgAdmin 4 is compatible with PostgreSQL v17.
+
+Bug fixes
+*********
diff --git a/web/config.py b/web/config.py
index d1b5af005cb..12729ea3694 100644
--- a/web/config.py
+++ b/web/config.py
@@ -461,12 +461,14 @@
     "pg-14": "",
     "pg-15": "",
     "pg-16": "",
+    "pg-17": "",
     "ppas": "",
     "ppas-12": "",
     "ppas-13": "",
     "ppas-14": "",
     "ppas-15": "",
-    "ppas-16": ""
+    "ppas-16": "",
+    "ppas-17": ""
 }
 
 ##########################################################################
@@ -481,12 +483,14 @@
     "pg-14": "",
     "pg-15": "",
     "pg-16": "",
+    "pg-17": "",
     "ppas": "",
     "ppas-12": "",
     "ppas-13": "",
     "ppas-14": "",
     "ppas-15": "",
-    "ppas-16": ""
+    "ppas-16": "",
+    "ppas-17": ""
 }
 
 ##########################################################################
diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/get_all_columns.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/get_all_columns.sql
index 54f4720aa1c..328856668b9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/get_all_columns.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/pg/default/sql/get_all_columns.sql
@@ -4,4 +4,4 @@ FROM
   pg_attribute
 WHERE
   attrelid = '{{ tid }}' :: regclass
-  and attstattarget =-1;
\ No newline at end of file
+  and attnum > 0;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_all_columns.sql b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_all_columns.sql
index 54f4720aa1c..328856668b9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_all_columns.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/publications/templates/publications/ppas/default/sql/get_all_columns.sql
@@ -4,4 +4,4 @@ FROM
   pg_attribute
 WHERE
   attrelid = '{{ tid }}' :: regclass
-  and attstattarget =-1;
\ No newline at end of file
+  and attnum > 0;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collations/sql/17_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collations/sql/17_plus/properties.sql
new file mode 100644
index 00000000000..c567e94e438
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collations/sql/17_plus/properties.sql
@@ -0,0 +1,10 @@
+SELECT c.oid, c.collname AS name, COALESCE(c.collcollate, c.colllocale) AS lc_collate,
+	COALESCE(c.collctype, c.colllocale) AS lc_type, c.collisdeterministic AS is_deterministic, c.collversion AS version,
+    c.collprovider AS provider, c.collicurules AS rules,
+    pg_catalog.pg_get_userbyid(c.collowner) AS owner, description, n.nspname AS schema
+FROM pg_catalog.pg_collation c
+    JOIN pg_catalog.pg_namespace n ON n.oid=c.collnamespace
+    LEFT OUTER JOIN pg_catalog.pg_description des ON (des.objoid=c.oid AND des.classoid='pg_collation'::regclass)
+WHERE c.collnamespace = {{scid}}::oid
+{% if coid %}    AND c.oid = {{coid}}::oid {% endif %}
+ORDER BY c.collname;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_table_columns/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_table_columns/sql/default/create.sql
index cf55c6672d4..64d0c55960b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_table_columns/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_table_columns/sql/default/create.sql
@@ -24,7 +24,7 @@ ALTER FOREIGN TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
     {{ VARIABLE.SET(conn, 'COLUMN', data.name, data.attoptions) }}
 {% endif %}
 {###  Alter column statistics value ###}
-{% if data.attstattarget is defined and data.attstattarget > -1 %}
+{% if data.attstattarget is defined and data.attstattarget is not none and data.attstattarget > -1 %}
 
 ALTER FOREIGN TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
     ALTER COLUMN {{conn|qtTypeIdent(data.name)}} SET STATISTICS {{data.attstattarget}};
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/create.sql
index be860007743..05c464817c1 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/create.sql
@@ -93,7 +93,7 @@ ALTER FOREIGN TABLE IF EXISTS {{conn|qtIdent(data.basensp, data.name)}}
 
 {% endif %}
 {###  Alter column statistics value ###}
-{% if c.attstattarget is defined and c.attstattarget > -1 %}
+{% if c.attstattarget is defined and c.attstattarget is not none and c.attstattarget > -1 %}
 ALTER FOREIGN TABLE IF EXISTS {{conn|qtIdent(data.basensp, data.name)}}
     ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STATISTICS {{c.attstattarget}};
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/12_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/12_plus/create.sql
index 46df0aeea56..0dc157dec89 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/12_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/12_plus/create.sql
@@ -33,7 +33,7 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
 
 {% endif %}
 {###  Alter column statistics value ###}
-{% if data.attstattarget is defined and data.attstattarget > -1 %}
+{% if data.attstattarget is defined and data.attstattarget is not none and data.attstattarget > -1 %}
 ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
     ALTER COLUMN {{conn|qtTypeIdent(data.name)}} SET STATISTICS {{data.attstattarget}};
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/14_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/14_plus/create.sql
index 4de4d365a66..6d5e47505fd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/14_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/14_plus/create.sql
@@ -33,7 +33,7 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
 
 {% endif %}
 {###  Alter column statistics value ###}
-{% if data.attstattarget is defined and data.attstattarget > -1 %}
+{% if data.attstattarget is defined and data.attstattarget is not none and data.attstattarget > -1 %}
 ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
     ALTER COLUMN {{conn|qtTypeIdent(data.name)}} SET STATISTICS {{data.attstattarget}};
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/16_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/16_plus/create.sql
index 89ac8fe6257..cfc9e0edc1a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/16_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/16_plus/create.sql
@@ -33,7 +33,7 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
 
 {% endif %}
 {###  Alter column statistics value ###}
-{% if data.attstattarget is defined and data.attstattarget > -1 %}
+{% if data.attstattarget is defined and data.attstattarget is not none and data.attstattarget > -1 %}
 ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
     ALTER COLUMN {{conn|qtTypeIdent(data.name)}} SET STATISTICS {{data.attstattarget}};
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/default/create.sql
index 7fa814ad125..c6bda6c7fa6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/columns/sql/default/create.sql
@@ -33,7 +33,7 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
 
 {% endif %}
 {###  Alter column statistics value ###}
-{% if data.attstattarget is defined and data.attstattarget > -1 %}
+{% if data.attstattarget is defined and data.attstattarget is not none and data.attstattarget > -1 %}
 ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.table)}}
     ALTER COLUMN {{conn|qtTypeIdent(data.name)}} SET STATISTICS {{data.attstattarget}};
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/create.sql
index ea21997d6f0..6a8ae8d5033 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/create.sql
@@ -171,7 +171,7 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
 
 {% endif %}
 {###  Alter column statistics value ###}
-{% if c.attstattarget is defined and c.attstattarget > -1 %}
+{% if c.attstattarget is defined and c.attstattarget is not none and c.attstattarget > -1 %}
 ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
     ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STATISTICS {{c.attstattarget}};
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/create.sql
index e3888b55011..20ed95c4541 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/create.sql
@@ -197,7 +197,7 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
 
 {% endif %}
 {###  Alter column statistics value ###}
-{% if c.attstattarget is defined and c.attstattarget > -1 %}
+{% if c.attstattarget is defined and c.attstattarget is not none and c.attstattarget > -1 %}
 ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
     ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STATISTICS {{c.attstattarget}};
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/14_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/14_plus/create.sql
index 823e1f337e3..0c60929e0dc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/14_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/14_plus/create.sql
@@ -199,7 +199,7 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
 
 {% endif %}
 {###  Alter column statistics value ###}
-{% if c.attstattarget is defined and c.attstattarget > -1 %}
+{% if c.attstattarget is defined and c.attstattarget is not none and c.attstattarget > -1 %}
 ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
     ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STATISTICS {{c.attstattarget}};
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/16_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/16_plus/create.sql
index 93ea6ecee3a..f95d732303a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/16_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/16_plus/create.sql
@@ -199,7 +199,7 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
 
 {% endif %}
 {###  Alter column statistics value ###}
-{% if c.attstattarget is defined and c.attstattarget > -1 %}
+{% if c.attstattarget is defined and c.attstattarget is not none and c.attstattarget > -1 %}
 ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
     ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STATISTICS {{c.attstattarget}};
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/create.sql
index 3e57637813c..6b2a3cba12a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/create.sql
@@ -170,7 +170,7 @@ ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
 
 {% endif %}
 {###  Alter column statistics value ###}
-{% if c.attstattarget is defined and c.attstattarget > -1 %}
+{% if c.attstattarget is defined and c.attstattarget is not none and c.attstattarget > -1 %}
 ALTER TABLE IF EXISTS {{conn|qtIdent(data.schema, data.name)}}
     ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STATISTICS {{c.attstattarget}};
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/17_plus/get_ctypes.sql b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/17_plus/get_ctypes.sql
new file mode 100644
index 00000000000..25276770ba7
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/17_plus/get_ctypes.sql
@@ -0,0 +1,8 @@
+SELECT CASE WHEN datlocprovider = 'i' THEN
+	(SELECT datlocale as cname FROM pg_database WHERE datname = current_database())
+ELSE
+    (SELECT datcollate as cname FROM pg_database WHERE datname = current_database()
+    UNION
+    SELECT datctype as cname FROM pg_database WHERE datname = current_database())
+END
+FROM pg_database WHERE datname = current_database();
diff --git a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/17_plus/get_icu_locale.sql b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/17_plus/get_icu_locale.sql
new file mode 100644
index 00000000000..128bfeb0649
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/17_plus/get_icu_locale.sql
@@ -0,0 +1 @@
+SELECT colllocale as colliculocale from pg_collation where collprovider = 'i'
diff --git a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/17_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/17_plus/properties.sql
new file mode 100644
index 00000000000..7ff6262fdaa
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/17_plus/properties.sql
@@ -0,0 +1,41 @@
+SELECT
+    db.oid AS did, db.oid, db.datname AS name, db.dattablespace AS spcoid,
+    spcname, datallowconn, pg_catalog.pg_encoding_to_char(encoding) AS encoding,
+    pg_catalog.pg_get_userbyid(datdba) AS datowner, db.datcollate, db.datctype,
+    datconnlimit, datlocale AS daticulocale, daticurules, datcollversion,
+    CASE WHEN datlocprovider = 'i' THEN 'icu' ELSE 'libc' END datlocaleprovider,
+    pg_catalog.has_database_privilege(db.oid, 'CREATE') AS cancreate,
+    pg_catalog.current_setting('default_tablespace') AS default_tablespace,
+    descr.description AS comments, db.datistemplate AS is_template,
+    {### Default ACL for Tables ###}
+    '' AS tblacl,
+    {### Default ACL for Sequnces ###}
+    '' AS seqacl,
+    {### Default ACL for Functions ###}
+    '' AS funcacl,
+    pg_catalog.array_to_string(datacl::text[], ', ') AS acl
+FROM pg_catalog.pg_database db
+    LEFT OUTER JOIN pg_catalog.pg_tablespace ta ON db.dattablespace=ta.OID
+    LEFT OUTER JOIN pg_catalog.pg_shdescription descr ON (
+        db.oid=descr.objoid AND descr.classoid='pg_database'::regclass
+    )
+WHERE
+{% if show_user_defined_templates is defined  %}
+     db.datistemplate = {{show_user_defined_templates}} AND
+{% endif %}
+{% if did %}
+    db.oid = {{ did|qtLiteral(conn) }}::OID
+{% else %}
+    {% if name %}
+        db.datname = {{ name|qtLiteral(conn) }}::text
+    {% endif %}
+{% endif %}
+
+{% if db_restrictions %}
+    {% if did or name %}AND{% endif %}
+    db.datname in ({{db_restrictions}})
+{% elif not did and not name%}
+    db.oid > {{ last_system_oid }}::OID OR db.datname IN ('postgres', 'edb')
+{% endif %}
+
+ORDER BY datname;
diff --git a/web/pgadmin/tools/schema_diff/tests/pg/17_plus/source.sql b/web/pgadmin/tools/schema_diff/tests/pg/17_plus/source.sql
new file mode 100644
index 00000000000..5957dd83e21
--- /dev/null
+++ b/web/pgadmin/tools/schema_diff/tests/pg/17_plus/source.sql
@@ -0,0 +1,1161 @@
+--
+-- PostgreSQL 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: postgres
+--
+
+CREATE SCHEMA test_schema_diff;
+
+
+ALTER SCHEMA test_schema_diff OWNER TO postgres;
+
+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: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 12273 (class 1259 OID 149208)
+-- Name: part1; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 12274 (class 1259 OID 149213)
+-- Name: table_for_partition_1; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 12275 (class 1259 OID 149216)
+-- Name: part3; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 12276 (class 1259 OID 149219)
+-- Name: part4; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 12258 (class 1259 OID 148963)
+-- Name: table_for_column; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 12256 (class 1259 OID 148895)
+-- Name: table_for_constraints; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+CREATE TABLE test_schema_diff.table_for_constraints (
+    col1 integer NOT NULL,
+    col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_constraints OWNER TO postgres;
+
+--
+-- TOC entry 61066 (class 0 OID 0)
+-- Dependencies: 12256
+-- Name: TABLE table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: postgres
+--
+
+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: postgres
+--
+
+CREATE TABLE test_schema_diff.table_for_identical (
+    col1 integer NOT NULL,
+    col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_identical OWNER TO postgres;
+
+--
+-- TOC entry 12260 (class 1259 OID 148977)
+-- Name: table_for_index; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+CREATE TABLE test_schema_diff.table_for_index (
+    col1 integer NOT NULL,
+    col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_index OWNER TO postgres;
+
+--
+-- TOC entry 12269 (class 1259 OID 149128)
+-- Name: table_for_primary_key; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 12264 (class 1259 OID 149024)
+-- Name: table_for_rule; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+CREATE TABLE test_schema_diff.table_for_rule (
+    col1 bigint NOT NULL,
+    col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_rule OWNER TO postgres;
+
+--
+-- TOC entry 12266 (class 1259 OID 149048)
+-- Name: table_for_trigger; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+CREATE TABLE test_schema_diff.table_for_trigger (
+    col1 bigint NOT NULL,
+    col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_trigger OWNER TO postgres;
+
+--
+-- TOC entry 56893 (class 2606 OID 148904)
+-- Name: table_for_constraints Exclusion; Type: CONSTRAINT; Schema: test_schema_diff; Owner: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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
+   FROM pg_class
+ LIMIT 10;
+
+
+ALTER TABLE test_schema_diff."test view" OWNER TO postgres;
+
+--
+-- TOC entry 12286 (class 1259 OID 347832)
+-- Name: test view f; Type: VIEW; Schema: test_schema_diff; Owner: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 61111 (class 0 OID 0)
+-- Dependencies: 12286
+-- Name: VIEW "test view f"; Type: COMMENT; Schema: test_schema_diff; Owner: postgres
+--
+
+COMMENT ON VIEW test_schema_diff."test view f" IS 'cmn';
+
+--
+-- TOC entry 223 (class 1255 OID 67206)
+-- Name: dodaj_klijenta(character varying, character varying, character varying, character varying, integer, character varying, character varying, character varying, boolean, boolean, character varying, character varying, character varying, character varying, numeric, character varying); Type: PROCEDURE; Schema: public; Owner: postgres
+--
+
+CREATE PROCEDURE test_schema_diff.dodaj_klijenta(v_naziv character varying, v_oib character varying, v_pdv_id character varying, v_adresa character varying, v_mjesto integer, v_drzava character varying, v_tip_p_sub character varying, v_vlasnik character varying, v_pdv boolean, v_fisk boolean, v_iban character varying, v_k_osoba character varying, v_email character varying, v_br_tel character varying, v_radna_god numeric, v_schema character varying)
+    LANGUAGE sql
+    AS $$select 1;$$;
+
+
+ALTER PROCEDURE test_schema_diff.dodaj_klijenta(v_naziv character varying, v_oib character varying, v_pdv_id character varying, v_adresa character varying, v_mjesto integer, v_drzava character varying, v_tip_p_sub character varying, v_vlasnik character varying, v_pdv boolean, v_fisk boolean, v_iban character varying, v_k_osoba character varying, v_email character varying, v_br_tel character varying, v_radna_god numeric, v_schema character varying) OWNER TO postgres;
+
+--
+-- TOC entry 220 (class 1255 OID 67205)
+-- Name: proc1(bigint); Type: PROCEDURE; Schema: test_schema_diff; Owner: postgres
+--
+
+CREATE PROCEDURE test_schema_diff.proc1(arg1 bigint)
+    LANGUAGE sql
+    AS $$select 1;$$;
+
+
+ALTER PROCEDURE test_schema_diff.proc1(arg1 bigint) OWNER TO postgres;
+
+-- Collation scripts
+CREATE COLLATION test_schema_diff.coll_src
+    FROM pg_catalog."POSIX";
+
+ALTER COLLATION test_schema_diff.coll_src
+    OWNER TO postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+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 postgres;
+
+CREATE TYPE test_schema_diff.typ_comp_diff_no_column AS
+(
+);
+ALTER TYPE test_schema_diff.typ_comp_diff_no_column
+    OWNER TO postgres;
+
+-- 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 postgres;
+
+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 postgres;
+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 postgres;
+
+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 pg_monitor;
+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 pg_monitor 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 postgres;
+
+-- Type Script SHELL type
+CREATE TYPE test_schema_diff.typ_shell_src;
+ALTER TYPE test_schema_diff.typ_shell_src
+    OWNER TO postgres;
+
+CREATE TYPE test_schema_diff.typ_shell_diff;
+ALTER TYPE test_schema_diff.typ_shell_diff
+    OWNER TO postgres;
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+-- 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 postgres;
+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 postgres;
+
+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 postgres;
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+-- 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 postgres;
+
+-- 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 postgres;
+CREATE SERVER test_fs2_for_foreign_table
+    FOREIGN DATA WRAPPER test_fdw_for_foreign_table;
+ALTER SERVER test_fs2_for_foreign_table
+    OWNER TO postgres;
+
+-- 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 postgres;
+
+-- Foreign Table scripts
+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 postgres;
+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 pg_monitor;
+GRANT ALL ON TABLE test_schema_diff.ft_src TO postgres;
+
+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 postgres;
+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 postgres;
+
+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 pg_monitor;
+GRANT ALL ON TABLE test_schema_diff.ft_diff_const TO postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+-- 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 postgres;
+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 postgres 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 postgres;
+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 postgres;
+GRANT USAGE ON LANGUAGE lan_diff_acl_add TO PUBLIC;
+GRANT USAGE ON LANGUAGE lan_diff_acl_add TO postgres 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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+-- Foreign Data Wrapper Script
+CREATE FOREIGN DATA WRAPPER fdw_src
+    VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER fdw_src
+    OWNER TO postgres;
+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 postgres;
+GRANT USAGE ON FOREIGN DATA WRAPPER fdw_diff_acl_add TO PUBLIC;
+GRANT USAGE ON FOREIGN DATA WRAPPER fdw_diff_acl_add TO postgres 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 postgres;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_add_validator
+    VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER fdw_diff_add_validator
+    OWNER TO postgres;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_remove_validator;
+ALTER FOREIGN DATA WRAPPER fdw_diff_remove_validator
+    OWNER TO postgres;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_add_options
+    OPTIONS (debug 'true');
+ALTER FOREIGN DATA WRAPPER fdw_diff_add_options
+    OWNER TO postgres;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_remove_options;
+ALTER FOREIGN DATA WRAPPER fdw_diff_remove_options
+    OWNER TO postgres;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_options
+    OPTIONS (debug 'false');
+ALTER FOREIGN DATA WRAPPER fdw_diff_options
+    OWNER TO postgres;
+
+-- 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 postgres;
+
+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 postgres;
+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 postgres;
+GRANT USAGE ON FOREIGN SERVER fs_diff_acl_add TO PUBLIC;
+GRANT USAGE ON FOREIGN SERVER fs_diff_acl_add TO postgres 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 postgres;
+
+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 postgres;
+
+CREATE SERVER fs_diff_type_version_remove
+    FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_type_version_remove
+    OWNER TO postgres;
+
+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 postgres;
+
+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 postgres;
+
+CREATE SERVER fs_diff_options_remove
+    FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_options_remove
+    OWNER TO postgres;
+
+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 postgres;
+
+-- 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 postgres;
+
+CREATE SERVER test_fs_for_user_mapping
+    FOREIGN DATA WRAPPER test_fdw_for_user_mapping;
+ALTER SERVER test_fs_for_user_mapping
+    OWNER TO postgres;
+
+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
+    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/17_plus/target.sql b/web/pgadmin/tools/schema_diff/tests/pg/17_plus/target.sql
new file mode 100644
index 00000000000..62467869dba
--- /dev/null
+++ b/web/pgadmin/tools/schema_diff/tests/pg/17_plus/target.sql
@@ -0,0 +1,1094 @@
+--
+-- PostgreSQL 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: postgres
+--
+
+CREATE SCHEMA test_schema_diff;
+
+ALTER SCHEMA test_schema_diff OWNER TO postgres;
+
+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: postgres
+--
+
+CREATE MATERIALIZED VIEW test_schema_diff."MView" AS
+ SELECT 'tekst'::text AS text
+  WITH NO DATA;
+
+
+ALTER TABLE test_schema_diff."MView" OWNER TO postgres;
+
+--
+-- TOC entry 12277 (class 1259 OID 149234)
+-- Name: table_for_partition_1; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 12278 (class 1259 OID 149237)
+-- Name: part3; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 12259 (class 1259 OID 148971)
+-- Name: table_for_column; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+CREATE TABLE test_schema_diff.table_for_column (
+    col1 bigint,
+    col2 bigint,
+    col4 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_column OWNER TO postgres;
+
+--
+-- TOC entry 12268 (class 1259 OID 149089)
+-- Name: table_for_constraints; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 61066 (class 0 OID 0)
+-- Dependencies: 12268
+-- Name: TABLE table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+CREATE TABLE test_schema_diff.table_for_del (
+);
+
+
+ALTER TABLE test_schema_diff.table_for_del OWNER TO postgres;
+
+--
+-- TOC entry 12271 (class 1259 OID 149172)
+-- Name: table_for_foreign_key; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 12263 (class 1259 OID 149013)
+-- Name: table_for_identical; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+CREATE TABLE test_schema_diff.table_for_identical (
+    col1 integer NOT NULL,
+    col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_identical OWNER TO postgres;
+
+--
+-- TOC entry 12261 (class 1259 OID 148986)
+-- Name: table_for_index; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+CREATE TABLE test_schema_diff.table_for_index (
+    col1 integer NOT NULL,
+    col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_index OWNER TO postgres;
+
+--
+-- TOC entry 12270 (class 1259 OID 149144)
+-- Name: table_for_primary_key; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 12265 (class 1259 OID 149034)
+-- Name: table_for_rule; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+CREATE TABLE test_schema_diff.table_for_rule (
+    col1 bigint NOT NULL,
+    col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_rule OWNER TO postgres;
+
+--
+-- TOC entry 12267 (class 1259 OID 149066)
+-- Name: table_for_trigger; Type: TABLE; Schema: test_schema_diff; Owner: postgres
+--
+
+CREATE TABLE test_schema_diff.table_for_trigger (
+    col1 bigint NOT NULL,
+    col2 text
+);
+
+
+ALTER TABLE test_schema_diff.table_for_trigger OWNER TO postgres;
+
+
+--
+-- TOC entry 56906 (class 2606 OID 149097)
+-- Name: table_for_constraints Exclusion; Type: CONSTRAINT; Schema: test_schema_diff; Owner: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+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: postgres
+--
+
+REFRESH MATERIALIZED VIEW test_schema_diff."MView";
+
+--
+-- TOC entry 12284 (class 1259 OID 347823)
+-- Name: test view; Type: VIEW; Schema: test_schema_diff; Owner: postgres
+--
+
+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
+   FROM pg_catalog.pg_class
+ LIMIT 10;
+
+
+ALTER TABLE test_schema_diff."test view" OWNER TO postgres;
+
+--
+-- TOC entry 12285 (class 1259 OID 347828)
+-- Name: test view f; Type: VIEW; Schema: test_schema_diff; Owner: postgres
+--
+
+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 postgres;
+
+--
+-- TOC entry 61105 (class 0 OID 0)
+-- Dependencies: 12285
+-- Name: VIEW "test view f"; Type: COMMENT; Schema: test_schema_diff; Owner: postgres
+--
+
+COMMENT ON VIEW test_schema_diff."test view f" IS 'cmn';
+
+
+--
+-- TOC entry 437 (class 1255 OID 112907)
+-- Name: dodaj_klijenta(character varying, character varying, character varying, character varying, integer, character varying, character varying, character varying, boolean, boolean, character varying, character varying, character varying, character varying, numeric, character varying); Type: PROCEDURE; Schema: test_schema_diff schema; Owner: postgres
+--
+
+CREATE PROCEDURE test_schema_diff.dodaj_klijenta(v_naziv character varying, v_oib character varying, v_pdv_id character varying, v_adresa character varying, v_mjesto integer, v_drzava character varying, v_tip_p_sub character varying, v_vlasnik character varying, v_pdv boolean, v_fisk boolean, v_iban character varying, v_k_osoba character varying, v_email character varying, v_br_tel character varying, v_radna_god numeric, v_schema character varying)
+    LANGUAGE sql
+    AS $$select 4;$$;
+
+
+ALTER PROCEDURE test_schema_diff.dodaj_klijenta(v_naziv character varying, v_oib character varying, v_pdv_id character varying, v_adresa character varying, v_mjesto integer, v_drzava character varying, v_tip_p_sub character varying, v_vlasnik character varying, v_pdv boolean, v_fisk boolean, v_iban character varying, v_k_osoba character varying, v_email character varying, v_br_tel character varying, v_radna_god numeric, v_schema character varying) OWNER TO postgres;
+
+-- Collation scripts
+CREATE COLLATION test_schema_diff.coll_tar
+    FROM pg_catalog."POSIX";
+
+ALTER COLLATION test_schema_diff.coll_tar
+    OWNER TO postgres;
+
+CREATE COLLATION test_schema_diff.coll_diff
+    (LC_COLLATE = 'C', LC_CTYPE = 'C');
+
+ALTER COLLATION test_schema_diff.coll_diff
+    OWNER TO postgres;
+
+-- 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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+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 postgres;
+
+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 postgres;
+
+-- 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 postgres;
+
+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 postgres;
+
+-- 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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+-- Type Script SHELL type
+CREATE TYPE test_schema_diff.typ_shell_tar;
+ALTER TYPE test_schema_diff.typ_shell_tar
+    OWNER TO postgres;
+
+CREATE TYPE test_schema_diff.typ_shell_diff;
+ALTER TYPE test_schema_diff.typ_shell_diff
+    OWNER TO pg_monitor;
+
+-- 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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+-- 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 postgres;
+
+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 postgres;
+
+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 postgres;
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+-- 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 postgres;
+
+-- 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 postgres;
+CREATE SERVER test_fs2_for_foreign_table
+    FOREIGN DATA WRAPPER test_fdw_for_foreign_table;
+ALTER SERVER test_fs2_for_foreign_table
+    OWNER TO postgres;
+
+-- 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 postgres;
+
+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 postgres;
+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 pg_monitor;
+GRANT ALL ON TABLE test_schema_diff.ft_tar TO postgres;
+
+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 postgres;
+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 pg_monitor;
+GRANT ALL ON TABLE test_schema_diff.ft_diff_col TO postgres;
+
+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 postgres;
+
+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 pg_monitor;
+GRANT ALL ON TABLE test_schema_diff.ft_diff_const TO postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+-- 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 postgres;
+GRANT USAGE ON LANGUAGE tar_language TO PUBLIC;
+GRANT USAGE ON LANGUAGE tar_language TO postgres 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 postgres;
+
+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 postgres;
+GRANT USAGE ON LANGUAGE lan_diff_acl_revoke TO PUBLIC;
+GRANT USAGE ON LANGUAGE lan_diff_acl_revoke TO postgres 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 postgres;
+
+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 postgres;
+
+-- Foreign Data Wrapper Script
+CREATE FOREIGN DATA WRAPPER fdw_tar
+    VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER fdw_tar
+    OWNER TO postgres;
+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 postgres;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_acl_revoke
+    VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER fdw_diff_acl_revoke
+    OWNER TO postgres;
+GRANT USAGE ON FOREIGN DATA WRAPPER fdw_diff_acl_revoke TO PUBLIC;
+GRANT USAGE ON FOREIGN DATA WRAPPER fdw_diff_acl_revoke TO postgres WITH GRANT OPTION;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_add_validator;
+ALTER FOREIGN DATA WRAPPER fdw_diff_add_validator
+    OWNER TO postgres;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_remove_validator
+    VALIDATOR pg_catalog.postgresql_fdw_validator;
+ALTER FOREIGN DATA WRAPPER fdw_diff_remove_validator
+    OWNER TO postgres;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_add_options;
+ALTER FOREIGN DATA WRAPPER fdw_diff_add_options
+    OWNER TO postgres;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_remove_options
+    OPTIONS (debug 'true');
+ALTER FOREIGN DATA WRAPPER fdw_diff_remove_options
+    OWNER TO postgres;
+
+CREATE FOREIGN DATA WRAPPER fdw_diff_options
+    OPTIONS (debug 'true');
+ALTER FOREIGN DATA WRAPPER fdw_diff_options
+    OWNER TO postgres;
+
+-- 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 postgres;
+
+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 postgres;
+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 postgres;
+
+CREATE SERVER fs_diff_acl_revoke
+    FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_acl_revoke
+    OWNER TO postgres;
+GRANT USAGE ON FOREIGN SERVER fs_diff_acl_revoke TO PUBLIC;
+GRANT USAGE ON FOREIGN SERVER fs_diff_acl_revoke TO postgres 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 postgres;
+
+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 postgres;
+
+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 postgres;
+
+CREATE SERVER fs_diff_options_add
+    FOREIGN DATA WRAPPER test_fdw_for_foreign_server;
+ALTER SERVER fs_diff_options_add
+    OWNER TO postgres;
+
+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 postgres;
+
+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 postgres;
+
+-- 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 postgres;
+
+CREATE SERVER test_fs_for_user_mapping
+    FOREIGN DATA WRAPPER test_fdw_for_user_mapping;
+ALTER SERVER test_fs_for_user_mapping
+    OWNER TO postgres;
+
+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/ppas/17_plus/source.sql b/web/pgadmin/tools/schema_diff/tests/ppas/17_plus/source.sql
new file mode 100644
index 00000000000..53c475fca5c
--- /dev/null
+++ b/web/pgadmin/tools/schema_diff/tests/ppas/17_plus/source.sql
@@ -0,0 +1,1315 @@
+--
+-- 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_catalog.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;
+
+-- Foreign Table scripts
+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;
+
+-- 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/17_plus/target.sql b/web/pgadmin/tools/schema_diff/tests/ppas/17_plus/target.sql
new file mode 100644
index 00000000000..81100a919a5
--- /dev/null
+++ b/web/pgadmin/tools/schema_diff/tests/ppas/17_plus/target.sql
@@ -0,0 +1,1256 @@
+--
+-- 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_catalog.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;
+
+-- 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 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/utils/constants.py b/web/pgadmin/utils/constants.py
index 11a18360461..012b422114f 100644
--- a/web/pgadmin/utils/constants.py
+++ b/web/pgadmin/utils/constants.py
@@ -90,6 +90,9 @@
          "isDefault": False},
         {"version": "160000", "next_major_version": "170000",
          "serverType": gettext("EDB Advanced Server 16"), "binaryPath": None,
+         "isDefault": False},
+        {"version": "170000", "next_major_version": "180000",
+         "serverType": gettext("EDB Advanced Server 17"), "binaryPath": None,
          "isDefault": False}
     ],
     "pg_bin_paths": [
@@ -107,6 +110,9 @@
          "isDefault": False},
         {"version": "160000", "next_major_version": "170000",
          "serverType": gettext("PostgreSQL 16"), "binaryPath": None,
+         "isDefault": False},
+        {"version": "170000", "next_major_version": "180000",
+         "serverType": gettext("PostgreSQL 17"), "binaryPath": None,
          "isDefault": False}
     ]
 }
diff --git a/web/pgadmin/utils/versioned_template_loader.py b/web/pgadmin/utils/versioned_template_loader.py
index 88d7d467600..61776fe95a8 100644
--- a/web/pgadmin/utils/versioned_template_loader.py
+++ b/web/pgadmin/utils/versioned_template_loader.py
@@ -76,7 +76,8 @@ def get_version_mapping_directories():
     :param server_type:
     :return:
     """
-    return ({'name': "16_plus", 'number': 160000},
+    return ({'name': "17_plus", 'number': 170000},
+            {'name': "16_plus", 'number': 160000},
             {'name': "15_plus", 'number': 150000},
             {'name': "14_plus", 'number': 140000},
             {'name': "13_plus", 'number': 130000},
diff --git a/web/regression/feature_tests/pg_utilities_backup_restore_test.py b/web/regression/feature_tests/pg_utilities_backup_restore_test.py
index dc4dfe147ae..208c7fb59b9 100644
--- a/web/regression/feature_tests/pg_utilities_backup_restore_test.py
+++ b/web/regression/feature_tests/pg_utilities_backup_restore_test.py
@@ -281,8 +281,9 @@ def _update_preferences(self):
         default_binary_path = self.server['default_binary_paths']
         if default_binary_path is not None:
             def get_server_version_string():
-                server_version = {160000: '16', 150000: '15', 140000: '14',
-                                  130000: '13', 120000: '12', 110000: '11'}
+                server_version = {170000: '17', 160000: '16', 150000: '15',
+                                  140000: '14', 130000: '13', 120000: '12',
+                                  110000: '11'}
                 for k, v in server_version.items():
                     if k <= self.server_information['server_version']:
                         return v
