Fix an issue where oid column should not be pasted when copy/paste row is used on query output containing the oid column. Fixes #4381

pull/26/head
Aditya Toshniwal 2019-08-28 13:35:40 +05:30 committed by Akshay Joshi
parent ac298b03c0
commit 028473eb83
3 changed files with 11 additions and 3 deletions

View File

@ -25,6 +25,7 @@ Bug fixes
| `Issue #2706 <https://redmine.postgresql.org/issues/2706>`_ - Added ProjectSet icon for explain module.
| `Issue #2828 <https://redmine.postgresql.org/issues/2828>`_ - Added Gather Merge, Named Tuple Store Scan and Table Function Scan icon for explain module.
| `Issue #3778 <https://redmine.postgresql.org/issues/3778>`_ - Ensure Boolean columns should be editable using keyboard keys.
| `Issue #4381 <https://redmine.postgresql.org/issues/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 <https://redmine.postgresql.org/issues/4419>`_ - Fix a debugger error when using Python 2.7.
| `Issue #4486 <https://redmine.postgresql.org/issues/4486>`_ - Ensure View should be created with special characters.
| `Issue #4487 <https://redmine.postgresql.org/issues/4487>`_ - Ensure Boolean columns should be editable in View/Edit data and Query Tool.

View File

@ -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,

View File

@ -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({