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
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 = [];
}
}
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers