public inbox for [email protected]  
help / color / mirror / Atom feed
From: Yogesh Mahajan <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][Patch] Bug #5886 - New foreign key creation on exist table
Date: Tue, 1 Dec 2020 11:04:09 +0530
Message-ID: <CAMa=N=OfaK4h3m9sL0RNWx-AZ_dA13zJVxJM4KrTW-cBgr8s5A@mail.gmail.com> (raw)

Hi,

Please find the attached patch which fixes the false error shown while
adding a new foreign key from table dialogue in case of an already existing
foreign key with Auto FK Index=True to table.

Thanks,
Yogesh Mahajan
EnterpriseDB


Attachments:

  [application/x-patch] RM5886_v1.patch (1.4K, 3-RM5886_v1.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
index 302728bad..a36d385ae 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
@@ -1097,11 +1097,13 @@ define('pgadmin.node.foreign_key', [
 
           var coveringindex = this.get('coveringindex'),
             autoindex = this.get('autoindex');
-          if (autoindex && (_.isUndefined(coveringindex) || _.isNull(coveringindex) ||
-              String(coveringindex).replace(/^\s+|\s+$/g, '') == '')) {
-            msg = gettext('Please specify covering index name.');
-            this.errorModel.set('coveringindex', msg);
-            return msg;
+          if (this.isNew()){
+            if (autoindex && (_.isUndefined(coveringindex) || _.isNull(coveringindex) ||
+                String(coveringindex).replace(/^\s+|\s+$/g, '') == '')) {
+              msg = gettext('Please specify covering index name.');
+              this.errorModel.set('coveringindex', msg);
+              return msg;
+            }
           }
 
           return null;


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][Patch] Bug #5886 - New foreign key creation on exist table
  In-Reply-To: <CAMa=N=OfaK4h3m9sL0RNWx-AZ_dA13zJVxJM4KrTW-cBgr8s5A@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