summaryrefslogtreecommitdiff
path: root/includes/common.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/common.inc')
-rw-r--r--includes/common.inc6
1 files changed, 6 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 220414a2d..be7c72234 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5955,6 +5955,12 @@ function drupal_write_record($table, &$record, $primary_keys = array()) {
$serial = $field;
}
+ // Skip field if it is in $primary_keys as it is unnecessary to update a
+ // field to the value it is already set to.
+ if (in_array($field, $primary_keys)) {
+ continue;
+ }
+
if (!property_exists($object, $field)) {
// Skip fields that are not provided, default values are already known
// by the database.