mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0
This commit is contained in:
commit
8d6811def7
3 changed files with 92 additions and 1 deletions
|
@ -3291,3 +3291,49 @@ f1 f2 x1
|
|||
30 1 30
|
||||
drop table t1;
|
||||
drop view v1, v2, v3;
|
||||
CREATE TABLE t1(key_a int4 NOT NULL, optimus varchar(32), PRIMARY KEY(key_a));
|
||||
CREATE TABLE t2(key_a int4 NOT NULL, prime varchar(32), PRIMARY KEY(key_a));
|
||||
CREATE table t3(key_a int4 NOT NULL, key_b int4 NOT NULL, foo varchar(32),
|
||||
PRIMARY KEY(key_a,key_b));
|
||||
INSERT INTO t1 VALUES (0,'');
|
||||
INSERT INTO t1 VALUES (1,'i');
|
||||
INSERT INTO t1 VALUES (2,'j');
|
||||
INSERT INTO t1 VALUES (3,'k');
|
||||
INSERT INTO t2 VALUES (1,'r');
|
||||
INSERT INTO t2 VALUES (2,'s');
|
||||
INSERT INTO t2 VALUES (3,'t');
|
||||
INSERT INTO t3 VALUES (1,5,'x');
|
||||
INSERT INTO t3 VALUES (1,6,'y');
|
||||
INSERT INTO t3 VALUES (2,5,'xx');
|
||||
INSERT INTO t3 VALUES (2,6,'yy');
|
||||
INSERT INTO t3 VALUES (2,7,'zz');
|
||||
INSERT INTO t3 VALUES (3,5,'xxx');
|
||||
SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
key_a foo
|
||||
2 xx
|
||||
EXPLAIN SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
|
||||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index
|
||||
1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1
|
||||
SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
key_a foo
|
||||
2 xx
|
||||
EXPLAIN SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
|
||||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index
|
||||
1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
|
|
@ -2760,3 +2760,48 @@ select f1, f2, v2.f1 as x1 from v2 order by v2.f1;
|
|||
select f1, f2, v3.f1 as x1 from v3 order by v3.f1;
|
||||
drop table t1;
|
||||
drop view v1, v2, v3;
|
||||
|
||||
#
|
||||
# Bug #15106: lost equality predicate of the form field=const in a join query
|
||||
#
|
||||
|
||||
CREATE TABLE t1(key_a int4 NOT NULL, optimus varchar(32), PRIMARY KEY(key_a));
|
||||
CREATE TABLE t2(key_a int4 NOT NULL, prime varchar(32), PRIMARY KEY(key_a));
|
||||
CREATE table t3(key_a int4 NOT NULL, key_b int4 NOT NULL, foo varchar(32),
|
||||
PRIMARY KEY(key_a,key_b));
|
||||
|
||||
INSERT INTO t1 VALUES (0,'');
|
||||
INSERT INTO t1 VALUES (1,'i');
|
||||
INSERT INTO t1 VALUES (2,'j');
|
||||
INSERT INTO t1 VALUES (3,'k');
|
||||
|
||||
INSERT INTO t2 VALUES (1,'r');
|
||||
INSERT INTO t2 VALUES (2,'s');
|
||||
INSERT INTO t2 VALUES (3,'t');
|
||||
|
||||
INSERT INTO t3 VALUES (1,5,'x');
|
||||
INSERT INTO t3 VALUES (1,6,'y');
|
||||
INSERT INTO t3 VALUES (2,5,'xx');
|
||||
INSERT INTO t3 VALUES (2,6,'yy');
|
||||
INSERT INTO t3 VALUES (2,7,'zz');
|
||||
INSERT INTO t3 VALUES (3,5,'xxx');
|
||||
|
||||
SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
EXPLAIN SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
|
||||
SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
EXPLAIN SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
|
|
@ -3662,7 +3662,7 @@ void Item_equal::merge(Item_equal *item)
|
|||
the multiple equality already contains a constant and its
|
||||
value is not equal to the value of c.
|
||||
*/
|
||||
add(const_item);
|
||||
add(c);
|
||||
}
|
||||
cond_false|= item->cond_false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue