public inbox for [email protected]  
help / color / mirror / Atom feed
From: Aditya Toshniwal <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM5807] Removed columns use modified name in generated script
Date: Thu, 17 Sep 2020 15:28:20 +0530
Message-ID: <CAM9w-_=ENcWVh4EmE2Ytx2+jyV9s-+_EBAhF7kg9FxNAD8Ppuw@mail.gmail.com> (raw)

Hi Hackers,

If a column is renamed and then removed, then drop SQL query takes the
renamed column and not the original one.
Attached is the patch to fix this issue.

-- 
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com*
<http://edbpostgres.com;
"Don't Complain about Heat, Plant a TREE"


Attachments:

  [application/octet-stream] RM5807.patch (966B, 3-RM5807.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/static/js/datamodel.js b/web/pgadmin/browser/static/js/datamodel.js
index cd74982ec..ce1a4706a 100644
--- a/web/pgadmin/browser/static/js/datamodel.js
+++ b/web/pgadmin/browser/static/js/datamodel.js
@@ -386,8 +386,8 @@ define([
         }
 
         self.trigger('pgadmin-session:set', self, attrs);
-        if (!options || !options.silent) {
-          self.trigger('change', self, options);
+        if (!opts || !opts.silent) {
+          self.trigger('change', self, opts);
         }
 
         // Perform default validations.
@@ -1132,7 +1132,8 @@ define([
           } else {
             (self.handler || self).trigger('pgadmin-session:removed', self, copy);
           }
-
+          /* When removing the object use the original session attrs and not the changed ones */
+          obj.set(obj.origSessAttrs, {silent: true});
           self.sessAttrs['deleted'].push(obj);
 
           self.checkDuplicateWithModel(obj);


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin][RM5807] Removed columns use modified name in generated script
  In-Reply-To: <CAM9w-_=ENcWVh4EmE2Ytx2+jyV9s-+_EBAhF7kg9FxNAD8Ppuw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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