Include the WHERE clause on EXCLUDE constraints in RE-SQL. Fixes #3726

This commit is contained in:
Akshay Joshi 2018-12-18 13:37:04 +00:00 committed by Dave Page
parent 72ba5bdaee
commit c973c3387e
7 changed files with 16 additions and 11 deletions

View File

@ -22,6 +22,7 @@ Bug fixes
| `Bug #3599 <https://redmine.postgresql.org/issues/3599>`_ - Run Postfix in the container build so passwords can be reset etc.
| `Bug #3619 <https://redmine.postgresql.org/issues/3619>`_ - Add titles to the code areas of the Query Tool and Debugger to ensure that panels can be re-docked within them.
| `Bug #3711 <https://redmine.postgresql.org/issues/3711>`_ - Fix an encoding issue in the query tool.
| `Bug #3726 <https://redmine.postgresql.org/issues/3726>`_ - Include the WHERE clause on EXCLUDE constraints in RE-SQL.
| `Bug #3757 <https://redmine.postgresql.org/issues/3757>`_ - Hide Radio buttons that should not be shown on the maintenance dialogue.
| `Bug #3797 <https://redmine.postgresql.org/issues/3797>`_ - Prevent attempts to bulk-drop schema objects.
| `Bug #3798 <https://redmine.postgresql.org/issues/3798>`_ - Ensure the browser toolbar buttons work in languages other than English.

View File

@ -764,8 +764,8 @@ define('pgadmin.node.exclusion_constraint', [
}
},
},{
id: 'constraint', label: gettext('Constraint'), cell: 'string',
type: 'multiline', mode: ['create', 'edit'], editable: false,
id: 'indconstraint', label: gettext('Constraint'), cell: 'string',
type: 'multiline', mode: ['create', 'edit', 'properties'], editable: false,
group: gettext('Definition'), disabled: function(m) {
return ((_.has(m, 'handler') &&
!_.isUndefined(m.handler) &&

View File

@ -59,6 +59,7 @@ class ExclusionConstraintAddTestCase(BaseTestGenerator):
"columns": [
{"column": "id", "sort_order": False, "nulls": False,
"operator": "="}],
"indconstraint": "(1=2)",
"include": ["name"]
}
response = self.tester.post(

View File

@ -8,12 +8,12 @@ ALTER TABLE {{ conn|qtIdent(data.schema, data.table) }}
WITH (FILLFACTOR={{data.fillfactor}}){% endif %}{% if data.spcname and data.spcname != "pg_default" %}
USING INDEX TABLESPACE {{ conn|qtIdent(data.spcname) }}{% endif %}
USING INDEX TABLESPACE {{ conn|qtIdent(data.spcname) }}{% endif %}{% if data.indconstraint %}
WHERE ({{data.indconstraint}}){% endif%}
{% if data.condeferrable %}
DEFERRABLE{% if data.condeferred %}
INITIALLY DEFERRED{% endif%}
{% endif%}{% if data.constraint %} WHERE ({{data.constraint}}){% endif%};
INITIALLY DEFERRED{% endif%}{% endif%};
{% if data.comment and data.name %}
COMMENT ON CONSTRAINT {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(data.schema, data.table) }}

View File

@ -15,7 +15,8 @@ SELECT cls.oid,
END AS comment,
condeferrable,
condeferred,
substring(array_to_string(cls.reloptions, ',') from 'fillfactor=([0-9]*)') AS fillfactor
substring(array_to_string(cls.reloptions, ',') from 'fillfactor=([0-9]*)') AS fillfactor,
pg_get_expr(idx.indpred, idx.indrelid) AS indconstraint
FROM pg_index idx
JOIN pg_class cls ON cls.oid=indexrelid
JOIN pg_class tab ON tab.oid=indrelid

View File

@ -4,14 +4,15 @@ ALTER TABLE {{ conn|qtIdent(data.schema, data.table) }}
{% endif %}{{ conn|qtIdent(col.column)}}{% if col.oper_class and col.oper_class != '' %} {{col.oper_class}}{% endif%}{% if col.order is defined and col.is_sort_nulls_applicable %}{% if col.order %} ASC{% else %} DESC{% endif %} NULLS{% endif %} {% if col.nulls_order is defined and col.is_sort_nulls_applicable %}{% if col.nulls_order %}FIRST {% else %}LAST {% endif %}{% endif %}WITH {{col.operator}}{% endfor %}){% if data.fillfactor %}
WITH (FILLFACTOR={{data.fillfactor}}){% endif %}{% if data.spcname and data.spcname != "pg_default" %}
USING INDEX TABLESPACE {{ conn|qtIdent(data.spcname) }}{% endif %}
USING INDEX TABLESPACE {{ conn|qtIdent(data.spcname) }}{% endif %}{% if data.indconstraint %}
WHERE ({{data.indconstraint}}){% endif%}
{% if data.condeferrable %}
DEFERRABLE{% if data.condeferred %}
INITIALLY DEFERRED{% endif%}
{% endif%}{% if data.constraint %} WHERE ({{data.constraint}}){% endif%};
INITIALLY DEFERRED{% endif%}{% endif%};
{% if data.comment and data.name %}
COMMENT ON CONSTRAINT {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(data.schema, data.table) }}
IS {{ data.comment|qtLiteral }};
{% endif %}
{% endif %}

View File

@ -15,7 +15,8 @@ SELECT cls.oid,
END AS comment,
condeferrable,
condeferred,
substring(array_to_string(cls.reloptions, ',') from 'fillfactor=([0-9]*)') AS fillfactor
substring(array_to_string(cls.reloptions, ',') from 'fillfactor=([0-9]*)') AS fillfactor,
pg_get_expr(idx.indpred, idx.indrelid) AS indconstraint
FROM pg_index idx
JOIN pg_class cls ON cls.oid=indexrelid
JOIN pg_class tab ON tab.oid=indrelid