Fixed schema diff issue in which the option 'null' doesn't appear in the DDL statement for the foreign table. Fixes #7265

This commit is contained in:
Akshay Joshi 2022-03-25 16:39:20 +05:30
parent 826d2d913c
commit d548a5bc50
8 changed files with 23 additions and 22 deletions

View File

@ -25,5 +25,6 @@ Bug fixes
| `Issue #7238 <https://redmine.postgresql.org/issues/7238>`_ - Fixed an issue where foreign key is not removed even if the referred table is removed in ERD.
| `Issue #7257 <https://redmine.postgresql.org/issues/7257>`_ - Support running the container under OpenShift with alternate UIDs.
| `Issue #7261 <https://redmine.postgresql.org/issues/7261>`_ - Correct typo in the documentation.
| `Issue #7265 <https://redmine.postgresql.org/issues/7265>`_ - Fixed schema diff issue in which the option 'null' doesn't appear in the DDL statement for the foreign table.
| `Issue #7267 <https://redmine.postgresql.org/issues/7267>`_ - Fixed an issue where unexpected error messages are displayed when users change the language via preferences.
| `Issue #7269 <https://redmine.postgresql.org/issues/7269>`_ - Ensure that pgAdmin4 should work with latest jinja2 version.

View File

@ -5,7 +5,7 @@ CREATE FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}(
{% if data.columns %}
{% for c in data.columns %}
{{conn|qtIdent(c.attname)}} {% if is_sql %}{{ c.fulltype }}{% else %}{{c.datatype }}{% if c.typlen %}({{c.typlen}}{% if c.precision %}, {{c.precision}}{% endif %}){% endif %}{% if c.isArrayType %}[]{% endif %}{% endif %}{% if c.coloptions %}
{% for o in c.coloptions %}{% if o.option and o.value %}
{% for o in c.coloptions %}{% if o.option is defined and o.value is defined %}
{% if loop.first %} OPTIONS ({% endif %}{% if not loop.first %}, {% endif %}{{o.option}} {{o.value|qtLiteral}}{% if loop.last %}){% endif %}{% endif %}
{% endfor %}{% endif %}{% if c.attnotnull %}
NOT NULL{% else %} NULL{% endif %}{% if c.typdefault is defined and c.typdefault is not none %}
@ -18,7 +18,7 @@ CREATE FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}(
SERVER {{ conn|qtIdent(data.ftsrvname) }}{% if data.ftoptions %}
{% for o in data.ftoptions %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
{% 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 %}

View File

@ -25,7 +25,7 @@ ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
ADD COLUMN {{conn|qtIdent(c.attname)}} {{ c.datatype }}{% if c.typlen %}({{c.typlen}}{% if c.precision %}, {{c.precision}}{% endif %}){% endif %}{% if c.isArrayType %}[]{% endif %}
{% if c.coloptions %}
{% for o in c.coloptions %}{% if o.option and o.value %}
{% for o in c.coloptions %}{% if o.option is defined and o.value is defined %}
{% if loop.first %} OPTIONS ({% endif %}{% if not loop.first %}, {% endif %}{{o.option}} {{o.value|qtLiteral}}{% if loop.last %}){% endif %}{% endif %}
{% endfor %}{% endif %}
{% if c.attnotnull %} NOT NULL{% else %} NULL{% endif %}
@ -70,13 +70,13 @@ ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
{% endif %}
{% endfor %}
{% for o in c.coloptions_updated.added %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
{% if loop.first %}ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
ALTER COLUMN {{conn|qtIdent(col_name)}} OPTIONS (ADD {% endif %}{% if not loop.first %}, {% endif %}{{o.option}} {{o.value|qtLiteral}}{% if loop.last %});{% endif %}
{% endif %}
{% endfor %}
{% for o in c.coloptions_updated.changed %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
{% if loop.first %}ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
ALTER COLUMN {{conn|qtIdent(col_name)}} OPTIONS (SET {% endif %}{% if not loop.first %}, {% endif %}{{o.option}} {{o.value|qtLiteral}}{% if loop.last %});{% endif %}
{% endif %}
@ -98,21 +98,21 @@ ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
{% endif -%}
{% if data.ftoptions %}
{% for o in data.ftoptions.deleted %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
OPTIONS ( DROP {{o.option}});
{% endif %}
{% endfor %}
{% for o in data.ftoptions.added %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
OPTIONS (ADD {{o.option}} {{o.value|qtLiteral}});
{% endif %}
{% endfor %}
{% for o in data.ftoptions.changed %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
OPTIONS (SET {{o.option}} {{o.value|qtLiteral}});

View File

@ -8,7 +8,7 @@ CREATE FOREIGN TABLE{% if add_not_exists_clause %} IF NOT EXISTS{% endif %} {{ c
{% if (not c.inheritedfrom or c.inheritedfrom =='' or c.inheritedfrom == None or c.inheritedfrom == 'None' ) %}
{% if is_columns.append('1') %}{% endif %}
{{conn|qtIdent(c.attname)}} {% if is_sql %}{{ c.fulltype }}{% else %}{{c.datatype }}{% if c.typlen %}({{c.typlen}}{% if c.precision %}, {{c.precision}}{% endif %}){% endif %}{% if c.isArrayType %}[]{% endif %}{% endif %}{% if c.coloptions %}
{% for o in c.coloptions %}{% if o.option and o.value %}
{% for o in c.coloptions %}{% if o.option is defined and o.value is defined %}
{% if loop.first %} OPTIONS ({% endif %}{% if not loop.first %}, {% endif %}{{o.option}} {{o.value|qtLiteral}}{% if loop.last %}){% endif %}{% endif %}
{% endfor %}{% endif %}
{% if c.attnotnull %} NOT NULL{% else %} NULL{% endif %}
@ -27,7 +27,7 @@ CREATE FOREIGN TABLE{% if add_not_exists_clause %} IF NOT EXISTS{% endif %} {{ c
SERVER {{ conn|qtIdent(data.ftsrvname) }}{% if data.ftoptions %}
{% for o in data.ftoptions %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
{% 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 %}

View File

@ -17,7 +17,7 @@ CREATE FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, o_data.name) }}(
{% if (not c.inheritedfrom or c.inheritedfrom =='' or c.inheritedfrom == None or c.inheritedfrom == 'None' ) %}
{% if is_columns.append('1') %}{% endif %}
{{conn|qtIdent(c.attname)}} {% if is_sql %}{{ c.fulltype }}{% else %}{{c.datatype }}{% if c.typlen %}({{c.typlen}}{% if c.precision %}, {{c.precision}}{% endif %}){% endif %}{% if c.isArrayType %}[]{% endif %}{% endif %}{% if c.coloptions %}
{% for o in c.coloptions %}{% if o.option and o.value %}
{% for o in c.coloptions %}{% if o.option is defined and o.value is defined %}
{% if loop.first %} OPTIONS ({% endif %}{% if not loop.first %}, {% endif %}{{o.option}} {{o.value|qtLiteral}}{% if loop.last %}){% endif %}{% endif %}
{% endfor %}{% endif %}
{% if c.attnotnull %} NOT NULL{% else %} NULL{% endif %}
@ -36,7 +36,7 @@ CREATE FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, o_data.name) }}(
SERVER {{ conn|qtIdent(data.ftsrvname) }}{% if ftoptions %}
{% for o in ftoptions %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
{% 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 or o_data.owner%}

View File

@ -26,7 +26,7 @@ ALTER FOREIGN TABLE IF EXISTS {{ conn|qtIdent(o_data.basensp, name) }}
ALTER FOREIGN TABLE IF EXISTS {{ conn|qtIdent(o_data.basensp, name) }}
ADD COLUMN {{conn|qtIdent(c.attname)}} {{ c.datatype }}{% if c.typlen %}({{c.typlen}}{% if c.precision %}, {{c.precision}}{% endif %}){% endif %}{% if c.isArrayType %}[]{% endif %}
{% if c.coloptions %}
{% for o in c.coloptions %}{% if o.option and o.value %}
{% for o in c.coloptions %}{% if o.option is defined and o.value is defined %}
{% if loop.first %} OPTIONS ({% endif %}{% if not loop.first %}, {% endif %}{{o.option}} {{o.value|qtLiteral}}{% if loop.last %}){% endif %}{% endif %}
{% endfor %}{% endif %}
{% if c.attnotnull %} NOT NULL{% else %} NULL{% endif %}
@ -72,13 +72,13 @@ ALTER FOREIGN TABLE IF EXISTS {{ conn|qtIdent(o_data.basensp, name) }}
{% endif %}
{% endfor %}
{% for o in c.coloptions_updated.added %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
{% if loop.first %}ALTER FOREIGN TABLE IF EXISTS {{ conn|qtIdent(o_data.basensp, name) }}
ALTER COLUMN {{conn|qtIdent(col_name)}} OPTIONS (ADD {% endif %}{% if not loop.first %}, {% endif %}{{o.option}} {{o.value|qtLiteral}}{% if loop.last %});{% endif %}
{% endif %}
{% endfor %}
{% for o in c.coloptions_updated.changed %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
{% if loop.first %}ALTER FOREIGN TABLE IF EXISTS {{ conn|qtIdent(o_data.basensp, name) }}
ALTER COLUMN {{conn|qtIdent(col_name)}} OPTIONS (SET {% endif %}{% if not loop.first %}, {% endif %}{{o.option}} {{o.value|qtLiteral}}{% if loop.last %});{% endif %}
{% endif %}
@ -142,21 +142,21 @@ ALTER FOREIGN TABLE IF EXISTS {{ conn|qtIdent(o_data.basensp, name) }}
{% endif %}
{% if data.ftoptions %}
{% for o in data.ftoptions.deleted %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
ALTER FOREIGN TABLE IF EXISTS {{ conn|qtIdent(o_data.basensp, name) }}
OPTIONS ( DROP {{o.option}});
{% endif %}
{% endfor %}
{% for o in data.ftoptions.added %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
ALTER FOREIGN TABLE IF EXISTS {{ conn|qtIdent(o_data.basensp, name) }}
OPTIONS (ADD {{o.option}} {{o.value|qtLiteral}});
{% endif %}
{% endfor %}
{% for o in data.ftoptions.changed %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
ALTER FOREIGN TABLE IF EXISTS {{ conn|qtIdent(o_data.basensp, name) }}
OPTIONS (SET {{o.option}} {{o.value|qtLiteral}});

View File

@ -12,7 +12,7 @@ CREATE FOREIGN TABLE{% if add_not_exists_clause %} IF NOT EXISTS{% endif %} {{ c
SERVER {{ conn|qtIdent(data.ftsrvname) }}{% if data.ftoptions %}
{% for o in data.ftoptions %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
{% 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 %}

View File

@ -57,21 +57,21 @@ ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
{% endif -%}
{% if data.ftoptions %}
{% for o in data.ftoptions.deleted %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
OPTIONS (DROP {{o.option}});
{% endif %}
{% endfor %}
{% for o in data.ftoptions.added %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
OPTIONS (ADD {{o.option}} {{o.value|qtLiteral}});
{% endif %}
{% endfor %}
{% for o in data.ftoptions.changed %}
{% if o.option and o.value %}
{% if o.option is defined and o.value is defined %}
ALTER FOREIGN TABLE {{ conn|qtIdent(o_data.basensp, name) }}
OPTIONS (SET {{o.option}} {{o.value|qtLiteral}});