diff --git a/docs/en_US/release_notes_4_12.rst b/docs/en_US/release_notes_4_12.rst index 9613a0b04..3963ad93d 100644 --- a/docs/en_US/release_notes_4_12.rst +++ b/docs/en_US/release_notes_4_12.rst @@ -42,4 +42,5 @@ Bug fixes | `Issue #4536 `_ - Fix load on demand in View/Edit data mode. | `Issue #4552 `_ - Fix some errors thrown on the JS console when dragging text in the Query Tool. | `Issue #4559 `_ - Ensure triggers should be updated properly for EPAS server. -| `Issue #4565 `_ - Fix the reverse engineered SQL for trigger functions with the WINDOW option selected. \ No newline at end of file +| `Issue #4565 `_ - Fix the reverse engineered SQL for trigger functions with the WINDOW option selected. +| `Issue #4581 `_ - Ensure the comment on a Primary Key constraint can be edited under the Table node. \ No newline at end of file diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/index_constraint/sql/default/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/index_constraint/sql/default/update.sql index 66185329d..abc064e7f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/index_constraint/sql/default/update.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/index_constraint/sql/default/update.sql @@ -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 %} \ No newline at end of file +{% endif %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py index 5689bc2c2..c845806ae 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py @@ -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([