summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Black <daniel@mariadb.org>2022-10-12 10:42:54 +1100
committerDaniel Black <daniel@mariadb.org>2022-10-22 08:47:10 +1100
commite46217182fab8f451799624402c2466474115926 (patch)
tree03671f73e20fd9e79e42c7ee02c8de1b1f5342fe
parent6bc2e9338127cf9e97fa76cc97ab23f9c929991b (diff)
downloadmariadb-git-e46217182fab8f451799624402c2466474115926.tar.gz
MDEV-29678 Valgrind/MSAN uninitialised value errors upon PS with ALTER under ONLY_FULL_GROUP_BY
st_select_lex::init_query is called in the exectuion of EXECUTE IMMEDIATE 'alter table ...'. so reset the initialization at the same point we set join= 0.
-rw-r--r--mysql-test/main/func_group.result4
-rw-r--r--mysql-test/main/func_group.test6
-rw-r--r--sql/sql_lex.cc1
3 files changed, 11 insertions, 0 deletions
diff --git a/mysql-test/main/func_group.result b/mysql-test/main/func_group.result
index c52e31b86d7..0f3169e330f 100644
--- a/mysql-test/main/func_group.result
+++ b/mysql-test/main/func_group.result
@@ -2548,5 +2548,9 @@ Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x'
DROP TABLE t1;
#
+# MDEV-29678 Valgrind/MSAN uninitialised value errors upon PS with ALTER under ONLY_FULL_GROUP_BY
+#
+SET STATEMENT sql_mode=ONLY_FULL_GROUP_BY FOR EXECUTE IMMEDIATE 'ALTER TABLE mysql.time_zone_transition ORDER BY Time_zone_id, Transition_time';
+#
# End of 10.3 tests
#
diff --git a/mysql-test/main/func_group.test b/mysql-test/main/func_group.test
index e34018aafd9..862ea453b46 100644
--- a/mysql-test/main/func_group.test
+++ b/mysql-test/main/func_group.test
@@ -1784,5 +1784,11 @@ SELECT DISTINCT a IN ( COLLATION (AVG ('x'))) FROM t1 ;
DROP TABLE t1;
--echo #
+--echo # MDEV-29678 Valgrind/MSAN uninitialised value errors upon PS with ALTER under ONLY_FULL_GROUP_BY
+--echo #
+
+SET STATEMENT sql_mode=ONLY_FULL_GROUP_BY FOR EXECUTE IMMEDIATE 'ALTER TABLE mysql.time_zone_transition ORDER BY Time_zone_id, Transition_time';
+
+--echo #
--echo # End of 10.3 tests
--echo #
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index c5bdfb596eb..5e4c41fe42c 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -2321,6 +2321,7 @@ void st_select_lex::init_query()
item_list.empty();
min_max_opt_list.empty();
join= 0;
+ cur_pos_in_select_list= UNDEF_POS;
having= prep_having= where= prep_where= 0;
cond_pushed_into_where= cond_pushed_into_having= 0;
olap= UNSPECIFIED_OLAP_TYPE;