summaryrefslogtreecommitdiff
path: root/mysql-test/r/union.result
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2011-07-11 11:20:19 +0200
committerTor Didriksen <tor.didriksen@oracle.com>2011-07-11 11:20:19 +0200
commit08ecbd5adb9051b77dca4cea0988ea286366a409 (patch)
tree447c4abb8f8fd47c3d9542cb3edbae4195395cdc /mysql-test/r/union.result
parente1fbd9113a29f761c4f8452f6920c6cfe6ac700e (diff)
downloadmariadb-git-08ecbd5adb9051b77dca4cea0988ea286366a409.tar.gz
Bug#11765255 - 58201: VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
We must allocate a larger ref_pointer_array. We failed to account for extra items allocated here: #0 find_order_in_list uint el= all_fields.elements; all_fields.push_front(order_item); /* Add new field to field list. */ ref_pointer_array[el]= order_item; order->item= ref_pointer_array + el; #1 setup_order #2 setup_without_group #3 JOIN::prepare mysql-test/r/order_by.result: New test case. mysql-test/r/union.result: New test case. mysql-test/t/order_by.test: New test case. mysql-test/t/union.test: New test case. sql/sql_lex.cc: find_order_in_list() may need some extra space, so multiply og_num by two. sql/sql_union.cc: For UNION, the 'n_sum_items' are accumulated in the "global_parameters" select_lex. This number must be propagated to setup_ref_array() When preparing a 'fake_select_lex' we need to use global_parameters->order_list rather than fake_select_lex->order_list (see comments inside st_select_lex_unit::cleanup)
Diffstat (limited to 'mysql-test/r/union.result')
-rw-r--r--mysql-test/r/union.result57
1 files changed, 57 insertions, 0 deletions
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 1ee313a2b46..9966cb0f0d0 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1647,4 +1647,61 @@ b
1
2
DROP TABLE t1,t2;
+#
+# Bug#11765255 58201:
+# VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
+#
+select 1 as foo
+union
+select 2
+union
+select 3
+union
+select 4
+order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
+;
+foo
+1
+prepare stmt1 from 'select 1 as foo
+union
+select 2
+union
+select 3
+union
+select 4
+order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
+';
+execute stmt1;
+foo
+1
+execute stmt1;
+foo
+1
+select 1 as foo
+union
+select 2
+union
+select 3
+union
+(select 4)
+order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
+;
+foo
+1
+prepare stmt1 from 'select 1 as foo
+union
+select 2
+union
+select 3
+union
+(select 4)
+order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
+';
+execute stmt1;
+foo
+1
+execute stmt1;
+foo
+1
+deallocate prepare stmt1;
End of 5.1 tests