From 0b5b2f864153bf236a844e225ed6f04d79c757d8 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 24 Jul 2020 17:43:10 +0200 Subject: Bug #25207522: INCORRECT ORDER-BY BEHAVIOR ON A PARTITIONED TABLE WITH A COMPOSITE PREFIX INDEX Fix prefix key comparison in partitioning. Comparions must take into account no more than prefix_len characters. It used to compare prefix_len*mbmaxlen bytes. --- sql/key.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql/key.cc') diff --git a/sql/key.cc b/sql/key.cc index 013733db62a..9b09387885b 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -623,8 +623,8 @@ int key_rec_cmp(void *key_p, uchar *first_rec, uchar *second_rec) max length. The exceptions are the BLOB and VARCHAR field types that take the max length into account. */ - if ((result= field->cmp_max(field->ptr+first_diff, field->ptr+sec_diff, - key_part->length))) + if ((result= field->cmp_prefix(field->ptr+first_diff, field->ptr+sec_diff, + key_part->length))) DBUG_RETURN(result); next_loop: key_part++; -- cgit v1.2.1