diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index a8027742a0ff4f070c223fe29a5c569295a5814d..38da68791e60bd61fd9af3b6011bbbc66fbcfe23 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -827,8 +827,6 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host, else if (parent->options.db) child->options.db = my_strdup(parent->options.db, MYF(0)); - child->options.rpl_parse = child->options.rpl_probe = child->rpl_pivot = 0; - return child; } @@ -842,9 +840,6 @@ STDCALL mysql_set_master(MYSQL* mysql, const char* host, mysql_close(mysql->master); if (!(mysql->master = spawn_init(mysql, host, port, user, passwd))) return 1; - mysql->master->rpl_pivot = 0; - mysql->master->options.rpl_parse = 0; - mysql->master->options.rpl_probe = 0; return 0; } diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 1b66f442a9a264a9d9cba8d6a19579ced072e6ee..0c8f2cb5323152756feff70a3c6e4ca3e493caa9 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -279,6 +279,16 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT * FROM t1 WHERE a IN(1,2) AND b=5; a b DROP TABLE t1; +CREATE TABLE t1 (a int, b int, c int, INDEX (c,a,b)); +INSERT INTO t1 VALUES (1,0,0),(1,0,0),(1,0,0); +INSERT INTO t1 VALUES (0,1,0),(0,1,0),(0,1,0); +SELECT COUNT(*) FROM t1 WHERE (c=0 and a=1) or (c=0 and b=1); +COUNT(*) +6 +SELECT COUNT(*) FROM t1 WHERE (c=0 and b=1) or (c=0 and a=1); +COUNT(*) +6 +DROP TABLE t1; create table t1 (id int(10) primary key); insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9); select id from t1 where id in (2,5,9) ; diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 75cbb7569985f4ea2109f1e9d8de5d1429eb7373..b1b846221e7d7181bf0852aba2503dbf74ffd9c9 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -226,7 +226,18 @@ INSERT INTO t1 VALUES # we expect that optimizer will choose index on A EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5; SELECT * FROM t1 WHERE a IN(1,2) AND b=5; +DROP TABLE t1; + +# +# Test error with +# +CREATE TABLE t1 (a int, b int, c int, INDEX (c,a,b)); +INSERT INTO t1 VALUES (1,0,0),(1,0,0),(1,0,0); +INSERT INTO t1 VALUES (0,1,0),(0,1,0),(0,1,0); +# -- First reports 3; second reports 6 +SELECT COUNT(*) FROM t1 WHERE (c=0 and a=1) or (c=0 and b=1); +SELECT COUNT(*) FROM t1 WHERE (c=0 and b=1) or (c=0 and a=1); DROP TABLE t1; # test for a bug with in() and unique key diff --git a/sql/opt_range.cc b/sql/opt_range.cc index e2761832e657fb64a86e3a780f03ff1eed740e2f..bbdc1913a8c0b7afaaef1b5af847e09d647244b6 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -68,7 +68,7 @@ class SEL_ARG :public Sql_alloc {} inline bool is_same(SEL_ARG *arg) { - if (type != arg->type) + if (type != arg->type || part != arg->part) return 0; if (type != KEY_RANGE) return 1;