diff --git a/docs/en_US/release_notes_5_1.rst b/docs/en_US/release_notes_5_1.rst index bb1b600c7..684cfd805 100644 --- a/docs/en_US/release_notes_5_1.rst +++ b/docs/en_US/release_notes_5_1.rst @@ -49,3 +49,4 @@ Bug fixes | `Issue #6286 `_ - Ensure that the template database should be visible while creating the database. | `Issue #6292 `_ - Fixed string index out of range error where the dependent tab is in focus and selecting any publication or table. | `Issue #6294 `_ - Fixed an issue where the dependent tab throwing an error when selecting any login/group role. +| `Issue #6312 `_ - Fixed an issue where copy/paste rows in view data paste the wrong value for boolean type. diff --git a/web/pgadmin/static/js/selection/range_boundary_navigator.js b/web/pgadmin/static/js/selection/range_boundary_navigator.js index 582e31e92..c4710027d 100644 --- a/web/pgadmin/static/js/selection/range_boundary_navigator.js +++ b/web/pgadmin/static/js/selection/range_boundary_navigator.js @@ -158,6 +158,8 @@ define(['sources/selection/range_selection_helper', 'json-bignumber'], val = quote_char + JSONBigNumber.stringify(val) + quote_char; } else if (val && cell_type != 'number' && cell_type != 'boolean') { val = quote_char + escape(val.toString()) + quote_char; + } else if (cell_type == 'string' && _.isNull(val)){ + val = null; } else if (_.isNull(val) || _.isUndefined(val)) { val = ''; } diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index 85d5956ef..b87051bf7 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -4172,6 +4172,7 @@ define('tools.querytool', [ if(pgAdmin.SqlEditor.copiedInOtherSessionWithHeaders) { copied_rows = copied_rows.slice(1); } + var row_index = 0; copied_rows = copied_rows.reduce((partial, values) => { // split each row with field separator character let row = {}; @@ -4182,13 +4183,27 @@ define('tools.querytool', [ if(v === '') { if(self.columns[col].has_default_val) { v = undefined; + } else if (self.copied_rows[row_index][self.columns[col].display_name] === null) { + v = null; + } else { + v = ''; + } + } + + if(self.columns[col].cell === 'boolean') { + if(v == 'true') { + v = true; + } else if(v == 'false') { + v = false; } else { v = null; } } + row[self.columns[col].name] = v; } partial.push(row); + row_index ++; return partial; }, []);