Fix renaming of check constraints when the table name is changed at the same time. Fixes #2201

pull/3/head
Harshal Dhumal 2017-02-24 10:44:43 +00:00 committed by Dave Page
parent 5e33fe4e95
commit 685b1ea12f
1 changed files with 3 additions and 3 deletions

View File

@ -1,13 +1,13 @@
{% if data %}
{% if data.name != o_data.name %}
ALTER TABLE {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
ALTER TABLE {{ conn|qtIdent(o_data.nspname, data.table) }}
RENAME CONSTRAINT {{ conn|qtIdent(o_data.name) }} TO {{ conn|qtIdent(data.name) }};{% endif -%}
{% if 'convalidated' in data and o_data.convalidated != data.convalidated and not data.convalidated %}
ALTER TABLE {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
ALTER TABLE {{ conn|qtIdent(o_data.nspname, data.table) }}
VALIDATE CONSTRAINT {{ conn|qtIdent(data.name) }};{% endif -%}
{% if data.comment is defined and data.comment != o_data.comment %}
COMMENT ON CONSTRAINT {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
COMMENT ON CONSTRAINT {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(o_data.nspname, data.table) }}
IS {{ data.comment|qtLiteral }};{% endif %}
{% endif -%}