1) Fixed schema diff owner related issue. Fixes #6877

2) Fixed schema diff related some issues. Fixes #6957
pull/63/head
Akshay Joshi 2021-12-11 22:10:28 +05:30
parent 441a3d4533
commit bd545fd5b2
11 changed files with 24 additions and 11 deletions

View File

@ -25,8 +25,10 @@ Bug fixes
*********
| `Issue #6840 <https://redmine.postgresql.org/issues/6840>`_ - Fixed an issue where tooltip data are not displaying on downloaded graphical explain plan.
| `Issue #6877 <https://redmine.postgresql.org/issues/6877>`_ - Fixed schema diff owner related issue.
| `Issue #6906 <https://redmine.postgresql.org/issues/6906>`_ - Fixed an issue where referenced table drop-down should be disabled in foreign key -> columns after one row is added.
| `Issue #6955 <https://redmine.postgresql.org/issues/6955>`_ - Ensure that sort order should be maintained when renaming a server group.
| `Issue #6957 <https://redmine.postgresql.org/issues/6957>`_ - Fixed schema diff related some issues.
| `Issue #6963 <https://redmine.postgresql.org/issues/6963>`_ - Ensure that the user should be allowed to set the schema of an extension while creating it.
| `Issue #6978 <https://redmine.postgresql.org/issues/6978>`_ - Increase the width of the scrollbars.
| `Issue #6986 <https://redmine.postgresql.org/issues/6986>`_ - Fixed an issue where the user can't debug function with timestamp parameter.

View File

@ -13,6 +13,9 @@ CREATE EVENT TRIGGER {{ conn|qtIdent(data.name) if data.name else conn|qtIdent(o
WHEN TAG IN ({{ data.when if data.when else o_data.when }})
{% endif %}
EXECUTE PROCEDURE {{ data.eventfunname if data.eventfunname else o_data.eventfunname }}();
ALTER EVENT TRIGGER {{ conn|qtIdent(o_data.name) }}
OWNER TO {{ conn|qtIdent(o_data.eventowner) }};
{% else %}
{% if data.name and data.name != o_data.name %}

View File

@ -29,6 +29,9 @@ CREATE SERVER {{ conn|qtIdent(o_data.name) }}{% if fsrvtype %}
OPTIONS ({% for variable in o_data.fsrvoptions %}{% if loop.index != 1 %}, {% endif %}
{{ conn|qtIdent(variable.fsrvoption) }} {{ variable.fsrvvalue|qtLiteral }}{% endfor %}){% endif %};
ALTER SERVER {{ conn|qtIdent(o_data.name) }}
OWNER TO {{ conn|qtIdent(o_data.fsrvowner) }};
{% else %}
{# ============= Update foreign server name ============= #}
{% if data.name != o_data.name %}

View File

@ -22,6 +22,9 @@ CREATE{% if tmp_trusted %} TRUSTED{% endif %} PROCEDURAL LANGUAGE {{ conn|qtIden
{% if tmp_lanval %}
VALIDATOR {{ conn|qtIdent(tmp_lanval) }}
{% endif %};
ALTER LANGUAGE {{ conn|qtIdent(o_data.name) }}
OWNER TO {{ conn|qtIdent(o_data.lanowner) }};
{% endif %}
{# ============= Update language name ============= #}
{% if data.name != o_data.name %}

View File

@ -17,6 +17,8 @@ CREATE COLLATION {{ conn|qtIdent(o_data.schema, o_data.name) }}
FROM {{ data.copy_collation }};
{% endif %}
ALTER COLLATION {{ conn|qtIdent(o_data.schema, o_data.name) }}
OWNER TO {{ conn|qtIdent(o_data.owner) }};
{% endif %}
{% if data.owner and data.owner != o_data.owner %}
ALTER COLLATION {{ conn|qtIdent(o_data.schema, o_data.name) }}

View File

@ -14,8 +14,8 @@ CREATE DOMAIN {{ conn|qtIdent(o_data.basensp, o_data.name) }}
NOT NULL{% endif %};
{% if data.owner %}
ALTER DOMAIN {{ conn|qtIdent(o_data.basensp, o_data.name) }} OWNER TO {{ conn|qtIdent(data.owner) }};
{% if data.owner or o_data.owner %}
ALTER DOMAIN {{ conn|qtIdent(o_data.basensp, o_data.name) }} OWNER TO {% if data.owner %}{{ conn|qtIdent(data.owner) }}{% else %}{{ conn|qtIdent(o_data.owner) }}{% endif %};
{% endif %}
{% if data.constraints %}
{% for c in data.constraints.added %}{% if c.conname and c.consrc %}

View File

@ -39,10 +39,10 @@ CREATE FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, o_data.name) }}(
{% if o.option and o.value %}
{% if loop.first %} OPTIONS ({% endif %}{% if not loop.first %}, {% endif %}{{o.option}} {{o.value|qtLiteral}}{% if loop.last %}){% endif %}{% endif %}
{% endfor %}{% endif %};
{% if data.owner %}
{% if data.owner or o_data.owner%}
ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, o_data.name) }}
OWNER TO {{ conn|qtIdent(data.owner) }};
OWNER TO {% if data.owner %}{{ conn|qtIdent(data.owner) }}{% else %}{{ conn|qtIdent(o_data.owner) }}{% endif %};
{% endif -%}
{% if constraints %}
{% for c in constraints %}

View File

@ -19,13 +19,12 @@ from pgadmin.tools.schema_diff.node_registry import SchemaDiffRegistry
class SchemaDiffTableCompare(SchemaDiffObjectCompare):
table_keys_to_ignore = ['oid', 'schema', 'edit_types',
table_keys_to_ignore = ['oid', 'schema', 'edit_types', 'attnum',
'col_type', 'references', 'reltuples', 'oid-2',
'rows_cnt', 'hastoasttable', 'relhassubclass',
'relacl_str', 'setting']
column_keys_to_ignore = ['attnum', 'atttypid', 'edit_types', 'elemoid',
'seqrelid']
column_keys_to_ignore = ['atttypid', 'edit_types', 'elemoid', 'seqrelid']
constraint_keys_to_ignore = ['relname', 'nspname', 'parent_tbl',
'attrelid', 'adrelid', 'fknsp', 'confrelid',

View File

@ -217,7 +217,8 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
})
keys_to_ignore = ['oid', 'typnamespace', 'typrelid', 'typarray', 'alias',
'schema', 'oid-2', 'type_acl', 'rngcollation', 'attnum']
'schema', 'oid-2', 'type_acl', 'rngcollation', 'attnum',
'typowner']
def check_precondition(f):
"""

View File

@ -62,11 +62,11 @@ CREATE TYPE {% if o_data.schema %}{{ conn|qtIdent(o_data.schema, o_data.name) }}
);
{% endif %}
{### Type Owner ###}
{% if data and data.typeowner %}
{% 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 {{ conn|qtIdent(data.typeowner) }};
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 %}

View File

@ -390,7 +390,7 @@ def compare_dictionaries(**kwargs):
if ignore_owner:
owner_keys = ['owner', 'eventowner', 'funcowner', 'fdwowner',
'fsrvowner', 'lanowner', 'relowner', 'seqowner',
'typowner', 'typeowner']
'typeowner']
ignore_keys = ignore_keys + owner_keys
# Compare the values of duplicates keys.