List:Commits« Previous MessageNext Message »
From:kevin.lewis Date:February 6 2012 2:15pm
Subject:bzr push into mysql-trunk branch (kevin.lewis:3838 to 3844) Bug#13464334
View as plain text  
 3844 Norvald H. Ryeng	2012-02-06
      Bug#13464334 SAME QUERY PRODUCES DIFFERENT RESULTS WHEN USED WITH AND
      WITHOUT UNION ALL
      
      Problem: Some outer join queries using views as inner tables do not
      evaluate conditions correctly.
      
      Inner tables of outer joins are tagged by setting the outer_join flag
      in the TABLE_LIST structure for the table. However, if the inner table
      is a view, the tables of the view are not tagged unless they are inner
      tables of a view defined as an outer join query. This means that
      tables referenced by views should some times be treated as inner
      tables of an outer join even if they are not tagged as such.
      
      In JOIN::optimize(), calls to list_contains_unique_index(), are used
      to check if GROUP BY or DISTINCT can be skipped. The function checks
      that enough columns to make it a unique key are mentioned and that
      none of the columns can return NULL. The check for NULL fails since it
      only checks the outer_join flag, which may not be set because of view
      usage. The result is the erroneous conclusion that GROUP BY or
      DISTINCT can be skipped, which in the end causes the query to return
      too many or too few rows.
      
      Fix: In list_contains_unique_index(), check if the table in question
      is in the inner part of an outer join (directly or nested) and
      therefore may return NULL values.
      
      This patch also adds checks for nested outer joins in
      Item_field::is_outer_field() and internal_remove_eq_conds().
     @ mysql-test/r/group_by.result
        Fix erroneous result.
     @ mysql-test/r/join_outer.result
        Add test case for bug #13464334.
     @ mysql-test/r/join_outer_bka.result
        Add test case for bug #13464334.
     @ mysql-test/r/join_outer_bka_nixbnl.result
        Add test case for bug #13464334.
     @ mysql-test/t/join_outer.test
        Add test case for bug #13464334.
     @ sql/item.h
        Include nested outer joins in check for outer join.
     @ sql/sql_optimizer.cc
        Include nested outer joins in checks for outer join.

    modified:
      mysql-test/r/group_by.result
      mysql-test/r/join_outer.result
      mysql-test/r/join_outer_bka.result
      mysql-test/r/join_outer_bka_nixbnl.result
      mysql-test/t/join_outer.test
      sql/item.h
      sql/sql_optimizer.cc
 3843 Vasil Dimov	2012-02-06 [merge]
      Merge mysql-5.5 -> mysql-trunk

    added:
      mysql-test/suite/innodb/r/innodb_bug11754376.result
      mysql-test/suite/innodb/t/innodb_bug11754376.test
    modified:
      storage/innobase/handler/ha_innodb.cc
 3842 Ashish Agarwal	2012-02-05 [merge]
      BUG#11754145: Merge from mysql-5.5 to mysql-trunk

    modified:
      mysql-test/include/have_64bit.inc
 3841 Nuno Carvalho	2012-02-03
      BUG#11758581 - 50801: CHANGE MASTER ACCEPTS BOGUS VARIABLES
            
      CHANGE MASTER command did not check invalid characters on its
      parameters. Also on server restart, invalid values were trimmed causing
      the loss of part of the variables value.
      
      Ensure that servers have a clean state before bogus variables tests.

    modified:
      mysql-test/suite/rpl/r/rpl_change_master.result
      mysql-test/suite/rpl/t/rpl_change_master.test
 3840 Nuno Carvalho	2012-02-03
      BUG#11758581 - 50801: CHANGE MASTER ACCEPTS BOGUS VARIABLES
      
      CHANGE MASTER command did not check invalid characters on its
      parameters. Also on server restart, invalid values were trimmed causing
      the loss of part of the variables value.
      
      SQL parser was improved to prohibit the use of new line characters on 
      CHANGE MASTER variables, throwing a ER_WRONG_VALUE error when such 
      character is used.

    modified:
      mysql-test/suite/rpl/r/rpl_change_master.result
      mysql-test/suite/rpl/t/rpl_change_master.test
      sql/sql_yacc.yy
 3839 Tor Didriksen	2012-02-03
      All the subquery_sj_xxx tests can get thread stack overrun on solaris

    modified:
      mysql-test/collections/default.experimental
 3838 Ashish Agarwal	2012-02-03
      BUG#11748748 - 37280: CHECK AND REPAIR TABLE REPORT TABLE
                            CORRUPTED WHEN RUN CONCURRENTLY WITH
      
      ISSUE: Concurrent queries in archive causes table
             corruption. Running repair and check query
             concurrently with insert query causes table
             corruption. Improper locking.
      
      SOLUTION: Locks are properly aquired.
                Initial lock is aquired and number of
                rows are remembered. Inserting
                remembered rows to new file. Locks
                are again aquired to process the
                remaining rows. Concurrent optimization
                on a same table not allowed.

    modified:
      storage/archive/ha_archive.cc
      storage/archive/ha_archive.h
=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	revid:ashish.y.agarwal@stripped
+++ b/mysql-test/collections/default.experimental	revid:norvald.ryeng@stripped
@@ -9,39 +9,41 @@ main.func_math @freebsd                 
 main.mysqlslap @windows                  # Bug#11761520 2010-08-10 alik mysqlslap fails sporadically starting from Dahlia
 main.signal_demo3 @solaris               # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
 main.sp @solaris                         # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_all_bka_nixbnl @solaris
-main.subquery_sj_all_bka @solaris
-main.subquery_sj_all_bkaunique @solaris
-main.subquery_sj_all @solaris
-main.subquery_sj_dupsweed_bka_nixbnl @solaris
-main.subquery_sj_dupsweed_bka @solaris
-main.subquery_sj_dupsweed_bkaunique @solaris
-main.subquery_sj_dupsweed @solaris
-main.subquery_sj_firstmatch_bka_nixbnl @solaris
-main.subquery_sj_firstmatch_bka @solaris
-main.subquery_sj_firstmatch_bkaunique @solaris
-main.subquery_sj_firstmatch @solaris
-main.subquery_sj_innodb_all_bka_nixbnl @solaris
-main.subquery_sj_innodb_all_bka @solaris
-main.subquery_sj_innodb_all_bkaunique @solaris
-main.subquery_sj_innodb_all @solaris
-main.subquery_sj_innodb_none_bka_nixbnl @solaris
-main.subquery_sj_innodb_none_bka @solaris
-main.subquery_sj_innodb_none_bkaunique @solaris
-main.subquery_sj_innodb_none @solaris
-main.subquery_sj_loosescan_bka_nixbnl @solaris
-main.subquery_sj_loosescan_bka @solaris
-main.subquery_sj_loosescan_bkaunique @solaris
-main.subquery_sj_loosescan @solaris
-main.subquery_sj_mat_bka_nixbnl @solaris
-main.subquery_sj_mat_bka @solaris
-main.subquery_sj_mat_bkaunique @solaris
-main.subquery_sj_mat_nosj @solaris
-main.subquery_sj_mat @solaris
-main.subquery_sj_none_bka_nixbnl @solaris
-main.subquery_sj_none_bka @solaris
-main.subquery_sj_none_bkaunique @solaris
-main.subquery_sj_none @solaris
+
+main.subquery_sj_all_bka_nixbnl @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_all_bka @solaris                # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_all_bkaunique @solaris          # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_all @solaris                    # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_dupsweed_bka_nixbnl @solaris    # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_dupsweed_bka @solaris           # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_dupsweed_bkaunique @solaris     # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_dupsweed @solaris               # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_firstmatch_bka_nixbnl @solaris  # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_firstmatch_bka @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_firstmatch_bkaunique @solaris   # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_firstmatch @solaris             # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_all_bka_nixbnl @solaris  # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_all_bka @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_all_bkaunique @solaris   # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_all @solaris             # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_none_bka_nixbnl @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_none_bka @solaris        # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_none_bkaunique @solaris  # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_none @solaris            # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_loosescan_bka_nixbnl @solaris   # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_loosescan_bka @solaris          # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_loosescan_bkaunique @solaris    # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_loosescan @solaris              # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat_bka_nixbnl @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat_bka @solaris                # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat_bkaunique @solaris          # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat_nosj @solaris               # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat @solaris                    # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_none_bka_nixbnl @solaris        # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_none_bka @solaris               # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_none_bkaunique @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_none @solaris                   # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+
 main.kill @freebsd                       # Bug#12619719 2011-08-04 Occasional failure in PB2
 
 innodb.innodb_monitor                    # Bug#12320827 2011-08-04 Occasional failure in PB2

=== modified file 'mysql-test/include/have_64bit.inc'
--- a/mysql-test/include/have_64bit.inc	revid:ashish.y.agarwal@stripped
+++ b/mysql-test/include/have_64bit.inc	revid:norvald.ryeng@stripped
@@ -2,10 +2,10 @@
 # see also have_32bit.inc
 
 --disable_query_log
-let $save = `SELECT @@session.myisam_sort_buffer_size`;
-SET @@session.myisam_sort_buffer_size = 4294967296;
-let $mach64 = `SELECT @@session.myisam_sort_buffer_size > 4294967295`;
-eval SET @@session.myisam_sort_buffer_size = $save;
+let $save = `SELECT @@session.sort_buffer_size`;
+SET @@session.sort_buffer_size = 4294967296;
+let $mach64 = `SELECT @@session.sort_buffer_size > 4294967295`;
+eval SET @@session.sort_buffer_size = $save;
 --enable_query_log
 if (!$mach64)
 {

=== modified file 'mysql-test/r/group_by.result'
--- a/mysql-test/r/group_by.result	revid:ashish.y.agarwal@stripped
+++ b/mysql-test/r/group_by.result	revid:norvald.ryeng@stripped
@@ -2110,6 +2110,7 @@ SELECT v1.pk
 FROM t1 LEFT JOIN v1 ON t1.i = v1.pk 
 GROUP BY v1.pk;
 pk
+NULL
 DROP VIEW v1;
 DROP TABLE t1,t2;
 # End of Bug#12798270

=== modified file 'mysql-test/r/join_outer.result'
--- a/mysql-test/r/join_outer.result	revid:ashish.y.agarwal@stripped
+++ b/mysql-test/r/join_outer.result	revid:norvald.ryeng@stripped
@@ -1996,3 +1996,19 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	1	Using where; Using join buffer (Block Nested Loop)
 1	SIMPLE	t6b	ALL	NULL	NULL	NULL	NULL	1	Using where; Using join buffer (Block Nested Loop)
 drop table t1,t2,t3,t4,t5,t6;
+#
+# Bug#13464334 SAME QUERY PRODUCES DIFFERENT RESULTS WHEN USED WITH AND
+# WITHOUT UNION ALL
+#
+CREATE TABLE t1 (p1 INT PRIMARY KEY, a CHAR(1));
+CREATE TABLE t2 (p2 INT PRIMARY KEY, b CHAR(1));
+INSERT INTO t1 VALUES (1,'a'),(2,'b'),(3,'c');
+INSERT INTO t2 VALUES (1,'h'),(2,'i'),(3,'j'),(4,'k');
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT * FROM t2;
+(SELECT p1 FROM v2 LEFT JOIN v1 ON b = a WHERE p2 = 1 GROUP BY p1 ORDER BY p1)
+UNION (SELECT NULL LIMIT 0);
+p1
+NULL
+DROP VIEW v1, v2;
+DROP TABLE t1, t2;

=== modified file 'mysql-test/r/join_outer_bka.result'
--- a/mysql-test/r/join_outer_bka.result	revid:ashish.y.agarwal@stripped
+++ b/mysql-test/r/join_outer_bka.result	revid:norvald.ryeng@stripped
@@ -1997,4 +1997,20 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	1	Using where; Using join buffer (Block Nested Loop)
 1	SIMPLE	t6b	ALL	NULL	NULL	NULL	NULL	1	Using where; Using join buffer (Block Nested Loop)
 drop table t1,t2,t3,t4,t5,t6;
+#
+# Bug#13464334 SAME QUERY PRODUCES DIFFERENT RESULTS WHEN USED WITH AND
+# WITHOUT UNION ALL
+#
+CREATE TABLE t1 (p1 INT PRIMARY KEY, a CHAR(1));
+CREATE TABLE t2 (p2 INT PRIMARY KEY, b CHAR(1));
+INSERT INTO t1 VALUES (1,'a'),(2,'b'),(3,'c');
+INSERT INTO t2 VALUES (1,'h'),(2,'i'),(3,'j'),(4,'k');
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT * FROM t2;
+(SELECT p1 FROM v2 LEFT JOIN v1 ON b = a WHERE p2 = 1 GROUP BY p1 ORDER BY p1)
+UNION (SELECT NULL LIMIT 0);
+p1
+NULL
+DROP VIEW v1, v2;
+DROP TABLE t1, t2;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/join_outer_bka_nixbnl.result'
--- a/mysql-test/r/join_outer_bka_nixbnl.result	revid:ashish.y.agarwal@stripped
+++ b/mysql-test/r/join_outer_bka_nixbnl.result	revid:norvald.ryeng@stripped
@@ -1997,4 +1997,20 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	1	Using where
 1	SIMPLE	t6b	ALL	NULL	NULL	NULL	NULL	1	Using where
 drop table t1,t2,t3,t4,t5,t6;
+#
+# Bug#13464334 SAME QUERY PRODUCES DIFFERENT RESULTS WHEN USED WITH AND
+# WITHOUT UNION ALL
+#
+CREATE TABLE t1 (p1 INT PRIMARY KEY, a CHAR(1));
+CREATE TABLE t2 (p2 INT PRIMARY KEY, b CHAR(1));
+INSERT INTO t1 VALUES (1,'a'),(2,'b'),(3,'c');
+INSERT INTO t2 VALUES (1,'h'),(2,'i'),(3,'j'),(4,'k');
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT * FROM t2;
+(SELECT p1 FROM v2 LEFT JOIN v1 ON b = a WHERE p2 = 1 GROUP BY p1 ORDER BY p1)
+UNION (SELECT NULL LIMIT 0);
+p1
+NULL
+DROP VIEW v1, v2;
+DROP TABLE t1, t2;
 set optimizer_switch=default;

=== added file 'mysql-test/suite/innodb/r/innodb_bug11754376.result'
--- a/mysql-test/suite/innodb/r/innodb_bug11754376.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb_bug11754376.result	revid:norvald.ryeng@stripped
@@ -0,0 +1,4 @@
+CREATE TABLE bug11754376 (c INT) ENGINE=INNODB;
+SET SESSION DEBUG='+d,test_normalize_table_name_low';
+DROP TABLE bug11754376;
+SET SESSION DEBUG='-d,test_normalize_table_name_low';

=== added file 'mysql-test/suite/innodb/t/innodb_bug11754376.test'
--- a/mysql-test/suite/innodb/t/innodb_bug11754376.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug11754376.test	revid:norvald.ryeng@stripped
@@ -0,0 +1,16 @@
+#
+# Bug#11754376 45976: INNODB LOST FILES FOR TEMPORARY TABLES ON GRACEFUL SHUTDOWN
+#
+
+-- source include/have_debug.inc
+-- source include/have_innodb.inc
+
+CREATE TABLE bug11754376 (c INT) ENGINE=INNODB;
+
+# This will invoke test_normalize_table_name_low() in debug builds
+
+SET SESSION DEBUG='+d,test_normalize_table_name_low';
+
+DROP TABLE bug11754376;
+
+SET SESSION DEBUG='-d,test_normalize_table_name_low';

=== modified file 'mysql-test/suite/rpl/r/rpl_change_master.result'
--- a/mysql-test/suite/rpl/r/rpl_change_master.result	revid:ashish.y.agarwal@stripped
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result	revid:norvald.ryeng@stripped
@@ -96,4 +96,27 @@ drop table t1;
 include/stop_slave.inc
 CHANGE MASTER TO master_host='SAVE_MASTER_HOST';
 include/start_slave.inc
+include/rpl_reset.inc
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='', MASTER_PORT=MASTER_PORT;
+ERROR HY000: Incorrect arguments to MASTER_HOST
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='127.0.0.1\n127.0.0.1', MASTER_PORT=MASTER_PORT;
+ERROR HY000: Incorrect argument contains not-allowed LF value: '127.0.0.1
+127.0.0.1'
+CHANGE MASTER TO MASTER_USER='root\n', MASTER_HOST='master2.mycompany.com', MASTER_PORT=MASTER_PORT, MASTER_USER='replication', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.001', MASTER_LOG_POS=4;
+ERROR HY000: Incorrect argument contains not-allowed LF value: 'root
+'
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='master2.mycompany.com', MASTER_PORT=MASTER_PORT, MASTER_USER='repli\ncation', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.001', MASTER_LOG_POS=4;
+ERROR HY000: Incorrect argument contains not-allowed LF value: 'repli
+cation'
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='master2.mycompany.com', MASTER_PORT=MASTER_PORT, MASTER_USER='replication', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.\n001', MASTER_LOG_POS=4;
+ERROR HY000: Incorrect argument contains not-allowed LF value: 'master2-bin.
+001'
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT;
+Warnings:
+Note	1756	Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note	1757	Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
+include/start_slave.inc
+Master_Host = '127.0.0.1'
+include/rpl_reset.inc
 include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_change_master.test'
--- a/mysql-test/suite/rpl/t/rpl_change_master.test	revid:ashish.y.agarwal@stripped
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test	revid:norvald.ryeng@stripped
@@ -11,4 +11,51 @@
 
 --source include/master-slave.inc
 --source extra/rpl_tests/rpl_change_master.test
+
+
+# BUG#11758581 - 50801: CHANGE MASTER ACCEPTS BOGUS VARIABLES
+# We want to check if CHANGE MASTER values have newline characters.
+--source include/rpl_reset.inc
+connection slave;
+
+###
+### This should fail with error ER_WRONG_ARGUMENTS due to empty MASTER_HOST
+### value.
+###
+--source include/stop_slave.inc
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_ARGUMENTS
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='', MASTER_PORT=$MASTER_MYPORT;
+
+###
+### This should fail with error ER_SYNTAX_ERROR due to newline
+### in string values.
+###
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_VALUE
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='127.0.0.1\n127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_VALUE
+eval CHANGE MASTER TO MASTER_USER='root\n', MASTER_HOST='master2.mycompany.com', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='replication', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.001', MASTER_LOG_POS=4;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_VALUE
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='master2.mycompany.com', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='repli\ncation', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.001', MASTER_LOG_POS=4;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_VALUE
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='master2.mycompany.com', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='replication', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.\n001', MASTER_LOG_POS=4;
+
+###
+### This should be accepted.
+###
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
+
+--source include/start_slave.inc
+--let $status_items= Master_Host
+--source include/show_slave_status.inc
+--source include/rpl_reset.inc
+
 --source include/rpl_end.inc

=== modified file 'mysql-test/t/join_outer.test'
--- a/mysql-test/t/join_outer.test	revid:ashish.y.agarwal@stripped
+++ b/mysql-test/t/join_outer.test	revid:norvald.ryeng@stripped
@@ -1489,3 +1489,19 @@ eval SELECT $rest_of_query;
 eval EXPLAIN SELECT $rest_of_query;
 
 drop table t1,t2,t3,t4,t5,t6;
+
+--echo #
+--echo # Bug#13464334 SAME QUERY PRODUCES DIFFERENT RESULTS WHEN USED WITH AND
+--echo # WITHOUT UNION ALL
+--echo #
+
+CREATE TABLE t1 (p1 INT PRIMARY KEY, a CHAR(1));
+CREATE TABLE t2 (p2 INT PRIMARY KEY, b CHAR(1));
+INSERT INTO t1 VALUES (1,'a'),(2,'b'),(3,'c');
+INSERT INTO t2 VALUES (1,'h'),(2,'i'),(3,'j'),(4,'k');
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT * FROM t2;
+(SELECT p1 FROM v2 LEFT JOIN v1 ON b = a WHERE p2 = 1 GROUP BY p1 ORDER BY p1)
+UNION (SELECT NULL LIMIT 0);
+DROP VIEW v1, v2;
+DROP TABLE t1, t2;

=== modified file 'sql/item.h'
--- a/sql/item.h	revid:ashish.y.agarwal@stripped
+++ b/sql/item.h	revid:norvald.ryeng@stripped
@@ -2034,7 +2034,8 @@ public:
   bool is_outer_field() const
   {
     DBUG_ASSERT(fixed);
-    return field->table->pos_in_table_list->outer_join;
+    return field->table->pos_in_table_list->outer_join ||
+           field->table->pos_in_table_list->in_outer_join_nest();
   }
   Field::geometry_type get_geometry_type() const
   {

=== modified file 'sql/sql_optimizer.cc'
--- a/sql/sql_optimizer.cc	revid:ashish.y.agarwal@stripped
+++ b/sql/sql_optimizer.cc	revid:norvald.ryeng@stripped
@@ -55,7 +55,7 @@ static Item *optimize_cond(JOIN *join, I
                            List<TABLE_LIST> *join_list,
 			   bool build_equalities,
                            Item::cond_result *cond_value);
-static bool list_contains_unique_index(TABLE *table,
+static bool list_contains_unique_index(JOIN_TAB *tab,
                           bool (*find_func) (Field *, void *), void *data);
 static bool find_field_in_item_list (Field *field, void *data);
 static bool find_field_in_order_list (Field *field, void *data);
@@ -522,7 +522,7 @@ JOIN::optimize()
        QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX))
   {
     if (group_list && rollup.state == ROLLUP::STATE_NONE &&
-       list_contains_unique_index(join_tab[const_tables].table,
+       list_contains_unique_index(&join_tab[const_tables],
                                  find_field_in_order_list,
                                  (void *) group_list))
     {
@@ -560,7 +560,7 @@ JOIN::optimize()
       group= 0;
     }
     if (select_distinct &&
-       list_contains_unique_index(join_tab[const_tables].table,
+       list_contains_unique_index(&join_tab[const_tables],
                                  find_field_in_item_list,
                                  (void *) &fields_list))
     {
@@ -8069,7 +8069,7 @@ internal_remove_eq_conds(THD *thd, Item 
         if (!eq_cond)
           return cond;
 
-        if (field->table->pos_in_table_list->outer_join)
+        if (args[0]->is_outer_field())
         {
           // outer join: transform "col IS NULL" to "col IS NULL or col=0"
           Item *or_cond= new(thd->mem_root) Item_cond_or(eq_cond, cond);
@@ -8223,7 +8223,7 @@ remove_eq_conds(THD *thd, Item *cond, It
     can safely remove the GROUP BY/DISTINCT,
     as no result set can be more distinct than an unique key.
 
-  @param table                The table to operate on.
+  @param tab                  The join table to operate on.
   @param find_func            function to iterate over the list and search
                               for a field
 
@@ -8231,13 +8231,19 @@ remove_eq_conds(THD *thd, Item *cond, It
     1                    found
   @retval
     0                    not found.
+
+  @note
+    The function assumes that make_outerjoin_info() has been called in
+    order for the check for outer tables to work.
 */
 
 static bool
-list_contains_unique_index(TABLE *table,
+list_contains_unique_index(JOIN_TAB *tab,
                           bool (*find_func) (Field *, void *), void *data)
 {
-  if (table->pos_in_table_list->outer_join)
+  TABLE *table= tab->table;
+
+  if (tab->is_inner_table_of_outer_join())
     return 0;
   for (uint keynr= 0; keynr < table->s->keys; keynr++)
   {

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	revid:ashish.y.agarwal@stripped
+++ b/sql/sql_yacc.yy	revid:norvald.ryeng@stripped
@@ -1504,7 +1504,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
         IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
         NCHAR_STRING opt_component key_cache_name
         sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty
-        opt_constraint constraint opt_ident
+        opt_constraint constraint opt_ident TEXT_STRING_sys_nonewline
 
 %type <lex_str_ptr>
         opt_table_alias
@@ -1983,19 +1983,19 @@ master_defs:
         ;
 
 master_def:
-          MASTER_HOST_SYM EQ TEXT_STRING_sys
+          MASTER_HOST_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.host = $3.str;
           }
-        | MASTER_BIND_SYM EQ TEXT_STRING_sys
+        | MASTER_BIND_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.bind_addr = $3.str;
           }
-        | MASTER_USER_SYM EQ TEXT_STRING_sys
+        | MASTER_USER_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.user = $3.str;
           }
-        | MASTER_PASSWORD_SYM EQ TEXT_STRING_sys
+        | MASTER_PASSWORD_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.password = $3.str;
           }
@@ -2027,23 +2027,23 @@ master_def:
             Lex->mi.ssl= $3 ? 
               LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
           }
-        | MASTER_SSL_CA_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_CA_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_ca= $3.str;
           }
-        | MASTER_SSL_CAPATH_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_CAPATH_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_capath= $3.str;
           }
-        | MASTER_SSL_CERT_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_CERT_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_cert= $3.str;
           }
-        | MASTER_SSL_CIPHER_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_CIPHER_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_cipher= $3.str;
           }
-        | MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_key= $3.str;
           }
@@ -2052,11 +2052,11 @@ master_def:
             Lex->mi.ssl_verify_server_cert= $3 ?
               LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
           }
-        | MASTER_SSL_CRL_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_CRL_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_crl= $3.str;
           }
-        | MASTER_SSL_CRLPATH_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_CRLPATH_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_crlpath= $3.str;
           }
@@ -2121,7 +2121,7 @@ ignore_server_id:
           }
 
 master_file_def:
-          MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
+          MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.log_file_name = $3.str;
           }
@@ -2141,7 +2141,7 @@ master_file_def:
             */
             Lex->mi.pos = max<ulonglong>(BIN_LOG_HEADER_SIZE, Lex->mi.pos);
           }
-        | RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
+        | RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.relay_log_name = $3.str;
           }
@@ -12815,6 +12815,19 @@ IDENT_sys:
           }
         ;
 
+TEXT_STRING_sys_nonewline:
+          TEXT_STRING_sys
+          {
+            if (!strcont($1.str, "\n"))
+              $$= $1;
+            else
+            {
+              my_error(ER_WRONG_VALUE, MYF(0), "argument contains not-allowed LF", $1.str);
+              MYSQL_YYABORT;
+            }
+          }
+        ;
+
 TEXT_STRING_sys:
           TEXT_STRING
           {

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	revid:ashish.y.agarwal@stripped
+++ b/storage/innobase/handler/ha_innodb.cc	revid:norvald.ryeng@stripped
@@ -3810,37 +3810,114 @@ normalize_table_name_low(
 {
 	char*	name_ptr;
 	char*	db_ptr;
+	ulint	db_len;
 	char*	ptr;
 
 	/* Scan name from the end */
 
-	ptr = strend(name)-1;
+	ptr = strend(name) - 1;
 
+	/* seek to the last path separator */
 	while (ptr >= name && *ptr != '\\' && *ptr != '/') {
 		ptr--;
 	}
 
 	name_ptr = ptr + 1;
 
-	DBUG_ASSERT(ptr > name);
+	/* skip any number of path separators */
+	while (ptr >= name && (*ptr == '\\' || *ptr == '/')) {
+		ptr--;
+	}
 
-	ptr--;
+	DBUG_ASSERT(ptr >= name);
 
+	/* seek to the last but one path separator or one char before
+	the beginning of name */
+	db_len = 0;
 	while (ptr >= name && *ptr != '\\' && *ptr != '/') {
 		ptr--;
+		db_len++;
 	}
 
 	db_ptr = ptr + 1;
 
-	memcpy(norm_name, db_ptr, strlen(name) + 1 - (db_ptr - name));
+	memcpy(norm_name, db_ptr, db_len);
+
+	norm_name[db_len] = '/';
 
-	norm_name[name_ptr - db_ptr - 1] = '/';
+	memcpy(norm_name + db_len + 1, name_ptr, strlen(name_ptr) + 1);
 
 	if (set_lower_case) {
 		innobase_casedn_str(norm_name);
 	}
 }
 
+#if !defined(DBUG_OFF)
+/*********************************************************************
+Test normalize_table_name_low(). */
+static
+void
+test_normalize_table_name_low()
+/*===========================*/
+{
+	char		norm_name[128];
+	const char*	test_data[][2] = {
+		/* input, expected result */
+		{"./mysqltest/t1", "mysqltest/t1"},
+		{"./test/#sql-842b_2", "test/#sql-842b_2"},
+		{"./test/#sql-85a3_10", "test/#sql-85a3_10"},
+		{"./test/#sql2-842b-2", "test/#sql2-842b-2"},
+		{"./test/bug29807", "test/bug29807"},
+		{"./test/foo", "test/foo"},
+		{"./test/innodb_bug52663", "test/innodb_bug52663"},
+		{"./test/t", "test/t"},
+		{"./test/t1", "test/t1"},
+		{"./test/t10", "test/t10"},
+		{"/a/b/db/table", "db/table"},
+		{"/a/b/db///////table", "db/table"},
+		{"/a/b////db///////table", "db/table"},
+		{"/var/tmp/mysqld.1/#sql842b_2_10", "mysqld.1/#sql842b_2_10"},
+		{"db/table", "db/table"},
+		{"ddd/t", "ddd/t"},
+		{"d/ttt", "d/ttt"},
+		{"d/t", "d/t"},
+		{".\\mysqltest\\t1", "mysqltest/t1"},
+		{".\\test\\#sql-842b_2", "test/#sql-842b_2"},
+		{".\\test\\#sql-85a3_10", "test/#sql-85a3_10"},
+		{".\\test\\#sql2-842b-2", "test/#sql2-842b-2"},
+		{".\\test\\bug29807", "test/bug29807"},
+		{".\\test\\foo", "test/foo"},
+		{".\\test\\innodb_bug52663", "test/innodb_bug52663"},
+		{".\\test\\t", "test/t"},
+		{".\\test\\t1", "test/t1"},
+		{".\\test\\t10", "test/t10"},
+		{"C:\\a\\b\\db\\table", "db/table"},
+		{"C:\\a\\b\\db\\\\\\\\\\\\\\table", "db/table"},
+		{"C:\\a\\b\\\\\\\\db\\\\\\\\\\\\\\table", "db/table"},
+		{"C:\\var\\tmp\\mysqld.1\\#sql842b_2_10", "mysqld.1/#sql842b_2_10"},
+		{"db\\table", "db/table"},
+		{"ddd\\t", "ddd/t"},
+		{"d\\ttt", "d/ttt"},
+		{"d\\t", "d/t"},
+	};
+
+	for (size_t i = 0; i < UT_ARR_SIZE(test_data); i++) {
+		printf("test_normalize_table_name_low(): "
+		       "testing \"%s\", expected \"%s\"... ",
+		       test_data[i][0], test_data[i][1]);
+
+		normalize_table_name_low(norm_name, test_data[i][0], FALSE);
+
+		if (strcmp(norm_name, test_data[i][1]) == 0) {
+			printf("ok\n");
+		} else {
+			printf("got \"%s\"\n", norm_name);
+			ut_error;
+		}
+	}
+}
+#endif /* !DBUG_OFF */
+
 /********************************************************************//**
 Get the upper limit of the MySQL integral and floating-point type.
 @return maximum allowed value for the field */
@@ -9084,6 +9161,11 @@ ha_innobase::delete_table(
 
 	DBUG_ENTER("ha_innobase::delete_table");
 
+	DBUG_EXECUTE_IF(
+		"test_normalize_table_name_low",
+		test_normalize_table_name_low();
+	);
+
 	/* Strangely, MySQL passes the table name without the '.frm'
 	extension, in contrast to ::create */
 	normalize_table_name(norm_name, name);

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (kevin.lewis:3838 to 3844) Bug#13464334kevin.lewis7 Feb