Ensure the comment on a Primary Key constraint can be edited under the Table node. Fixes #4581

This commit is contained in:
Khushboo Vashi 2019-08-08 09:52:10 +01:00 committed by Dave Page
parent 7f53e13aa7
commit c29275011a
3 changed files with 8 additions and 3 deletions

View File

@ -42,4 +42,5 @@ Bug fixes
| `Issue #4536 <https://redmine.postgresql.org/issues/4536>`_ - Fix load on demand in View/Edit data mode.
| `Issue #4552 <https://redmine.postgresql.org/issues/4552>`_ - Fix some errors thrown on the JS console when dragging text in the Query Tool.
| `Issue #4559 <https://redmine.postgresql.org/issues/4559>`_ - Ensure triggers should be updated properly for EPAS server.
| `Issue #4565 <https://redmine.postgresql.org/issues/4565>`_ - Fix the reverse engineered SQL for trigger functions with the WINDOW option selected.
| `Issue #4565 <https://redmine.postgresql.org/issues/4565>`_ - Fix the reverse engineered SQL for trigger functions with the WINDOW option selected.
| `Issue #4581 <https://redmine.postgresql.org/issues/4581>`_ - Ensure the comment on a Primary Key constraint can be edited under the Table node.

View File

@ -1,7 +1,7 @@
{### SQL to update constraint object ###}
{% if data %}
{# ==== To update constraint name ==== #}
{% if data.name != o_data.name %}
{% if data.name and data.name != o_data.name %}
ALTER TABLE {{ conn|qtIdent(data.schema, data.table) }}
RENAME CONSTRAINT {{ conn|qtIdent(o_data.name) }} TO {{ conn|qtIdent(data.name) }};
{% endif %}
@ -19,4 +19,4 @@ ALTER INDEX {{ conn|qtIdent(data.schema, data.name) }}
COMMENT ON CONSTRAINT {{ conn|qtIdent(data.name) }} ON {{ conn|qtIdent(data.schema, data.table) }}
IS {{ data.comment|qtLiteral }};
{% endif %}
{% endif %}
{% endif %}

View File

@ -1325,6 +1325,10 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
return internal_server_error(errormsg=res)
old_data = res['rows'][0]
# If changes are from table node
if 'name' not in c:
c['name'] = old_data['name']
# Sql to update object
sql.append(
render_template("/".join([