summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2020-11-24 20:05:54 -0800
committerIgor Babaev <igor@askmonty.org>2020-11-27 10:43:47 -0800
commitb92391d5b19dd372422b0cfadcc4f6f0bbc7b300 (patch)
treeea5d5243bdbc4b28f3707cecacbefde172d77c70 /sql/sql_union.cc
parent1555c6d1251a79ec7194803b8f2be8bc37b18ae5 (diff)
downloadmariadb-git-b92391d5b19dd372422b0cfadcc4f6f0bbc7b300.tar.gz
MDEV-24242 Query returns wrong result while using big_tables=1
When executing set operations in a pipeline using only one temporary table additional scans of intermediate results may be needed. The scans are performed with usage of the rnd_next() handler function that might leave record buffers used for the temporary table not in a state that is good for following writes into the table. For example it happens for aria engine when the last call of rnd_next() encounters only deleted records. Thus a cleanup of record buffers is needed after each such scan of the temporary table. Approved by Oleksandr Byelkin <sanja@mariadb.com>
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r--sql/sql_union.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 021720f594e..9e51bb43a74 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -880,6 +880,10 @@ bool select_unit_ext::send_eof()
table->file->ha_rnd_end();
}
+ /* Clean up table buffers for the next set operation from pipeline */
+ if (next_sl)
+ restore_record(table,s->default_values);
+
if (unlikely(error))
table->file->print_error(error, MYF(0));