public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin][RM-6312]: Serious data issue when copying/pasting rows
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin][RM-6312]: Serious data issue when copying/pasting rows
@ 2021-03-15 10:55 Nikhil Mohite <[email protected]>
  2021-03-16 06:15 ` Re: [pgAdmin][RM-6312]: Serious data issue when copying/pasting rows Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Nikhil Mohite @ 2021-03-15 10:55 UTC (permalink / raw)
  To: pgadmin-hackers

Hi Hackers,

Please find the attached patch for RM-6312
<https://redmine.postgresql.org/issues/6312;: Serious data issue when
copying/pasting rows.




-- 
*Thanks & Regards,*
*Nikhil Mohite*
*Software Engineer.*
*EDB Postgres* <https://www.enterprisedb.com/;
*Mob.No: +91-7798364578.*


Attachments:

  [application/octet-stream] RM-6312.patch (2.2K, 3-RM-6312.patch)
  download | inline diff:
diff --git a/web/pgadmin/static/js/selection/range_boundary_navigator.js b/web/pgadmin/static/js/selection/range_boundary_navigator.js
index 582e31e9..c4710027 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 85d5956e..b87051bf 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;
         }, []);
 


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [pgAdmin][RM-6312]: Serious data issue when copying/pasting rows
  2021-03-15 10:55 [pgAdmin][RM-6312]: Serious data issue when copying/pasting rows Nikhil Mohite <[email protected]>
@ 2021-03-16 06:15 ` Akshay Joshi <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Akshay Joshi @ 2021-03-16 06:15 UTC (permalink / raw)
  To: Nikhil Mohite <[email protected]>; +Cc: pgadmin-hackers

Thanks, patch applied.

On Mon, Mar 15, 2021 at 4:25 PM Nikhil Mohite <
[email protected]> wrote:

> Hi Hackers,
>
> Please find the attached patch for RM-6312
> <https://redmine.postgresql.org/issues/6312;: Serious data issue when
> copying/pasting rows.
>
>
>
>
> --
> *Thanks & Regards,*
> *Nikhil Mohite*
> *Software Engineer.*
> *EDB Postgres* <https://www.enterprisedb.com/;
> *Mob.No: +91-7798364578.*
>


-- 
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*

*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-03-16 06:15 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15 10:55 [pgAdmin][RM-6312]: Serious data issue when copying/pasting rows Nikhil Mohite <[email protected]>
2021-03-16 06:15 ` Akshay Joshi <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox