public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][Patch]: Fixed RM #2425 : Can't delete rows when using composite primary key
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin4][Patch]: Fixed RM #2425 : Can't delete rows when using composite primary key
@ 2017-05-31 10:01 Khushboo Vashi <[email protected]>
  2017-06-06 08:58 ` Re: [pgAdmin4][Patch]: Fixed RM #2425 : Can't delete rows when using composite primary key Dave Page <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Khushboo Vashi @ 2017-05-31 10:01 UTC (permalink / raw)
  To: pgadmin-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 = [];
                  }
                }
 


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

* Re: [pgAdmin4][Patch]: Fixed RM #2425 : Can't delete rows when using composite primary key
  2017-05-31 10:01 [pgAdmin4][Patch]: Fixed RM #2425 : Can't delete rows when using composite primary key Khushboo Vashi <[email protected]>
@ 2017-06-06 08:58 ` Dave Page <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Page @ 2017-06-06 08:58 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers

Thanks, applied.

On Wed, May 31, 2017 at 11:01 AM, Khushboo Vashi
<[email protected]> wrote:
> 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
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers




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


end of thread, other threads:[~2017-06-06 08:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31 10:01 [pgAdmin4][Patch]: Fixed RM #2425 : Can't delete rows when using composite primary key Khushboo Vashi <[email protected]>
2017-06-06 08:58 ` Dave Page <[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