summaryrefslogtreecommitdiff
path: root/sql/sql_sort.h
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-05-30 02:27:33 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-06-01 17:53:07 +0530
commitade8253cb9260371ffd393f0962f56619c949c07 (patch)
treef837205f53df56b5fa919e27ee7e4ec73914ed26 /sql/sql_sort.h
parent132d5822e2bd2a3c90eb926ca10e38a40d0b16f9 (diff)
downloadmariadb-git-ade8253cb9260371ffd393f0962f56619c949c07.tar.gz
MDEV-22303: Incorrect ordering with REGEXP_REPLACE and OFFSET/LIMIT
For character sets and collation where character to weight mapping > 1, there we need to make sure while creating a sort key, a temporary buffer is created to store the value of the item by val_str function and then copy that value back to the sort buffer. In this case when using a priority queue Sort_param::tmp_buffer was not allocated. Minor refactoring: Changed Sort_param::tmp_buffer from char* to String
Diffstat (limited to 'sql/sql_sort.h')
-rw-r--r--sql/sql_sort.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_sort.h b/sql/sql_sort.h
index 5b3f5a67d17..cff54f18bde 100644
--- a/sql/sql_sort.h
+++ b/sql/sql_sort.h
@@ -536,7 +536,7 @@ public:
uchar *unique_buff;
bool not_killable;
- char* tmp_buffer;
+ String tmp_buffer;
// The fields below are used only by Unique class.
qsort2_cmp compare;
BUFFPEK_COMPARE_CONTEXT cmp_context;
@@ -544,6 +544,7 @@ public:
Sort_param()
{
memset(reinterpret_cast<void*>(this), 0, sizeof(*this));
+ tmp_buffer.set_thread_specific();
}
void init_for_filesort(uint sortlen, TABLE *table,
ha_rows maxrows, bool sort_positions);