diff --git a/docs/en_US/images/preferences_schema_diff.png b/docs/en_US/images/preferences_schema_diff.png index 7dd51fe0ecf..74567e46489 100644 Binary files a/docs/en_US/images/preferences_schema_diff.png and b/docs/en_US/images/preferences_schema_diff.png differ diff --git a/docs/en_US/images/schema_diff_compare_button.png b/docs/en_US/images/schema_diff_compare_button.png index 0c4beb50346..ebe44f964cb 100644 Binary files a/docs/en_US/images/schema_diff_compare_button.png and b/docs/en_US/images/schema_diff_compare_button.png differ diff --git a/docs/en_US/preferences.rst b/docs/en_US/preferences.rst index 90d1989632b..aa7ed4c9bd3 100644 --- a/docs/en_US/preferences.rst +++ b/docs/en_US/preferences.rst @@ -529,9 +529,13 @@ Expand the *Schema Diff* node to specify your display preferences. :alt: Preferences schema diff :align: center -Use the *Ignore owner* switch to ignores the owner while comparing the objects. +Use the *Ignore Grant/Revoke* switch to ignores the grant and revoke command while comparing the objects. -Use the *Ignore whitespace* switch to ignores the whitespace while comparing +Use the *Ignore Owner* switch to ignores the owner while comparing the objects. + +Use the *Ignore Tablespace* switch to ignores the tablespace while comparing the objects. + +Use the *Ignore Whitespace* switch to ignores the whitespace while comparing the string objects. Whitespace includes space, tabs, and CRLF. diff --git a/docs/en_US/release_notes_7_6.rst b/docs/en_US/release_notes_7_6.rst index 725e0c80a03..5e01b0e5584 100644 --- a/docs/en_US/release_notes_7_6.rst +++ b/docs/en_US/release_notes_7_6.rst @@ -22,13 +22,17 @@ New features | `Issue #2595 `_ - Added Expression to CREATE INDEX. | `Issue #3942 `_ - Added cascade option while creating an extension. + | `Issue #5759 `_ - Added 'Ignore Grants' option in the schema diff tool. + | `Issue #6004 `_ - Added 'Ignore Tablespace' option in the schema diff tool. | `Issue #6375 `_ - Added support for ALTER INDEX column statistics. | `Issue #6376 `_ - Added unlogged option while creating a sequence. + | `Issue #6377 `_ - Added all like options while creating a table. | `Issue #6381 `_ - Added support for SYSTEM, CONCURRENTLY and TABLESPACE options in REINDEX. | `Issue #6382 `_ - Added WAL option to EXPLAIN ANALYZE command. | `Issue #6397 `_ - Added new/missing options to the VACUUM command. | `Issue #6415 `_ - Added SKIP_LOCKED and BUFFER_USAGE_LIMIT option to Analyze command. | `Issue #6448 `_ - Add support for TRUNCATE trigger in foreign table. + | `Issue #6595 `_ - Ensure that Schema Diff comparison results should be displayed in the sorted order. Housekeeping ************ @@ -44,3 +48,8 @@ Bug fixes | `Issue #6420 `_ - Fix the query tool issue where raise Notice from func/proc or code blocks are no longer displayed live. | `Issue #6500 `_ - Fix the issue where query tool window turns blank if the user tries to generate a graph on the result. | `Issue #6624 `_ - Fix an issue where changing MFA_SUPPORTED_METHODS breaks the MFA validation. + | `Issue #6630 `_ - Fix an issue where pgAdmin 7.5 fails to render table SQL with extension loaded index method. + | `Issue #6639 `_ - Fix an issue where cycle syntax was not added in SQL when creating new sequence from UI. + | `Issue #6651 `_ - Fix an issue where the SET directive is excluded from the function header in the schema diff tool. + | `Issue #6660 `_ - Fix a query tool error 'pgAdminThread' object has no attribute 'native_id'. + | `Issue #6664 `_ - Ensure keyboard shortcut for query execution is disabled when query execution is in progress. diff --git a/docs/en_US/schema_diff.rst b/docs/en_US/schema_diff.rst index dc36a5eb166..48b0e018889 100644 --- a/docs/en_US/schema_diff.rst +++ b/docs/en_US/schema_diff.rst @@ -65,11 +65,15 @@ same or different (and within the same server or from different servers). :alt: Schema diff compare button :align: center -Use the drop-down near to *Compare* button to ignore owner and ignore whitespace. +Use the drop-down near to *Compare* button to ignore owner, whitespace, tablespace and grants. - * Ignore owner – Select to ignores the owner while comparing the objects. + * Ignore Owner – Select to ignores the owner while comparing the objects. - * Ignore whitespace – Select to ignores the whitespace while comparing the string objects. Whitespace includes space, tabs, and CRLF. + * Ignore Whitespace – Select to ignores the whitespace while comparing the string objects. Whitespace includes space, tabs, and CRLF. + + * Ignore Tablespace – Select to ignores the tablespace while comparing the objects. + + * Ignore Grant/Revoke – Select to ignores the grant and revoke command while comparing the objects. After you select servers, and databases, click on the *Compare* button to obtain the *Comparison Result*. diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py index 07924f93d88..081b8c6ab41 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py @@ -224,8 +224,7 @@ class ForeignTableView(PGChildNodeView) 'compare': [{'get': 'compare'}, {'get': 'compare'}] }) - keys_to_ignore = ['oid', 'basensp', 'oid-2', 'attnum', 'strftoptions', - 'relacl'] + keys_to_ignore = ['oid', 'basensp', 'oid-2', 'attnum', 'strftoptions'] def validate_request(f): """ @@ -889,9 +888,9 @@ def sql(self, gid, sid, did, scid, foid=None, **kwargs): data['basensp'] = target_schema # Parse Privileges - if 'acl' in data: - data['acl'] = parse_priv_to_db(data['acl'], - ["a", "r", "w", "x"]) + if 'relacl' in data: + data['relacl'] = parse_priv_to_db(data['relacl'], + ["a", "r", "w", "x"]) SQL = render_template("/".join([self.template_path, self._CREATE_SQL]), @@ -932,9 +931,22 @@ def msql(self, gid, sid, did, scid, foid=None): Returns: SQL statements to create/update the Foreign Table. """ + data = {} + for k, v in self.request.items(): + try: + # comments should be taken as is because if user enters a + # json comment it is parsed by loads which should not happen + if k in ('description',): + data[k] = v + else: + data[k] = json.loads(v) + except ValueError: + data[k] = v + except TypeError: + data[k] = v try: SQL, name = self.get_sql(gid=gid, sid=sid, did=did, scid=scid, - data=self.request, foid=foid) + data=data, foid=foid) # Most probably this is due to error if not isinstance(SQL, str): return SQL @@ -956,15 +968,15 @@ def _parse_privileges(data): :param data: Data. :return: """ - if 'acl' in data and 'added' in data['acl']: - data['acl']['added'] = parse_priv_to_db(data['acl']['added'], - ["a", "r", "w", "x"]) - if 'acl' in data and 'changed' in data['acl']: - data['acl']['changed'] = parse_priv_to_db( - data['acl']['changed'], ["a", "r", "w", "x"]) - if 'acl' in data and 'deleted' in data['acl']: - data['acl']['deleted'] = parse_priv_to_db( - data['acl']['deleted'], ["a", "r", "w", "x"]) + if 'relacl' in data and 'added' in data['relacl']: + data['relacl']['added'] = parse_priv_to_db( + data['relacl']['added'], ["a", "r", "w", "x"]) + if 'relacl' in data and 'changed' in data['relacl']: + data['relacl']['changed'] = parse_priv_to_db( + data['relacl']['changed'], ["a", "r", "w", "x"]) + if 'relacl' in data and 'deleted' in data['relacl']: + data['relacl']['deleted'] = parse_priv_to_db( + data['relacl']['deleted'], ["a", "r", "w", "x"]) @staticmethod def _check_old_col_ops(old_col_frmt_options, option, col): @@ -1095,9 +1107,9 @@ def get_sql(self, **kwargs): data['columns'] = self._format_columns(data['columns']) # Parse Privileges - if 'acl' in data: - data['acl'] = parse_priv_to_db(data['acl'], - ["a", "r", "w", "x"]) + if 'relacl' in data: + data['relacl'] = parse_priv_to_db(data['relacl'], + ["a", "r", "w", "x"]) sql = render_template("/".join([self.template_path, self._CREATE_SQL]), data=data, @@ -1320,7 +1332,7 @@ def _format_proacl_from_db(self, proacl): priv = parse_priv_from_db(row) privileges.append(priv) - return {"acl": privileges} + return {"relacl": privileges} def _parse_variables_from_db(self, db_variables): """ diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign_table.ui.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign_table.ui.js index 3703392e961..4cfda05e27d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign_table.ui.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign_table.ui.js @@ -33,7 +33,6 @@ export default class ForeignTableSchema extends BaseUISchema { columns: [], ftoptions: [], relacl: [], - stracl: [], seclabels: [], ...initValues }); @@ -198,12 +197,11 @@ export default class ForeignTableSchema extends BaseUISchema { canAdd: true, canDelete: true, uniqueCol : ['option'], }, { - id: 'relacl', label: gettext('Privileges'), cell: 'text', - type: 'text', group: gettext('Security'), - mode: ['properties'], min_version: 90200, + id: 'acl', label: gettext('Privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], min_version: 90200, }, { - id: 'acl', label: gettext('Privileges'), type: 'collection', + id: 'relacl', label: gettext('Privileges'), type: 'collection', schema: this.getPrivilegeRoleSchema(['a','r','w','x']), uniqueCol : ['grantee', 'grantor'], editable: false, 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 f508eee0a6b..bebc5ec7df7 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 @@ -56,9 +56,9 @@ COMMENT ON COLUMN {{conn|qtIdent(data.basensp, data.name, c.attname)}} {% endif %} {% endfor %} {% endif %} -{% if data.acl %} +{% if data.relacl %} -{% for priv in data.acl %} +{% for priv in data.relacl %} {{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, data.name, priv.without_grant, priv.with_grant, data.basensp) }} {% endfor -%} {% endif -%} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/properties.sql index 686523f68e1..c560899f86d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/properties.sql @@ -1,5 +1,6 @@ SELECT - c.oid, c.relname AS name, c.relacl, pg_catalog.pg_get_userbyid(relowner) AS owner, + c.oid, c.relname AS name, pg_catalog.pg_get_userbyid(relowner) AS owner, + pg_catalog.array_to_string(c.relacl::text[], ', ') as acl, ftoptions, srvname AS ftsrvname, description, nspname AS basensp, (SELECT pg_catalog.array_agg(provider || '=' || label) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/update.sql index a04be1ac750..78817bcbd4e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/update.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/update.sql @@ -187,23 +187,23 @@ COMMENT ON FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }} IS {{ data.description|qtLiteral(conn) }}; {% endif -%} -{% if data.acl %} -{% if 'deleted' in data.acl %} -{% for priv in data.acl.deleted %} +{% if data.relacl %} +{% if 'deleted' in data.relacl %} +{% for priv in data.relacl.deleted %} {{ PRIVILEGE.UNSETALL(conn, 'TABLE', priv.grantee, name, o_data.basensp) }} {% endfor %} {% endif -%} -{% if 'changed' in data.acl %} -{% for priv in data.acl.changed %} +{% if 'changed' in data.relacl %} +{% for priv in data.relacl.changed %} {{ PRIVILEGE.UNSETALL(conn, 'TABLE', priv.grantee, name, o_data.basensp) }} {{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, name, priv.without_grant, priv.with_grant, o_data.basensp) }} {% endfor %} {% endif -%} -{% if 'added' in data.acl %} -{% for priv in data.acl.added %} +{% if 'added' in data.relacl %} +{% for priv in data.relacl.added %} {{ PRIVILEGE.SET(conn, 'TABLE', priv.grantee, name, priv.without_grant, priv.with_grant, o_data.basensp) }} {% endfor %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/pg/default/test_foreign_table.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/pg/default/test_foreign_table.json index 4929d45f128..58428d0a523 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/pg/default/test_foreign_table.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/pg/default/test_foreign_table.json @@ -55,7 +55,7 @@ "option":"table_name", "value":"test_table" }], - "acl":[{ + "relacl":[{ "grantee":"PUBLIC", "grantor":"postgres", "privileges":[{ @@ -153,7 +153,7 @@ "sql_endpoint": "NODE-foreign_table.sql_id", "msql_endpoint": "NODE-foreign_table.msql_id", "data": { - "acl":{ + "relacl":{ "added": [{ "grantee":"PUBLIC", "grantor":"postgres", @@ -205,7 +205,7 @@ "sql_endpoint": "NODE-foreign_table.sql_id", "msql_endpoint": "NODE-foreign_table.msql_id", "data": { - "acl":{ + "relacl":{ "deleted": [{ "grantee":"PUBLIC", "grantor":"postgres", diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/ppas/default/test_foreign_table.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/ppas/default/test_foreign_table.json index 303e1df57a2..19889d9bc01 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/ppas/default/test_foreign_table.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/ppas/default/test_foreign_table.json @@ -55,7 +55,7 @@ "option":"table_name", "value":"test_table" }], - "acl":[{ + "relacl":[{ "grantee":"PUBLIC", "grantor":"enterprisedb", "privileges":[{ @@ -153,7 +153,7 @@ "sql_endpoint": "NODE-foreign_table.sql_id", "msql_endpoint": "NODE-foreign_table.msql_id", "data": { - "acl":{ + "relacl":{ "added": [{ "grantee":"PUBLIC", "grantor":"enterprisedb", @@ -205,7 +205,7 @@ "sql_endpoint": "NODE-foreign_table.sql_id", "msql_endpoint": "NODE-foreign_table.msql_id", "data": { - "acl":{ + "relacl":{ "deleted": [{ "grantee":"PUBLIC", "grantor":"enterprisedb", diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/11_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/11_plus/update.sql deleted file mode 100644 index 5daef3a8be7..00000000000 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/11_plus/update.sql +++ /dev/null @@ -1,122 +0,0 @@ -{% import 'macros/functions/security.macros' as SECLABEL %} -{% import 'macros/functions/privilege.macros' as PRIVILEGE %} -{% import 'macros/functions/variable.macros' as VARIABLE %}{% if data %} -{% set name = o_data.name %} -{% set exclude_quoting = ['search_path'] %} -{% if data.name %} -{% if data.name != o_data.name %} -ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{ -o_data.proargtypenames }}) - RENAME TO {{ conn|qtIdent(data.name) }}; -{% set name = data.name %} -{% endif %} -{% endif -%} -{% if data.change_func %} - -CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if data.arguments %} -{% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname) }} {% endif %}{% if p.argtype %}{{ p.argtype }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %} -{% if not loop.last %},{% endif %} -{% endfor %} -{% endif -%} -) - RETURNS {% if 'prorettypename' in data %}{{ data.prorettypename }}{% else %}{{ o_data.prorettypename }}{% endif %} - -{% if 'lanname' in data %} - LANGUAGE {{ data.lanname|qtLiteral(conn) }} {% else %} - LANGUAGE {{ o_data.lanname|qtLiteral(conn) }} - {% endif %}{% if 'provolatile' in data and data.provolatile %}{{ data.provolatile }} {% elif 'provolatile' not in data and o_data.provolatile %}{{ o_data.provolatile }}{% endif %} -{% if ('proleakproof' in data and data.proleakproof) or ('proleakproof' not in data and o_data.proleakproof) %} LEAKPROOF{% elif 'proleakproof' in data and not data.proleakproof %} NOT LEAKPROOF{% endif %} -{% if ('proisstrict' in data and data.proisstrict) or ('proisstrict' not in data and o_data.proisstrict) %} STRICT{% endif %} -{% if ('prosecdef' in data and data.prosecdef) or ('prosecdef' not in data and o_data.prosecdef) %} SECURITY DEFINER{% endif %} -{% if ('proiswindow' in data and data.proiswindow) or ('proiswindow' not in data and o_data.proiswindow) %} WINDOW{% endif %} - - {% if 'proparallel' in data and data.proparallel %}PARALLEL {{ data.proparallel }}{% elif 'proparallel' not in data and o_data.proparallel %}PARALLEL {{ o_data.proparallel }}{% endif %} - - {% if data.procost %}COST {{data.procost}}{% elif o_data.procost %}COST {{o_data.procost}}{% endif %}{% if data.prorows and data.prorows != '0'%} - - ROWS {{data.prorows}}{% elif data.prorows is not defined and o_data.prorows and o_data.prorows != '0' %} ROWS {{o_data.prorows}} {%endif -%}{% if data.merged_variables %}{% for v in data.merged_variables %} - - SET {{ conn|qtIdent(v.name) }}={% if v.name in exclude_quoting %}{{ v.value }}{% else %}{{ v.value|qtLiteral(conn) }}{% endif %}{% endfor -%} - {% endif %} - -AS {% if (data.lanname == 'c' or o_data.lanname == 'c') and ('probin' in data or 'prosrc_c' in data) %} -{% if 'probin' in data %}{{ data.probin|qtLiteral(conn) }}{% else %}{{ o_data.probin|qtLiteral(conn) }}{% endif %}, {% if 'prosrc_c' in data %}{{ data.prosrc_c|qtLiteral(conn) }}{% else %}{{ o_data.prosrc_c|qtLiteral(conn) }}{% endif %}{% elif 'prosrc' in data %} -$BODY${{ data.prosrc }}$BODY${% elif o_data.lanname == 'c' %} -{{ o_data.probin|qtLiteral(conn) }}, {{ o_data.prosrc_c|qtLiteral(conn) }}{% else %} -$BODY${{ o_data.prosrc }}$BODY${% endif -%}; -{% endif -%} -{% if data.funcowner %} - -ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{o_data.proargtypenames }}) - OWNER TO {{ conn|qtIdent(data.funcowner) }}; -{% endif -%} -{# The SQL generated below will change priviledges #} -{% if data.acl %} -{% if 'deleted' in data.acl %} -{% for priv in data.acl.deleted %} - -{{ PRIVILEGE.UNSETALL(conn, 'FUNCTION', priv.grantee, name, o_data.pronamespace, o_data.proargtypenames) }} -{% endfor %} -{% endif -%} -{% if 'changed' in data.acl %} -{% for priv in data.acl.changed %} - -{% if priv.grantee != priv.old_grantee %} -{{ PRIVILEGE.UNSETALL(conn, 'FUNCTION', priv.old_grantee, name, o_data.pronamespace, o_data.proargtypenames) }} -{% else %} -{{ PRIVILEGE.UNSETALL(conn, 'FUNCTION', priv.grantee, name, o_data.pronamespace, o_data.proargtypenames) }} -{% endif %} - -{{ PRIVILEGE.SET(conn, 'FUNCTION', priv.grantee, name, priv.without_grant, priv.with_grant, o_data.pronamespace, o_data.proargtypenames) }} -{% endfor %} -{% endif -%} -{% if 'added' in data.acl %} -{% for priv in data.acl.added %} - -{{ PRIVILEGE.SET(conn, 'FUNCTION', priv.grantee, name, priv.without_grant, priv.with_grant, o_data.pronamespace, o_data.proargtypenames) }} -{% endfor %}{% endif -%} -{% endif -%} -{% if data.change_func == False %} -{% if data.variables %} -{% if 'deleted' in data.variables and data.variables.deleted|length > 0 %} - -{{ VARIABLE.UNSET(conn, 'FUNCTION', name, data.variables.deleted, o_data.pronamespace, o_data.proargtypenames) }} -{% endif -%} -{% if 'merged_variables' in data and data.merged_variables|length > 0 %} - -{{ VARIABLE.SET(conn, 'FUNCTION', name, data.merged_variables, o_data.pronamespace, o_data.proargtypenames) }} -{% endif -%} -{% endif -%} -{% endif -%} -{% set seclabels = data.seclabels %} -{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %} -{% for r in seclabels.deleted %} - -{{ SECLABEL.UNSET(conn, 'FUNCTION', name, r.provider, o_data.pronamespace, o_data.proargtypenames) }} -{% endfor %} -{% endif -%} -{% if 'added' in seclabels and seclabels.added|length > 0 %} -{% for r in seclabels.added %} - -{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }} -{% endfor %} -{% endif -%} -{% if 'changed' in seclabels and seclabels.changed|length > 0 %} -{% for r in seclabels.changed %} - -{{ SECLABEL.SET(conn, 'FUNCTION', name, r.provider, r.label, o_data.pronamespace, o_data.proargtypenames) }} -{% endfor %} -{% endif -%} -{% if data.description is defined and data.description != o_data.description%} - -COMMENT ON FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{o_data.proargtypenames }}) - IS {{ data.description|qtLiteral(conn) }}; -{% endif -%} - -{% if data.pronamespace %} - -ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({{o_data.proargtypenames }}) - SET SCHEMA {{ conn|qtIdent(data.pronamespace) }}; -{% endif -%} - -{% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/12_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/12_plus/update.sql index 5e41fdaf035..73f7cdb7f36 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/12_plus/update.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/12_plus/update.sql @@ -3,6 +3,12 @@ {% import 'macros/functions/variable.macros' as VARIABLE %}{% if data %} {% set name = o_data.name %} {% set exclude_quoting = ['search_path'] %} +{% set set_variables = [] %} +{% if 'merged_variables' in data and data.merged_variables|length > 0 %} +{% set set_variables = data.merged_variables %} +{% elif 'variables' in o_data and o_data.variables|length > 0 %} +{% set set_variables = o_data.variables %} +{% endif %} {% if data.name %} {% if data.name != o_data.name %} ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{ @@ -36,7 +42,7 @@ CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if d ROWS {{data.prorows}}{% elif data.prorows is not defined and o_data.prorows and o_data.prorows != '0' %} ROWS {{o_data.prorows}} {%endif %} - {% if data.prosupportfunc %}SUPPORT {{ data.prosupportfunc }}{% elif data.prosupportfunc is not defined and o_data.prosupportfunc %}SUPPORT {{ o_data.prosupportfunc }}{% endif -%}{% if data.merged_variables %}{% for v in data.merged_variables %} + {% if data.prosupportfunc %}SUPPORT {{ data.prosupportfunc }}{% elif data.prosupportfunc is not defined and o_data.prosupportfunc %}SUPPORT {{ o_data.prosupportfunc }}{% endif -%}{% if set_variables and set_variables|length > 0 %}{% for v in set_variables %} SET {{ conn|qtIdent(v.name) }}={% if v.name in exclude_quoting %}{{ v.value }}{% else %}{{ v.value|qtLiteral(conn) }}{% endif %}{% endfor -%} {% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/14_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/14_plus/update.sql index 24d65f066e7..a3d3f24a3c4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/14_plus/update.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/14_plus/update.sql @@ -3,6 +3,12 @@ {% import 'macros/functions/variable.macros' as VARIABLE %}{% if data %} {% set name = o_data.name %} {% set exclude_quoting = ['search_path'] %} +{% set set_variables = [] %} +{% if 'merged_variables' in data and data.merged_variables|length > 0 %} +{% set set_variables = data.merged_variables %} +{% elif 'variables' in o_data and o_data.variables|length > 0 %} +{% set set_variables = o_data.variables %} +{% endif %} {% if data.name %} {% if data.name != o_data.name %} ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{ @@ -36,7 +42,7 @@ CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if d ROWS {{data.prorows}}{% elif data.prorows is not defined and o_data.prorows and o_data.prorows != '0' %} ROWS {{o_data.prorows}} {%endif %} - {% if data.prosupportfunc %}SUPPORT {{ data.prosupportfunc }}{% elif data.prosupportfunc is not defined and o_data.prosupportfunc %}SUPPORT {{ o_data.prosupportfunc }}{% endif -%}{% if data.merged_variables %}{% for v in data.merged_variables %} + {% if data.prosupportfunc %}SUPPORT {{ data.prosupportfunc }}{% elif data.prosupportfunc is not defined and o_data.prosupportfunc %}SUPPORT {{ o_data.prosupportfunc }}{% endif -%}{% if set_variables and set_variables|length > 0 %}{% for v in set_variables %} SET {{ conn|qtIdent(v.name) }}={% if v.name in exclude_quoting %}{{ v.value }}{% else %}{{ v.value|qtLiteral(conn) }}{% endif %}{% endfor -%} {% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/default/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/default/update.sql index ccd5ffa8acf..e624d5f52e8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/default/update.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/default/update.sql @@ -3,6 +3,12 @@ {% import 'macros/functions/variable.macros' as VARIABLE %}{% if data %} {% set name = o_data.name %} {% set exclude_quoting = ['search_path'] %} +{% set set_variables = [] %} +{% if 'merged_variables' in data and data.merged_variables|length > 0 %} +{% set set_variables = data.merged_variables %} +{% elif 'variables' in o_data and o_data.variables|length > 0 %} +{% set set_variables = o_data.variables %} +{% endif %} {% if data.name %} {% if data.name != o_data.name %} ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{ @@ -34,7 +40,7 @@ CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if d {% if data.procost %}COST {{data.procost}}{% elif o_data.procost %}COST {{o_data.procost}}{% endif %}{% if data.prorows and data.prorows != '0' %} - ROWS {{data.prorows}}{% elif data.prorows is not defined and o_data.prorows and o_data.prorows != '0' %} ROWS {{o_data.prorows}} {%endif -%}{% if data.merged_variables %}{% for v in data.merged_variables %} + ROWS {{data.prorows}}{% elif data.prorows is not defined and o_data.prorows and o_data.prorows != '0' %} ROWS {{o_data.prorows}} {%endif -%}{% if set_variables and set_variables|length > 0 %}{% for v in set_variables %} SET {{ conn|qtIdent(v.name) }}={% if v.name in exclude_quoting %}{{ v.value }}{% else %}{{ v.value|qtLiteral(conn) }}{% endif %}{% endfor -%} {% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/12_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/12_plus/update.sql index 5e41fdaf035..73f7cdb7f36 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/12_plus/update.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/12_plus/update.sql @@ -3,6 +3,12 @@ {% import 'macros/functions/variable.macros' as VARIABLE %}{% if data %} {% set name = o_data.name %} {% set exclude_quoting = ['search_path'] %} +{% set set_variables = [] %} +{% if 'merged_variables' in data and data.merged_variables|length > 0 %} +{% set set_variables = data.merged_variables %} +{% elif 'variables' in o_data and o_data.variables|length > 0 %} +{% set set_variables = o_data.variables %} +{% endif %} {% if data.name %} {% if data.name != o_data.name %} ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{ @@ -36,7 +42,7 @@ CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if d ROWS {{data.prorows}}{% elif data.prorows is not defined and o_data.prorows and o_data.prorows != '0' %} ROWS {{o_data.prorows}} {%endif %} - {% if data.prosupportfunc %}SUPPORT {{ data.prosupportfunc }}{% elif data.prosupportfunc is not defined and o_data.prosupportfunc %}SUPPORT {{ o_data.prosupportfunc }}{% endif -%}{% if data.merged_variables %}{% for v in data.merged_variables %} + {% if data.prosupportfunc %}SUPPORT {{ data.prosupportfunc }}{% elif data.prosupportfunc is not defined and o_data.prosupportfunc %}SUPPORT {{ o_data.prosupportfunc }}{% endif -%}{% if set_variables and set_variables|length > 0 %}{% for v in set_variables %} SET {{ conn|qtIdent(v.name) }}={% if v.name in exclude_quoting %}{{ v.value }}{% else %}{{ v.value|qtLiteral(conn) }}{% endif %}{% endfor -%} {% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/14_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/14_plus/update.sql index 24d65f066e7..a3d3f24a3c4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/14_plus/update.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/14_plus/update.sql @@ -3,6 +3,12 @@ {% import 'macros/functions/variable.macros' as VARIABLE %}{% if data %} {% set name = o_data.name %} {% set exclude_quoting = ['search_path'] %} +{% set set_variables = [] %} +{% if 'merged_variables' in data and data.merged_variables|length > 0 %} +{% set set_variables = data.merged_variables %} +{% elif 'variables' in o_data and o_data.variables|length > 0 %} +{% set set_variables = o_data.variables %} +{% endif %} {% if data.name %} {% if data.name != o_data.name %} ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{ @@ -36,7 +42,7 @@ CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if d ROWS {{data.prorows}}{% elif data.prorows is not defined and o_data.prorows and o_data.prorows != '0' %} ROWS {{o_data.prorows}} {%endif %} - {% if data.prosupportfunc %}SUPPORT {{ data.prosupportfunc }}{% elif data.prosupportfunc is not defined and o_data.prosupportfunc %}SUPPORT {{ o_data.prosupportfunc }}{% endif -%}{% if data.merged_variables %}{% for v in data.merged_variables %} + {% if data.prosupportfunc %}SUPPORT {{ data.prosupportfunc }}{% elif data.prosupportfunc is not defined and o_data.prosupportfunc %}SUPPORT {{ o_data.prosupportfunc }}{% endif -%}{% if set_variables and set_variables|length > 0 %}{% for v in set_variables %} SET {{ conn|qtIdent(v.name) }}={% if v.name in exclude_quoting %}{{ v.value }}{% else %}{{ v.value|qtLiteral(conn) }}{% endif %}{% endfor -%} {% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/default/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/default/update.sql index ccd5ffa8acf..e624d5f52e8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/default/update.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/default/update.sql @@ -3,6 +3,12 @@ {% import 'macros/functions/variable.macros' as VARIABLE %}{% if data %} {% set name = o_data.name %} {% set exclude_quoting = ['search_path'] %} +{% set set_variables = [] %} +{% if 'merged_variables' in data and data.merged_variables|length > 0 %} +{% set set_variables = data.merged_variables %} +{% elif 'variables' in o_data and o_data.variables|length > 0 %} +{% set set_variables = o_data.variables %} +{% endif %} {% if data.name %} {% if data.name != o_data.name %} ALTER FUNCTION {{ conn|qtIdent(o_data.pronamespace, o_data.name) }}({{ @@ -34,7 +40,7 @@ CREATE OR REPLACE FUNCTION {{ conn|qtIdent(o_data.pronamespace, name) }}({% if d {% if data.procost %}COST {{data.procost}}{% elif o_data.procost %}COST {{o_data.procost}}{% endif %}{% if data.prorows and data.prorows != '0' %} - ROWS {{data.prorows}}{% elif data.prorows is not defined and o_data.prorows and o_data.prorows != '0' %} ROWS {{o_data.prorows}} {%endif -%}{% if data.merged_variables %}{% for v in data.merged_variables %} + ROWS {{data.prorows}}{% elif data.prorows is not defined and o_data.prorows and o_data.prorows != '0' %} ROWS {{o_data.prorows}} {%endif -%}{% if set_variables and set_variables|length > 0 %}{% for v in set_variables %} SET {{ conn|qtIdent(v.name) }}={% if v.name in exclude_quoting %}{{ v.value }}{% else %}{{ v.value|qtLiteral(conn) }}{% endif %}{% endfor -%} {% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/schema_diff_utils.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/schema_diff_utils.py index abe02d083e5..df4ab6b0a93 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/schema_diff_utils.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/schema_diff_utils.py @@ -57,6 +57,8 @@ def compare(self, **kwargs): 'scid': kwargs.get('target_scid')} ignore_owner = kwargs.get('ignore_owner') ignore_whitespaces = kwargs.get('ignore_whitespaces') + ignore_tablespace = kwargs.get('ignore_tablespace') + ignore_grants = kwargs.get('ignore_grants') group_name = kwargs.get('group_name') source_schema_name = kwargs.get('source_schema_name', None) @@ -90,7 +92,9 @@ def compare(self, **kwargs): ignore_keys=self.keys_to_ignore, source_schema_name=source_schema_name, ignore_owner=ignore_owner, - ignore_whitespaces=ignore_whitespaces) + ignore_whitespaces=ignore_whitespaces, + ignore_tablespace=ignore_tablespace, + ignore_grants=ignore_grants) def ddl_compare(self, **kwargs): """ diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/types/ppas/sql/default/type_schema_diff.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/types/ppas/sql/default/type_schema_diff.sql new file mode 100644 index 00000000000..246e3bc1d15 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/types/ppas/sql/default/type_schema_diff.sql @@ -0,0 +1,105 @@ +{% import 'macros/schemas/security.macros' as SECLABEL %} +{% import 'macros/schemas/privilege.macros' as PRIVILEGE %} +{% import 'types/macros/get_full_type_sql_format.macros' as GET_TYPE %} +-- WARNING: +-- We have found the difference in either of Type or SubType or Collation, +-- so we need to drop the existing type first and re-create it. +DROP TYPE {{ conn|qtIdent(o_data.schema, o_data.name) }} CASCADE; + +{## If user selected shell type then just create type template ##} +{% if data and data.typtype == 'p' %} +CREATE TYPE {{ conn|qtIdent(o_data.schema, o_data.name) }}; +{% endif %} +{### Composite Type ###} +{% if data and data.typtype == 'c' %} +{% if data.composite %}{% set typinput = data.typinput %}{% elif o_data.typinput %}{% set typinput = o_data.typinput %}{% endif %} +CREATE TYPE {% if o_data.schema %}{{ conn|qtIdent(o_data.schema, o_data.name) }}{% else %}{{ conn|qtIdent(o_data.name) }}{% endif %} AS +({{"\n\t"}}{% if data.composite.added %}{% for d in data.composite.added %}{% if loop.index != 1 %},{{"\n\t"}}{% endif %}{{ conn|qtIdent(d.member_name) }} {% if is_sql %}{{ d.fulltype }}{% else %}{{ GET_TYPE.CREATE_TYPE_SQL(conn, d.cltype, d.tlength, d.precision, d.hasSqrBracket) }}{% endif %}{% if d.collation %} COLLATE {{d.collation}}{% endif %}{% endfor %}{% endif %}{{"\n"}}); +{% endif %} +{### Enum Type ###} +{% if data and data.typtype == 'e' %} +CREATE TYPE {% if o_data.schema %}{{ conn|qtIdent(o_data.schema, o_data.name) }}{% else %}{{ conn|qtIdent(o_data.name) }}{% endif %} AS ENUM + ({% for e in data.enum.added %}{% if loop.index != 1 %}, {% endif %}{{ e.label|qtLiteral(conn) }}{% endfor %}); +{% endif %} +{### Range Type ###} +{% if data and (data.typtype == 'r' or (data.typtype is not defined and o_data.typtype == 'r')) %} +{% if data.typname %}{% set typname = data.typname %}{% elif o_data.typname %}{% set typname = o_data.typname %}{% endif %} +CREATE TYPE {% if o_data.schema %}{{ conn|qtIdent(o_data.schema, o_data.name) }}{% else %}{{ conn|qtIdent(o_data.name) }}{% endif %} AS RANGE +( + {% if typname %}SUBTYPE={{ conn|qtTypeIdent(typname) }}{% endif %}{% if data.collname %}, + COLLATION = {{ data.collname }}{% endif %}{% if data.opcname %}, + SUBTYPE_OPCLASS = {{ data.opcname }}{% endif %}{% if data.rngcanonical %}, + CANONICAL = {{ data.rngcanonical }}{% endif %}{% if data.rngsubdiff %}, + SUBTYPE_DIFF = {{ data.rngsubdiff }}{% endif %} + +); +{% endif %} +{### External Type ###} +{% if data and (data.typtype == 'b' or (data.typtype is not defined and o_data.typtype == 'b')) %} +{% if data.typinput %}{% set typinput = data.typinput %}{% elif o_data.typinput %}{% set typinput = o_data.typinput %}{% endif %} +{% if data.typoutput %}{% set typoutput = data.typoutput %}{% elif o_data.typoutput %}{% set typoutput = o_data.typoutput %}{% endif %} +CREATE TYPE {% if o_data.schema %}{{ conn|qtIdent(o_data.schema, o_data.name) }}{% else %}{{ conn|qtIdent(o_data.name) }}{% endif %} + +( + {% if typinput %}INPUT = {{ typinput }}{% endif %}{% if typoutput %}, + OUTPUT = {{ typoutput }}{% endif %}{% if data.typreceive %}, + RECEIVE = {{data.typreceive}}{% endif %}{% if data.typsend %}, + SEND = {{data.typsend}}{% endif %}{% if data.typmodin %}, + TYPMOD_IN = {{data.typmodin}}{% endif %}{% if data.typmodout %}, + TYPMOD_OUT = {{data.typmodout}}{% endif %}{% if data.typanalyze %}, + ANALYZE = {{data.typanalyze}}{% endif %}{% if data.typlen %}, + INTERNALLENGTH = {{data.typlen}}{% endif %}{% if data.typbyval %}, + PASSEDBYVALUE{% endif %}{% if data.typalign %}, + ALIGNMENT = {{data.typalign}}{% endif %}{% if data.typstorage %}, + STORAGE = {{data.typstorage}}{% endif %}{% if data.typcategory %}, + CATEGORY = {{data.typcategory|qtLiteral(conn)}}{% endif %}{% if data.typispreferred %}, + PREFERRED = {{data.typispreferred}}{% endif %}{% if data.typdefault %}, + DEFAULT = {{data.typdefault|qtLiteral(conn)}}{% endif %}{% if data.element %}, + ELEMENT = {{data.element}}{% endif %}{% if data.typdelim %}, + DELIMITER = {{data.typdelim|qtLiteral(conn)}}{% endif %}{% if data.is_collatable %}, + COLLATABLE = {{data.is_collatable}}{% endif %} + +); +{% endif %} +{### Type Owner ###} +{% if data and (data.typeowner or o_data.typeowner)%} + +ALTER TYPE {% if o_data.schema %}{{ conn|qtIdent(o_data.schema, o_data.name) }}{% else %}{{ conn|qtIdent(o_data.name) }}{% endif %} + + OWNER TO {% if data.typeowner %}{{ conn|qtIdent(data.typeowner) }}{% elif o_data.typeowner %}{{ conn|qtIdent(o_data.typeowner) }}{% endif %}; +{% endif %} +{### Type Comments ###} +{% if data and data.description %} + +COMMENT ON TYPE {% if o_data.schema %}{{ conn|qtIdent(o_data.schema, o_data.name) }}{% else %}{{ conn|qtIdent(o_data.name) }}{% endif %} + + IS {{data.description|qtLiteral(conn)}}; +{% endif %} +{### ACL ###} +{% if data.typacl and data.typacl|length > 0 %} +{% if 'deleted' in data.typacl %} +{% for priv in data.typacl.deleted %} +{{ PRIVILEGE.UNSETALL(conn, 'TYPE', priv.grantee, o_data.name, o_data.schema) }} +{% endfor %} +{% endif %} +{% if 'changed' in data.typacl %} +{% for priv in data.typacl.changed %} +{{ PRIVILEGE.UNSETALL(conn, 'TYPE', priv.grantee, o_data.name, o_data.schema) }} +{{ PRIVILEGE.SET(conn, 'TYPE', priv.grantee, o_data.name, priv.without_grant, priv.with_grant, o_data.schema) }} +{% endfor %} +{% endif %} +{% if 'added' in data.typacl %} +{% for priv in data.typacl.added %} +{{ PRIVILEGE.SET(conn, 'TYPE', priv.grantee, o_data.name, priv.without_grant, priv.with_grant, o_data.schema) }} +{% endfor %} +{% endif %} +{% endif %} +{### Security Lables ###} +{% if data.seclabels %} + +{% for r in data.seclabels %} +{% if r.provider and r.label %} +{{ SECLABEL.SET(conn, 'TYPE', o_data.name, r.provider, r.label, o_data.schema) }} +{% endif %} +{% endfor %} +{% endif %} diff --git a/web/pgadmin/tools/schema_diff/__init__.py b/web/pgadmin/tools/schema_diff/__init__.py index 327f421351e..3ce36c258e4 100644 --- a/web/pgadmin/tools/schema_diff/__init__.py +++ b/web/pgadmin/tools/schema_diff/__init__.py @@ -73,7 +73,7 @@ def register_preferences(self): self.preference.register( 'display', 'ignore_whitespaces', - gettext("Ignore whitespace"), 'boolean', False, + gettext("Ignore Whitespace"), 'boolean', False, category_label=PREF_LABEL_DISPLAY, help_str=gettext('Set ignore whitespace on or off by default in ' 'the drop-down menu near the Compare button in ' @@ -82,13 +82,31 @@ def register_preferences(self): self.preference.register( 'display', 'ignore_owner', - gettext("Ignore owner"), 'boolean', False, + gettext("Ignore Owner"), 'boolean', False, category_label=PREF_LABEL_DISPLAY, help_str=gettext('Set ignore owner on or off by default in the ' 'drop-down menu near the Compare button in the ' 'Schema Diff tab.') ) + self.preference.register( + 'display', 'ignore_tablespace', + gettext("Ignore Tablespace"), 'boolean', False, + category_label=PREF_LABEL_DISPLAY, + help_str=gettext('Set ignore tablespace on or off by default in ' + 'the drop-down menu near the Compare button in ' + 'the Schema Diff tab.') + ) + + self.preference.register( + 'display', 'ignore_grants', + gettext("Ignore Grants/Revoke"), 'boolean', False, + category_label=PREF_LABEL_DISPLAY, + help_str=gettext('Set ignore grants/revoke on or off by default ' + 'in the drop-down menu near the Compare button ' + 'in the Schema Diff tab.') + ) + blueprint = SchemaDiffModule(MODULE_NAME, __name__, static_url_path='/static') @@ -462,6 +480,8 @@ def compare_database(params): try: ignore_owner = bool(params['ignore_owner']) ignore_whitespaces = bool(params['ignore_whitespaces']) + ignore_tablespace = bool(params['ignore_tablespace']) + ignore_grants = bool(params['ignore_grants']) # Fetch all the schemas of source and target database # Compare them and get the status. @@ -476,7 +496,7 @@ def compare_database(params): node_percent = 0 if total_schema > 0: node_percent = round(100 / (total_schema * len( - SchemaDiffRegistry.get_registered_nodes()))) + SchemaDiffRegistry.get_registered_nodes())), 2) total_percent = 0 # Compare Database objects @@ -489,7 +509,9 @@ def compare_database(params): target_did=params['target_did'], diff_model_obj=diff_model_obj, total_percent=total_percent, node_percent=node_percent, ignore_owner=ignore_owner, - ignore_whitespaces=ignore_whitespaces) + ignore_whitespaces=ignore_whitespaces, + ignore_tablespace=ignore_tablespace, + ignore_grants=ignore_grants) comparison_result = \ comparison_result + comparison_schema_result @@ -511,7 +533,9 @@ def compare_database(params): node_percent=node_percent, is_schema_source_only=True, ignore_owner=ignore_owner, - ignore_whitespaces=ignore_whitespaces) + ignore_whitespaces=ignore_whitespaces, + ignore_tablespace=ignore_tablespace, + ignore_grants=ignore_grants) comparison_result = \ comparison_result + comparison_schema_result @@ -532,7 +556,9 @@ def compare_database(params): total_percent=total_percent, node_percent=node_percent, ignore_owner=ignore_owner, - ignore_whitespaces=ignore_whitespaces) + ignore_whitespaces=ignore_whitespaces, + ignore_tablespace=ignore_tablespace, + ignore_grants=ignore_grants) comparison_result = \ comparison_result + comparison_schema_result @@ -555,7 +581,9 @@ def compare_database(params): total_percent=total_percent, node_percent=node_percent, ignore_owner=ignore_owner, - ignore_whitespaces=ignore_whitespaces) + ignore_whitespaces=ignore_whitespaces, + ignore_tablespace=ignore_tablespace, + ignore_grants=ignore_grants) comparison_result = \ comparison_result + comparison_schema_result @@ -597,8 +625,10 @@ def compare_schema(params): try: ignore_owner = bool(params['ignore_owner']) ignore_whitespaces = bool(params['ignore_whitespaces']) + ignore_tablespace = bool(params['ignore_tablespace']) + ignore_grants = bool(params['ignore_grants']) all_registered_nodes = SchemaDiffRegistry.get_registered_nodes() - node_percent = round(100 / len(all_registered_nodes)) + node_percent = round(100 / len(all_registered_nodes), 2) total_percent = 0 comparison_schema_result, total_percent = \ @@ -615,7 +645,9 @@ def compare_schema(params): total_percent=total_percent, node_percent=node_percent, ignore_owner=ignore_owner, - ignore_whitespaces=ignore_whitespaces) + ignore_whitespaces=ignore_whitespaces, + ignore_tablespace=ignore_tablespace, + ignore_grants=ignore_grants) comparison_result = \ comparison_result + comparison_schema_result @@ -749,6 +781,8 @@ def compare_database_objects(**kwargs): node_percent = kwargs.get('node_percent') ignore_owner = kwargs.get('ignore_owner') ignore_whitespaces = kwargs.get('ignore_whitespaces') + ignore_tablespace = kwargs.get('ignore_tablespace') + ignore_grants = kwargs.get('ignore_grants') comparison_result = [] all_registered_nodes = SchemaDiffRegistry.get_registered_nodes(None, @@ -772,7 +806,9 @@ def compare_database_objects(**kwargs): target_did=target_did, group_name=gettext('Database Objects'), ignore_owner=ignore_owner, - ignore_whitespaces=ignore_whitespaces) + ignore_whitespaces=ignore_whitespaces, + ignore_tablespace=ignore_tablespace, + ignore_grants=ignore_grants) if res is not None: comparison_result = comparison_result + res @@ -803,6 +839,8 @@ def compare_schema_objects(**kwargs): is_schema_source_only = kwargs.get('is_schema_source_only', False) ignore_owner = kwargs.get('ignore_owner') ignore_whitespaces = kwargs.get('ignore_whitespaces') + ignore_tablespace = kwargs.get('ignore_tablespace') + ignore_grants = kwargs.get('ignore_grants') source_schema_name = None if is_schema_source_only: @@ -839,12 +877,14 @@ def compare_schema_objects(**kwargs): group_name=gettext(schema_name), source_schema_name=source_schema_name, ignore_owner=ignore_owner, - ignore_whitespaces=ignore_whitespaces) + ignore_whitespaces=ignore_whitespaces, + ignore_tablespace=ignore_tablespace, + ignore_grants=ignore_grants) if res is not None: comparison_result = comparison_result + res total_percent = total_percent + node_percent - # if total_percent is more then 100 then set it to less then 100 + # if total_percent is more than 100 then set it to less than 100 if total_percent >= 100: total_percent = 96 diff --git a/web/pgadmin/tools/schema_diff/compare.py b/web/pgadmin/tools/schema_diff/compare.py index 11568f27dbb..6668f135b56 100644 --- a/web/pgadmin/tools/schema_diff/compare.py +++ b/web/pgadmin/tools/schema_diff/compare.py @@ -59,6 +59,8 @@ def compare(self, **kwargs): 'did': kwargs.get('target_did')} ignore_owner = kwargs.get('ignore_owner', False) ignore_whitespaces = kwargs.get('ignore_whitespaces', False) + ignore_tablespace = kwargs.get('ignore_tablespace', False) + ignore_grants = kwargs.get('ignore_grants', False) group_name = kwargs.get('group_name') source_schema_name = kwargs.get('source_schema_name', None) @@ -102,7 +104,9 @@ def compare(self, **kwargs): ignore_keys=self.keys_to_ignore, source_schema_name=source_schema_name, ignore_owner=ignore_owner, - ignore_whitespaces=ignore_whitespaces) + ignore_whitespaces=ignore_whitespaces, + ignore_tablespace=ignore_tablespace, + ignore_grants=ignore_grants) def ddl_compare(self, **kwargs): """ diff --git a/web/pgadmin/tools/schema_diff/directory_compare.py b/web/pgadmin/tools/schema_diff/directory_compare.py index a216a9d910a..bd8ffc3e3f3 100644 --- a/web/pgadmin/tools/schema_diff/directory_compare.py +++ b/web/pgadmin/tools/schema_diff/directory_compare.py @@ -253,6 +253,8 @@ def _get_identical_and_different_list(intersect_keys, source_dict, target_dict, group_name = kwargs['group_name'] target_schema = kwargs.get('target_schema') ignore_whitespaces = kwargs.get('ignore_whitespaces') + ignore_grants = kwargs.get('ignore_grants', False) + for key in intersect_keys: source_object_id, target_object_id = \ get_source_target_oid(source_dict, target_dict, key) @@ -299,7 +301,10 @@ def _get_identical_and_different_list(intersect_keys, source_dict, target_dict, ignore_keys=temp_ignore_keys, difference={} ) - parse_acl(dict1[key], dict2[key], diff_dict) + + # No need to parse acl if ignore_grants is set to True. + if not ignore_grants: + parse_acl(dict1[key], dict2[key], diff_dict) temp_src_params['tid'] = source_object_id temp_tgt_params['tid'] = target_object_id @@ -326,7 +331,10 @@ def _get_identical_and_different_list(intersect_keys, source_dict, target_dict, dict1[key], dict2[key], ignore_keys=view_object.keys_to_ignore, difference={} ) - parse_acl(dict1[key], dict2[key], diff_dict) + + # No need to parse acl if ignore_grants is set to True. + if not ignore_grants: + parse_acl(dict1[key], dict2[key], diff_dict) temp_src_params['oid'] = source_object_id temp_tgt_params['oid'] = target_object_id @@ -387,6 +395,8 @@ def compare_dictionaries(**kwargs): source_schema_name = kwargs.get('source_schema_name') ignore_owner = kwargs.get('ignore_owner') ignore_whitespaces = kwargs.get('ignore_whitespaces') + ignore_tablespace = kwargs.get('ignore_tablespace') + ignore_grants = kwargs.get('ignore_grants') dict1 = copy.deepcopy(source_dict) dict2 = copy.deepcopy(target_dict) @@ -421,10 +431,22 @@ def compare_dictionaries(**kwargs): # ignore keys. if ignore_owner: owner_keys = ['owner', 'eventowner', 'funcowner', 'fdwowner', - 'fsrvowner', 'lanowner', 'relowner', 'relacl', 'acl', - 'seqowner', 'typeowner'] + 'fsrvowner', 'lanowner', 'relowner', 'seqowner', + 'typeowner'] ignore_keys = ignore_keys + owner_keys + # if ignore_tablespace is True then add all the possible tablespace keys + # to the ignore keys. + if ignore_tablespace: + tablespace_keys = ['spcname', 'spcoid'] + ignore_keys = ignore_keys + tablespace_keys + + # if ignore_grants is True then add all the possible grants keys + # to the ignore keys. + if ignore_grants: + grant_keys = ['relacl', 'acl', 'datacl', 'fdwacl', 'lanacl', 'fsrvacl'] + ignore_keys = ignore_keys + grant_keys + # Compare the values of duplicates keys. other_param = { "dict1": dict1, @@ -434,7 +456,8 @@ def compare_dictionaries(**kwargs): "target_params": target_params, "group_name": group_name, "target_schema": target_schema, - "ignore_whitespaces": ignore_whitespaces + "ignore_whitespaces": ignore_whitespaces, + "ignore_grants": ignore_grants } identical, different = _get_identical_and_different_list( @@ -486,11 +509,12 @@ def are_dictionaries_identical(source_dict, target_dict, ignore_keys, """ src_keys = set(source_dict.keys()) tar_keys = set(target_dict.keys()) + igr_keys = set(ignore_keys) # Keys that are available in source and missing in target. - src_only = src_keys - tar_keys + src_only = (src_keys - igr_keys) - tar_keys # Keys that are available in target and missing in source. - tar_only = tar_keys - src_keys + tar_only = (tar_keys - igr_keys) - src_keys # If number of keys are different in source and target then # return False @@ -590,11 +614,12 @@ def directory_diff(source_dict, target_dict, ignore_keys=[], difference=None): difference = {} if difference is None else difference src_keys = set(source_dict.keys()) tar_keys = set(target_dict.keys()) + igr_keys = set(ignore_keys) # Keys that are available in source and missing in target. - src_only = src_keys - tar_keys + src_only = (src_keys - igr_keys) - tar_keys # Keys that are available in target and missing in source. - tar_only = tar_keys - src_keys + tar_only = (tar_keys - igr_keys) - src_keys for key in source_dict.keys(): added = [] diff --git a/web/pgadmin/tools/schema_diff/static/js/SchemaDiffConstants.js b/web/pgadmin/tools/schema_diff/static/js/SchemaDiffConstants.js index a807ec907d3..82b2369b59d 100644 --- a/web/pgadmin/tools/schema_diff/static/js/SchemaDiffConstants.js +++ b/web/pgadmin/tools/schema_diff/static/js/SchemaDiffConstants.js @@ -34,7 +34,9 @@ export const STYLE_CONSTANT = { export const MENUS_COMPARE_CONSTANT = { COMPARE_IGNORE_OWNER: 1, - COMPARE_IGNORE_WHITESPACE: 2 + COMPARE_IGNORE_WHITESPACE: 2, + COMPARE_IGNORE_TABLESPACE: 3, + COMPARE_IGNORE_GRANTS: 4 }; export const MENUS_FILTER_CONSTANT = { @@ -63,3 +65,10 @@ export const FILTER_NAME = { SOURCE_ONLY: gettext('Source Only'), TARGET_ONLY: gettext('Target Only') }; + +export const IGNORE_OPTION = { + OWNER : gettext('Ignore Owner'), + WHITESPACE : gettext('Ignore Whitespace'), + TABLESPACE: gettext('Ignore Tablespace'), + GRANTS: gettext('Ignore Grant/Revoke') +}; diff --git a/web/pgadmin/tools/schema_diff/static/js/components/ResultGridComponent.jsx b/web/pgadmin/tools/schema_diff/static/js/components/ResultGridComponent.jsx index ca07bc146d6..ff512f6c7d3 100644 --- a/web/pgadmin/tools/schema_diff/static/js/components/ResultGridComponent.jsx +++ b/web/pgadmin/tools/schema_diff/static/js/components/ResultGridComponent.jsx @@ -371,13 +371,17 @@ function prepareRows(rows, gridData, filterParams) { let adedIds = []; gridData.map((record) => { - let childrens = getChildrenRows(record); - - if (childrens.length > 0) { - childrens.map((child) => { - let subChildrens = getChildrenRows(child); + let children = getChildrenRows(record); + // Sort the children using label + children.sort((a, b) => (a.label > b.label) ? 1 : -1); + + if (children.length > 0) { + children.map((child) => { + let subChildren = getChildrenRows(child); + // Sort the sub children using label + subChildren.sort((a, b) => (a.label > b.label) ? 1 : -1); let tempChildList = []; - subChildrens.map((subChild) => { + subChildren.map((subChild) => { if (filterParams.includes(subChild.status)) { tempChildList.push(subChild); adedIds.push(subChild.id); diff --git a/web/pgadmin/tools/schema_diff/static/js/components/SchemaDiffButtonComponent.jsx b/web/pgadmin/tools/schema_diff/static/js/components/SchemaDiffButtonComponent.jsx index 8e7eaf8c1f4..cd396668fc6 100644 --- a/web/pgadmin/tools/schema_diff/static/js/components/SchemaDiffButtonComponent.jsx +++ b/web/pgadmin/tools/schema_diff/static/js/components/SchemaDiffButtonComponent.jsx @@ -17,13 +17,12 @@ import { Box } from '@material-ui/core'; import CompareArrowsRoundedIcon from '@material-ui/icons/CompareArrowsRounded'; import FeaturedPlayListRoundedIcon from '@material-ui/icons/FeaturedPlayListRounded'; import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown'; -import CheckRoundedIcon from '@material-ui/icons/CheckRounded'; import { makeStyles } from '@material-ui/styles'; import { DefaultButton, PgButtonGroup, PgIconButton, PrimaryButton } from '../../../../../static/js/components/Buttons'; import { FilterIcon } from '../../../../../static/js/components/ExternalIcon'; import { PgMenu, PgMenuItem, usePgMenuGroup } from '../../../../../static/js/components/Menu'; -import { FILTER_NAME, MENUS, MENUS_COMPARE_CONSTANT, SCHEMA_DIFF_EVENT } from '../SchemaDiffConstants'; +import { FILTER_NAME, MENUS, MENUS_COMPARE_CONSTANT, SCHEMA_DIFF_EVENT, IGNORE_OPTION } from '../SchemaDiffConstants'; import { SchemaDiffContext, SchemaDiffEventsContext } from './SchemaDiffComponent'; @@ -85,7 +84,11 @@ export function SchemaDiffButtonComponent({ sourceData, targetData, selectedRowI useEffect(() => { let isDisableComp = true; if (sourceData.sid != null && sourceData.did != null && targetData.sid != null && targetData.did != null) { - isDisableComp = false; + if ((sourceData.scid != null && targetData.scid == null) || (sourceData.scid == null && targetData.scid != null)) { + isDisableComp = true; + } else { + isDisableComp = false; + } } setIsDisableCompare(isDisableComp); }, [sourceData, targetData]); @@ -96,10 +99,14 @@ export function SchemaDiffButtonComponent({ sourceData, targetData, selectedRowI if (!_.isUndefined(compareParams)) { compareParams.ignoreOwner && prefCompareOptions.push(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_OWNER); compareParams.ignoreWhitespaces && prefCompareOptions.push(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_WHITESPACE); + compareParams.ignoreTablespace && prefCompareOptions.push(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_TABLESPACE); + compareParams.ignoreGrants && prefCompareOptions.push(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_GRANTS); setSelectedCompare(prefCompareOptions); } else { schemaDiffCtx?.preferences_schema_diff?.ignore_owner && prefCompareOptions.push(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_OWNER); schemaDiffCtx?.preferences_schema_diff?.ignore_whitespaces && prefCompareOptions.push(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_WHITESPACE); + schemaDiffCtx?.preferences_schema_diff?.ignore_tablespace && prefCompareOptions.push(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_TABLESPACE); + schemaDiffCtx?.preferences_schema_diff?.ignore_grants && prefCompareOptions.push(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_GRANTS); setSelectedCompare(prefCompareOptions); } }, [schemaDiffCtx.preferences_schema_diff]); @@ -140,6 +147,8 @@ export function SchemaDiffButtonComponent({ sourceData, targetData, selectedRowI let compareParam = { 'ignoreOwner': selectedCompare.includes(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_OWNER) ? 1 : 0, 'ignoreWhitespaces': selectedCompare.includes(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_WHITESPACE) ? 1 : 0, + 'ignoreTablespace': selectedCompare.includes(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_TABLESPACE) ? 1 : 0, + 'ignoreGrants': selectedCompare.includes(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_GRANTS) ? 1 : 0, }; let filterParam = selectedFilters; eventBus.fireEvent(SCHEMA_DIFF_EVENT.TRIGGER_COMPARE_DIFF, { sourceData, targetData, compareParams: compareParam, filterParams: filterParam }); @@ -182,32 +191,32 @@ export function SchemaDiffButtonComponent({ sourceData, targetData, selectedRowI open={openMenuName == MENUS.COMPARE} onClose={onMenuClose} label={gettext('Compare')} + align="end" > - { selectCompareOption(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_OWNER); }}> - {selectedCompare.includes(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_OWNER) ? : }{gettext('Ignore owner')} - - { selectCompareOption(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_WHITESPACE); }}> - {selectedCompare.includes(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_WHITESPACE) ? : }{gettext('Ignore whitespace')} - + { selectCompareOption(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_OWNER); }}>{IGNORE_OPTION.OWNER} + { selectCompareOption(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_WHITESPACE); }}>{IGNORE_OPTION.WHITESPACE} + { selectCompareOption(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_TABLESPACE); }}>{IGNORE_OPTION.TABLESPACE} + { selectCompareOption(MENUS_COMPARE_CONSTANT.COMPARE_IGNORE_GRANTS); }}>{IGNORE_OPTION.GRANTS} - { selectFilterOption(FILTER_NAME.IDENTICAL); }}> - {selectedFilters.includes(FILTER_NAME.IDENTICAL) ? : } {gettext(FILTER_NAME.IDENTICAL)} - - { selectFilterOption(FILTER_NAME.DIFFERENT); }}> - {selectedFilters.includes(FILTER_NAME.DIFFERENT) ? : } {gettext(FILTER_NAME.DIFFERENT)} - - { selectFilterOption(FILTER_NAME.SOURCE_ONLY); }}> - {selectedFilters.includes(FILTER_NAME.SOURCE_ONLY) ? : } {gettext(FILTER_NAME.SOURCE_ONLY)} - - { selectFilterOption(FILTER_NAME.TARGET_ONLY); }}> - {selectedFilters.includes(FILTER_NAME.TARGET_ONLY) ? : } {gettext(FILTER_NAME.TARGET_ONLY)} - + { selectFilterOption(FILTER_NAME.IDENTICAL); }}>{FILTER_NAME.IDENTICAL} + { selectFilterOption(FILTER_NAME.DIFFERENT); }}>{FILTER_NAME.DIFFERENT} + { selectFilterOption(FILTER_NAME.SOURCE_ONLY); }}>{FILTER_NAME.SOURCE_ONLY} + { selectFilterOption(FILTER_NAME.TARGET_ONLY); }}>{FILTER_NAME.TARGET_ONLY} ); diff --git a/web/pgadmin/tools/schema_diff/static/js/components/SchemaDiffCompare.jsx b/web/pgadmin/tools/schema_diff/static/js/components/SchemaDiffCompare.jsx index 4714a03dc2c..ca8d0954226 100644 --- a/web/pgadmin/tools/schema_diff/static/js/components/SchemaDiffCompare.jsx +++ b/web/pgadmin/tools/schema_diff/static/js/components/SchemaDiffCompare.jsx @@ -256,8 +256,6 @@ export function SchemaDiffCompare({ params }) { } } - - }; const triggerSelectSchema = ({ selectedSC, diff_type }) => { @@ -272,7 +270,17 @@ export function SchemaDiffCompare({ params }) { const triggerCompareDiff = async ({ sourceData, targetData, compareParams, filterParams }) => { setGridData([]); setIsInit(false); - if (JSON.stringify(sourceData) === JSON.stringify(targetData)) { + + let raiseSelectionError = false; + if (!_.isEmpty(sourceData.scid) && !_.isEmpty(targetData.scid)) { + if (sourceData.sid === targetData.sid && sourceData.did === targetData.did && sourceData.scid === targetData.scid) { + raiseSelectionError = true; + } + } else if (sourceData.sid === targetData.sid && sourceData.did === targetData.did) { + raiseSelectionError = true; + } + + if (raiseSelectionError) { Notifier.alert(gettext('Selection Error'), gettext('Please select the different source and target.')); } else { @@ -285,6 +293,8 @@ export function SchemaDiffCompare({ params }) { 'target_did': targetData['did'], 'ignore_owner': compareParams['ignoreOwner'], 'ignore_whitespaces': compareParams['ignoreWhitespaces'], + 'ignore_tablespace': compareParams['ignoreTablespace'], + 'ignore_grants': compareParams['ignoreGrants'], }; let socketEndpoint = 'compare_database'; if (sourceData['scid'] != null && targetData['scid'] != null) { @@ -299,7 +309,7 @@ export function SchemaDiffCompare({ params }) { socket = await openSocket('/schema_diff'); socket.on('compare_status', res=>{ let msg = res.compare_msg; - msg = msg + gettext(` (this may take a few minutes)... ${res.diff_percentage} %`); + msg = msg + gettext(` (this may take a few minutes)... ${Math.round(res.diff_percentage)} %`); setLoaderText(msg); }); resData = await socketApiGet(socket, socketEndpoint, url_params); diff --git a/web/pgadmin/tools/schema_diff/tests/pg/10_plus/source.sql b/web/pgadmin/tools/schema_diff/tests/pg/10_plus/source.sql deleted file mode 100644 index 9b54fe88e61..00000000000 --- a/web/pgadmin/tools/schema_diff/tests/pg/10_plus/source.sql +++ /dev/null @@ -1,1160 +0,0 @@ --- --- 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, - 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.relhasoids, - pg_class.relhaspkey, - pg_class.relhasrules, - pg_class.relhastriggers, - pg_class.relhassubclass, - pg_class.relrowsecurity, - pg_class.relforcerowsecurity, - pg_class.relispopulated, - pg_class.relreplident, - pg_class.relispartition, - pg_class.relfrozenxid, - pg_class.relminmxid, - pg_class.relacl, - pg_class.reloptions, - pg_class.relpartbound - FROM pg_class - LIMIT 10; - - -ALTER TABLE test_schema_diff."test view" OWNER TO 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'; - --- 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; - --- Extension script -CREATE EXTENSION adminpack - SCHEMA pg_catalog - VERSION "1.1"; - --- Language script -CREATE TRUSTED PROCEDURAL LANGUAGE src_trusted_language - HANDLER plpgsql_call_handler - INLINE plpgsql_inline_handler - VALIDATOR plpgsql_validator; -ALTER LANGUAGE src_trusted_language - OWNER TO 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 Script -CREATE TABLE test_schema_diff.table_for_publication ( - col1 integer NOT NULL, - col2 text -); - -CREATE PUBLICATION for_all_table - FOR ALL TABLES - WITH (publish = 'insert, delete'); - -CREATE PUBLICATION with_one_table - FOR TABLE test_schema_diff.table_for_publication - WITH (publish = 'insert, delete'); - -ALTER PUBLICATION with_one_table - RENAME TO with_one_table_alter; - -ALTER PUBLICATION with_one_table_alter SET - (publish = 'insert, update'); - --- Subscription script - -CREATE SUBSCRIPTION "subscription_test1" - CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword' - PUBLICATION sample_publication - WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off'); - -ALTER SUBSCRIPTION subscription_test1 - CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres'; - -ALTER SUBSCRIPTION subscription_test1 - SET (synchronous_commit = 'remote_apply'); - -ALTER SUBSCRIPTION subscription_test1 - SET PUBLICATION edb WITH (refresh = false); - -ALTER SUBSCRIPTION subscription_test1 - RENAME TO subscription_test; - -DROP SUBSCRIPTION subscription_test; diff --git a/web/pgadmin/tools/schema_diff/tests/pg/10_plus/target.sql b/web/pgadmin/tools/schema_diff/tests/pg/10_plus/target.sql deleted file mode 100644 index d51563d4049..00000000000 --- a/web/pgadmin/tools/schema_diff/tests/pg/10_plus/target.sql +++ /dev/null @@ -1,1111 +0,0 @@ --- --- 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, - 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.relhasoids, - pg_class.relhaspkey, - pg_class.relhasrules, - pg_class.relhastriggers, - pg_class.relhassubclass, - pg_class.relrowsecurity, - pg_class.relforcerowsecurity, - pg_class.relispopulated, - pg_class.relreplident, - pg_class.relispartition, - pg_class.relfrozenxid, - pg_class.relminmxid, - pg_class.relacl, - pg_class.reloptions, - pg_class.relpartbound - FROM pg_class - LIMIT 10; - - -ALTER TABLE test_schema_diff."test view" OWNER TO 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'; - --- 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; - --- Extension script -CREATE EXTENSION adminpack - SCHEMA pg_catalog - VERSION "1.0"; - --- Language script -CREATE TRUSTED PROCEDURAL LANGUAGE tar_language - HANDLER plpgsql_call_handler - INLINE plpgsql_inline_handler - VALIDATOR plpgsql_validator; -ALTER LANGUAGE tar_language - OWNER TO 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 script - -CREATE TABLE test_schema_diff.table_for_publication ( - col1 integer NOT NULL, - col2 text -); - -CREATE TABLE test_schema_diff.table_for_publication_in_target ( - col1 integer NOT NULL, - col2 text -); - -CREATE PUBLICATION for_all_table - FOR ALL TABLES - WITH (publish = 'insert, delete'); - -CREATE PUBLICATION with_one_table_in_target - FOR TABLE test_schema_diff.table_for_publication_in_target - WITH (publish = 'insert, delete'); - -ALTER PUBLICATION with_one_table_in_target - RENAME TO with_one_table_in_target_alter; - -ALTER PUBLICATION with_one_table_in_target_alter SET - (publish = 'insert, update'); - --- Subscription script - -CREATE SUBSCRIPTION "subscription_test1_in_target" - CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword' - PUBLICATION sample_publication - WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off'); - -ALTER SUBSCRIPTION subscription_test1_in_target - CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres'; - -ALTER SUBSCRIPTION subscription_test1_in_target - SET (synchronous_commit = 'remote_apply'); - -ALTER SUBSCRIPTION subscription_test1_in_target - SET PUBLICATION edb WITH (refresh = false); - -ALTER SUBSCRIPTION subscription_test1_in_target - RENAME TO subscription_test_in_target; - -DROP SUBSCRIPTION subscription_test_in_target; diff --git a/web/pgadmin/tools/schema_diff/tests/pg/11_plus/source.sql b/web/pgadmin/tools/schema_diff/tests/pg/11_plus/source.sql index d121ee5393f..4b70f41422d 100644 --- a/web/pgadmin/tools/schema_diff/tests/pg/11_plus/source.sql +++ b/web/pgadmin/tools/schema_diff/tests/pg/11_plus/source.sql @@ -413,7 +413,7 @@ CREATE VIEW test_schema_diff."test view" AS pg_class.relacl, pg_class.reloptions, pg_class.relpartbound - FROM pg_class + FROM pg_catalog.pg_class LIMIT 10; @@ -1117,7 +1117,7 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping; CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping OPTIONS (password 'admin123'); --- Publication Script +-- Publication scripts CREATE TABLE test_schema_diff.table_for_publication ( col1 integer NOT NULL, @@ -1158,4 +1158,3 @@ ALTER SUBSCRIPTION subscription_test1 RENAME TO subscription_test; DROP SUBSCRIPTION subscription_test; - diff --git a/web/pgadmin/tools/schema_diff/tests/pg/11_plus/target.sql b/web/pgadmin/tools/schema_diff/tests/pg/11_plus/target.sql index 479bd9b90c4..430d596af47 100644 --- a/web/pgadmin/tools/schema_diff/tests/pg/11_plus/target.sql +++ b/web/pgadmin/tools/schema_diff/tests/pg/11_plus/target.sql @@ -363,7 +363,6 @@ CREATE RULE rule3 AS 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 @@ -402,7 +401,7 @@ CREATE VIEW test_schema_diff."test view" AS pg_class.relacl, pg_class.reloptions, pg_class.relpartbound - FROM pg_class + FROM pg_catalog.pg_class LIMIT 10; @@ -1108,4 +1107,3 @@ ALTER SUBSCRIPTION subscription_test1_in_target RENAME TO subscription_test_in_target; DROP SUBSCRIPTION subscription_test_in_target; - diff --git a/web/pgadmin/tools/schema_diff/tests/pg/12_plus/target.sql b/web/pgadmin/tools/schema_diff/tests/pg/12_plus/target.sql index 572cd0791d7..9b07dbde23a 100644 --- a/web/pgadmin/tools/schema_diff/tests/pg/12_plus/target.sql +++ b/web/pgadmin/tools/schema_diff/tests/pg/12_plus/target.sql @@ -1051,6 +1051,8 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping 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 diff --git a/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/source.sql b/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/source.sql deleted file mode 100644 index dc541b16ada..00000000000 --- a/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/source.sql +++ /dev/null @@ -1,1320 +0,0 @@ --- --- enterprisedbQL database dump --- - --- Dumped from database version 10.7 --- Dumped by pg_dump version 12beta2 - --- Started on 2019-11-01 12:54:15 IST - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - --- --- TOC entry 17 (class 2615 OID 139770) --- Name: test_schema_diff; Type: SCHEMA; Schema: -; Owner: enterprisedb --- - -CREATE SCHEMA test_schema_diff; - - -ALTER SCHEMA test_schema_diff OWNER TO enterprisedb; - -SET default_tablespace = ''; - - -CREATE EXTENSION btree_gist - SCHEMA test_schema_diff; - --- --- TOC entry 12272 (class 1259 OID 149205) --- Name: table_for_partition; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_partition ( - col1 bigint NOT NULL -) -PARTITION BY RANGE (col1); - - -ALTER TABLE test_schema_diff.table_for_partition OWNER TO enterprisedb; - --- --- TOC entry 12273 (class 1259 OID 149208) --- Name: part1; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.part1 ( - col1 bigint NOT NULL -); -ALTER TABLE ONLY test_schema_diff.table_for_partition ATTACH PARTITION test_schema_diff.part1 FOR VALUES FROM ('1') TO ('23'); - - -ALTER TABLE test_schema_diff.part1 OWNER TO enterprisedb; - --- --- TOC entry 12274 (class 1259 OID 149213) --- Name: table_for_partition_1; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_partition_1 ( - col1 bigint -) -PARTITION BY RANGE (col1); - - -ALTER TABLE test_schema_diff.table_for_partition_1 OWNER TO enterprisedb; - --- --- TOC entry 12275 (class 1259 OID 149216) --- Name: part3; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.part3 ( - col1 bigint -); -ALTER TABLE ONLY test_schema_diff.table_for_partition_1 ATTACH PARTITION test_schema_diff.part3 FOR VALUES FROM ('1') TO ('10'); - - -ALTER TABLE test_schema_diff.part3 OWNER TO enterprisedb; - --- --- TOC entry 12276 (class 1259 OID 149219) --- Name: part4; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.part4 ( - col1 bigint -); -ALTER TABLE ONLY test_schema_diff.table_for_partition_1 ATTACH PARTITION test_schema_diff.part4 FOR VALUES FROM ('11') TO ('20'); - - -ALTER TABLE test_schema_diff.part4 OWNER TO enterprisedb; - --- --- TOC entry 12258 (class 1259 OID 148963) --- Name: table_for_column; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_column ( - col1 bigint NOT NULL, - col2 text, - col3 text -); - - -ALTER TABLE test_schema_diff.table_for_column OWNER TO enterprisedb; - --- --- TOC entry 12256 (class 1259 OID 148895) --- Name: table_for_constraints; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_constraints ( - col1 integer NOT NULL, - col2 text -); - - -ALTER TABLE test_schema_diff.table_for_constraints OWNER TO enterprisedb; - --- --- TOC entry 61066 (class 0 OID 0) --- Dependencies: 12256 --- Name: TABLE table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb --- - -COMMENT ON TABLE test_schema_diff.table_for_constraints IS 'comments'; - - --- --- TOC entry 12262 (class 1259 OID 149004) --- Name: table_for_identical; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_identical ( - col1 integer NOT NULL, - col2 text -); - - -ALTER TABLE test_schema_diff.table_for_identical OWNER TO enterprisedb; - --- --- TOC entry 12260 (class 1259 OID 148977) --- Name: table_for_index; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_index ( - col1 integer NOT NULL, - col2 text -); - - -ALTER TABLE test_schema_diff.table_for_index OWNER TO enterprisedb; - --- --- TOC entry 12269 (class 1259 OID 149128) --- Name: table_for_primary_key; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_primary_key ( - col1 integer NOT NULL, - col2 text NOT NULL -); - - -ALTER TABLE test_schema_diff.table_for_primary_key OWNER TO enterprisedb; - --- --- TOC entry 12264 (class 1259 OID 149024) --- Name: table_for_rule; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_rule ( - col1 bigint NOT NULL, - col2 text -); - - -ALTER TABLE test_schema_diff.table_for_rule OWNER TO enterprisedb; - --- --- TOC entry 12266 (class 1259 OID 149048) --- Name: table_for_trigger; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_trigger ( - col1 bigint NOT NULL, - col2 text -); - - -ALTER TABLE test_schema_diff.table_for_trigger OWNER TO enterprisedb; - --- --- TOC entry 56893 (class 2606 OID 148904) --- Name: table_for_constraints Exclusion; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_constraints - ADD CONSTRAINT "Exclusion" EXCLUDE USING gist (col2 WITH <>) WITH (fillfactor='12') WHERE ((col1 > 1)) DEFERRABLE INITIALLY DEFERRED; - - --- --- TOC entry 61067 (class 0 OID 0) --- Dependencies: 56893 --- Name: CONSTRAINT "Exclusion" ON table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb --- - -COMMENT ON CONSTRAINT "Exclusion" ON test_schema_diff.table_for_constraints IS 'comments'; - - --- --- TOC entry 56891 (class 2606 OID 148911) --- Name: table_for_constraints check_con; Type: CHECK CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE test_schema_diff.table_for_constraints - ADD CONSTRAINT check_con CHECK ((col1 > 10)) NOT VALID; - - --- --- TOC entry 61068 (class 0 OID 0) --- Dependencies: 56891 --- Name: CONSTRAINT check_con ON table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb --- - -COMMENT ON CONSTRAINT check_con ON test_schema_diff.table_for_constraints IS 'coment'; - - --- --- TOC entry 56899 (class 2606 OID 148970) --- Name: table_for_column table_for_column_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_column - ADD CONSTRAINT table_for_column_pkey PRIMARY KEY (col1); - - --- --- TOC entry 56895 (class 2606 OID 148902) --- Name: table_for_constraints table_for_constraints_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_constraints - ADD CONSTRAINT table_for_constraints_pkey PRIMARY KEY (col1); - - --- --- TOC entry 56904 (class 2606 OID 148984) --- Name: table_for_index table_for_index_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_index - ADD CONSTRAINT table_for_index_pkey PRIMARY KEY (col1); - - --- --- TOC entry 56913 (class 2606 OID 149135) --- Name: table_for_primary_key table_for_primary_key_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_primary_key - ADD CONSTRAINT table_for_primary_key_pkey PRIMARY KEY (col1, col2); - - --- --- TOC entry 56909 (class 2606 OID 149031) --- Name: table_for_rule table_for_rule_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_rule - ADD CONSTRAINT table_for_rule_pkey PRIMARY KEY (col1); - - --- --- TOC entry 56907 (class 2606 OID 149011) --- Name: table_for_identical table_for_table_for_identical_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_identical - ADD CONSTRAINT table_for_table_for_identical_pkey PRIMARY KEY (col1); - - --- --- TOC entry 56911 (class 2606 OID 149055) --- Name: table_for_trigger table_for_trigger_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_trigger - ADD CONSTRAINT table_for_trigger_pkey PRIMARY KEY (col1); - - --- --- TOC entry 56897 (class 2606 OID 148913) --- Name: table_for_constraints unique; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_constraints - ADD CONSTRAINT "unique" UNIQUE (col1); - - --- --- TOC entry 61069 (class 0 OID 0) --- Dependencies: 56897 --- Name: CONSTRAINT "unique" ON table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb --- - -COMMENT ON CONSTRAINT "unique" ON test_schema_diff.table_for_constraints IS 'cmnt'; - - --- --- TOC entry 56900 (class 1259 OID 149023) --- Name: index1; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE INDEX index1 ON test_schema_diff.table_for_index USING btree (col2 varchar_pattern_ops); - - --- --- TOC entry 56905 (class 1259 OID 149012) --- Name: index_identical; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE INDEX index_identical ON test_schema_diff.table_for_identical USING btree (col2 text_pattern_ops); - - --- --- TOC entry 56901 (class 1259 OID 149211) --- Name: index_same; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE INDEX index_same ON test_schema_diff.table_for_index USING btree (col2 text_pattern_ops); - - --- --- TOC entry 56902 (class 1259 OID 149022) --- Name: index_source; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE INDEX index_source ON test_schema_diff.table_for_index USING btree (col2 text_pattern_ops); - - --- --- TOC entry 61044 (class 2618 OID 149032) --- Name: table_for_rule rule1; Type: RULE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE RULE rule1 AS - ON UPDATE TO test_schema_diff.table_for_rule DO INSTEAD NOTHING; - - --- --- TOC entry 61070 (class 0 OID 0) --- Dependencies: 61044 --- Name: RULE rule1 ON table_for_rule; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb --- - -COMMENT ON RULE rule1 ON test_schema_diff.table_for_rule IS 'comments'; - - --- --- TOC entry 61045 (class 2618 OID 149033) --- Name: table_for_rule rule2; Type: RULE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE RULE rule2 AS - ON INSERT TO test_schema_diff.table_for_rule DO NOTHING; - --- --- TOC entry 12283 (class 1259 OID 347818) --- Name: test view; Type: VIEW; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE VIEW test_schema_diff."test view" AS - SELECT pg_class.relname, - pg_class.relnamespace, - pg_class.reltype, - pg_class.reloftype, - pg_class.relowner, - pg_class.relam, - pg_class.relfilenode, - pg_class.reltablespace, - pg_class.relpages, - pg_class.reltuples, - pg_class.relallvisible, - pg_class.reltoastrelid, - pg_class.relhasindex, - pg_class.relisshared, - pg_class.relpersistence, - pg_class.relkind, - pg_class.relnatts, - pg_class.relchecks, - pg_class.relhasrules, - pg_class.relhastriggers, - pg_class.relhassubclass, - pg_class.relrowsecurity, - pg_class.relforcerowsecurity, - pg_class.relispopulated, - pg_class.relreplident, - pg_class.relispartition, - pg_class.relfrozenxid, - pg_class.relminmxid, - pg_class.relacl, - pg_class.reloptions, - pg_class.relpartbound - FROM pg_class - LIMIT 10; - - -ALTER TABLE test_schema_diff."test view" OWNER TO enterprisedb; - --- --- TOC entry 12286 (class 1259 OID 347832) --- Name: test view f; Type: VIEW; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE VIEW test_schema_diff."test view f" WITH (security_barrier='false') AS - SELECT 2; - - -ALTER TABLE test_schema_diff."test view f" OWNER TO enterprisedb; - --- --- TOC entry 61111 (class 0 OID 0) --- Dependencies: 12286 --- Name: VIEW "test view f"; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb --- - -COMMENT ON VIEW test_schema_diff."test view f" IS 'cmn'; - --- Collation scripts -CREATE COLLATION test_schema_diff.coll_src - FROM pg_catalog."POSIX"; - -ALTER COLLATION test_schema_diff.coll_src - OWNER TO enterprisedb; - -COMMENT ON COLLATION test_schema_diff.coll_src - IS 'Test Comment'; - -CREATE COLLATION test_schema_diff.coll_diff - (LC_COLLATE = 'POSIX', LC_CTYPE = 'POSIX'); - -ALTER COLLATION test_schema_diff.coll_diff - OWNER TO enterprisedb; - -COMMENT ON COLLATION test_schema_diff.coll_diff - IS 'Test Comment'; - --- FTS Configuration scripts -CREATE TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_src ( - COPY=german -); - -ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_src OWNER TO enterprisedb; - -COMMENT ON TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_src - IS 'Test Comment'; - -CREATE TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ( - PARSER = default -); -ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ADD MAPPING FOR asciiword WITH german_stem; -ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ADD MAPPING FOR email WITH simple; -ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ADD MAPPING FOR hword WITH dutch_stem; - --- FTS Dictionary scripts -CREATE TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_src ( - TEMPLATE = simple, - stopwords = 'english' -); - -COMMENT ON TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_src - IS 'Test Comment'; - -CREATE TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_diff ( - TEMPLATE = simple, - stopwords = 'english' -); - -COMMENT ON TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_diff - IS 'Test Comment'; - --- FTS Parser scripts -CREATE TEXT SEARCH PARSER test_schema_diff.fts_par_src ( - START = prsd_start, - GETTOKEN = prsd_nexttoken, - END = prsd_end, - LEXTYPES = prsd_lextype); - -COMMENT ON TEXT SEARCH PARSER test_schema_diff.fts_par_src - IS 'Test Comment'; - -CREATE TEXT SEARCH PARSER test_schema_diff.fts_par_diff ( - START = prsd_start, - GETTOKEN = prsd_nexttoken, - END = prsd_end, - LEXTYPES = prsd_lextype); - -COMMENT ON TEXT SEARCH PARSER test_schema_diff.fts_par_diff - IS 'Test Comment'; - --- FTS Template scripts -CREATE TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_src ( - INIT = dispell_init, - LEXIZE = dispell_lexize -); - -COMMENT ON TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_src IS 'Test Comment'; - -CREATE TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_diff ( - INIT = dispell_init, - LEXIZE = dispell_lexize -); - -COMMENT ON TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_diff IS 'Test Comment'; - --- Domain and Domain Constraint script -CREATE DOMAIN test_schema_diff.dom_src - AS bigint - DEFAULT 100 - NOT NULL; - -ALTER DOMAIN test_schema_diff.dom_src OWNER TO enterprisedb; - -ALTER DOMAIN test_schema_diff.dom_src - ADD CONSTRAINT con_src CHECK (VALUE <> 100); - -CREATE DOMAIN test_schema_diff.dom_cons_diff - AS bigint - DEFAULT 100 - NOT NULL; - -ALTER DOMAIN test_schema_diff.dom_cons_diff OWNER TO enterprisedb; - -ALTER DOMAIN test_schema_diff.dom_cons_diff - ADD CONSTRAINT cons_diff_1 CHECK (VALUE <> 50); - -ALTER DOMAIN test_schema_diff.dom_cons_diff - ADD CONSTRAINT cons_src_only CHECK (VALUE <> 25); - -CREATE DOMAIN test_schema_diff.dom_type_diff - AS character varying(40) - COLLATE pg_catalog."POSIX"; - -ALTER DOMAIN test_schema_diff.dom_type_diff OWNER TO enterprisedb; - -ALTER DOMAIN test_schema_diff.dom_type_diff - ADD CONSTRAINT cons1 CHECK (VALUE::text <> 'pgAdmin3'::text); - -ALTER DOMAIN test_schema_diff.dom_type_diff - ADD CONSTRAINT cons2 CHECK (VALUE::text <> 'pgAdmin4'::text); - -COMMENT ON DOMAIN test_schema_diff.dom_type_diff - IS 'Test comment'; - --- Type Script composite type -CREATE TYPE test_schema_diff.typ_comp_src AS -( - m1 bit(5), - m2 text COLLATE pg_catalog."POSIX" -); -ALTER TYPE test_schema_diff.typ_comp_src - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_comp_diff AS -( - m1 numeric(5,2), - m3 character varying(30) COLLATE pg_catalog."C" -); -ALTER TYPE test_schema_diff.typ_comp_diff - OWNER TO enterprisedb; -COMMENT ON TYPE test_schema_diff.typ_comp_diff - IS 'Test Comment'; -GRANT USAGE ON TYPE test_schema_diff.typ_comp_diff TO PUBLIC; -GRANT USAGE ON TYPE test_schema_diff.typ_comp_diff TO pg_monitor WITH GRANT OPTION; -GRANT USAGE ON TYPE test_schema_diff.typ_comp_diff TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_comp_diff_no_column AS -( -); -ALTER TYPE test_schema_diff.typ_comp_diff_no_column - OWNER TO enterprisedb; - --- Type Script ENUM type -CREATE TYPE test_schema_diff.typ_enum_src AS ENUM - ('test_enum'); -ALTER TYPE test_schema_diff.typ_enum_src - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_enum_diff AS ENUM - ('test_enum', 'test_enum_1'); -ALTER TYPE test_schema_diff.typ_enum_diff - OWNER TO enterprisedb; -COMMENT ON TYPE test_schema_diff.typ_enum_diff - IS 'Test Comment'; -GRANT USAGE ON TYPE test_schema_diff.typ_enum_src TO pg_monitor WITH GRANT OPTION; - --- Type Script RANGE type -CREATE TYPE test_schema_diff.typ_range_src AS RANGE -( - SUBTYPE=text, - COLLATION = pg_catalog."POSIX", - SUBTYPE_OPCLASS = text_ops -); -ALTER TYPE test_schema_diff.typ_range_src - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_range_col_diff AS RANGE -( - SUBTYPE=text, - COLLATION = pg_catalog."C", - SUBTYPE_OPCLASS = text_ops -); -ALTER TYPE test_schema_diff.typ_range_col_diff - OWNER TO enterprisedb; -COMMENT ON TYPE test_schema_diff.typ_range_col_diff - IS 'Test Comment'; -GRANT USAGE ON TYPE test_schema_diff.typ_range_col_diff TO PUBLIC; -GRANT USAGE ON TYPE test_schema_diff.typ_range_col_diff TO enterprisedb WITH GRANT OPTION; - -CREATE TYPE test_schema_diff.typ_range_subtype_diff AS RANGE -( - SUBTYPE=bpchar, - COLLATION = pg_catalog."POSIX" -); -ALTER TYPE test_schema_diff.typ_range_subtype_diff - OWNER TO enterprisedb; - --- Type Script SHELL type -CREATE TYPE test_schema_diff.typ_shell_src; -ALTER TYPE test_schema_diff.typ_shell_src - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_shell_diff; -ALTER TYPE test_schema_diff.typ_shell_diff - OWNER TO enterprisedb; -COMMENT ON TYPE test_schema_diff.typ_shell_diff - IS 'Test Comment'; - --- Type script to test when Type is different -CREATE TYPE test_schema_diff.typ_comp_range_diff AS -( - m1 bigint, - m2 text[] COLLATE pg_catalog."POSIX" -); -ALTER TYPE test_schema_diff.typ_comp_range_diff - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_comp_enum_diff AS -( - m1 bigint, - m2 text[] COLLATE pg_catalog."POSIX" -); -ALTER TYPE test_schema_diff.typ_comp_range_diff - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_range_comp_diff AS RANGE -( - SUBTYPE=text, - COLLATION = pg_catalog."C", - SUBTYPE_OPCLASS = text_ops -); -ALTER TYPE test_schema_diff.typ_range_comp_diff - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_range_enum_diff AS RANGE -( - SUBTYPE=text, - COLLATION = pg_catalog."C", - SUBTYPE_OPCLASS = text_ops -); -ALTER TYPE test_schema_diff.typ_range_enum_diff - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_enum_comp_diff AS ENUM - ('test_enum', 'test_enum_1'); -ALTER TYPE test_schema_diff.typ_enum_comp_diff - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_enum_range_diff AS ENUM - ('test_enum', 'test_enum_1'); -ALTER TYPE test_schema_diff.typ_enum_range_diff - OWNER TO enterprisedb; - --- Package script (test_schema_diff only) -CREATE OR REPLACE PACKAGE test_schema_diff.pkg_src -IS - FUNCTION get_dept_name(p_deptno numeric) RETURN character varying; - PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric); -END pkg_src; - -CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_src -IS - FUNCTION get_dept_name(p_deptno numeric) RETURN character varying IS - v_dname VARCHAR2(14); - BEGIN - SELECT dname INTO v_dname FROM dept WHERE deptno = p_deptno; - RETURN v_dname; - EXCEPTION - WHEN NO_DATA_FOUND THEN - DBMS_OUTPUT.PUT_LINE('Invalid department number ' || p_deptno); - RETURN ''; - END; - - PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric) IS - BEGIN - INSERT INTO emp(empno, ename, job, sal, hiredate, comm, mgr, deptno) - VALUES(p_empno, p_ename, p_job, p_sal, - p_hiredate, p_comm, p_mgr, p_deptno); - END; -END pkg_src; - -COMMENT ON PACKAGE test_schema_diff.pkg_src - IS 'Target'; - --- Package script difference in header, acl and comment -CREATE OR REPLACE PACKAGE test_schema_diff.pkg_header_diff -IS - FUNCTION get_dept_name(p_deptno numeric) RETURN character varying; - PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric); -END pkg_header_diff; - -CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_header_diff -IS - FUNCTION get_dept_name(p_deptno numeric) RETURN character varying IS - v_dname VARCHAR2(14); - BEGIN - SELECT dname INTO v_dname FROM dept WHERE deptno = p_deptno; - RETURN v_dname; - EXCEPTION - WHEN NO_DATA_FOUND THEN - DBMS_OUTPUT.PUT_LINE('Invalid department number ' || p_deptno); - RETURN ''; - END; - - PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric) IS - BEGIN - INSERT INTO emp(empno, ename, job, sal, hiredate, comm, mgr, deptno) - VALUES(p_empno, p_ename, p_job, p_sal, - p_hiredate, p_comm, p_mgr, p_deptno); - END; -END pkg_header_diff; - -COMMENT ON PACKAGE test_schema_diff.pkg_header_diff - IS 'Header Diff'; - -GRANT EXECUTE ON PACKAGE test_schema_diff.pkg_header_diff TO PUBLIC; -GRANT EXECUTE ON PACKAGE test_schema_diff.pkg_header_diff TO enterprisedb WITH GRANT OPTION; - --- Package script difference in body, acl and comment -CREATE OR REPLACE PACKAGE test_schema_diff.pkg_body_diff -IS - PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric); -END pkg_body_diff; - -CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_body_diff -IS - PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric) IS - BEGIN - DBMS_OUTPUT.PUT_LINE('Before Insert '); - INSERT INTO emp(empno, ename, job, sal, hiredate, comm, mgr, deptno) - VALUES(p_empno, p_ename, p_job, p_sal, - p_hiredate, p_comm, p_mgr, p_deptno); - DBMS_OUTPUT.PUT_LINE('After Insert '); - END; -END pkg_body_diff; - --- Synonyms Scripts --- Prerequisite for synonyms -CREATE OR REPLACE FUNCTION test_schema_diff.fun_for_syn() -RETURNS void - LANGUAGE 'plpgsql' - VOLATILE - COST 100 - -AS $BODY$BEGIN -SELECT 1; -END;$BODY$; -ALTER FUNCTION test_schema_diff.fun_for_syn() - OWNER TO enterprisedb; - -CREATE OR REPLACE PROCEDURE test_schema_diff.proc_for_syn() - SECURITY DEFINER VOLATILE - COST 100 -AS $BODY$BEGIN -SELECT 1; -END;$BODY$; - -CREATE OR REPLACE PACKAGE test_schema_diff.pkg_for_syn -IS -FUNCTION get_dept_name(p_deptno numeric) RETURN character varying; -END pkg_for_syn; -CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_for_syn -IS -FUNCTION get_dept_name(p_deptno numeric) RETURN character varying IS -BEGIN - RETURN ''; -END; -END pkg_for_syn; - -CREATE TABLE test_schema_diff.table_for_syn -( - id bigint, - name text COLLATE pg_catalog."default" -) -TABLESPACE pg_default; -ALTER TABLE test_schema_diff.table_for_syn - OWNER to enterprisedb; - -CREATE SEQUENCE test_schema_diff.seq_for_syn - INCREMENT 5 - START 1 - MINVALUE 1 - MAXVALUE 100 - CACHE 1; -ALTER SEQUENCE test_schema_diff.seq_for_syn - OWNER TO enterprisedb; - -CREATE OR REPLACE SYNONYM test_schema_diff.syn_fun_src - FOR test_schema_diff.fun_for_syn; - -CREATE OR REPLACE SYNONYM test_schema_diff.syn_pkg_src - FOR test_schema_diff.pkg_for_syn; - -CREATE OR REPLACE SYNONYM test_schema_diff.syn_proc_src - FOR test_schema_diff.proc_for_syn; - -CREATE OR REPLACE SYNONYM test_schema_diff.syn_seq_src - FOR test_schema_diff.seq_for_syn; - -CREATE OR REPLACE SYNONYM test_schema_diff.syn_table_src - FOR test_schema_diff.table_for_syn; - -CREATE TABLE public.table_for_syn -( - id bigint, - name text COLLATE pg_catalog."default" -) -TABLESPACE pg_default; -ALTER TABLE public.table_for_syn - OWNER to enterprisedb; - -CREATE OR REPLACE SYNONYM test_schema_diff.syn_diff - FOR public.table_for_syn; - --- Sequences Script -CREATE SEQUENCE test_schema_diff.seq_src - CYCLE - INCREMENT 1 - START 1 - MINVALUE 1 - MAXVALUE 3 - CACHE 6; -ALTER SEQUENCE test_schema_diff.seq_src - OWNER TO enterprisedb; -COMMENT ON SEQUENCE test_schema_diff.seq_src - IS 'Test Comment'; -GRANT ALL ON SEQUENCE test_schema_diff.seq_src TO PUBLIC; -GRANT ALL ON SEQUENCE test_schema_diff.seq_src TO enterprisedb; - -CREATE SEQUENCE test_schema_diff.seq_diff_comment_acl - INCREMENT 1 - START 1 - MINVALUE 1 - MAXVALUE 9223372036854775807 - CACHE 1; -ALTER SEQUENCE test_schema_diff.seq_diff_comment_acl - OWNER TO enterprisedb; -COMMENT ON SEQUENCE test_schema_diff.seq_diff_comment_acl - IS 'Test Comment'; -GRANT ALL ON SEQUENCE test_schema_diff.seq_diff_comment_acl TO PUBLIC; -GRANT ALL ON SEQUENCE test_schema_diff.seq_diff_comment_acl TO enterprisedb; - -CREATE SEQUENCE test_schema_diff.seq_diff_comment_acl_remove - INCREMENT 1 - START 1 - MINVALUE 1 - MAXVALUE 9223372036854775807 - CACHE 1; -ALTER SEQUENCE test_schema_diff.seq_diff_comment_acl_remove - OWNER TO enterprisedb; - -CREATE SEQUENCE test_schema_diff.seq_diff - CYCLE - INCREMENT 3 - START 3 - MINVALUE 3 - MAXVALUE 100 - CACHE 2; -ALTER SEQUENCE test_schema_diff.seq_diff - OWNER TO enterprisedb; - -CREATE SEQUENCE test_schema_diff.seq_start_diff - INCREMENT 5 - START 3 - MINVALUE 3 - MAXVALUE 20; -ALTER SEQUENCE test_schema_diff.seq_start_diff - OWNER TO enterprisedb; - --- Foreign Data Wrapper to test foreign table -CREATE FOREIGN DATA WRAPPER test_fdw_for_foreign_table; -ALTER FOREIGN DATA WRAPPER test_fdw_for_foreign_table - OWNER TO enterprisedb; - --- Foreign Server to test foreign table -CREATE SERVER test_fs_for_foreign_table - FOREIGN DATA WRAPPER test_fdw_for_foreign_table; -ALTER SERVER test_fs_for_foreign_table - OWNER TO enterprisedb; -CREATE SERVER test_fs2_for_foreign_table - FOREIGN DATA WRAPPER test_fdw_for_foreign_table; -ALTER SERVER test_fs2_for_foreign_table - OWNER TO enterprisedb; - --- Table to test inheritance in foreign table -CREATE TABLE public.test_table_for_foreign_table -( - tid bigint NOT NULL, - tname text COLLATE pg_catalog."default", - CONSTRAINT test_table_for_foreign_table_pkey PRIMARY KEY (tid) -) -WITH ( - OIDS = FALSE -) -TABLESPACE pg_default; -ALTER TABLE public.test_table_for_foreign_table - OWNER to enterprisedb; - -CREATE FOREIGN TABLE test_schema_diff.ft_src( - fid bigint NULL, - fname text NULL COLLATE pg_catalog."default" -) - SERVER test_fs_for_foreign_table; -ALTER FOREIGN TABLE test_schema_diff.ft_src - OWNER TO enterprisedb; -ALTER FOREIGN TABLE test_schema_diff.ft_src - ADD CONSTRAINT fcheck CHECK ((fid > 1000)) NO INHERIT; -COMMENT ON FOREIGN TABLE test_schema_diff.ft_src - IS 'Test Comment'; -GRANT INSERT ON TABLE test_schema_diff.ft_src TO PUBLIC; -GRANT ALL ON TABLE test_schema_diff.ft_src TO enterprisedb; - -CREATE FOREIGN TABLE test_schema_diff.ft_diff_col( - fid bigint NULL, - fname text NULL COLLATE pg_catalog."default", - fcity character varying(40) NULL COLLATE pg_catalog."POSIX" -) - SERVER test_fs_for_foreign_table; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_col - OWNER TO enterprisedb; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_col - ADD CONSTRAINT fcheck CHECK ((fid > 1000)) NO INHERIT; -COMMENT ON FOREIGN TABLE test_schema_diff.ft_diff_col - IS 'Test Comment'; - -CREATE FOREIGN TABLE test_schema_diff.ft_diff_const( - fid bigint NULL, - fname text NULL COLLATE pg_catalog."default" -) - SERVER test_fs_for_foreign_table; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_const - OWNER TO enterprisedb; - -ALTER FOREIGN TABLE test_schema_diff.ft_diff_const - ADD CONSTRAINT fcheck CHECK ((fid > 1000)) NO INHERIT; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_const - ADD CONSTRAINT fcheck1 CHECK ((fid > 1000)) NO INHERIT NOT VALID; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_const - ADD CONSTRAINT fcheck2 CHECK ((fid > 20)); -ALTER FOREIGN TABLE test_schema_diff.ft_diff_const - ADD CONSTRAINT fcheck_src CHECK ((fid > 50)); - -GRANT INSERT ON TABLE test_schema_diff.ft_diff_const TO PUBLIC; -GRANT ALL ON TABLE test_schema_diff.ft_diff_const TO enterprisedb; - -CREATE FOREIGN TABLE test_schema_diff.ft_diff_opt( - fid bigint NULL, - fname text NULL COLLATE pg_catalog."default" -) - SERVER test_fs_for_foreign_table - OPTIONS (opt1 'val1', opt2 'val20', opt_src 'val_src'); -ALTER FOREIGN TABLE test_schema_diff.ft_diff_opt - OWNER TO enterprisedb; - -CREATE FOREIGN TABLE test_schema_diff.ft_diff_foreign_server( - fid bigint NULL, - fname text NULL COLLATE pg_catalog."default" -) - SERVER test_fs_for_foreign_table; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_foreign_server - OWNER TO enterprisedb; - -CREATE FOREIGN TABLE test_schema_diff.ft_diff_foreign_server_1( - fid bigint NULL, - fname text NULL COLLATE pg_catalog."default" -) - SERVER test_fs_for_foreign_table - OPTIONS (opt1 'val1'); -ALTER FOREIGN TABLE test_schema_diff.ft_diff_foreign_server_1 - OWNER TO enterprisedb; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_foreign_server_1 - ADD CONSTRAINT cs1 CHECK ((fid > 200)) NO INHERIT; - --- Test for RM #5350 -CREATE TABLE test_schema_diff.events_transactions -( - event_code integer, - numerator integer, - account_token text COLLATE pg_catalog."default", - transaction_dt timestamp without time zone, - payment_method integer, - payment_pin integer, - approval text COLLATE pg_catalog."default", - amount integer, - file_dt timestamp without time zone DEFAULT CURRENT_TIMESTAMP, - file_name character varying(256) COLLATE pg_catalog."default", - transfer_dt timestamp without time zone, - transaction_type integer -); - --- Casts script -CREATE CAST (money AS bigint) - WITHOUT FUNCTION - AS IMPLICIT; - -COMMENT ON CAST (money AS bigint) IS 'money -> bigint'; - --- Event Trigger script -CREATE FUNCTION public.evt_tri_fun() - RETURNS event_trigger - LANGUAGE 'plpgsql' - NOT LEAKPROOF -AS $BODY$ -BEGIN -PERFORM 1; -END; -$BODY$; -ALTER FUNCTION public.evt_tri_fun() - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_src ON DDL_COMMAND_START - EXECUTE PROCEDURE public.evt_tri_fun(); -COMMENT ON EVENT TRIGGER evt_tri_src - IS 'Event Trigger Source'; -ALTER EVENT TRIGGER evt_tri_src - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_event1 ON DDL_COMMAND_START - EXECUTE PROCEDURE public.evt_tri_fun(); -ALTER EVENT TRIGGER evt_tri_diff_event1 - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_event2 ON DDL_COMMAND_END - EXECUTE PROCEDURE public.evt_tri_fun(); -ALTER EVENT TRIGGER evt_tri_diff_event2 - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_event3 ON SQL_DROP - EXECUTE PROCEDURE public.evt_tri_fun(); -ALTER EVENT TRIGGER evt_tri_diff_event3 - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_enable_status1 ON DDL_COMMAND_START - EXECUTE PROCEDURE public.evt_tri_fun(); -ALTER EVENT TRIGGER evt_tri_diff_enable_status1 - DISABLE; -ALTER EVENT TRIGGER evt_tri_diff_enable_status1 - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_enable_status2 ON DDL_COMMAND_START - EXECUTE PROCEDURE public.evt_tri_fun(); -ALTER EVENT TRIGGER evt_tri_diff_enable_status2 - ENABLE REPLICA; -ALTER EVENT TRIGGER evt_tri_diff_enable_status2 - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_enable_status3 ON DDL_COMMAND_START - EXECUTE PROCEDURE public.evt_tri_fun(); -ALTER EVENT TRIGGER evt_tri_diff_enable_status3 - ENABLE ALWAYS; -ALTER EVENT TRIGGER evt_tri_diff_enable_status3 - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_func ON DDL_COMMAND_START - EXECUTE PROCEDURE public.evt_tri_fun(); -ALTER EVENT TRIGGER evt_tri_diff_func - OWNER TO enterprisedb; - --- Extension script -CREATE EXTENSION adminpack - SCHEMA pg_catalog - VERSION "1.1"; - --- Language script -CREATE TRUSTED PROCEDURAL LANGUAGE src_trusted_language - HANDLER plpgsql_call_handler - INLINE plpgsql_inline_handler - VALIDATOR plpgsql_validator; -ALTER LANGUAGE src_trusted_language - OWNER TO enterprisedb; -COMMENT ON LANGUAGE src_trusted_language - IS 'Custom Trusted Language'; -GRANT USAGE ON LANGUAGE src_trusted_language TO PUBLIC; -GRANT USAGE ON LANGUAGE src_trusted_language TO enterprisedb WITH GRANT OPTION; - -CREATE PROCEDURAL LANGUAGE src_proc_language - HANDLER plpgsql_call_handler - INLINE plpgsql_inline_handler - VALIDATOR plpgsql_validator; -ALTER LANGUAGE src_proc_language - OWNER TO enterprisedb; -COMMENT ON LANGUAGE src_proc_language - IS 'Custom Procedural Language'; - -CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_acl_add - HANDLER plpgsql_call_handler - INLINE plpgsql_inline_handler - VALIDATOR plpgsql_validator; -ALTER LANGUAGE lan_diff_acl_add - OWNER TO enterprisedb; -GRANT USAGE ON LANGUAGE lan_diff_acl_add TO PUBLIC; -GRANT USAGE ON LANGUAGE lan_diff_acl_add TO enterprisedb WITH GRANT OPTION; - -CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_acl_revoke - HANDLER plpgsql_call_handler - INLINE plpgsql_inline_handler - VALIDATOR plpgsql_validator; -ALTER LANGUAGE lan_diff_acl_revoke - OWNER TO enterprisedb; - -CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_type - HANDLER plpgsql_call_handler - INLINE plpgsql_inline_handler - VALIDATOR plpgsql_validator; -ALTER LANGUAGE lan_diff_type - OWNER TO enterprisedb; - -CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_inline_validator - HANDLER plpgsql_call_handler - INLINE prsd_end - VALIDATOR pg_stat_reset_single_table_counters; -ALTER LANGUAGE lan_diff_type - OWNER TO enterprisedb; - --- Foreign Data Wrapper Script -CREATE FOREIGN DATA WRAPPER fdw_src - VALIDATOR pg_catalog.postgresql_fdw_validator; -ALTER FOREIGN DATA WRAPPER fdw_src - OWNER TO enterprisedb; -COMMENT ON FOREIGN DATA WRAPPER fdw_src - IS 'Foreign Data Wrapper'; - -CREATE FOREIGN DATA WRAPPER fdw_diff_acl_add - VALIDATOR pg_catalog.postgresql_fdw_validator; -ALTER FOREIGN DATA WRAPPER fdw_diff_acl_add - OWNER TO enterprisedb; -GRANT USAGE ON FOREIGN DATA WRAPPER fdw_diff_acl_add TO PUBLIC; -GRANT USAGE ON FOREIGN DATA WRAPPER fdw_diff_acl_add TO enterprisedb WITH GRANT OPTION; - -CREATE FOREIGN DATA WRAPPER fdw_diff_acl_revoke - VALIDATOR pg_catalog.postgresql_fdw_validator; -ALTER FOREIGN DATA WRAPPER fdw_diff_acl_revoke - OWNER TO enterprisedb; - -CREATE FOREIGN DATA WRAPPER fdw_diff_add_validator - VALIDATOR pg_catalog.postgresql_fdw_validator; -ALTER FOREIGN DATA WRAPPER fdw_diff_add_validator - OWNER TO enterprisedb; - -CREATE FOREIGN DATA WRAPPER fdw_diff_remove_validator; -ALTER FOREIGN DATA WRAPPER fdw_diff_remove_validator - OWNER TO enterprisedb; - -CREATE FOREIGN DATA WRAPPER fdw_diff_add_options - OPTIONS (debug 'true'); -ALTER FOREIGN DATA WRAPPER fdw_diff_add_options - OWNER TO enterprisedb; - -CREATE FOREIGN DATA WRAPPER fdw_diff_remove_options; -ALTER FOREIGN DATA WRAPPER fdw_diff_remove_options - OWNER TO enterprisedb; - -CREATE FOREIGN DATA WRAPPER fdw_diff_options - OPTIONS (debug 'false'); -ALTER FOREIGN DATA WRAPPER fdw_diff_options - OWNER TO enterprisedb; - --- Foreign Server Script -CREATE FOREIGN DATA WRAPPER test_fdw_for_foreign_server - VALIDATOR pg_catalog.postgresql_fdw_validator; -ALTER FOREIGN DATA WRAPPER test_fdw_for_foreign_server - OWNER TO enterprisedb; - -CREATE SERVER fs_src - TYPE 'PG' - VERSION '10' - FOREIGN DATA WRAPPER test_fdw_for_foreign_server - OPTIONS (host '127.0.0.1', port '5432'); -ALTER SERVER fs_src - OWNER TO enterprisedb; -COMMENT ON SERVER fs_src - IS 'Foreign Server'; - -CREATE SERVER fs_diff_acl_add - FOREIGN DATA WRAPPER test_fdw_for_foreign_server; -ALTER SERVER fs_diff_acl_add - OWNER TO enterprisedb; -GRANT USAGE ON FOREIGN SERVER fs_diff_acl_add TO PUBLIC; -GRANT USAGE ON FOREIGN SERVER fs_diff_acl_add TO enterprisedb WITH GRANT OPTION; - -CREATE SERVER fs_diff_acl_revoke - FOREIGN DATA WRAPPER test_fdw_for_foreign_server; -ALTER SERVER fs_diff_acl_revoke - OWNER TO enterprisedb; - -CREATE SERVER fs_diff_type_version_add - TYPE 'PG' - VERSION '10' - FOREIGN DATA WRAPPER test_fdw_for_foreign_server; -ALTER SERVER fs_diff_type_version_add - OWNER TO enterprisedb; - -CREATE SERVER fs_diff_type_version_remove - FOREIGN DATA WRAPPER test_fdw_for_foreign_server; -ALTER SERVER fs_diff_type_version_remove - OWNER TO enterprisedb; - -CREATE SERVER fs_diff_type_version_modify - TYPE 'PG' - VERSION '10' - FOREIGN DATA WRAPPER test_fdw_for_foreign_server; -ALTER SERVER fs_diff_type_version_modify - OWNER TO enterprisedb; - -CREATE SERVER fs_diff_options_add - FOREIGN DATA WRAPPER test_fdw_for_foreign_server - OPTIONS (host '127.0.0.1', port '5432'); -ALTER SERVER fs_diff_options_add - OWNER TO enterprisedb; - -CREATE SERVER fs_diff_options_remove - FOREIGN DATA WRAPPER test_fdw_for_foreign_server; -ALTER SERVER fs_diff_options_remove - OWNER TO enterprisedb; - -CREATE SERVER fs_diff_options_modify - FOREIGN DATA WRAPPER test_fdw_for_foreign_server - OPTIONS (host '192.168.1.1', port '8080'); -ALTER SERVER fs_diff_options_modify - OWNER TO enterprisedb; - --- User Mapping Script -CREATE FOREIGN DATA WRAPPER test_fdw_for_user_mapping - VALIDATOR pg_catalog.postgresql_fdw_validator; -ALTER FOREIGN DATA WRAPPER test_fdw_for_user_mapping - OWNER TO enterprisedb; - -CREATE SERVER test_fs_for_user_mapping - FOREIGN DATA WRAPPER test_fdw_for_user_mapping; -ALTER SERVER test_fs_for_user_mapping - OWNER TO enterprisedb; - -CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping; - -CREATE USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping - OPTIONS (password 'admin123'); - --- Publication Script - -CREATE TABLE test_schema_diff.table_for_publication ( - col1 integer NOT NULL, - col2 text -); - - -CREATE PUBLICATION for_all_table - FOR ALL TABLES - WITH (publish = 'insert, delete'); - -CREATE PUBLICATION with_one_table - FOR TABLE test_schema_diff.table_for_publication - WITH (publish = 'insert, delete'); - -ALTER PUBLICATION with_one_table - RENAME TO with_one_table_alter; - -ALTER PUBLICATION with_one_table_alter SET - (publish = 'insert, update'); - --- Subscription script - -CREATE SUBSCRIPTION "subscription_test1" - CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword' - PUBLICATION sample_publication - WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off'); - -ALTER SUBSCRIPTION subscription_test1 - CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres'; - -ALTER SUBSCRIPTION subscription_test1 - SET (synchronous_commit = 'remote_apply'); - -ALTER SUBSCRIPTION subscription_test1 - SET PUBLICATION edb WITH (refresh = false); - -ALTER SUBSCRIPTION subscription_test1 - RENAME TO subscription_test; - -DROP SUBSCRIPTION subscription_test; diff --git a/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/target.sql b/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/target.sql deleted file mode 100644 index 77a22c5bf4d..00000000000 --- a/web/pgadmin/tools/schema_diff/tests/ppas/10_plus/target.sql +++ /dev/null @@ -1,1261 +0,0 @@ --- --- enterprisedbQL database dump --- - --- Dumped from database version 10.7 --- Dumped by pg_dump version 12beta2 - --- Started on 2019-11-01 12:55:22 IST - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - --- --- TOC entry 18 (class 2615 OID 139771) --- Name: test_schema_diff; Type: SCHEMA; Schema: -; Owner: enterprisedb --- - -CREATE SCHEMA test_schema_diff; - -ALTER SCHEMA test_schema_diff OWNER TO enterprisedb; - -SET default_tablespace = ''; - -CREATE EXTENSION btree_gist - SCHEMA test_schema_diff; - --- --- TOC entry 12250 (class 1259 OID 139938) --- Name: MView; Type: MATERIALIZED VIEW; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE MATERIALIZED VIEW test_schema_diff."MView" AS - SELECT 'tekst'::text AS text - WITH NO DATA; - - -ALTER TABLE test_schema_diff."MView" OWNER TO enterprisedb; - --- --- TOC entry 12277 (class 1259 OID 149234) --- Name: table_for_partition_1; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_partition_1 ( - col1 bigint -) -PARTITION BY RANGE (col1); - - -ALTER TABLE test_schema_diff.table_for_partition_1 OWNER TO enterprisedb; - --- --- TOC entry 12278 (class 1259 OID 149237) --- Name: part3; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.part3 ( - col1 bigint -); -ALTER TABLE ONLY test_schema_diff.table_for_partition_1 ATTACH PARTITION test_schema_diff.part3 FOR VALUES FROM ('13') TO ('56'); - - -ALTER TABLE test_schema_diff.part3 OWNER TO enterprisedb; - --- --- TOC entry 12259 (class 1259 OID 148971) --- Name: table_for_column; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_column ( - col1 bigint, - col2 bigint, - col4 text -); - - -ALTER TABLE test_schema_diff.table_for_column OWNER TO enterprisedb; - --- --- TOC entry 12268 (class 1259 OID 149089) --- Name: table_for_constraints; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_constraints ( - col1 integer NOT NULL, - col2 text, - CONSTRAINT check_con CHECK ((col1 > 30)) -); - - -ALTER TABLE test_schema_diff.table_for_constraints OWNER TO enterprisedb; - --- --- TOC entry 61066 (class 0 OID 0) --- Dependencies: 12268 --- Name: TABLE table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb --- - -COMMENT ON TABLE test_schema_diff.table_for_constraints IS 'comments'; - - --- --- TOC entry 61067 (class 0 OID 0) --- Dependencies: 12268 --- Name: CONSTRAINT check_con ON table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb --- - -COMMENT ON CONSTRAINT check_con ON test_schema_diff.table_for_constraints IS 'coment'; - - --- --- TOC entry 12257 (class 1259 OID 148960) --- Name: table_for_del; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_del ( -); - - -ALTER TABLE test_schema_diff.table_for_del OWNER TO enterprisedb; - --- --- TOC entry 12271 (class 1259 OID 149172) --- Name: table_for_foreign_key; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_foreign_key ( - col1 integer NOT NULL, - col2 "char", - col3 bigint -); - - -ALTER TABLE test_schema_diff.table_for_foreign_key OWNER TO enterprisedb; - --- --- TOC entry 12263 (class 1259 OID 149013) --- Name: table_for_identical; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_identical ( - col1 integer NOT NULL, - col2 text -); - - -ALTER TABLE test_schema_diff.table_for_identical OWNER TO enterprisedb; - --- --- TOC entry 12261 (class 1259 OID 148986) --- Name: table_for_index; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_index ( - col1 integer NOT NULL, - col2 text -); - - -ALTER TABLE test_schema_diff.table_for_index OWNER TO enterprisedb; - --- --- TOC entry 12270 (class 1259 OID 149144) --- Name: table_for_primary_key; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_primary_key ( - col1 integer NOT NULL, - col2 text NOT NULL -); - - -ALTER TABLE test_schema_diff.table_for_primary_key OWNER TO enterprisedb; - --- --- TOC entry 12265 (class 1259 OID 149034) --- Name: table_for_rule; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_rule ( - col1 bigint NOT NULL, - col2 text -); - - -ALTER TABLE test_schema_diff.table_for_rule OWNER TO enterprisedb; - --- --- TOC entry 12267 (class 1259 OID 149066) --- Name: table_for_trigger; Type: TABLE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE TABLE test_schema_diff.table_for_trigger ( - col1 bigint NOT NULL, - col2 text -); - - -ALTER TABLE test_schema_diff.table_for_trigger OWNER TO enterprisedb; - - --- --- TOC entry 56906 (class 2606 OID 149097) --- Name: table_for_constraints Exclusion; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_constraints - ADD CONSTRAINT "Exclusion" EXCLUDE USING gist (col2 WITH <>) WITH (fillfactor='15') WHERE ((col1 > 1)) DEFERRABLE INITIALLY DEFERRED; - - --- --- TOC entry 61068 (class 0 OID 0) --- Dependencies: 56906 --- Name: CONSTRAINT "Exclusion" ON table_for_constraints; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb --- - -COMMENT ON CONSTRAINT "Exclusion" ON test_schema_diff.table_for_constraints IS 'comments'; - - --- --- TOC entry 56910 (class 2606 OID 149176) --- Name: table_for_foreign_key table_for_foreign_key_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_foreign_key - ADD CONSTRAINT table_for_foreign_key_pkey PRIMARY KEY (col1); - - --- --- TOC entry 56897 (class 2606 OID 148993) --- Name: table_for_index table_for_index_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_index - ADD CONSTRAINT table_for_index_pkey PRIMARY KEY (col1); - - --- --- TOC entry 56908 (class 2606 OID 149151) --- Name: table_for_primary_key table_for_primary_key_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_primary_key - ADD CONSTRAINT table_for_primary_key_pkey PRIMARY KEY (col1); - - --- --- TOC entry 56902 (class 2606 OID 149041) --- Name: table_for_rule table_for_rule_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_rule - ADD CONSTRAINT table_for_rule_pkey PRIMARY KEY (col1); - - --- --- TOC entry 56900 (class 2606 OID 149020) --- Name: table_for_identical table_for_table_for_identical_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_identical - ADD CONSTRAINT table_for_table_for_identical_pkey PRIMARY KEY (col1); - - --- --- TOC entry 56904 (class 2606 OID 149073) --- Name: table_for_trigger table_for_trigger_pkey; Type: CONSTRAINT; Schema: test_schema_diff; Owner: enterprisedb --- - -ALTER TABLE ONLY test_schema_diff.table_for_trigger - ADD CONSTRAINT table_for_trigger_pkey PRIMARY KEY (col1); - - --- --- TOC entry 56893 (class 1259 OID 148994) --- Name: index1; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE INDEX index1 ON test_schema_diff.table_for_index USING btree (col2 text_pattern_ops); - - --- --- TOC entry 56894 (class 1259 OID 148995) --- Name: index2; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE INDEX index2 ON test_schema_diff.table_for_index USING btree (col2 text_pattern_ops); - - --- --- TOC entry 56898 (class 1259 OID 149021) --- Name: index_identical; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE INDEX index_identical ON test_schema_diff.table_for_identical USING btree (col2 text_pattern_ops); - - --- --- TOC entry 56895 (class 1259 OID 149212) --- Name: index_same; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE INDEX index_same ON test_schema_diff.table_for_index USING btree (col2 text_pattern_ops); - - --- --- TOC entry 56892 (class 1259 OID 139945) --- Name: mview_index; Type: INDEX; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE INDEX mview_index ON test_schema_diff."MView" USING btree (text text_pattern_ops); - - --- --- TOC entry 61045 (class 2618 OID 149042) --- Name: table_for_rule rule1; Type: RULE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE RULE rule1 AS - ON UPDATE TO test_schema_diff.table_for_rule DO INSTEAD NOTHING; - - --- --- TOC entry 61069 (class 0 OID 0) --- Dependencies: 61045 --- Name: RULE rule1 ON table_for_rule; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb --- - -COMMENT ON RULE rule1 ON test_schema_diff.table_for_rule IS 'comments'; - - --- --- TOC entry 61046 (class 2618 OID 149043) --- Name: table_for_rule rule2; Type: RULE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE RULE rule2 AS - ON UPDATE TO test_schema_diff.table_for_rule DO NOTHING; - - --- --- TOC entry 61047 (class 2618 OID 149044) --- Name: table_for_rule rule3; Type: RULE; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE RULE rule3 AS - ON INSERT TO test_schema_diff.table_for_rule DO NOTHING; - - --- --- TOC entry 61050 (class 0 OID 139938) --- Dependencies: 12250 61062 --- Name: MView; Type: MATERIALIZED VIEW DATA; Schema: test_schema_diff; Owner: enterprisedb --- - -REFRESH MATERIALIZED VIEW test_schema_diff."MView"; - - --- --- TOC entry 12284 (class 1259 OID 347823) --- Name: test view; Type: VIEW; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE VIEW test_schema_diff."test view" AS - SELECT pg_class.relname, - pg_class.relnamespace, - pg_class.reltype, - pg_class.reloftype, - pg_class.relowner, - pg_class.relam, - pg_class.relfilenode, - pg_class.reltablespace, - pg_class.relpages, - pg_class.reltuples, - pg_class.relallvisible, - pg_class.reltoastrelid, - pg_class.relhasindex, - pg_class.relisshared, - pg_class.relpersistence, - pg_class.relkind, - pg_class.relnatts, - pg_class.relchecks, - pg_class.relhasrules, - pg_class.relhastriggers, - pg_class.relhassubclass, - pg_class.relrowsecurity, - pg_class.relforcerowsecurity, - pg_class.relispopulated, - pg_class.relreplident, - pg_class.relispartition, - pg_class.relfrozenxid, - pg_class.relminmxid, - pg_class.relacl, - pg_class.reloptions, - pg_class.relpartbound - FROM pg_class - LIMIT 10; - - -ALTER TABLE test_schema_diff."test view" OWNER TO enterprisedb; - --- --- TOC entry 12285 (class 1259 OID 347828) --- Name: test view f; Type: VIEW; Schema: test_schema_diff; Owner: enterprisedb --- - -CREATE VIEW test_schema_diff."test view f" WITH (security_barrier='true') AS - SELECT 2; - - -ALTER TABLE test_schema_diff."test view f" OWNER TO enterprisedb; - --- --- TOC entry 61105 (class 0 OID 0) --- Dependencies: 12285 --- Name: VIEW "test view f"; Type: COMMENT; Schema: test_schema_diff; Owner: enterprisedb --- - -COMMENT ON VIEW test_schema_diff."test view f" IS 'cmn'; - --- Collation scripts -CREATE COLLATION test_schema_diff.coll_tar - FROM pg_catalog."POSIX"; - -ALTER COLLATION test_schema_diff.coll_tar - OWNER TO enterprisedb; - -CREATE COLLATION test_schema_diff.coll_diff - (LC_COLLATE = 'C', LC_CTYPE = 'C'); - -ALTER COLLATION test_schema_diff.coll_diff - OWNER TO enterprisedb; - --- FTS Configuration scripts -CREATE TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_tar ( - COPY=german -); - -ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_tar OWNER TO enterprisedb; - -CREATE TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ( - PARSER = default -); -ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ADD MAPPING FOR asciiword WITH dutch_stem; -ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ADD MAPPING FOR email WITH simple; -ALTER TEXT SEARCH CONFIGURATION test_schema_diff.fts_con_diff ADD MAPPING FOR hword WITH german_stem; - --- FTS Dictionary scripts -CREATE TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_tar ( - TEMPLATE = simple, - stopwords = 'english' -); - -CREATE TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_diff ( - TEMPLATE = simple, - stopwords = 'german' -); - -COMMENT ON TEXT SEARCH DICTIONARY test_schema_diff.fts_dict_diff - IS 'Comment'; - --- FTS Parser scripts -CREATE TEXT SEARCH PARSER test_schema_diff.fts_par_tar ( - START = prsd_start, - GETTOKEN = prsd_nexttoken, - END = prsd_end, - LEXTYPES = prsd_lextype); - -CREATE TEXT SEARCH PARSER test_schema_diff.fts_par_diff ( - START = int4_accum, - GETTOKEN = inet_gist_penalty, - END = btint2sortsupport, - LEXTYPES = dispell_init); - -COMMENT ON TEXT SEARCH PARSER test_schema_diff.fts_par_diff - IS 'Comment'; - --- FTS Template scripts -CREATE TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_tar ( - INIT = dispell_init, - LEXIZE = dispell_lexize -); - -CREATE TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_diff ( - INIT = dsimple_init, - LEXIZE = dsimple_lexize -); - -COMMENT ON TEXT SEARCH TEMPLATE test_schema_diff.fts_templ_diff IS 'Comment'; - --- Domain and Domain Constraint script -CREATE DOMAIN test_schema_diff.dom_tar - AS bigint - DEFAULT 100 - NOT NULL; - -ALTER DOMAIN test_schema_diff.dom_tar OWNER TO enterprisedb; - -ALTER DOMAIN test_schema_diff.dom_tar - ADD CONSTRAINT con_tar CHECK (VALUE <> 100); - -CREATE DOMAIN test_schema_diff.dom_cons_diff - AS bigint - DEFAULT 400; - -ALTER DOMAIN test_schema_diff.dom_cons_diff OWNER TO enterprisedb; - -ALTER DOMAIN test_schema_diff.dom_cons_diff - ADD CONSTRAINT cons_diff_1 CHECK (VALUE <> 40); - -ALTER DOMAIN test_schema_diff.dom_cons_diff - ADD CONSTRAINT cons_tar_only CHECK (VALUE <> 25); - -CREATE DOMAIN test_schema_diff.dom_type_diff - AS numeric(8,4); - -ALTER DOMAIN test_schema_diff.dom_type_diff OWNER TO enterprisedb; - -ALTER DOMAIN test_schema_diff.dom_type_diff - ADD CONSTRAINT cons1 CHECK (VALUE <> 45::numeric); - -ALTER DOMAIN test_schema_diff.dom_type_diff - ADD CONSTRAINT cons2 CHECK (VALUE <> 50::numeric); - -COMMENT ON DOMAIN test_schema_diff.dom_type_diff - IS 'Comment'; - --- Type Script composite type -CREATE TYPE test_schema_diff.typ_comp_tar AS -( - m1 bit(5), - m2 text COLLATE pg_catalog."POSIX" -); -ALTER TYPE test_schema_diff.typ_comp_tar - OWNER TO enterprisedb; -CREATE TYPE test_schema_diff.typ_comp_diff AS -( - m1 bit(5), - m2 text COLLATE pg_catalog."POSIX" -); -ALTER TYPE test_schema_diff.typ_comp_diff - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_comp_diff_no_column AS -( - a "char", - b "char" -); -ALTER TYPE test_schema_diff.typ_comp_diff_no_column - OWNER TO enterprisedb; - --- Type Script ENUM type -CREATE TYPE test_schema_diff.typ_enum_tar AS ENUM - ('test_enum'); -ALTER TYPE test_schema_diff.typ_enum_tar - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_enum_diff AS ENUM - ('test_enum', 'test_enum_1'); -ALTER TYPE test_schema_diff.typ_enum_diff - OWNER TO enterprisedb; - --- Type Script RANGE type -CREATE TYPE test_schema_diff.typ_range_tar AS RANGE -( - SUBTYPE=text, - COLLATION = pg_catalog."POSIX", - SUBTYPE_OPCLASS = text_ops -); -ALTER TYPE test_schema_diff.typ_range_tar - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_range_col_diff AS RANGE -( - SUBTYPE=text, - COLLATION = pg_catalog."POSIX", - SUBTYPE_OPCLASS = text_ops -); -ALTER TYPE test_schema_diff.typ_range_col_diff - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_range_subtype_diff AS RANGE -( - SUBTYPE=bool, - SUBTYPE_OPCLASS = bool_ops -); -ALTER TYPE test_schema_diff.typ_range_subtype_diff - OWNER TO enterprisedb; - --- Type Script SHELL type -CREATE TYPE test_schema_diff.typ_shell_tar; -ALTER TYPE test_schema_diff.typ_shell_tar - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_shell_diff; -ALTER TYPE test_schema_diff.typ_shell_diff - OWNER TO enterprisedb; - --- Type script to test when Type is different -CREATE TYPE test_schema_diff.typ_comp_range_diff AS RANGE -( - SUBTYPE=text, - COLLATION = pg_catalog."C", - SUBTYPE_OPCLASS = text_ops -); -ALTER TYPE test_schema_diff.typ_comp_range_diff - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_comp_enum_diff AS ENUM - ('test_enum', 'test_enum_1'); -ALTER TYPE test_schema_diff.typ_comp_enum_diff - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_range_comp_diff AS -( - m1 bigint, - m2 text[] COLLATE pg_catalog."POSIX" -); -ALTER TYPE test_schema_diff.typ_range_comp_diff - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_range_enum_diff AS ENUM - ('test_enum', 'test_enum_1'); -ALTER TYPE test_schema_diff.typ_range_enum_diff - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_enum_comp_diff AS -( - m1 bigint, - m2 text[] COLLATE pg_catalog."POSIX" -); -ALTER TYPE test_schema_diff.typ_enum_comp_diff - OWNER TO enterprisedb; - -CREATE TYPE test_schema_diff.typ_enum_range_diff AS RANGE -( - SUBTYPE=text, - COLLATION = pg_catalog."C", - SUBTYPE_OPCLASS = text_ops -); -ALTER TYPE test_schema_diff.typ_enum_range_diff - OWNER TO enterprisedb; - --- Package script (test_schema_diff only) -CREATE OR REPLACE PACKAGE test_schema_diff.pkg_tar -IS - FUNCTION get_dept_name(p_deptno numeric) RETURN character varying; - PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric); -END pkg_tar; - - -CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_tar -IS - FUNCTION get_dept_name(p_deptno numeric) RETURN character varying IS - v_dname VARCHAR2(14); - BEGIN - SELECT dname INTO v_dname FROM dept WHERE deptno = p_deptno; - RETURN v_dname; - EXCEPTION - WHEN NO_DATA_FOUND THEN - DBMS_OUTPUT.PUT_LINE('Invalid department number ' || p_deptno); - RETURN ''; - END; - - PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric) IS - BEGIN - INSERT INTO emp(empno, ename, job, sal, hiredate, comm, mgr, deptno) - VALUES(p_empno, p_ename, p_job, p_sal, - p_hiredate, p_comm, p_mgr, p_deptno); - END; -END pkg_tar; - -COMMENT ON PACKAGE test_schema_diff.pkg_tar - IS 'test_schema_diff'; - --- Package script difference in header, acl and comment -CREATE OR REPLACE PACKAGE test_schema_diff.pkg_header_diff -IS - FUNCTION get_dept_name(p_deptno numeric) RETURN character varying; -END pkg_header_diff; - -CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_header_diff -IS - FUNCTION get_dept_name(p_deptno numeric) RETURN character varying IS - v_dname VARCHAR2(14); - BEGIN - SELECT dname INTO v_dname FROM dept WHERE deptno = p_deptno; - RETURN v_dname; - EXCEPTION - WHEN NO_DATA_FOUND THEN - DBMS_OUTPUT.PUT_LINE('Invalid department number ' || p_deptno); - RETURN ''; - END; -END pkg_header_diff; - --- Package script difference in body, acl and comment -CREATE OR REPLACE PACKAGE test_schema_diff.pkg_body_diff -IS - PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric); -END pkg_body_diff; - -CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_body_diff -IS - PROCEDURE hire_emp(p_empno numeric, p_ename character varying, p_job character varying, p_sal numeric, p_hiredate timestamp without time zone, p_comm numeric, p_mgr numeric, p_deptno numeric) IS - BEGIN - DBMS_OUTPUT.PUT_LINE('Before Insert '); - INSERT INTO emp(empno, ename, job, sal, hiredate, comm, mgr, deptno) - VALUES(p_empno, p_ename, p_job, p_sal, - p_hiredate, p_comm, p_mgr, p_deptno); - DBMS_OUTPUT.PUT_LINE('After Insert '); - END; -END pkg_body_diff; - -COMMENT ON PACKAGE test_schema_diff.pkg_body_diff - IS 'Header Diff'; - -GRANT EXECUTE ON PACKAGE test_schema_diff.pkg_body_diff TO PUBLIC; -GRANT EXECUTE ON PACKAGE test_schema_diff.pkg_body_diff TO enterprisedb WITH GRANT OPTION; - --- Synonyms Scripts --- Prerequisite for synonyms -CREATE OR REPLACE FUNCTION test_schema_diff.fun_for_syn() -RETURNS void - LANGUAGE 'plpgsql' - VOLATILE - COST 100 - -AS $BODY$BEGIN -SELECT 1; -END;$BODY$; -ALTER FUNCTION test_schema_diff.fun_for_syn() - OWNER TO enterprisedb; - -CREATE OR REPLACE PROCEDURE test_schema_diff.proc_for_syn() - SECURITY DEFINER VOLATILE - COST 100 -AS $BODY$BEGIN -SELECT 1; -END;$BODY$; - -CREATE OR REPLACE PACKAGE test_schema_diff.pkg_for_syn -IS -FUNCTION get_dept_name(p_deptno numeric) RETURN character varying; -END pkg_for_syn; -CREATE OR REPLACE PACKAGE BODY test_schema_diff.pkg_for_syn -IS -FUNCTION get_dept_name(p_deptno numeric) RETURN character varying IS -BEGIN - RETURN ''; -END; -END pkg_for_syn; - -CREATE TABLE test_schema_diff.table_for_syn -( - id bigint, - name text COLLATE pg_catalog."default" -) -TABLESPACE pg_default; -ALTER TABLE test_schema_diff.table_for_syn - OWNER to enterprisedb; - -CREATE SEQUENCE test_schema_diff.seq_for_syn - INCREMENT 5 - START 1 - MINVALUE 1 - MAXVALUE 100 - CACHE 1; -ALTER SEQUENCE test_schema_diff.seq_for_syn - OWNER TO enterprisedb; - -CREATE OR REPLACE SYNONYM test_schema_diff.syn_fun_src - FOR test_schema_diff.fun_for_syn; - -CREATE OR REPLACE SYNONYM test_schema_diff.syn_pkg_src - FOR test_schema_diff.pkg_for_syn; - -CREATE OR REPLACE SYNONYM test_schema_diff.syn_proc_src - FOR test_schema_diff.proc_for_syn; - -CREATE OR REPLACE SYNONYM test_schema_diff.syn_seq_src - FOR test_schema_diff.seq_for_syn; - -CREATE OR REPLACE SYNONYM test_schema_diff.syn_table_src - FOR test_schema_diff.table_for_syn; - -CREATE OR REPLACE PROCEDURE public.proc_for_syn() - SECURITY DEFINER VOLATILE - COST 100 -AS $BODY$BEGIN -SELECT 1; -END;$BODY$; - -CREATE OR REPLACE SYNONYM test_schema_diff.syn_diff - FOR public.proc_for_syn; - --- Sequences Script -CREATE SEQUENCE test_schema_diff.seq_tar - CYCLE - INCREMENT 1 - START 1 - MINVALUE 1 - MAXVALUE 3 - CACHE 6; -ALTER SEQUENCE test_schema_diff.seq_tar - OWNER TO enterprisedb; - -CREATE SEQUENCE test_schema_diff.seq_diff_comment_acl - INCREMENT 1 - START 1 - MINVALUE 1 - MAXVALUE 9223372036854775807 - CACHE 1; - -ALTER SEQUENCE test_schema_diff.seq_diff_comment_acl - OWNER TO enterprisedb; - -CREATE SEQUENCE test_schema_diff.seq_diff_comment_acl_remove - INCREMENT 1 - START 1 - MINVALUE 1 - MAXVALUE 9223372036854775807 - CACHE 1; -ALTER SEQUENCE test_schema_diff.seq_diff_comment_acl_remove - OWNER TO enterprisedb; -COMMENT ON SEQUENCE test_schema_diff.seq_diff_comment_acl_remove - IS 'Test Comment'; -GRANT ALL ON SEQUENCE test_schema_diff.seq_diff_comment_acl_remove TO PUBLIC; -GRANT ALL ON SEQUENCE test_schema_diff.seq_diff_comment_acl_remove TO enterprisedb; - -CREATE SEQUENCE test_schema_diff.seq_diff - INCREMENT 5 - START 3 - MINVALUE 3 - MAXVALUE 80 - CACHE 1; - -ALTER SEQUENCE test_schema_diff.seq_diff - OWNER TO enterprisedb; - -CREATE SEQUENCE test_schema_diff.seq_start_diff - INCREMENT 5 - START 1 - MINVALUE 1 - MAXVALUE 20; -ALTER SEQUENCE test_schema_diff.seq_start_diff - OWNER TO enterprisedb; - --- Foreign Data Wrapper to test foreign table -CREATE FOREIGN DATA WRAPPER test_fdw_for_foreign_table; -ALTER FOREIGN DATA WRAPPER test_fdw_for_foreign_table - OWNER TO enterprisedb; - --- Foreign Server to test foreign table -CREATE SERVER test_fs_for_foreign_table - FOREIGN DATA WRAPPER test_fdw_for_foreign_table; -ALTER SERVER test_fs_for_foreign_table - OWNER TO enterprisedb; -CREATE SERVER test_fs2_for_foreign_table - FOREIGN DATA WRAPPER test_fdw_for_foreign_table; -ALTER SERVER test_fs2_for_foreign_table - OWNER TO enterprisedb; - --- Table to test inheritance in foreign table -CREATE TABLE public.test_table_for_foreign_table -( - tid bigint NOT NULL, - tname text COLLATE pg_catalog."default", - CONSTRAINT test_table_for_foreign_table_pkey PRIMARY KEY (tid) -) -WITH ( - OIDS = FALSE -) -TABLESPACE pg_default; -ALTER TABLE public.test_table_for_foreign_table - OWNER to enterprisedb; - -CREATE FOREIGN TABLE test_schema_diff.ft_tar( - fid bigint NULL, - fname text NULL COLLATE pg_catalog."default" -) - SERVER test_fs_for_foreign_table; -ALTER FOREIGN TABLE test_schema_diff.ft_tar - OWNER TO enterprisedb; -ALTER FOREIGN TABLE test_schema_diff.ft_tar - ADD CONSTRAINT fcheck CHECK ((fid > 1000)) NO INHERIT; -COMMENT ON FOREIGN TABLE test_schema_diff.ft_tar - IS 'Test Comment'; -GRANT INSERT ON TABLE test_schema_diff.ft_tar TO PUBLIC; -GRANT ALL ON TABLE test_schema_diff.ft_tar TO enterprisedb; - -CREATE FOREIGN TABLE test_schema_diff.ft_diff_col( - fid bigint NULL, - fname text NOT NULL COLLATE pg_catalog."default" -) - SERVER test_fs_for_foreign_table; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_col - OWNER TO enterprisedb; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_col - ADD CONSTRAINT fcheck CHECK ((fid > 1000)) NO INHERIT; -COMMENT ON FOREIGN TABLE test_schema_diff.ft_diff_col - IS 'Comment'; -GRANT INSERT ON TABLE test_schema_diff.ft_diff_col TO PUBLIC; -GRANT ALL ON TABLE test_schema_diff.ft_diff_col TO enterprisedb; - -CREATE FOREIGN TABLE test_schema_diff.ft_diff_const( - fid bigint NULL, - fname text NULL COLLATE pg_catalog."default" -) - SERVER test_fs_for_foreign_table; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_const - OWNER TO enterprisedb; - -ALTER FOREIGN TABLE test_schema_diff.ft_diff_const - ADD CONSTRAINT fcheck CHECK ((fid > 1000)) NO INHERIT; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_const - ADD CONSTRAINT fcheck1 CHECK ((fid > 50)) NO INHERIT NOT VALID; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_const - ADD CONSTRAINT fcheck2 CHECK ((fid > 20)) NO INHERIT; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_const - ADD CONSTRAINT fcheck_tar CHECK ((fid > 50)); - -GRANT INSERT ON TABLE test_schema_diff.ft_diff_const TO PUBLIC; -GRANT ALL ON TABLE test_schema_diff.ft_diff_const TO enterprisedb; - -CREATE FOREIGN TABLE test_schema_diff.ft_diff_opt( - fid bigint NULL, - fname text NULL COLLATE pg_catalog."default" -) - SERVER test_fs_for_foreign_table - OPTIONS (debug 'true', opt2 'val30', opt_tar 'val_tar'); - -ALTER FOREIGN TABLE test_schema_diff.ft_diff_opt - OWNER TO enterprisedb; - -CREATE FOREIGN TABLE test_schema_diff.ft_diff_foreign_server( - fid bigint NULL, - fname text NULL COLLATE pg_catalog."default" -) - SERVER test_fs2_for_foreign_table; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_foreign_server - OWNER TO enterprisedb; - -CREATE FOREIGN TABLE test_schema_diff.ft_diff_foreign_server_1( - fid bigint NULL, - fcity text NULL COLLATE pg_catalog."default" -) - SERVER test_fs2_for_foreign_table - OPTIONS (opt1 'val1', opt2 'val2'); -ALTER FOREIGN TABLE test_schema_diff.ft_diff_foreign_server_1 - OWNER TO enterprisedb; -ALTER FOREIGN TABLE test_schema_diff.ft_diff_foreign_server_1 - ADD CONSTRAINT cs2 CHECK ((fid > 200)) NO INHERIT; - --- Test for RM #5350 -CREATE TABLE test_schema_diff.events_transactions -( - event_code integer, - numerator integer, - account_token text COLLATE pg_catalog."default", - transaction_dt timestamp without time zone, - payment_method integer, - approval text COLLATE pg_catalog."default", - amount integer, - file_dt timestamp without time zone DEFAULT CURRENT_TIMESTAMP, - file_name character varying(256) COLLATE pg_catalog."default", - payment_pin integer, - transfer_dt timestamp without time zone, - transaction_type integer -); - --- Event Trigger script -CREATE FUNCTION public.evt_tri_fun() - RETURNS event_trigger - LANGUAGE 'plpgsql' - NOT LEAKPROOF -AS $BODY$ -BEGIN -PERFORM 1; -END; -$BODY$; -ALTER FUNCTION public.evt_tri_fun() - OWNER TO enterprisedb; - -CREATE FUNCTION public.evt_tri_fun2() - RETURNS event_trigger - LANGUAGE 'plpgsql' - NOT LEAKPROOF -AS $BODY$ -BEGIN -PERFORM 1; -END; -$BODY$; -ALTER FUNCTION public.evt_tri_fun2() - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_tar ON DDL_COMMAND_START - EXECUTE PROCEDURE public.evt_tri_fun(); -COMMENT ON EVENT TRIGGER evt_tri_tar - IS 'Event Trigger Source'; -ALTER EVENT TRIGGER evt_tri_tar - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_event1 ON DDL_COMMAND_END - EXECUTE PROCEDURE public.evt_tri_fun(); -ALTER EVENT TRIGGER evt_tri_diff_event1 - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_event2 ON DDL_COMMAND_START - EXECUTE PROCEDURE public.evt_tri_fun(); -ALTER EVENT TRIGGER evt_tri_diff_event2 - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_event3 ON DDL_COMMAND_START - EXECUTE PROCEDURE public.evt_tri_fun(); -ALTER EVENT TRIGGER evt_tri_diff_event3 - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_enable_status1 ON DDL_COMMAND_START - EXECUTE PROCEDURE public.evt_tri_fun(); -ALTER EVENT TRIGGER evt_tri_diff_enable_status1 - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_enable_status2 ON DDL_COMMAND_START - EXECUTE PROCEDURE public.evt_tri_fun(); -ALTER EVENT TRIGGER evt_tri_diff_enable_status2 - DISABLE; -ALTER EVENT TRIGGER evt_tri_diff_enable_status2 - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_enable_status3 ON DDL_COMMAND_START - EXECUTE PROCEDURE public.evt_tri_fun(); -ALTER EVENT TRIGGER evt_tri_diff_enable_status3 - OWNER TO enterprisedb; - -CREATE EVENT TRIGGER evt_tri_diff_func ON DDL_COMMAND_START - EXECUTE PROCEDURE public.evt_tri_fun2(); -ALTER EVENT TRIGGER evt_tri_diff_func - OWNER TO enterprisedb; - --- Extension script -CREATE EXTENSION adminpack - SCHEMA pg_catalog - VERSION "1.0"; - --- Language script -CREATE TRUSTED PROCEDURAL LANGUAGE tar_language - HANDLER plpgsql_call_handler - INLINE plpgsql_inline_handler - VALIDATOR plpgsql_validator; -ALTER LANGUAGE tar_language - OWNER TO enterprisedb; -GRANT USAGE ON LANGUAGE tar_language TO PUBLIC; -GRANT USAGE ON LANGUAGE tar_language TO enterprisedb WITH GRANT OPTION; - -CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_acl_add - HANDLER plpgsql_call_handler - INLINE plpgsql_inline_handler - VALIDATOR plpgsql_validator; -ALTER LANGUAGE lan_diff_acl_add - OWNER TO enterprisedb; - -CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_acl_revoke - HANDLER plpgsql_call_handler - INLINE plpgsql_inline_handler - VALIDATOR plpgsql_validator; -ALTER LANGUAGE lan_diff_acl_revoke - OWNER TO enterprisedb; -GRANT USAGE ON LANGUAGE lan_diff_acl_revoke TO PUBLIC; -GRANT USAGE ON LANGUAGE lan_diff_acl_revoke TO enterprisedb WITH GRANT OPTION; - -CREATE PROCEDURAL LANGUAGE lan_diff_type - HANDLER plpgsql_call_handler - INLINE plpgsql_inline_handler - VALIDATOR plpgsql_validator; -ALTER LANGUAGE lan_diff_type - OWNER TO enterprisedb; - -CREATE TRUSTED PROCEDURAL LANGUAGE lan_diff_inline_validator - HANDLER plpgsql_call_handler - INLINE plpgsql_inline_handler - VALIDATOR plpgsql_validator; -ALTER LANGUAGE lan_diff_type - OWNER TO enterprisedb; - --- Foreign Data Wrapper Script -CREATE FOREIGN DATA WRAPPER fdw_tar - VALIDATOR pg_catalog.postgresql_fdw_validator; -ALTER FOREIGN DATA WRAPPER fdw_tar - OWNER TO enterprisedb; -COMMENT ON FOREIGN DATA WRAPPER fdw_tar - IS 'Foreign Data Wrapper'; - -CREATE FOREIGN DATA WRAPPER fdw_diff_acl_add - VALIDATOR pg_catalog.postgresql_fdw_validator; -ALTER FOREIGN DATA WRAPPER fdw_diff_acl_add - OWNER TO enterprisedb; - -CREATE FOREIGN DATA WRAPPER fdw_diff_acl_revoke - VALIDATOR pg_catalog.postgresql_fdw_validator; -ALTER FOREIGN DATA WRAPPER fdw_diff_acl_revoke - OWNER TO enterprisedb; -GRANT USAGE ON FOREIGN DATA WRAPPER fdw_diff_acl_revoke TO PUBLIC; -GRANT USAGE ON FOREIGN DATA WRAPPER fdw_diff_acl_revoke TO enterprisedb WITH GRANT OPTION; - -CREATE FOREIGN DATA WRAPPER fdw_diff_add_validator; -ALTER FOREIGN DATA WRAPPER fdw_diff_add_validator - OWNER TO enterprisedb; - -CREATE FOREIGN DATA WRAPPER fdw_diff_remove_validator - VALIDATOR pg_catalog.postgresql_fdw_validator; -ALTER FOREIGN DATA WRAPPER fdw_diff_remove_validator - OWNER TO enterprisedb; - -CREATE FOREIGN DATA WRAPPER fdw_diff_add_options; -ALTER FOREIGN DATA WRAPPER fdw_diff_add_options - OWNER TO enterprisedb; - -CREATE FOREIGN DATA WRAPPER fdw_diff_remove_options - OPTIONS (debug 'true'); -ALTER FOREIGN DATA WRAPPER fdw_diff_remove_options - OWNER TO enterprisedb; - -CREATE FOREIGN DATA WRAPPER fdw_diff_options - OPTIONS (debug 'true'); -ALTER FOREIGN DATA WRAPPER fdw_diff_options - OWNER TO enterprisedb; - --- Foreign Server Script -CREATE FOREIGN DATA WRAPPER test_fdw_for_foreign_server - VALIDATOR pg_catalog.postgresql_fdw_validator; -ALTER FOREIGN DATA WRAPPER test_fdw_for_foreign_server - OWNER TO enterprisedb; - -CREATE SERVER fs_tar - TYPE 'PG' - VERSION '10' - FOREIGN DATA WRAPPER test_fdw_for_foreign_server - OPTIONS (host '127.0.0.1', port '5432'); -ALTER SERVER fs_tar - OWNER TO enterprisedb; -COMMENT ON SERVER fs_tar - IS 'Foreign Server'; - -CREATE SERVER fs_diff_acl_add - FOREIGN DATA WRAPPER test_fdw_for_foreign_server; -ALTER SERVER fs_diff_acl_add - OWNER TO enterprisedb; - -CREATE SERVER fs_diff_acl_revoke - FOREIGN DATA WRAPPER test_fdw_for_foreign_server; -ALTER SERVER fs_diff_acl_revoke - OWNER TO enterprisedb; -GRANT USAGE ON FOREIGN SERVER fs_diff_acl_revoke TO PUBLIC; -GRANT USAGE ON FOREIGN SERVER fs_diff_acl_revoke TO enterprisedb WITH GRANT OPTION; - -CREATE SERVER fs_diff_type_version_add - FOREIGN DATA WRAPPER test_fdw_for_foreign_server; -ALTER SERVER fs_diff_type_version_add - OWNER TO enterprisedb; - -CREATE SERVER fs_diff_type_version_remove - TYPE 'PG' - VERSION '10' - FOREIGN DATA WRAPPER test_fdw_for_foreign_server; -ALTER SERVER fs_diff_type_version_remove - OWNER TO enterprisedb; - -CREATE SERVER fs_diff_type_version_modify - TYPE 'EPAS' - VERSION '11' - FOREIGN DATA WRAPPER test_fdw_for_foreign_server; -ALTER SERVER fs_diff_type_version_modify - OWNER TO enterprisedb; - -CREATE SERVER fs_diff_options_add - FOREIGN DATA WRAPPER test_fdw_for_foreign_server; -ALTER SERVER fs_diff_options_add - OWNER TO enterprisedb; - -CREATE SERVER fs_diff_options_remove - FOREIGN DATA WRAPPER test_fdw_for_foreign_server - OPTIONS (host '127.0.0.1', port '5432'); -ALTER SERVER fs_diff_options_remove - OWNER TO enterprisedb; - -CREATE SERVER fs_diff_options_modify - FOREIGN DATA WRAPPER test_fdw_for_foreign_server - OPTIONS (host '127.0.0.1', port '5432'); -ALTER SERVER fs_diff_options_modify - OWNER TO enterprisedb; - --- User Mapping Script -CREATE FOREIGN DATA WRAPPER test_fdw_for_user_mapping - VALIDATOR pg_catalog.postgresql_fdw_validator; -ALTER FOREIGN DATA WRAPPER test_fdw_for_user_mapping - OWNER TO enterprisedb; - -CREATE SERVER test_fs_for_user_mapping - FOREIGN DATA WRAPPER test_fdw_for_user_mapping; -ALTER SERVER test_fs_for_user_mapping - OWNER TO enterprisedb; - -CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping - OPTIONS (password 'admin123'); - -CREATE USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping; - --- Publication script - -CREATE TABLE test_schema_diff.table_for_publication ( - col1 integer NOT NULL, - col2 text -); - -CREATE TABLE test_schema_diff.table_for_publication_in_target ( - col1 integer NOT NULL, - col2 text -); - -CREATE PUBLICATION for_all_table - FOR ALL TABLES - WITH (publish = 'insert, delete'); - -CREATE PUBLICATION with_one_table_in_target - FOR TABLE test_schema_diff.table_for_publication_in_target - WITH (publish = 'insert, delete'); - -ALTER PUBLICATION with_one_table_in_target - RENAME TO with_one_table_in_target_alter; - -ALTER PUBLICATION with_one_table_in_target_alter SET - (publish = 'insert, update'); - --- Subscription script - -CREATE SUBSCRIPTION "subscription_test1_in_target" - CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword' - PUBLICATION sample_publication - WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off'); - -ALTER SUBSCRIPTION subscription_test1_in_target - CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres'; - -ALTER SUBSCRIPTION subscription_test1_in_target - SET (synchronous_commit = 'remote_apply'); - -ALTER SUBSCRIPTION subscription_test1_in_target - SET PUBLICATION edb WITH (refresh = false); - -ALTER SUBSCRIPTION subscription_test1_in_target - RENAME TO subscription_test_in_target; - -DROP SUBSCRIPTION subscription_test_in_target; diff --git a/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/source.sql b/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/source.sql index d05f1dce226..b624a7da56a 100644 --- a/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/source.sql +++ b/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/source.sql @@ -32,7 +32,7 @@ SET default_tablespace = ''; CREATE EXTENSION btree_gist - SCHEMA test_schema_diff; + SCHEMA test_schema_diff; -- -- TOC entry 12272 (class 1259 OID 149205) @@ -937,6 +937,7 @@ 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" diff --git a/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/target.sql b/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/target.sql index 137eeb603f9..53dc4239fc9 100644 --- a/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/target.sql +++ b/web/pgadmin/tools/schema_diff/tests/ppas/11_plus/target.sql @@ -1213,7 +1213,7 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping CREATE USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping; --- Publication script +-- Publication scripts CREATE TABLE test_schema_diff.table_for_publication ( col1 integer NOT NULL, diff --git a/web/pgadmin/tools/schema_diff/tests/test_schema_diff_comp.py b/web/pgadmin/tools/schema_diff/tests/test_schema_diff_comp.py index 35ba649e646..d124832764d 100644 --- a/web/pgadmin/tools/schema_diff/tests/test_schema_diff_comp.py +++ b/web/pgadmin/tools/schema_diff/tests/test_schema_diff_comp.py @@ -117,7 +117,9 @@ def compare(self): 'target_sid': self.server_id, 'target_did': self.tar_db_id, 'ignore_owner': 0, - 'ignore_whitespaces': 0 + 'ignore_whitespaces': 0, + 'ignore_tablespace': 0, + 'ignore_grants': 0 } self.socket_client.emit('compare_database', data, namespace=self.SOCKET_NAMESPACE)