summaryrefslogtreecommitdiff
path: root/sql/opt_split.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-11-03 16:24:47 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-11-03 16:24:47 +0200
commit133b4b46fefde402542214d8226262534dc3601a (patch)
tree51bbdc0ee35a4af61e5af6d97948963ae9354f39 /sql/opt_split.cc
parent44836bcd12e3974e79c928be747955bfb3b73910 (diff)
parent533a13af069d8c9e6c5f4e1a72851497185ade03 (diff)
downloadmariadb-git-133b4b46fefde402542214d8226262534dc3601a.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'sql/opt_split.cc')
-rw-r--r--sql/opt_split.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/sql/opt_split.cc b/sql/opt_split.cc
index a6031f75a5b..3a086aef04c 100644
--- a/sql/opt_split.cc
+++ b/sql/opt_split.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2017 MariaDB
+ Copyright (c) 2017, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -749,13 +749,13 @@ void JOIN::add_keyuses_for_splitting()
if (allocate_dynamic(&keyuse, save_qep->keyuse.elements + added_keyuse_count))
goto err;
- memcpy(keyuse.buffer,
- save_qep->keyuse.buffer,
- (size_t) save_qep->keyuse.elements * keyuse.size_of_element);
- keyuse.elements= save_qep->keyuse.elements;
+ idx= keyuse.elements= save_qep->keyuse.elements;
+ if (keyuse.elements)
+ memcpy(keyuse.buffer,
+ save_qep->keyuse.buffer,
+ (size_t) keyuse.elements * keyuse.size_of_element);
keyuse_ext= &ext_keyuses_for_splitting->at(0);
- idx= save_qep->keyuse.elements;
for (i=0; i < added_keyuse_count; i++, keyuse_ext++, idx++)
{
set_dynamic(&keyuse, (KEYUSE *) keyuse_ext, idx);