[pgAdmin][RM4506] "can't execute an empty query" message displayed if user remove fill factor of any existing table

Aditya Toshniwal <[email protected]> Mon, 9 Dec 2019 15:32:58 +0530
Newsgroups gmane.comp.db.postgresql.pgadmin.devel
Message-ID <CAM9w-_kNeQ5EANaFoFEB4UFFM03NAZBuwQzFmBdFd59rpWfriw@mail.gmail.com>
Hi Hackers,

Attached is the patch to fix an issue where just clicking on an
empty textbox like fill factor in tables dialog considers it a change and
so the save button is enabled.
The fix is common will apply at other places also.

Kindly review.

-- 
Thanks and Regards,
Aditya Toshniwal
Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"
RM4506.patch (application/octet-stream, 668 B)
diff --git a/web/pgadmin/browser/static/js/datamodel.js b/web/pgadmin/browser/static/js/datamodel.js
index 514c40392..8a0288a99 100644
--- a/web/pgadmin/browser/static/js/datamodel.js
+++ b/web/pgadmin/browser/static/js/datamodel.js
@@ -367,7 +367,8 @@ define([
             return;
           }
           attrs[k] = v;
-          if (_.isEqual(self.origSessAttrs[k], v)) {
+          /* If the orig value was null and new one is empty string, then its a "no change" */
+          if (_.isEqual(self.origSessAttrs[k], v) || (self.origSessAttrs[k] === null && v === '')) {
             delete self.sessAttrs[k];
           } else {
             self.sessAttrs[k] = v;