From 3abee40e6b15a99b5765b003af8a793b36ae0818 Mon Sep 17 00:00:00 2001 From: Matthias Leich Date: Thu, 2 Jul 2009 13:22:12 +0200 Subject: Fix for Bug#45902 rpl_sp fails sporadically in check testcases Details: - Add "sync_slave_with_master" at test end - Restore the initial value of log_bin_trust_function_creators --- mysql-test/t/rpl_sp.test | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test index f045257d279..6ac6729e662 100644 --- a/mysql-test/t/rpl_sp.test +++ b/mysql-test/t/rpl_sp.test @@ -7,6 +7,9 @@ # accepted). The old name could be removed in 5.1 or 6.0. source include/master-slave.inc; +# Save the current value and restore at end of testing +let $log_bin_trust_function_creators= + `SELECT @@global.log_bin_trust_function_creators`; # we need a db != test, where we don't have automatic grants --disable_warnings @@ -629,3 +632,10 @@ use test; drop procedure mysqltestbug36570_p1; drop procedure ` mysqltestbug36570_p2`; drop function mysqltestbug36570_f1; + +# Cleanup +sync_slave_with_master; +# Restore the initial value of log_bin_trust_function_creators +eval +set global log_bin_trust_function_creators = $log_bin_trust_function_creators; + -- cgit v1.2.1 From ae8950f1e831e267894e8363cd289a9ebb5d2311 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Thu, 2 Jul 2009 17:42:00 +0300 Subject: Bug #45807: crash accessing partitioned table and sql_mode contains ONLY_FULL_GROUP_BY The partitioning code needs to issue a Item::fix_fields() on the partitioning expression in order to prepare it for being evaluated. It does this by creating a special table and a table list for the scope of the partitioning expression. But when checking ONLY_FULL_GROUP_BY the Item_field::fix_fields() was relying that there always be cached_table set and was trying to use it to get the select_lex of the SELECT the field's table is in. But the cached_table was not set by the partitioning code that creates the artificial TABLE_LIST used to resolve the partitioning expression and this resulted in a crash. Fixed by rectifying the following errors : 1. Item_field::fix_fields() : the code that check for ONLY_FULL_GROUP_BY relies on having tables with cacheable_table set. This is mostly true, the only two exceptions being the partitioning context table and the trigger context table. Fixed by taking the current parsing context if no pointer to the TABLE_LIST instance is present in the cached_table. 2. fix_fields_part_func() : 2a. The code that adds the table being created to the scope for the partitioning expression is mostly a copy of the add_table_to_list and friends with one exception : it was not marking the table as cacheable (something that normal add_table_to_list is doing). This caused the problem in the check for ONLY_FULL_GROUP_BY in Item_field::fix_fields() to appear. Fixed by setting the correct members to make the table cacheable. The ideal structural fix for this is to use a unified interface for adding a table to a table list (add_table_to_list?) : noted in a TODO comment 2b. The Item::fix_fields() was called with a NULL destination pointer. This causes uninitalized memory reads in the overloaded ::fix_fields() function (namely Item_field::fix_fields()) as it expects a non-zero pointer there. Fixed by passing the source pointer similarly to how it's done in JOIN::prepare(). mysql-test/r/partition.result: Bug #45807: test case mysql-test/t/partition.test: Bug #45807: test case sql/item.cc: Bug #45807: fix the ONLY_FULL_GROUP_BY check code to handle correctly non-cacheable tables. sql/sql_partition.cc: Bug #45807: fix the Item::fix_fields() context initializatio for the partitioning expression in CREATE TABLE. --- mysql-test/t/partition.test | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 8535e1bc5c2..8b4af201af2 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1976,6 +1976,17 @@ SELECT b, c FROM t1 WHERE b = 1 GROUP BY b, c; DROP TABLE t1; +--echo # +--echo # Bug #45807: crash accessing partitioned table and sql_mode +--echo # contains ONLY_FULL_GROUP_BY +--echo # + +SET SESSION SQL_MODE='ONLY_FULL_GROUP_BY'; +CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM + PARTITION BY HASH(id) PARTITIONS 2; +DROP TABLE t1; +SET SESSION SQL_MODE=DEFAULT; + --echo End of 5.1 tests SET @@global.general_log= @old_general_log; -- cgit v1.2.1