diff --git a/docs/en_US/release_notes_9_16.rst b/docs/en_US/release_notes_9_16.rst index a7ec92e1bee..9c29f5d0c8b 100644 --- a/docs/en_US/release_notes_9_16.rst +++ b/docs/en_US/release_notes_9_16.rst @@ -25,3 +25,5 @@ Housekeeping Bug fixes ********* + + | `Issue #8318 `_ - Fixed an error ("i.default.find(...) is undefined") that prevented deleting a table or relationship link in the ERD tool when a foreign key referenced a column that had been renamed. diff --git a/web/pgadmin/tools/erd/static/js/erd_tool/ERDCore.js b/web/pgadmin/tools/erd/static/js/erd_tool/ERDCore.js index ec38954865c..117e7577b97 100644 --- a/web/pgadmin/tools/erd/static/js/erd_tool/ERDCore.js +++ b/web/pgadmin/tools/erd/static/js/erd_tool/ERDCore.js @@ -526,7 +526,7 @@ export default class ERDCore { let newForeingKeys = []; tableData.foreign_key?.forEach((theFkRow)=>{ let theFk = theFkRow.columns[0]; - let attnum = _.find(tableNode.getColumns(), (col)=>col.name==theFk.local_column).attnum; + let attnum = _.find(tableNode.getColumns(), (col)=>col.name==theFk.local_column)?.attnum; /* Skip all those whose attnum and table matches to the link */ if(linkData.local_column_attnum != attnum || linkData.referenced_table_uid != theFk.references) { newForeingKeys.push(theFkRow);