summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-12-04 16:06:07 -0800
committerIgor Babaev <igor@askmonty.org>2012-12-04 16:06:07 -0800
commit5e345281e3599c793fdea771d0f23eb19f22d601 (patch)
treee83f6afd57d876a7e2bc17fb8e616fb85dc76f83 /sql/sql_insert.cc
parentb057f95d421cd0174d36ce77a058936a7046ed13 (diff)
downloadmariadb-git-5e345281e3599c793fdea771d0f23eb19f22d601.tar.gz
Fixed bug mdev-3888.
When inserting a record with update on duplicate keys the server calls the ha_index_read_idx_map handler function to look for the record that violates unique key constraints. The third parameter of this call should mark only the base components of the index where the server is searched for the record. Possible hidden components of the primary key are to be unmarked.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 3c3b9f85727..231671d172b 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1677,9 +1677,10 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
}
}
key_copy((uchar*) key,table->record[0],table->key_info+key_nr,0);
+ key_part_map keypart_map= (1 << table->key_info[key_nr].key_parts) - 1;
if ((error= (table->file->ha_index_read_idx_map(table->record[1],
key_nr, (uchar*) key,
- HA_WHOLE_KEY,
+ keypart_map,
HA_READ_KEY_EXACT))))
goto err;
}