summaryrefslogtreecommitdiff
path: root/sql/opt_subselect.cc
diff options
context:
space:
mode:
authorVarun Gupta <varunraiko1803@gmail.com>2018-03-06 19:59:57 +0530
committerVarun Gupta <varunraiko1803@gmail.com>2018-03-11 16:17:14 +0530
commit926edd48e1e67bf9a315b3602638a76c4c445ef6 (patch)
tree477fc7e57cfdff94e27b70fc6e8706bc977f377b /sql/opt_subselect.cc
parentac3fd5acac6b3717ce206e3e9ebf78204af06861 (diff)
downloadmariadb-git-926edd48e1e67bf9a315b3602638a76c4c445ef6.tar.gz
MDEV-15235: Assertion `length > 0' failed in create_ref_for_key
The issue is that we are creating a materialised table with key of length 0 which is incorrect, we should disable materialisation for such a case.
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r--sql/opt_subselect.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 028bf44bf79..24f35a0c14c 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -873,8 +873,10 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs)
Make sure that create_tmp_table will not fail due to too long keys.
See MDEV-7122. This check is performed inside create_tmp_table also and
we must do it so that we know the table has keys created.
+ Make sure that the length of the key for the temp_table is atleast
+ greater than 0.
*/
- if (total_key_length > tmp_table_max_key_length() ||
+ if (!total_key_length || total_key_length > tmp_table_max_key_length() ||
elements > tmp_table_max_key_parts())
DBUG_RETURN(FALSE);