diff --git a/docs/en_US/release_notes_4_13.rst b/docs/en_US/release_notes_4_13.rst index 3630d2f2a..1f28ec984 100644 --- a/docs/en_US/release_notes_4_13.rst +++ b/docs/en_US/release_notes_4_13.rst @@ -25,6 +25,7 @@ Bug fixes | `Issue #2706 `_ - Added ProjectSet icon for explain module. | `Issue #2828 `_ - Added Gather Merge, Named Tuple Store Scan and Table Function Scan icon for explain module. | `Issue #3778 `_ - Ensure Boolean columns should be editable using keyboard keys. +| `Issue #4381 `_ - Fix an issue where oid column should not be pasted when copy/paste row is used on query output containing the oid column. | `Issue #4419 `_ - Fix a debugger error when using Python 2.7. | `Issue #4486 `_ - Ensure View should be created with special characters. | `Issue #4487 `_ - Ensure Boolean columns should be editable in View/Edit data and Query Tool. diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index 82ceb3f5b..905f84227 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -3712,6 +3712,10 @@ define('tools.querytool', [ new_row.is_row_copied = true; self.temp_new_rows.push(count); new_row[self.client_primary_key] = _key; + if(self.has_oids && new_row.oid) { + new_row.oid = null; + } + dataView.addItem(new_row); self.data_store.added[_key] = { 'err': false, diff --git a/web/pgadmin/tools/sqleditor/utils/save_changed_data.py b/web/pgadmin/tools/sqleditor/utils/save_changed_data.py index 12df12e42..cdfdc2116 100644 --- a/web/pgadmin/tools/sqleditor/utils/save_changed_data.py +++ b/web/pgadmin/tools/sqleditor/utils/save_changed_data.py @@ -98,7 +98,6 @@ def save_changed_data(changed_data, columns_info, conn, command_obj, # of not null which is set by default. column_data = {} pk_names, primary_keys = command_obj.get_primary_keys() - has_oids = 'oid' in column_type for each_row in added_index: # Get the row index to match with the added rows @@ -109,6 +108,10 @@ def save_changed_data(changed_data, columns_info, conn, command_obj, data.pop(client_primary_key, None) data.pop('is_row_copied', None) + # Remove oid col + if command_obj.has_oids(): + data.pop('oid', None) + # Update columns value with columns having # not_null=False and has no default value column_data.update(data) @@ -122,7 +125,7 @@ def save_changed_data(changed_data, columns_info, conn, command_obj, nsp_name=command_obj.nsp_name, data_type=column_type, pk_names=pk_names, - has_oids=has_oids + has_oids=command_obj.has_oids() ) select_sql = render_template( @@ -130,7 +133,7 @@ def save_changed_data(changed_data, columns_info, conn, command_obj, object_name=command_obj.object_name, nsp_name=command_obj.nsp_name, primary_keys=primary_keys, - has_oids=has_oids + has_oids=command_obj.has_oids() ) list_of_sql[of_type].append({