public inbox for [email protected]
help / color / mirror / Atom feedFrom: Khushboo Vashi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch]: Fixed RM #2425 : Can't delete rows when using composite primary key
Date: Wed, 31 May 2017 15:31:08 +0530
Message-ID: <CAFOhELeqTVxWNM9NrR5LcTpDsq0O-6r3zyzeWPS4b_eRPVBAPQ@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Hi,
Please find the attached patch to fix RM #2425 : Can't delete rows when
using composite primary key.
The grid selection checking for Primary key does not honour the composite
key which has been fixed.
Thanks,
Khushboo
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[text/x-patch] RM_2425.patch (1.4K, 3-RM_2425.patch)
download | inline diff:
diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
index 7d51193..fc578b7 100644
--- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
@@ -726,14 +726,18 @@ define(
// Clear selection model if row primary keys is set to default
var row_data = _.clone(collection[selected_rows_list[count]]),
- is_primary_key = _.has(row_data, primary_key_list) &&
- row_data[0] != undefined ? true : false;
-
- if (primary_key_list.length &&
- !is_primary_key && !is_new_row
- ) {
- this.selection.setSelectedRows([]);
- selected_rows_list = [];
+ is_primary_key = true;
+
+ // Primary key validation
+ _.each(primary_key_list, function(pk) {
+ if (!(_.has(row_data, pk)) || row_data[pk] == undefined) {
+ is_primary_key = false;
+ }
+ })
+
+ if (primary_key_list.length && !is_primary_key && !is_new_row) {
+ this.selection.setSelectedRows([]);
+ selected_rows_list = [];
}
}
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: [pgAdmin4][Patch]: Fixed RM #2425 : Can't delete rows when using composite primary key
In-Reply-To: <CAFOhELeqTVxWNM9NrR5LcTpDsq0O-6r3zyzeWPS4b_eRPVBAPQ@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