mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
MariaDB 5.2 -> MariaDB 5.3 merge
This commit is contained in:
@@ -12728,3 +12728,31 @@ Table Op Msg_type Msg_text
|
||||
test.t1 repair Error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
|
||||
test.t1 repair error Corrupt
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#48757 - missing .ARZ file causes server crash
|
||||
#
|
||||
CREATE TABLE t1(a INT) ENGINE=ARCHIVE;
|
||||
FLUSH TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
ERROR HY000: Can't find file: 't1' (errno: 2)
|
||||
DROP TABLE t1;
|
||||
ERROR 42S02: Unknown table 't1'
|
||||
#
|
||||
# BUG#46565 - repair of partition fail for archive engine
|
||||
#
|
||||
# Installing corrupted table files for t1.
|
||||
SELECT * FROM t1;
|
||||
ERROR HY000: Table 't1' is marked as crashed and should be repaired
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair error Corrupt
|
||||
SELECT * FROM t1;
|
||||
ERROR HY000: Table 't1' is marked as crashed and should be repaired
|
||||
REPAIR TABLE t1 EXTENDED;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
DROP TABLE t1;
|
||||
|
@@ -4,23 +4,23 @@ create table t4(n int);
|
||||
backup table t4 to '../../bogus';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t4 backup error Failed copying .frm file (errno: X)
|
||||
test.t4 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t4 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode: X)
|
||||
test.t4 backup status Operation failed
|
||||
backup table t4 to '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t4 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t4 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t4 backup status OK
|
||||
backup table t4 to '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t4 backup error Failed copying .frm file (errno: X)
|
||||
test.t4 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t4 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode: X)
|
||||
test.t4 backup status Operation failed
|
||||
drop table t4;
|
||||
restore table t4 from '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t4 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t4 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t4 restore status OK
|
||||
select count(*) from t4;
|
||||
count(*)
|
||||
@@ -29,18 +29,18 @@ create table t1(n int);
|
||||
insert into t1 values (23),(45),(67);
|
||||
backup table t1 to '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 backup status OK
|
||||
drop table t1;
|
||||
restore table t1 from '../../bogus';
|
||||
Table Op Msg_type Msg_text
|
||||
t1 restore error Failed copying .frm file
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
Warning 1287 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
Error 29 File 'MYSQLTEST_VARDIR/bogus/t1.frm' not found (Errcode: X)
|
||||
restore table t1 from '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 restore status OK
|
||||
select n from t1;
|
||||
n
|
||||
@@ -53,13 +53,13 @@ insert into t2 values (123),(145),(167);
|
||||
insert into t3 values (223),(245),(267);
|
||||
backup table t2,t3 to '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t2 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t2 backup status OK
|
||||
test.t3 backup status OK
|
||||
drop table t1,t2,t3;
|
||||
restore table t1,t2,t3 from '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 restore status OK
|
||||
test.t2 restore status OK
|
||||
test.t3 restore status OK
|
||||
@@ -81,14 +81,14 @@ k
|
||||
drop table t1,t2,t3,t4;
|
||||
restore table t1 from '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 restore status OK
|
||||
rename table t1 to t5;
|
||||
lock tables t5 write;
|
||||
backup table t5 to '../../tmp';
|
||||
unlock tables;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t5 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t5 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t5 backup status OK
|
||||
drop table t5;
|
||||
DROP TABLE IF EXISTS `t+1`;
|
||||
@@ -96,12 +96,12 @@ CREATE TABLE `t+1` (c1 INT);
|
||||
INSERT INTO `t+1` VALUES (1), (2), (3);
|
||||
BACKUP TABLE `t+1` TO '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t+1 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t+1 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t+1 backup status OK
|
||||
DROP TABLE `t+1`;
|
||||
RESTORE TABLE `t+1` FROM '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t+1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t+1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t+1 restore status OK
|
||||
SELECT * FROM `t+1`;
|
||||
c1
|
||||
|
@@ -404,3 +404,37 @@ describe t1;
|
||||
Field Type Null Key Default Extra
|
||||
bi decimal(19,0) NO 0
|
||||
drop table t1;
|
||||
#
|
||||
# Bug #45360: wrong results
|
||||
#
|
||||
CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
a BIGINT(20) UNSIGNED,
|
||||
b VARCHAR(20));
|
||||
INSERT INTO t1 (a) VALUES
|
||||
(0),
|
||||
(CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED)),
|
||||
(CAST(0x8000000000000000 AS UNSIGNED)),
|
||||
(CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED));
|
||||
UPDATE t1 SET b = a;
|
||||
# FFFFFFFFFFFFFFFF
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 18446744073709551615 AND TRIM(a) = b;
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 18446744073709551615) and ('18446744073709551615' = `test`.`t1`.`b`))
|
||||
# 8000000000000000
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 9223372036854775808 AND TRIM(a) = b;
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 9223372036854775808) and ('9223372036854775808' = `test`.`t1`.`b`))
|
||||
# 7FFFFFFFFFFFFFFF
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 9223372036854775807 AND TRIM(a) = b;
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 9223372036854775807) and ('9223372036854775807' = `test`.`t1`.`b`))
|
||||
# 0
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 0 AND TRIM(a) = b;
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 0) and ('0' = `test`.`t1`.`b`))
|
||||
DROP TABLE t1;
|
||||
# End of 5.1 tests
|
||||
|
32
mysql-test/r/bug39022.result
Normal file
32
mysql-test/r/bug39022.result
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# Bug #39022: Mysql randomly crashing in lock_sec_rec_cons_read_sees
|
||||
#
|
||||
CREATE TABLE t1(a TINYINT NOT NULL,b TINYINT,PRIMARY KEY(b)) ENGINE=innodb;
|
||||
CREATE TABLE t2(d TINYINT NOT NULL,UNIQUE KEY(d)) ENGINE=innodb;
|
||||
INSERT INTO t1 VALUES (13,0),(8,1),(9,2),(6,3),
|
||||
(11,5),(11,6),(7,7),(7,8),(4,9),(6,10),(3,11),(11,12),
|
||||
(12,13),(7,14);
|
||||
INSERT INTO t2 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
|
||||
(11),(12),(13),(14);
|
||||
# in thread1
|
||||
START TRANSACTION;
|
||||
# in thread2
|
||||
REPLACE INTO t2 VALUES (-17);
|
||||
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d);
|
||||
d
|
||||
# in thread1
|
||||
REPLACE INTO t1(a,b) VALUES (67,20);
|
||||
# in thread2
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
REPLACE INTO t1(a,b) VALUES (65,-50);
|
||||
REPLACE INTO t2 VALUES (-91);
|
||||
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d);
|
||||
# in thread1
|
||||
# should not crash
|
||||
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d);
|
||||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
# in thread2
|
||||
d
|
||||
# in thread1;
|
||||
DROP TABLE t1,t2;
|
8
mysql-test/r/bug46261.result
Normal file
8
mysql-test/r/bug46261.result
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# Bug#46261 Plugins can be installed with --skip-grant-tables
|
||||
#
|
||||
INSTALL PLUGIN example SONAME 'ha_example.so';
|
||||
ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
|
||||
UNINSTALL PLUGIN example;
|
||||
ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
|
||||
End of 5.1 tests
|
@@ -1,3 +1,36 @@
|
||||
grant select on test.* to test_nopw;
|
||||
grant select on test.* to test_oldpw identified by password "09301740536db389";
|
||||
grant select on test.* to test_newpw identified by "newpw";
|
||||
select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
|
||||
concat('<', user(), '>') concat('<', current_user(), '>') database()
|
||||
<root@localhost> <root@localhost> test
|
||||
select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
|
||||
concat('<', user(), '>') concat('<', current_user(), '>') database()
|
||||
<test_nopw@localhost> <test_nopw@%> NULL
|
||||
select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
|
||||
concat('<', user(), '>') concat('<', current_user(), '>') database()
|
||||
<test_oldpw@localhost> <test_oldpw@%> NULL
|
||||
select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
|
||||
concat('<', user(), '>') concat('<', current_user(), '>') database()
|
||||
<test_newpw@localhost> <test_newpw@%> NULL
|
||||
select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
|
||||
concat('<', user(), '>') concat('<', current_user(), '>') database()
|
||||
<root@localhost> <root@localhost> NULL
|
||||
select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
|
||||
concat('<', user(), '>') concat('<', current_user(), '>') database()
|
||||
<test_nopw@localhost> <test_nopw@%> test
|
||||
select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
|
||||
concat('<', user(), '>') concat('<', current_user(), '>') database()
|
||||
<test_oldpw@localhost> <test_oldpw@%> test
|
||||
select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
|
||||
concat('<', user(), '>') concat('<', current_user(), '>') database()
|
||||
<test_newpw@localhost> <test_newpw@%> test
|
||||
select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
|
||||
concat('<', user(), '>') concat('<', current_user(), '>') database()
|
||||
<root@localhost> <root@localhost> test
|
||||
drop user test_nopw;
|
||||
drop user test_oldpw;
|
||||
drop user test_newpw;
|
||||
Bug#20023
|
||||
SELECT @@session.sql_big_selects;
|
||||
@@session.sql_big_selects
|
||||
|
@@ -88,7 +88,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) AS `COUNT(*)` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a TIMESTAMP);
|
||||
INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
|
||||
|
@@ -225,3 +225,17 @@ Connection on extra port 2 ok
|
||||
# ------------------------------------------------------------------
|
||||
# -- End of 5.1 tests
|
||||
# ------------------------------------------------------------------
|
||||
CREATE USER mysqltest_up1 IDENTIFIED VIA mysql_native_password using '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB';
|
||||
CREATE USER mysqltest_up2 IDENTIFIED VIA mysql_old_password using '09301740536db389';
|
||||
connect(localhost,mysqltest_up1,foo,test,MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'mysqltest_up1'@'localhost' (using password: YES)
|
||||
select user(), current_user();
|
||||
user() current_user()
|
||||
mysqltest_up1@localhost mysqltest_up1@%
|
||||
connect(localhost,mysqltest_up2,newpw,test,MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'mysqltest_up2'@'localhost' (using password: YES)
|
||||
select user(), current_user();
|
||||
user() current_user()
|
||||
mysqltest_up2@localhost mysqltest_up2@%
|
||||
DROP USER mysqltest_up1@'%';
|
||||
DROP USER mysqltest_up2@'%';
|
||||
|
@@ -5394,17 +5394,24 @@ select * from t1;
|
||||
ERROR HY000: File 'MYSQLD_DATADIR/test/t1.CSV' not found (Errcode: 2)
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
create table t1(a enum ('a') not null) engine=csv;
|
||||
insert into t1 values (2);
|
||||
CREATE TABLE t1 (e enum('foo','bar') NOT NULL) ENGINE = CSV;
|
||||
INSERT INTO t1 VALUES();
|
||||
INSERT INTO t1 VALUES(default);
|
||||
INSERT INTO t1 VALUES(0);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
select * from t1 limit 1;
|
||||
ERROR HY000: Table 't1' is marked as crashed and should be repaired
|
||||
repair table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair Warning Data truncated for column 'a' at row 1
|
||||
test.t1 repair status OK
|
||||
select * from t1 limit 1;
|
||||
a
|
||||
drop table t1;
|
||||
Warning 1265 Data truncated for column 'e' at row 1
|
||||
INSERT INTO t1 VALUES(3);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'e' at row 1
|
||||
INSERT INTO t1 VALUES(-1);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'e' at row 1
|
||||
SELECT * FROM t1;
|
||||
e
|
||||
foo
|
||||
foo
|
||||
|
||||
|
||||
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@@ -49,6 +49,15 @@ SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
|
||||
a
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#51976 LDML collations issue (cyrillic example)
|
||||
#
|
||||
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
|
||||
INSERT INTO t1 (a) VALUES ('Hello');
|
||||
SELECT a, UPPER(a), LOWER(a) FROM t1;
|
||||
a UPPER(a) LOWER(a)
|
||||
Hello HELLO hello
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#43827 Server closes connections and restarts
|
||||
#
|
||||
CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
|
||||
|
@@ -1230,6 +1230,14 @@ SELECT HEX(DAYNAME(19700101));
|
||||
HEX(DAYNAME(19700101))
|
||||
0427043504420432043504400433
|
||||
SET character_set_connection=latin1;
|
||||
#
|
||||
# Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
|
||||
#
|
||||
CREATE TABLE t1 (a CHAR(1) CHARSET ascii, b CHAR(1) CHARSET latin1);
|
||||
CREATE VIEW v1 AS SELECT 1 from t1
|
||||
WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
Start of 5.1 tests
|
||||
SET NAMES utf8;
|
||||
|
@@ -180,7 +180,6 @@ insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:0
|
||||
insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4);
|
||||
Warnings:
|
||||
Warning 1364 Field 'a' doesn't have a default value
|
||||
Warning 1364 Field 'b' doesn't have a default value
|
||||
Warning 1364 Field 'c' doesn't have a default value
|
||||
Warning 1364 Field 'd' doesn't have a default value
|
||||
Warning 1364 Field 'e' doesn't have a default value
|
||||
@@ -193,7 +192,7 @@ a b c d e f g h i x
|
||||
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 1
|
||||
small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 2
|
||||
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 3
|
||||
00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 4
|
||||
small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 4
|
||||
drop table bug20691;
|
||||
create table t1 (id int not null);
|
||||
insert into t1 values(default);
|
||||
|
@@ -278,6 +278,18 @@ DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1;
|
||||
ERROR 42000: Incorrect number of arguments for FUNCTION test.f1; expected 0, got 1
|
||||
DROP TABLE t1;
|
||||
DROP FUNCTION f1;
|
||||
#
|
||||
# Bug #49552 : sql_buffer_result cause crash + not found records
|
||||
# in multitable delete/subquery
|
||||
#
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
SET SESSION SQL_BUFFER_RESULT=1;
|
||||
DELETE t1 FROM (SELECT SUM(a) a FROM t1) x,t1;
|
||||
SET SESSION SQL_BUFFER_RESULT=DEFAULT;
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
#
|
||||
# Bug#46958: Assertion in Diagnostics_area::set_ok_status, trigger,
|
||||
@@ -337,16 +349,4 @@ END |
|
||||
DELETE IGNORE FROM t1;
|
||||
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #49552 : sql_buffer_result cause crash + not found records
|
||||
# in multitable delete/subquery
|
||||
#
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
SET SESSION SQL_BUFFER_RESULT=1;
|
||||
DELETE t1 FROM (SELECT SUM(a) a FROM t1) x,t1;
|
||||
SET SESSION SQL_BUFFER_RESULT=DEFAULT;
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@@ -18,3 +18,26 @@ SELECT MAX(a) FROM t1 GROUP BY a,b;
|
||||
ERROR 23000: Can't write; duplicate key in table 'tmp_table'
|
||||
set tmp_table_size=default;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #50946: fast index creation still seems to copy the table
|
||||
#
|
||||
CREATE TABLE t1 (a INT(100) NOT NULL);
|
||||
INSERT INTO t1 VALUES (1), (0), (2);
|
||||
SET SESSION debug='+d,alter_table_only_index_change';
|
||||
ALTER TABLE t1 ADD INDEX a(a);
|
||||
SET SESSION debug=DEFAULT;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(100) NOT NULL,
|
||||
KEY `a` (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
0
|
||||
1
|
||||
2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
||||
|
@@ -729,9 +729,8 @@ set @@sql_mode= pow(2,32)-1;
|
||||
create event e1 on schedule every 1 day do select 1;
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,?,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH
|
||||
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,IGNORE_BAD_TABLE_OPTIONS,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH
|
||||
set @@sql_mode= @old_mode;
|
||||
select replace(@full_mode, '?', 'NOT_USED') into @full_mode;
|
||||
select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode;
|
||||
select name from mysql.event where name = 'p' and sql_mode = @full_mode;
|
||||
name
|
||||
|
@@ -168,6 +168,23 @@ WHERE t1.a = d1.a;
|
||||
ERROR 42S22: Unknown column 'd1.a' in 'where clause'
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#48295:
|
||||
# explain extended crash with subquery and ONLY_FULL_GROUP_BY sql_mode
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT);
|
||||
SELECT @@session.sql_mode INTO @old_sql_mode;
|
||||
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1
|
||||
WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
|
||||
ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <not>(<exists>(...))
|
||||
SET SESSION sql_mode=@old_sql_mode;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
#
|
||||
# Bug#37870: Usage of uninitialized value caused failed assertion.
|
||||
#
|
||||
create table t1 (dt datetime not null, t time not null);
|
||||
@@ -195,19 +212,30 @@ dt
|
||||
2001-01-01 01:01:01
|
||||
drop tables t1, t2;
|
||||
#
|
||||
# Bug#48295:
|
||||
# explain extended crash with subquery and ONLY_FULL_GROUP_BY sql_mode
|
||||
# Bug#47669: Query showed by EXPLAIN EXTENDED gives different result from original query
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT);
|
||||
SELECT @@session.sql_mode INTO @old_sql_mode;
|
||||
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1
|
||||
WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
|
||||
ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <not>(<exists>(...))
|
||||
SET SESSION sql_mode=@old_sql_mode;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c int);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
CREATE TABLE t2 (d int);
|
||||
INSERT INTO t2 VALUES (NULL), (0);
|
||||
EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select (select 1 from `test`.`t2` where (`test`.`t2`.`d` = NULL)) AS `(SELECT 1 FROM t2 WHERE d = c)` from `test`.`t1`
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug #48419: another explain crash..
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (b BLOB, KEY b(b(100)));
|
||||
INSERT INTO t2 VALUES ('1'), ('2'), ('3');
|
||||
FLUSH TABLES;
|
||||
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t1 t JOIN t2 WHERE b <= 1 AND t.a);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.1 tests.
|
||||
|
@@ -611,6 +611,26 @@ WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
|
||||
count(*)
|
||||
0
|
||||
DROP TABLE t1,t2,t3;
|
||||
CREATE TABLE t1 (a VARCHAR(4), FULLTEXT(a));
|
||||
INSERT INTO t1 VALUES
|
||||
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
|
||||
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
|
||||
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
|
||||
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
|
||||
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
|
||||
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
|
||||
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
|
||||
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
|
||||
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
|
||||
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
|
||||
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
|
||||
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
|
||||
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('awrd'),('cwrd'),
|
||||
('awrd');
|
||||
SELECT COUNT(*) FROM t1 WHERE MATCH(a) AGAINST("+awrd bwrd* +cwrd*" IN BOOLEAN MODE);
|
||||
COUNT(*)
|
||||
0
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #49445: Assertion failed: 0, file .\item_row.cc, line 55 with
|
||||
# fulltext search and row op
|
||||
@@ -619,4 +639,17 @@ CREATE TABLE t1(a CHAR(1),FULLTEXT(a));
|
||||
SELECT 1 FROM t1 WHERE MATCH(a) AGAINST ('') AND ROW(a,a) > ROW(1,1);
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#51866 - crash with repair by sort and fulltext keys
|
||||
#
|
||||
CREATE TABLE t1(a CHAR(4), FULLTEXT(a));
|
||||
INSERT INTO t1 VALUES('aaaa');
|
||||
SET myisam_sort_buffer_size=4;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '4'
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@@ -130,4 +130,22 @@ SELECT @query;
|
||||
@query
|
||||
abcde,0,1234
|
||||
DROP PROCEDURE p1;
|
||||
#
|
||||
# Bug #40625: Concat fails on DOUBLE values in a Stored Procedure,
|
||||
# while DECIMAL works
|
||||
#
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE v1 DOUBLE(10,3);
|
||||
SET v1= 100;
|
||||
SET @s = CONCAT('########################################', 40 , v1);
|
||||
SELECT @s;
|
||||
END;//
|
||||
CALL p1();
|
||||
@s
|
||||
########################################40100.000
|
||||
CALL p1();
|
||||
@s
|
||||
########################################40100.000
|
||||
DROP PROCEDURE p1;
|
||||
# End of 5.1 tests
|
||||
|
@@ -978,4 +978,36 @@ GROUP BY t1.a
|
||||
1
|
||||
1
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (f1 INT);
|
||||
INSERT INTO t1 VALUES (),();
|
||||
EXPLAIN EXTENDED SELECT 1 FROM
|
||||
(SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort; Distinct
|
||||
2 DERIVED td ALL NULL NULL NULL NULL 2 100.00 Distinct; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from (select distinct group_concat(`test`.`td`.`f1` separator ',') AS `GROUP_CONCAT(td.f1)` from `test`.`t1` join `test`.`t1` `td` group by `test`.`td`.`f1`) `d` join `test`.`t1`
|
||||
SELECT 1 FROM
|
||||
(SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1;
|
||||
1
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #52397: another crash with explain extended and group_concat
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (0), (0);
|
||||
EXPLAIN EXTENDED SELECT 1 FROM
|
||||
(SELECT GROUP_CONCAT(t1.a ORDER BY t1.a ASC) FROM
|
||||
t1 t2, t1 GROUP BY t1.a) AS d;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from (select group_concat(`test`.`t1`.`a` order by `test`.`t1`.`a` ASC separator ',') AS `GROUP_CONCAT(t1.a ORDER BY t1.a ASC)` from `test`.`t1` `t2` join `test`.`t1` group by `test`.`t1`.`a`) `d`
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@@ -1307,12 +1307,12 @@ explain extended select encode(f1,'zxcv') as 'enc' from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select encode('','zxcv') AS `enc` from `test`.`t1`
|
||||
Note 1003 select encode(NULL,'zxcv') AS `enc` from `test`.`t1`
|
||||
explain extended select decode(f1,'zxcv') as 'enc' from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select decode('','zxcv') AS `enc` from `test`.`t1`
|
||||
Note 1003 select decode(NULL,'zxcv') AS `enc` from `test`.`t1`
|
||||
drop table t1;
|
||||
create table t1 (a bigint not null)engine=myisam;
|
||||
insert into t1 set a = 1024*1024*1024*4;
|
||||
@@ -2587,3 +2587,17 @@ FROM t2 WHERE t2.b = 1 GROUP BY t2.b;
|
||||
DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a)
|
||||
secret
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#52164 Assertion failed: param.sort_length, file .\filesort.cc, line 149
|
||||
#
|
||||
CREATE TABLE t1 (a LONGBLOB NOT NULL);
|
||||
INSERT INTO t1 VALUES (''),('');
|
||||
SELECT 1 FROM t1, t1 t2
|
||||
ORDER BY QUOTE(t1.a);
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@@ -682,7 +682,7 @@ select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1;
|
||||
timestampadd(SQL_TSI_FRAC_SECOND, 1, date)
|
||||
2003-01-02 00:00:00.000001
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
|
||||
Warning 1287 'FRAC_SECOND' is deprecated and will be removed in a future release. Please use MICROSECOND instead
|
||||
select timestampdiff(MONTH, '2001-02-01', '2001-05-01') as a;
|
||||
a
|
||||
3
|
||||
@@ -717,7 +717,7 @@ select timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05
|
||||
a
|
||||
7689538999999
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
|
||||
Warning 1287 'FRAC_SECOND' is deprecated and will be removed in a future release. Please use MICROSECOND instead
|
||||
select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1,
|
||||
timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2,
|
||||
timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3,
|
||||
@@ -1088,7 +1088,7 @@ timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
|
||||
Warning 1287 'FRAC_SECOND' is deprecated and will be removed in a future release. Please use MICROSECOND instead
|
||||
Note 1003 select timestampdiff(WEEK,'2001-02-01','2001-05-01') AS `a1`,timestampdiff(SECOND_FRAC,'2001-02-01 12:59:59.120000','2001-05-01 12:58:58.119999') AS `a2`
|
||||
select time_format('100:00:00', '%H %k %h %I %l');
|
||||
time_format('100:00:00', '%H %k %h %I %l')
|
||||
@@ -1120,7 +1120,7 @@ drop function t_slow_sysdate;
|
||||
drop table t1;
|
||||
SET GLOBAL log_bin_trust_function_creators = 0;
|
||||
create table t1 (a datetime, i int, b datetime);
|
||||
insert into t1 select sysdate(), sleep(1), sysdate() from dual;
|
||||
insert into t1 select sysdate(), sleep(2), sysdate() from dual;
|
||||
select a != b from t1;
|
||||
a != b
|
||||
1
|
||||
@@ -1287,12 +1287,12 @@ SELECT TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18');
|
||||
TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18')
|
||||
2008-02-18 00:00:00.000001
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
|
||||
Warning 1287 'FRAC_SECOND' is deprecated and will be removed in a future release. Please use MICROSECOND instead
|
||||
SELECT TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18');
|
||||
TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18')
|
||||
86400000000
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
|
||||
Warning 1287 'FRAC_SECOND' is deprecated and will be removed in a future release. Please use MICROSECOND instead
|
||||
SELECT DATE_ADD('2008-02-18', INTERVAL 1 FRAC_SECOND);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FRAC_SECOND)' at line 1
|
||||
SELECT DATE_SUB('2008-02-18', INTERVAL 1 FRAC_SECOND);
|
||||
|
@@ -1076,4 +1076,26 @@ SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #51357: crash when using handler commands on spatial indexes
|
||||
#
|
||||
CREATE TABLE t1(a GEOMETRY NOT NULL,SPATIAL INDEX a(a));
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ a FIRST;
|
||||
a
|
||||
HANDLER t1 READ a NEXT;
|
||||
a
|
||||
HANDLER t1 READ a PREV;
|
||||
a
|
||||
HANDLER t1 READ a LAST;
|
||||
a
|
||||
HANDLER t1 CLOSE;
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ a FIRST;
|
||||
a
|
||||
INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
|
||||
# should not crash
|
||||
HANDLER t1 READ a NEXT;
|
||||
HANDLER t1 CLOSE;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
|
@@ -13,8 +13,8 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
grant delete on mysqltest.* to mysqltest_1@localhost;
|
||||
select * from mysql.user where user="mysqltest_1";
|
||||
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
|
||||
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0 0
|
||||
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin auth_string
|
||||
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0 0
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
@@ -44,15 +44,15 @@ delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10;
|
||||
select * from mysql.user where user="mysqltest_1";
|
||||
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
|
||||
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 0 0 0
|
||||
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin auth_string
|
||||
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 0 0 0
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10
|
||||
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30;
|
||||
select * from mysql.user where user="mysqltest_1";
|
||||
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections
|
||||
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 0
|
||||
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin auth_string
|
||||
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 0
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30
|
||||
@@ -164,6 +164,7 @@ Warnings:
|
||||
Warning 1364 Field 'ssl_cipher' doesn't have a default value
|
||||
Warning 1364 Field 'x509_issuer' doesn't have a default value
|
||||
Warning 1364 Field 'x509_subject' doesn't have a default value
|
||||
Warning 1364 Field 'auth_string' doesn't have a default value
|
||||
insert into mysql.db (host, db, user, select_priv) values
|
||||
('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
|
||||
alter table mysql.db order by db asc;
|
||||
@@ -1413,3 +1414,19 @@ DROP USER 'user1';
|
||||
DROP USER 'user1'@'localhost';
|
||||
DROP USER 'user2';
|
||||
DROP DATABASE db1;
|
||||
CREATE DATABASE db1;
|
||||
CREATE DATABASE db2;
|
||||
GRANT SELECT ON db1.* to 'testbug'@localhost;
|
||||
USE db2;
|
||||
CREATE TABLE t1 (a INT);
|
||||
USE test;
|
||||
SELECT * FROM `../db2/tb2`;
|
||||
ERROR 42S02: Table 'db1.../db2/tb2' doesn't exist
|
||||
SELECT * FROM `../db2`.tb2;
|
||||
ERROR 42000: SELECT command denied to user 'testbug'@'localhost' for table 'tb2'
|
||||
SELECT * FROM `#mysql50#/../db2/tb2`;
|
||||
ERROR 42S02: Table 'db1.#mysql50#/../db2/tb2' doesn't exist
|
||||
DROP USER 'testbug'@localhost;
|
||||
DROP TABLE db2.t1;
|
||||
DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
|
@@ -287,6 +287,7 @@ Warnings:
|
||||
Warning 1364 Field 'ssl_cipher' doesn't have a default value
|
||||
Warning 1364 Field 'x509_issuer' doesn't have a default value
|
||||
Warning 1364 Field 'x509_subject' doesn't have a default value
|
||||
Warning 1364 Field 'auth_string' doesn't have a default value
|
||||
create user mysqltest_A@'%';
|
||||
rename user mysqltest_B@'%' to mysqltest_C@'%';
|
||||
drop user mysqltest_C@'%';
|
||||
@@ -354,6 +355,7 @@ Warnings:
|
||||
Warning 1364 Field 'ssl_cipher' doesn't have a default value
|
||||
Warning 1364 Field 'x509_issuer' doesn't have a default value
|
||||
Warning 1364 Field 'x509_subject' doesn't have a default value
|
||||
Warning 1364 Field 'auth_string' doesn't have a default value
|
||||
INSERT INTO mysql.db (host, db, user, select_priv) VALUES
|
||||
('%','TESTDB','mysqltest_1','Y');
|
||||
FLUSH PRIVILEGES;
|
||||
|
@@ -1703,3 +1703,91 @@ COUNT(i)
|
||||
1
|
||||
DROP TABLE t1;
|
||||
SET @@sql_mode = @old_sql_mode;
|
||||
#
|
||||
# Bug #45640: optimizer bug produces wrong results
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (4, 40), (1, 10), (2, 20), (2, 20), (3, 30);
|
||||
# should return 4 ordered records:
|
||||
SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa;
|
||||
aa COUNT(DISTINCT b)
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
SELECT (SELECT (SELECT t1.a)) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa;
|
||||
aa COUNT(DISTINCT b)
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa+0;
|
||||
aa COUNT(DISTINCT b)
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
# should return the same result in a reverse order:
|
||||
SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY -aa;
|
||||
aa COUNT(DISTINCT b)
|
||||
4 1
|
||||
3 1
|
||||
2 1
|
||||
1 1
|
||||
# execution plan should not use temporary table:
|
||||
EXPLAIN EXTENDED
|
||||
SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa+0;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using filesort
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select (select `test`.`t1`.`a`) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by ((select `test`.`t1`.`a`) + 0)
|
||||
EXPLAIN EXTENDED
|
||||
SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY -aa;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using filesort
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select (select `test`.`t1`.`a`) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by -((select `test`.`t1`.`a`))
|
||||
# should return only one record
|
||||
SELECT (SELECT tt.a FROM t1 tt LIMIT 1) aa, COUNT(DISTINCT b) FROM t1
|
||||
GROUP BY aa;
|
||||
aa COUNT(DISTINCT b)
|
||||
4 4
|
||||
CREATE TABLE t2 SELECT DISTINCT a FROM t1;
|
||||
# originally reported queries (1st two columns of next two query
|
||||
# results should be same):
|
||||
SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT(DISTINCT b)
|
||||
FROM t1 GROUP BY aa, b;
|
||||
aa b COUNT(DISTINCT b)
|
||||
1 10 1
|
||||
2 20 1
|
||||
3 30 1
|
||||
4 40 1
|
||||
SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT( b)
|
||||
FROM t1 GROUP BY aa, b;
|
||||
aa b COUNT( b)
|
||||
1 10 1
|
||||
2 20 2
|
||||
3 30 1
|
||||
4 40 1
|
||||
# ORDER BY for sure:
|
||||
SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT(DISTINCT b)
|
||||
FROM t1 GROUP BY aa, b ORDER BY -aa, -b;
|
||||
aa b COUNT(DISTINCT b)
|
||||
4 40 1
|
||||
3 30 1
|
||||
2 20 1
|
||||
1 10 1
|
||||
SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT( b)
|
||||
FROM t1 GROUP BY aa, b ORDER BY -aa, -b;
|
||||
aa b COUNT( b)
|
||||
4 40 1
|
||||
3 30 1
|
||||
2 20 2
|
||||
1 10 1
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
|
@@ -2524,4 +2524,247 @@ SELECT a, MAX(b) FROM t WHERE b GROUP BY a;
|
||||
a MAX(b)
|
||||
2 1
|
||||
DROP TABLE t;
|
||||
CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL, KEY (b));
|
||||
INSERT INTO t1 VALUES(1,1),(2,1);
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
SELECT 1 AS c, b FROM t1 WHERE b IN (1,2) GROUP BY c, b;
|
||||
c b
|
||||
1 1
|
||||
SELECT a FROM t1 WHERE b=1;
|
||||
a
|
||||
1
|
||||
2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#47762: Incorrect result from MIN() when WHERE tests NOT NULL column
|
||||
# for NULL
|
||||
#
|
||||
## Test for NULLs allowed
|
||||
CREATE TABLE t1 ( a INT, KEY (a) );
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a <=> NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x No matching min/max row
|
||||
SELECT MIN( a ) FROM t1 WHERE a <=> NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
x x x x x x x x x Using where; Using index
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x No matching min/max row
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
INSERT INTO t1 VALUES (NULL), (NULL);
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a <=> NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Select tables optimized away
|
||||
SELECT MIN( a ) FROM t1 WHERE a <=> NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
x x x x x x x x x Using where; Using index
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Select tables optimized away
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
## Test for NOT NULLs
|
||||
CREATE TABLE t1 ( a INT NOT NULL PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
#
|
||||
# NULL-safe operator test disabled for non-NULL indexed columns.
|
||||
#
|
||||
# See bugs
|
||||
#
|
||||
# - Bug#52173: Reading NULL value from non-NULL index gives
|
||||
# wrong result in embedded server
|
||||
#
|
||||
# - Bug#52174: Sometimes wrong plan when reading a MAX value from
|
||||
# non-NULL index
|
||||
#
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a = NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a <> NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a > NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a < NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE noticed after reading const tables
|
||||
x x x x x x x x x Using where; Using index
|
||||
SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0);
|
||||
MIN( a )
|
||||
NULL
|
||||
EXPLAIN
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x x x x x x x Impossible WHERE
|
||||
SELECT MIN( a ) FROM t1 WHERE a IS NULL;
|
||||
MIN( a )
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@@ -756,4 +756,17 @@ TRUNCATE t1;
|
||||
HANDLER t1 READ FIRST;
|
||||
ERROR 42S02: Unknown table 't1' in HANDLER
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#51877 - HANDLER interface causes invalid memory read
|
||||
#
|
||||
CREATE TABLE t1(a INT, KEY(a));
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ a FIRST;
|
||||
a
|
||||
INSERT INTO t1 VALUES(1);
|
||||
HANDLER t1 READ a NEXT;
|
||||
a
|
||||
1
|
||||
HANDLER t1 CLOSE;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@@ -12,7 +12,7 @@ explain extended select count(a) as b from t1 where a=0 having b >=0;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select count('0') AS `b` from `test`.`t1` where 0 having (`b` >= 0)
|
||||
Note 1003 select count(NULL) AS `b` from `test`.`t1` where 0 having (`b` >= 0)
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
raw_id int(10) NOT NULL default '0',
|
||||
@@ -430,4 +430,105 @@ SELECT b, COUNT(DISTINCT a) FROM t1 GROUP BY b HAVING b is NULL;
|
||||
b COUNT(DISTINCT a)
|
||||
NULL 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#50995 Having clause on subquery result produces incorrect results.
|
||||
#
|
||||
CREATE TABLE t1
|
||||
(
|
||||
id1 INT,
|
||||
id2 INT NOT NULL,
|
||||
INDEX id1(id2)
|
||||
);
|
||||
INSERT INTO t1 SET id1=1, id2=1;
|
||||
INSERT INTO t1 SET id1=2, id2=1;
|
||||
INSERT INTO t1 SET id1=3, id2=1;
|
||||
SELECT t1.id1,
|
||||
(SELECT 0 FROM DUAL
|
||||
WHERE t1.id1=t1.id1) AS amount FROM t1
|
||||
WHERE t1.id2 = 1
|
||||
HAVING amount > 0
|
||||
ORDER BY t1.id1;
|
||||
id1 amount
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#48916 Server incorrectly processing HAVING clauses with an ORDER BY clause
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT, f3 INT);
|
||||
INSERT INTO t1 VALUES (2,7,9), (4,7,9), (6,2,9), (17,0,9);
|
||||
SELECT table1.f1, table2.f2
|
||||
FROM t1 AS table1
|
||||
JOIN t1 AS table2 ON table1.f3 = table2.f3
|
||||
WHERE table2.f1 = 2
|
||||
GROUP BY table1.f1, table2.f2
|
||||
HAVING (table2.f2 = 8 AND table1.f1 >= 6);
|
||||
f1 f2
|
||||
EXPLAIN EXTENDED
|
||||
SELECT table1.f1, table2.f2
|
||||
FROM t1 AS table1
|
||||
JOIN t1 AS table2 ON table1.f3 = table2.f3
|
||||
WHERE table2.f1 = 2
|
||||
GROUP BY table1.f1, table2.f2
|
||||
HAVING (table2.f2 = 8 AND table1.f1 >= 6);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort
|
||||
1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having (('7' = 8) and (`test`.`table1`.`f1` >= 6))
|
||||
EXPLAIN EXTENDED
|
||||
SELECT table1.f1, table2.f2
|
||||
FROM t1 AS table1
|
||||
JOIN t1 AS table2 ON table1.f3 = table2.f3
|
||||
WHERE table2.f1 = 2
|
||||
GROUP BY table1.f1, table2.f2
|
||||
HAVING (table2.f2 = 8);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort
|
||||
1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having ('7' = 8)
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355
|
||||
#
|
||||
CREATE TABLE t1(f1 INT, f2 INT);
|
||||
INSERT INTO t1 VALUES (10,8);
|
||||
CREATE TABLE t2 (f1 INT);
|
||||
INSERT INTO t2 VALUES (5);
|
||||
SELECT COUNT(f1) FROM t2
|
||||
HAVING (7, 9) IN (SELECT f1, MIN(f2) FROM t1);
|
||||
COUNT(f1)
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (f1 INT, f2 VARCHAR(1));
|
||||
INSERT INTO t1 VALUES (16,'f');
|
||||
INSERT INTO t1 VALUES (16,'f');
|
||||
CREATE TABLE t2 (f1 INT, f2 VARCHAR(1));
|
||||
INSERT INTO t2 VALUES (13,'f');
|
||||
INSERT INTO t2 VALUES (20,'f');
|
||||
CREATE TABLE t3 (f1 INT, f2 VARCHAR(1));
|
||||
INSERT INTO t3 VALUES (7,'f');
|
||||
SELECT t1.f2 FROM t1
|
||||
STRAIGHT_JOIN (t2 JOIN t3 ON t3.f2 = t2.f2 ) ON t3 .f2 = t2 .f2
|
||||
HAVING ('v', 'i') NOT IN (SELECT f2, MIN(f2) FROM t1)
|
||||
ORDER BY f2;
|
||||
f2
|
||||
f
|
||||
f
|
||||
f
|
||||
f
|
||||
DROP TABLES t1,t2,t3;
|
||||
#
|
||||
# Bug#52340 Segfault: read_cached_record (tab=0x94a2634) at sql_select.cc:14411
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT, f2 VARCHAR(1));
|
||||
INSERT INTO t1 VALUES (16,'d');
|
||||
CREATE TABLE t2 (f1 INT, f2 VARCHAR(1));
|
||||
INSERT INTO t2 VALUES (13,'e');
|
||||
INSERT INTO t2 VALUES (20,'d');
|
||||
SELECT MAX(t2.f2) FROM t2 JOIN t1 ON t1.f2
|
||||
HAVING ('e' , 'd') IN
|
||||
(SELECT ts1.f2, ts2.f2 FROM t2 ts1 JOIN t2 ts2 ON ts1.f1)
|
||||
ORDER BY t1.f2;
|
||||
MAX(t2.f2)
|
||||
NULL
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.0 tests
|
||||
|
@@ -286,7 +286,7 @@ NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
|
||||
explain select * from (select * from t1 where key1 = 3 or key2 =3) as Z where key8 >5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||
2 DERIVED t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where; Using index
|
||||
2 DERIVED t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
|
||||
create table t3 like t0;
|
||||
insert into t3 select * from t0;
|
||||
alter table t3 add key9 int not null, add index i9(key9);
|
||||
|
@@ -67,8 +67,11 @@ INNODB_INDEX_STATS
|
||||
INNODB_LOCKS
|
||||
INNODB_LOCK_WAITS
|
||||
INNODB_RSEG
|
||||
INNODB_SYS_INDEXES
|
||||
INNODB_SYS_TABLES
|
||||
INNODB_TABLE_STATS
|
||||
INNODB_TRX
|
||||
KEY_CACHES
|
||||
KEY_COLUMN_USAGE
|
||||
PARTITIONS
|
||||
PLUGINS
|
||||
@@ -615,7 +618,7 @@ proc body longblob
|
||||
proc definer char(77)
|
||||
proc created timestamp
|
||||
proc modified timestamp
|
||||
proc sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH')
|
||||
proc sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH')
|
||||
proc comment char(64)
|
||||
proc character_set_client char(32)
|
||||
proc collation_connection char(32)
|
||||
|
@@ -13,6 +13,7 @@ FILES
|
||||
GLOBAL_STATUS
|
||||
GLOBAL_VARIABLES
|
||||
INDEX_STATISTICS
|
||||
KEY_CACHES
|
||||
KEY_COLUMN_USAGE
|
||||
PARTITIONS
|
||||
PLUGINS
|
||||
@@ -41,12 +42,14 @@ XTRADB_ENHANCEMENTS
|
||||
INNODB_BUFFER_POOL_PAGES_INDEX
|
||||
XTRADB_ADMIN_COMMAND
|
||||
INNODB_TRX
|
||||
INNODB_CMP_RESET
|
||||
INNODB_SYS_TABLES
|
||||
INNODB_LOCK_WAITS
|
||||
INNODB_CMPMEM_RESET
|
||||
INNODB_LOCKS
|
||||
INNODB_CMPMEM
|
||||
INNODB_TABLE_STATS
|
||||
INNODB_SYS_INDEXES
|
||||
INNODB_CMP_RESET
|
||||
INNODB_BUFFER_POOL_PAGES_BLOB
|
||||
INNODB_INDEX_STATS
|
||||
SELECT t.table_name, c1.column_name
|
||||
@@ -76,6 +79,7 @@ FILES TABLE_SCHEMA
|
||||
GLOBAL_STATUS VARIABLE_NAME
|
||||
GLOBAL_VARIABLES VARIABLE_NAME
|
||||
INDEX_STATISTICS TABLE_SCHEMA
|
||||
KEY_CACHES KEY_CACHE_NAME
|
||||
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
|
||||
PARTITIONS TABLE_SCHEMA
|
||||
PLUGINS PLUGIN_NAME
|
||||
@@ -104,14 +108,16 @@ XTRADB_ENHANCEMENTS name
|
||||
INNODB_BUFFER_POOL_PAGES_INDEX schema_name
|
||||
XTRADB_ADMIN_COMMAND result_message
|
||||
INNODB_TRX trx_id
|
||||
INNODB_CMP_RESET page_size
|
||||
INNODB_SYS_TABLES NAME
|
||||
INNODB_LOCK_WAITS requesting_trx_id
|
||||
INNODB_CMPMEM_RESET page_size
|
||||
INNODB_LOCKS lock_id
|
||||
INNODB_CMPMEM page_size
|
||||
INNODB_TABLE_STATS table_name
|
||||
INNODB_TABLE_STATS table_schema
|
||||
INNODB_SYS_INDEXES TABLE_ID
|
||||
INNODB_CMP_RESET page_size
|
||||
INNODB_BUFFER_POOL_PAGES_BLOB space_id
|
||||
INNODB_INDEX_STATS table_name
|
||||
INNODB_INDEX_STATS table_schema
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
@@ -139,6 +145,7 @@ FILES TABLE_SCHEMA
|
||||
GLOBAL_STATUS VARIABLE_NAME
|
||||
GLOBAL_VARIABLES VARIABLE_NAME
|
||||
INDEX_STATISTICS TABLE_SCHEMA
|
||||
KEY_CACHES KEY_CACHE_NAME
|
||||
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
|
||||
PARTITIONS TABLE_SCHEMA
|
||||
PLUGINS PLUGIN_NAME
|
||||
@@ -167,14 +174,16 @@ XTRADB_ENHANCEMENTS name
|
||||
INNODB_BUFFER_POOL_PAGES_INDEX schema_name
|
||||
XTRADB_ADMIN_COMMAND result_message
|
||||
INNODB_TRX trx_id
|
||||
INNODB_CMP_RESET page_size
|
||||
INNODB_SYS_TABLES NAME
|
||||
INNODB_LOCK_WAITS requesting_trx_id
|
||||
INNODB_CMPMEM_RESET page_size
|
||||
INNODB_LOCKS lock_id
|
||||
INNODB_CMPMEM page_size
|
||||
INNODB_TABLE_STATS table_name
|
||||
INNODB_TABLE_STATS table_schema
|
||||
INNODB_SYS_INDEXES TABLE_ID
|
||||
INNODB_CMP_RESET page_size
|
||||
INNODB_BUFFER_POOL_PAGES_BLOB space_id
|
||||
INNODB_INDEX_STATS table_name
|
||||
INNODB_INDEX_STATS table_schema
|
||||
select 1 as f1 from information_schema.tables where "CHARACTER_SETS"=
|
||||
(select cast(table_name as char) from information_schema.tables
|
||||
order by table_name limit 1) limit 1;
|
||||
@@ -219,8 +228,11 @@ INNODB_INDEX_STATS information_schema.INNODB_INDEX_STATS 1
|
||||
INNODB_LOCKS information_schema.INNODB_LOCKS 1
|
||||
INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1
|
||||
INNODB_RSEG information_schema.INNODB_RSEG 1
|
||||
INNODB_SYS_INDEXES information_schema.INNODB_SYS_INDEXES 1
|
||||
INNODB_SYS_TABLES information_schema.INNODB_SYS_TABLES 1
|
||||
INNODB_TABLE_STATS information_schema.INNODB_TABLE_STATS 1
|
||||
INNODB_TRX information_schema.INNODB_TRX 1
|
||||
KEY_CACHES information_schema.KEY_CACHES 1
|
||||
KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1
|
||||
PARTITIONS information_schema.PARTITIONS 1
|
||||
PBXT_STATISTICS information_schema.PBXT_STATISTICS 1
|
||||
@@ -259,6 +271,7 @@ Database: information_schema
|
||||
| GLOBAL_STATUS |
|
||||
| GLOBAL_VARIABLES |
|
||||
| INDEX_STATISTICS |
|
||||
| KEY_CACHES |
|
||||
| KEY_COLUMN_USAGE |
|
||||
| PARTITIONS |
|
||||
| PLUGINS |
|
||||
@@ -287,12 +300,14 @@ Database: information_schema
|
||||
| INNODB_BUFFER_POOL_PAGES_INDEX |
|
||||
| XTRADB_ADMIN_COMMAND |
|
||||
| INNODB_TRX |
|
||||
| INNODB_CMP_RESET |
|
||||
| INNODB_SYS_TABLES |
|
||||
| INNODB_LOCK_WAITS |
|
||||
| INNODB_CMPMEM_RESET |
|
||||
| INNODB_LOCKS |
|
||||
| INNODB_CMPMEM |
|
||||
| INNODB_TABLE_STATS |
|
||||
| INNODB_SYS_INDEXES |
|
||||
| INNODB_CMP_RESET |
|
||||
| INNODB_BUFFER_POOL_PAGES_BLOB |
|
||||
| INNODB_INDEX_STATS |
|
||||
+---------------------------------------+
|
||||
@@ -312,6 +327,7 @@ Database: INFORMATION_SCHEMA
|
||||
| GLOBAL_STATUS |
|
||||
| GLOBAL_VARIABLES |
|
||||
| INDEX_STATISTICS |
|
||||
| KEY_CACHES |
|
||||
| KEY_COLUMN_USAGE |
|
||||
| PARTITIONS |
|
||||
| PLUGINS |
|
||||
@@ -340,12 +356,14 @@ Database: INFORMATION_SCHEMA
|
||||
| INNODB_BUFFER_POOL_PAGES_INDEX |
|
||||
| XTRADB_ADMIN_COMMAND |
|
||||
| INNODB_TRX |
|
||||
| INNODB_CMP_RESET |
|
||||
| INNODB_SYS_TABLES |
|
||||
| INNODB_LOCK_WAITS |
|
||||
| INNODB_CMPMEM_RESET |
|
||||
| INNODB_LOCKS |
|
||||
| INNODB_CMPMEM |
|
||||
| INNODB_TABLE_STATS |
|
||||
| INNODB_SYS_INDEXES |
|
||||
| INNODB_CMP_RESET |
|
||||
| INNODB_BUFFER_POOL_PAGES_BLOB |
|
||||
| INNODB_INDEX_STATS |
|
||||
+---------------------------------------+
|
||||
@@ -357,5 +375,5 @@ Wildcard: inf_rmation_schema
|
||||
+--------------------+
|
||||
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
|
||||
table_schema count(*)
|
||||
information_schema 48
|
||||
information_schema 51
|
||||
mysql 22
|
||||
|
@@ -1,30 +0,0 @@
|
||||
drop table if exists t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (null);
|
||||
INSERT INTO t1 VALUES (null);
|
||||
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
|
||||
SELECT * FROM t1;
|
||||
d1
|
||||
1
|
||||
2
|
||||
SELECT * FROM t1;
|
||||
d1
|
||||
1
|
||||
2
|
||||
INSERT INTO t1 VALUES(null);
|
||||
Got one of the listed errors
|
||||
ALTER TABLE t1 AUTO_INCREMENT = 3;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`d1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`d1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES(null);
|
||||
SELECT * FROM t1;
|
||||
d1
|
||||
1
|
||||
2
|
||||
3
|
||||
DROP TABLE t1;
|
File diff suppressed because it is too large
Load Diff
@@ -1,55 +0,0 @@
|
||||
#
|
||||
# Bug#21704: Renaming column does not update FK definition.
|
||||
#
|
||||
|
||||
# Test that it's not possible to rename columns participating in a
|
||||
# foreign key (either in the referencing or referenced table).
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b INT,
|
||||
CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a))
|
||||
ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT,
|
||||
CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a))
|
||||
ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
|
||||
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
|
||||
INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3);
|
||||
|
||||
# Test renaming the column in the referenced table.
|
||||
|
||||
ALTER TABLE t1 CHANGE a c INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t1 CHANGE b c INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Test renaming the column in the referencing table
|
||||
|
||||
ALTER TABLE t2 CHANGE a c INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t2 CHANGE b c INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Test with self-referential constraints
|
||||
|
||||
ALTER TABLE t3 CHANGE a d INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
|
||||
ALTER TABLE t3 CHANGE b d INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t3 CHANGE c d INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Cleanup.
|
||||
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
@@ -1,11 +0,0 @@
|
||||
SET storage_engine=InnoDB;
|
||||
INSERT INTO bug38231 VALUES (1), (10), (300);
|
||||
SET autocommit=0;
|
||||
SELECT * FROM bug38231 FOR UPDATE;
|
||||
a
|
||||
1
|
||||
10
|
||||
300
|
||||
TRUNCATE TABLE bug38231;
|
||||
COMMIT;
|
||||
DROP TABLE bug38231;
|
@@ -1 +0,0 @@
|
||||
SET storage_engine=InnoDB;
|
@@ -1,9 +0,0 @@
|
||||
create table bug40565(value decimal(4,2)) engine=innodb;
|
||||
insert into bug40565 values (1), (null);
|
||||
update bug40565 set value=NULL;
|
||||
affected rows: 1
|
||||
info: Rows matched: 2 Changed: 1 Warnings: 0
|
||||
update bug40565 set value=NULL;
|
||||
affected rows: 0
|
||||
info: Rows matched: 2 Changed: 0 Warnings: 0
|
||||
drop table bug40565;
|
@@ -1,26 +0,0 @@
|
||||
set global innodb_commit_concurrency=0;
|
||||
ERROR HY000: Incorrect arguments to SET
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
1
|
||||
set global innodb_commit_concurrency=1;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
1
|
||||
set global innodb_commit_concurrency=42;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
42
|
||||
set global innodb_commit_concurrency=DEFAULT;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
1
|
||||
set global innodb_commit_concurrency=0;
|
||||
ERROR HY000: Incorrect arguments to SET
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
1
|
||||
set global innodb_commit_concurrency=1;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
1
|
@@ -1,22 +0,0 @@
|
||||
set global innodb_commit_concurrency=0;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
0
|
||||
set global innodb_commit_concurrency=1;
|
||||
ERROR HY000: Incorrect arguments to SET
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
0
|
||||
set global innodb_commit_concurrency=42;
|
||||
ERROR HY000: Incorrect arguments to SET
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
0
|
||||
set global innodb_commit_concurrency=0;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
0
|
||||
set global innodb_commit_concurrency=DEFAULT;
|
||||
select @@innodb_commit_concurrency;
|
||||
@@innodb_commit_concurrency
|
||||
0
|
@@ -1,7 +0,0 @@
|
||||
CREATE TABLE bug44032(c CHAR(3) CHARACTER SET UTF8) ROW_FORMAT=REDUNDANT
|
||||
ENGINE=InnoDB;
|
||||
INSERT INTO bug44032 VALUES('abc'),(0xEFBCA4EFBCA4EFBCA4);
|
||||
UPDATE bug44032 SET c='DDD' WHERE c=0xEFBCA4EFBCA4EFBCA4;
|
||||
UPDATE bug44032 SET c=NULL WHERE c='DDD';
|
||||
UPDATE bug44032 SET c='DDD' WHERE c IS NULL;
|
||||
DROP TABLE bug44032;
|
@@ -1,6 +0,0 @@
|
||||
create table bug44369 (DB_ROW_ID int) engine=innodb;
|
||||
ERROR 42000: Incorrect column name 'DB_ROW_ID'
|
||||
create table bug44369 (db_row_id int) engine=innodb;
|
||||
ERROR 42000: Incorrect column name 'db_row_id'
|
||||
create table bug44369 (db_TRX_Id int) engine=innodb;
|
||||
ERROR 42000: Incorrect column name 'db_TRX_Id'
|
@@ -1,7 +0,0 @@
|
||||
set session transaction isolation level read committed;
|
||||
create table bug45357(a int, b int,key(b))engine=innodb;
|
||||
insert into bug45357 values (25170,6122);
|
||||
update bug45357 set a=1 where b=30131;
|
||||
delete from bug45357 where b < 20996;
|
||||
delete from bug45357 where b < 7001;
|
||||
drop table bug45357;
|
@@ -1,18 +0,0 @@
|
||||
create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
|
||||
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
|
||||
create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
|
||||
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
|
||||
Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
|
||||
Error 1005 Can't create table 'test.bug46000' (errno: -1)
|
||||
create table bug46000(id int) engine=innodb;
|
||||
create index GEN_CLUST_INDEX on bug46000(id);
|
||||
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
|
||||
Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
|
||||
create index idx on bug46000(id);
|
||||
drop table bug46000;
|
@@ -1,13 +0,0 @@
|
||||
create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
|
||||
insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
|
||||
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
|
||||
count(*)
|
||||
1
|
||||
update bug47777 set c2=GeomFromText('POINT(1 1)');
|
||||
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
|
||||
count(*)
|
||||
0
|
||||
select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
|
||||
count(*)
|
||||
1
|
||||
drop table bug47777;
|
@@ -2276,4 +2276,117 @@ END|
|
||||
DROP PROCEDURE p1;
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# Bug #49324: more valgrind errors in test_if_skip_sort_order
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb ;
|
||||
#should not cause valgrind warnings
|
||||
SELECT 1 FROM t1 JOIN t1 a USING(a) GROUP BY t1.a,t1.a;
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#50843: Filesort used instead of clustered index led to
|
||||
# performance degradation.
|
||||
#
|
||||
create table t1(f1 int not null primary key, f2 int) engine=innodb;
|
||||
create table t2(f1 int not null, key (f1)) engine=innodb;
|
||||
insert into t1 values (1,1),(2,2),(3,3);
|
||||
insert into t2 values (1),(2),(3);
|
||||
explain select t1.* from t1 left join t2 using(f1) group by t1.f1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL PRIMARY 4 NULL 3
|
||||
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 1 Using index
|
||||
drop table t1,t2;
|
||||
#
|
||||
#
|
||||
# Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may
|
||||
# corrupt definition at engine
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, KEY k (a,b))
|
||||
ENGINE=InnoDB;
|
||||
ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b);
|
||||
SHOW INDEXES FROM t1;;
|
||||
Table t1
|
||||
Non_unique 0
|
||||
Key_name k
|
||||
Seq_in_index 1
|
||||
Column_name a
|
||||
Collation A
|
||||
Cardinality 0
|
||||
Sub_part NULL
|
||||
Packed NULL
|
||||
Null
|
||||
Index_type BTREE
|
||||
Comment
|
||||
Table t1
|
||||
Non_unique 0
|
||||
Key_name k
|
||||
Seq_in_index 2
|
||||
Column_name b
|
||||
Collation A
|
||||
Cardinality 0
|
||||
Sub_part NULL
|
||||
Packed NULL
|
||||
Null
|
||||
Index_type BTREE
|
||||
Comment
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #53334: wrong result for outer join with impossible ON condition
|
||||
# (see the same test case for MyISAM in join.test)
|
||||
#
|
||||
create table t1 (id int primary key);
|
||||
create table t2 (id int);
|
||||
insert into t1 values (75);
|
||||
insert into t1 values (79);
|
||||
insert into t1 values (78);
|
||||
insert into t1 values (77);
|
||||
replace into t1 values (76);
|
||||
replace into t1 values (76);
|
||||
insert into t1 values (104);
|
||||
insert into t1 values (103);
|
||||
insert into t1 values (102);
|
||||
insert into t1 values (101);
|
||||
insert into t1 values (105);
|
||||
insert into t1 values (106);
|
||||
insert into t1 values (107);
|
||||
insert into t2 values (107),(75),(1000);
|
||||
select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
|
||||
where t2.id=75 and t1.id is null;
|
||||
id id
|
||||
NULL 75
|
||||
explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
|
||||
where t2.id=75 and t1.id is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||
drop table t1,t2;
|
||||
#
|
||||
# Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when
|
||||
# JOINed during an UPDATE
|
||||
#
|
||||
CREATE TABLE t1 (d INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a INT, b INT,
|
||||
c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB;
|
||||
set up our data elements
|
||||
INSERT INTO t1 (d) VALUES (1);
|
||||
INSERT INTO t2 (a,b) VALUES (1,1);
|
||||
SELECT SECOND(c) INTO @bug47453 FROM t2;
|
||||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
|
||||
SECOND(c)-@bug47453
|
||||
0
|
||||
UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
|
||||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
|
||||
SECOND(c)-@bug47453
|
||||
0
|
||||
SELECT SLEEP(1);
|
||||
SLEEP(1)
|
||||
0
|
||||
UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
|
||||
#should be 0
|
||||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
|
||||
SECOND(c)-@bug47453
|
||||
0
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.1 tests
|
||||
|
@@ -1117,6 +1117,45 @@ ON t4.a = t5.a
|
||||
ON t1.a = t3.a;
|
||||
a a a a a a
|
||||
DROP TABLE t1,t2,t3,t4,t5,t6;
|
||||
#
|
||||
# Bug#48483: crash in get_best_combination()
|
||||
#
|
||||
CREATE TABLE t1(f1 INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
CREATE VIEW v1 AS SELECT 1 FROM t1 LEFT JOIN t1 AS t2 on 1=1;
|
||||
EXPLAIN EXTENDED
|
||||
SELECT 1 FROM v1 right join v1 AS v2 ON RAND();
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` left join `test`.`t1` `t2` on((1 = 1)) left join (`test`.`t1` left join `test`.`t1` `t2` on((1 = 1))) on(rand()) where 1
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#52177 crash with explain, row comparison, join, text field
|
||||
#
|
||||
CREATE TABLE t1 (a TINYINT, b TEXT, KEY (a));
|
||||
INSERT INTO t1 VALUES (0,''),(0,'');
|
||||
FLUSH TABLES;
|
||||
EXPLAIN SELECT 1 FROM t1 LEFT JOIN t1 a ON 1
|
||||
WHERE ROW(t1.a, 1111.11) = ROW(1111.11, 1111.11) AND
|
||||
ROW(t1.b, 1111.11) <=> ROW('','');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
|
||||
INSERT INTO t1 VALUES (0,0), (1,1);
|
||||
SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
|
||||
a b a b
|
||||
0 0 0 0
|
||||
1 1 1 1
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
CREATE TABLE t1 (f1 int);
|
||||
CREATE TABLE t2 (f1 int);
|
||||
@@ -1128,3 +1167,21 @@ EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM;
|
||||
CREATE TABLE t2(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM;
|
||||
INSERT INTO t1 VALUES ('1',null),(null,null);
|
||||
INSERT INTO t2 VALUES ('1',null),(null,null);
|
||||
CREATE TABLE mm1(a CHAR(9),b INT,KEY(b),KEY(a))
|
||||
ENGINE=MERGE UNION=(t1,t2);
|
||||
SELECT t1.a FROM mm1,t1;
|
||||
a
|
||||
NULL
|
||||
1
|
||||
NULL
|
||||
1
|
||||
NULL
|
||||
1
|
||||
NULL
|
||||
1
|
||||
DROP TABLE t1, t2, mm1;
|
||||
End of 5.1 tests
|
||||
|
@@ -1289,3 +1289,23 @@ a COUNT( t2.b ) SUM( t2.b ) MAX( t2.b )
|
||||
1 3 6 3
|
||||
NULL 3 6 3
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#51598 Inconsistent behaviour with a COALESCE statement inside an IN comparison
|
||||
#
|
||||
CREATE TABLE t1(f1 INT, f2 INT, f3 INT);
|
||||
INSERT INTO t1 VALUES (1, NULL, 3);
|
||||
CREATE TABLE t2(f1 INT, f2 INT);
|
||||
INSERT INTO t2 VALUES (2, 1);
|
||||
EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
|
||||
WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
|
||||
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
|
||||
Warnings:
|
||||
Note 1003 select '1' AS `f1`,NULL AS `f2`,'3' AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t1` left join `test`.`t2` on(multiple equal(NULL)) where ((coalesce('1',NULL),'3') in ((1,3),(2,2)))
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
|
||||
WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
|
||||
f1 f2 f3 f1 f2
|
||||
1 NULL 3 NULL NULL
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.1 tests
|
||||
|
@@ -1293,6 +1293,26 @@ a COUNT( t2.b ) SUM( t2.b ) MAX( t2.b )
|
||||
1 3 6 3
|
||||
NULL 3 6 3
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#51598 Inconsistent behaviour with a COALESCE statement inside an IN comparison
|
||||
#
|
||||
CREATE TABLE t1(f1 INT, f2 INT, f3 INT);
|
||||
INSERT INTO t1 VALUES (1, NULL, 3);
|
||||
CREATE TABLE t2(f1 INT, f2 INT);
|
||||
INSERT INTO t2 VALUES (2, 1);
|
||||
EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
|
||||
WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
|
||||
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
|
||||
Warnings:
|
||||
Note 1003 select '1' AS `f1`,NULL AS `f2`,'3' AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t1` left join `test`.`t2` on(multiple equal(NULL)) where ((coalesce('1',NULL),'3') in ((1,3),(2,2)))
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
|
||||
WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
|
||||
f1 f2 f3 f1 f2
|
||||
1 NULL 3 NULL NULL
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.1 tests
|
||||
set join_cache_level=default;
|
||||
show variables like 'join_cache_level';
|
||||
Variable_name Value
|
||||
|
@@ -1,5 +1,7 @@
|
||||
drop table if exists t1, t2, t3;
|
||||
SET @save_key_buffer=@@key_buffer_size;
|
||||
SET @save_key_buffer_size=@@key_buffer_size;
|
||||
SET @save_key_cache_block_size=@@key_cache_block_size;
|
||||
SET @save_key_cache_segments=@@key_cache_segments;
|
||||
SELECT @@key_buffer_size, @@small.key_buffer_size;
|
||||
@@key_buffer_size @@small.key_buffer_size
|
||||
2097152 131072
|
||||
@@ -37,7 +39,7 @@ SELECT @@small.key_buffer_size;
|
||||
SELECT @@medium.key_buffer_size;
|
||||
@@medium.key_buffer_size
|
||||
0
|
||||
SET @@global.key_buffer_size=@save_key_buffer;
|
||||
SET @@global.key_buffer_size=@save_key_buffer_size;
|
||||
SELECT @@default.key_buffer_size;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'default.key_buffer_size' at line 1
|
||||
SELECT @@skr.storage_engine="test";
|
||||
@@ -366,3 +368,432 @@ Variable_name Value
|
||||
key_cache_block_size 1536
|
||||
SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size;
|
||||
DROP TABLE t1;
|
||||
set global key_buffer_size=@save_key_buffer_size;
|
||||
set global key_cache_block_size=@save_key_cache_block_size;
|
||||
select @@key_buffer_size;
|
||||
@@key_buffer_size
|
||||
2097152
|
||||
select @@key_cache_block_size;
|
||||
@@key_cache_block_size
|
||||
1024
|
||||
select @@key_cache_segments;
|
||||
@@key_cache_segments
|
||||
0
|
||||
create table t1 (
|
||||
p int not null auto_increment primary key,
|
||||
a char(10));
|
||||
create table t2 (
|
||||
p int not null auto_increment primary key,
|
||||
i int, a char(10), key k1(i), key k2(a));
|
||||
select @@key_cache_segments;
|
||||
@@key_cache_segments
|
||||
0
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default NULL NULL 2097152 1024 0 # 0 0 0 0 0
|
||||
small NULL NULL 1048576 1024 1 # 0 1 0 2 1
|
||||
insert into t1 values (1, 'qqqq'), (2, 'yyyy');
|
||||
insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
|
||||
(3, 1, 'yyyy'), (4, 3, 'zzzz');
|
||||
select * from t1;
|
||||
p a
|
||||
1 qqqq
|
||||
2 yyyy
|
||||
select * from t2;
|
||||
p i a
|
||||
1 1 qqqq
|
||||
2 1 pppp
|
||||
3 1 yyyy
|
||||
4 3 zzzz
|
||||
update t1 set p=3 where p=1;
|
||||
update t2 set i=2 where i=1;
|
||||
show status like 'key_%';
|
||||
Variable_name Value
|
||||
Key_blocks_not_flushed 0
|
||||
Key_blocks_unused KEY_BLOCKS_UNUSED
|
||||
Key_blocks_used 4
|
||||
Key_read_requests 22
|
||||
Key_reads 0
|
||||
Key_write_requests 26
|
||||
Key_writes 6
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default NULL NULL 2097152 1024 4 # 0 22 0 26 6
|
||||
small NULL NULL 1048576 1024 1 # 0 1 0 2 1
|
||||
delete from t2 where a='zzzz';
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default NULL NULL 2097152 1024 4 # 0 29 0 32 9
|
||||
small NULL NULL 1048576 1024 1 # 0 1 0 2 1
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default NULL NULL 2097152 1024 4 # 0 29 0 32 9
|
||||
small NULL NULL 1048576 1024 1 # 0 1 0 2 1
|
||||
set global key_cache_segments=2;
|
||||
select @@key_cache_segments;
|
||||
@@key_cache_segments
|
||||
2
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 2097152 1024 0 # 0 0 0 0 0
|
||||
small NULL NULL 1048576 1024 1 # 0 1 0 2 1
|
||||
insert into t1 values (1, 'qqqq'), (2, 'yyyy');
|
||||
insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
|
||||
(3, 1, 'yyyy'), (4, 3, 'zzzz');
|
||||
select * from t1;
|
||||
p a
|
||||
1 qqqq
|
||||
2 yyyy
|
||||
select * from t2;
|
||||
p i a
|
||||
1 1 qqqq
|
||||
2 1 pppp
|
||||
3 1 yyyy
|
||||
4 3 zzzz
|
||||
update t1 set p=3 where p=1;
|
||||
update t2 set i=2 where i=1;
|
||||
show status like 'key_%';
|
||||
Variable_name Value
|
||||
Key_blocks_not_flushed 0
|
||||
Key_blocks_unused KEY_BLOCKS_UNUSED
|
||||
Key_blocks_used 4
|
||||
Key_read_requests 22
|
||||
Key_reads 0
|
||||
Key_write_requests 26
|
||||
Key_writes 6
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 2097152 1024 4 # 0 22 0 26 6
|
||||
small NULL NULL 1048576 1024 1 # 0 1 0 2 1
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 2097152 1024 4 # 0 22 0 26 6
|
||||
small NULL NULL 1048576 1024 1 # 0 1 0 2 1
|
||||
set global key_cache_segments=1;
|
||||
select @@key_cache_segments;
|
||||
@@key_cache_segments
|
||||
1
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 1 NULL 2097152 1024 0 # 0 0 0 0 0
|
||||
small NULL NULL 1048576 1024 1 # 0 1 0 2 1
|
||||
insert into t1 values (1, 'qqqq'), (2, 'yyyy');
|
||||
insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
|
||||
(3, 1, 'yyyy'), (4, 3, 'zzzz');
|
||||
select * from t1;
|
||||
p a
|
||||
1 qqqq
|
||||
2 yyyy
|
||||
select * from t2;
|
||||
p i a
|
||||
1 1 qqqq
|
||||
2 1 pppp
|
||||
3 1 yyyy
|
||||
4 3 zzzz
|
||||
update t1 set p=3 where p=1;
|
||||
update t2 set i=2 where i=1;
|
||||
show status like 'key_%';
|
||||
Variable_name Value
|
||||
Key_blocks_not_flushed 0
|
||||
Key_blocks_unused KEY_BLOCKS_UNUSED
|
||||
Key_blocks_used 4
|
||||
Key_read_requests 22
|
||||
Key_reads 0
|
||||
Key_write_requests 26
|
||||
Key_writes 6
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 1 NULL 2097152 1024 4 # 0 22 0 26 6
|
||||
small NULL NULL 1048576 1024 1 # 0 1 0 2 1
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 1 NULL 2097152 1024 4 # 0 22 0 26 6
|
||||
small NULL NULL 1048576 1024 1 # 0 1 0 2 1
|
||||
flush tables;
|
||||
flush status;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 1 NULL 2097152 1024 4 # 0 0 0 0 0
|
||||
small NULL NULL 1048576 1024 1 # 0 0 0 0 0
|
||||
set global key_buffer_size=32*1024;
|
||||
select @@key_buffer_size;
|
||||
@@key_buffer_size
|
||||
32768
|
||||
set global key_cache_segments=2;
|
||||
select @@key_cache_segments;
|
||||
@@key_cache_segments
|
||||
2
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 0 # 0 0 0 0 0
|
||||
small NULL NULL 1048576 1024 1 # 0 0 0 0 0
|
||||
insert into t1 values (1, 'qqqq'), (2, 'yyyy');
|
||||
insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
|
||||
(3, 1, 'yyyy'), (4, 3, 'zzzz');
|
||||
select * from t1;
|
||||
p a
|
||||
1 qqqq
|
||||
2 yyyy
|
||||
select * from t2;
|
||||
p i a
|
||||
1 1 qqqq
|
||||
2 1 pppp
|
||||
3 1 yyyy
|
||||
4 3 zzzz
|
||||
update t1 set p=3 where p=1;
|
||||
update t2 set i=2 where i=1;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 4 # 0 22 0 26 6
|
||||
small NULL NULL 1048576 1024 1 # 0 0 0 0 0
|
||||
insert into t1(a) select a from t1;
|
||||
insert into t1(a) select a from t1;
|
||||
insert into t1(a) select a from t1;
|
||||
insert into t1(a) select a from t1;
|
||||
insert into t1(a) select a from t1;
|
||||
insert into t1(a) select a from t1;
|
||||
insert into t1(a) select a from t1;
|
||||
insert into t1(a) select a from t1;
|
||||
insert into t2(i,a) select i,a from t2;
|
||||
insert into t2(i,a) select i,a from t2;
|
||||
insert into t2(i,a) select i,a from t2;
|
||||
insert into t2(i,a) select i,a from t2;
|
||||
insert into t2(i,a) select i,a from t2;
|
||||
insert into t2(i,a) select i,a from t2;
|
||||
insert into t2(i,a) select i,a from t2;
|
||||
insert into t2(i,a) select i,a from t2;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 6733 # 3684 103
|
||||
small NULL NULL 1048576 1024 # # 0 0 # 0 0
|
||||
select * from t1 where p between 1010 and 1020 ;
|
||||
p a
|
||||
select * from t2 where p between 1010 and 1020 ;
|
||||
p i a
|
||||
1010 2 pppp
|
||||
1011 2 yyyy
|
||||
1012 3 zzzz
|
||||
1013 2 qqqq
|
||||
1014 2 pppp
|
||||
1015 2 yyyy
|
||||
1016 3 zzzz
|
||||
1017 2 qqqq
|
||||
1018 2 pppp
|
||||
1019 2 yyyy
|
||||
1020 3 zzzz
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 6750 # 3684 103
|
||||
small NULL NULL 1048576 1024 # # 0 0 # 0 0
|
||||
flush tables;
|
||||
flush status;
|
||||
update t1 set a='zzzz' where a='qqqq';
|
||||
update t2 set i=1 where i=2;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3076 18 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
set global keycache1.key_buffer_size=256*1024;
|
||||
select @@keycache1.key_buffer_size;
|
||||
@@keycache1.key_buffer_size
|
||||
262144
|
||||
set global keycache1.key_cache_segments=7;
|
||||
select @@keycache1.key_cache_segments;
|
||||
@@keycache1.key_cache_segments
|
||||
7
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3076 18 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache1 7 NULL 262143 2048 # # 0 0 0 0 0
|
||||
select * from information_schema.key_caches where key_cache_name like "key%"
|
||||
and segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
keycache1 7 NULL 262143 2048 0 # 0 0 0 0 0
|
||||
cache index t1 key (`primary`) in keycache1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 assign_to_keycache status OK
|
||||
explain select p from t1 where p between 1010 and 1020;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where; Using index
|
||||
select p from t1 where p between 1010 and 1020;
|
||||
p
|
||||
explain select i from t2 where p between 1010 and 1020;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 28 Using index condition; Using MRR
|
||||
select i from t2 where p between 1010 and 1020;
|
||||
i
|
||||
1
|
||||
1
|
||||
3
|
||||
1
|
||||
1
|
||||
1
|
||||
3
|
||||
1
|
||||
1
|
||||
1
|
||||
3
|
||||
explain select count(*) from t1, t2 where t1.p = t2.i;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index k1 k1 5 NULL 1024 Using index
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.i 1 Using index
|
||||
select count(*) from t1, t2 where t1.p = t2.i;
|
||||
count(*)
|
||||
256
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3172 24 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache1 7 NULL 262143 2048 # # 0 14 3 0 0
|
||||
select * from information_schema.key_caches where key_cache_name like "key%"
|
||||
and segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
keycache1 7 NULL 262143 2048 3 # 0 14 3 0 0
|
||||
cache index t2 in keycache1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 assign_to_keycache status OK
|
||||
update t2 set p=p+3000, i=2 where a='qqqq';
|
||||
select * from information_schema.key_caches where key_cache_name like "key%"
|
||||
and segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
keycache1 7 NULL 262143 2048 25 # 0 2082 25 1071 19
|
||||
set global keycache2.key_buffer_size=1024*1024;
|
||||
cache index t2 in keycache2;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 assign_to_keycache status OK
|
||||
insert into t2 values (2000, 3, 'yyyy');
|
||||
select * from information_schema.key_caches where key_cache_name like "keycache2"
|
||||
and segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
keycache2 NULL NULL 1048576 1024 6 # 0 6 6 3 3
|
||||
select * from information_schema.key_caches where key_cache_name like "key%"
|
||||
and segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
keycache1 7 NULL 262143 2048 25 # 0 2082 25 1071 19
|
||||
keycache2 NULL NULL 1048576 1024 6 # 0 6 6 3 3
|
||||
cache index t2 in keycache1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 assign_to_keycache status OK
|
||||
update t2 set p=p+5000 where a='zzzz';
|
||||
select * from t2 where p between 1010 and 1020;
|
||||
p i a
|
||||
1010 1 pppp
|
||||
1011 1 yyyy
|
||||
1014 1 pppp
|
||||
1015 1 yyyy
|
||||
1018 1 pppp
|
||||
1019 1 yyyy
|
||||
explain select p from t2 where p between 1010 and 1020;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 7 Using where; Using index
|
||||
select p from t2 where p between 1010 and 1020;
|
||||
p
|
||||
1010
|
||||
1011
|
||||
1014
|
||||
1015
|
||||
1018
|
||||
1019
|
||||
explain select i from t2 where a='yyyy' and i=3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ref k1,k2 k1 5 const 188 Using where
|
||||
select i from t2 where a='yyyy' and i=3;
|
||||
i
|
||||
3
|
||||
explain select a from t2 where a='yyyy' and i=3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ref k1,k2 k1 5 const 188 Using where
|
||||
select a from t2 where a='yyyy' and i=3 ;
|
||||
a
|
||||
yyyy
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3172 24 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache1 7 NULL 262143 2048 # # 0 3201 43 1594 30
|
||||
keycache2 NULL NULL 1048576 1024 # # 0 6 6 3 3
|
||||
set global keycache1.key_cache_block_size=2*1024;
|
||||
insert into t2 values (7000, 3, 'yyyy');
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3172 24 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache1 7 NULL 262143 2048 # # 0 6 6 3 3
|
||||
keycache2 NULL NULL 1048576 1024 # # 0 6 6 3 3
|
||||
set global keycache1.key_cache_block_size=8*1024;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3172 24 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache1 3 NULL 262143 8192 # # 0 0 0 0 0
|
||||
keycache2 NULL NULL 1048576 1024 # # 0 6 6 3 3
|
||||
insert into t2 values (8000, 3, 'yyyy');
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3172 24 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache1 3 NULL 262143 8192 # # 0 6 5 3 3
|
||||
keycache2 NULL NULL 1048576 1024 # # 0 6 6 3 3
|
||||
set global keycache1.key_buffer_size=64*1024;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3172 24 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache2 NULL NULL 1048576 1024 # # 0 6 6 3 3
|
||||
set global keycache1.key_cache_block_size=2*1024;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3172 24 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache1 3 NULL 65535 2048 # # 0 0 0 0 0
|
||||
keycache2 NULL NULL 1048576 1024 # # 0 6 6 3 3
|
||||
set global keycache1.key_cache_block_size=8*1024;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3172 24 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache2 NULL NULL 1048576 1024 # # 0 6 6 3 3
|
||||
set global keycache1.key_buffer_size=0;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3172 24 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache2 NULL NULL 1048576 1024 # # 0 6 6 3 3
|
||||
set global keycache1.key_cache_block_size=8*1024;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3172 24 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache2 NULL NULL 1048576 1024 # # 0 6 6 3 3
|
||||
set global keycache1.key_buffer_size=0;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3172 24 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache2 NULL NULL 1048576 1024 # # 0 6 6 3 3
|
||||
set global keycache1.key_buffer_size=128*1024;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3172 24 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache1 1 NULL 131072 8192 # # 0 0 0 0 0
|
||||
keycache2 NULL NULL 1048576 1024 # # 0 6 6 3 3
|
||||
set global keycache1.key_cache_block_size=1024;
|
||||
select * from information_schema.key_caches where segment_number is null;
|
||||
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
|
||||
default 2 NULL 32768 1024 # # 0 3172 24 1552 18
|
||||
small NULL NULL 1048576 1024 # # 0 0 0 0 0
|
||||
keycache1 7 NULL 131068 1024 # # 0 0 0 0 0
|
||||
keycache2 NULL NULL 1048576 1024 # # 0 6 6 3 3
|
||||
drop table t1,t2;
|
||||
set global keycache1.key_buffer_size=0;
|
||||
set global keycache2.key_buffer_size=0;
|
||||
set global key_buffer_size=@save_key_buffer_size;
|
||||
set global key_cache_segments=@save_key_cache_segments;
|
||||
|
@@ -202,12 +202,6 @@ select * from t1;
|
||||
a b c
|
||||
10 NULL Ten
|
||||
15 NULL Fifteen
|
||||
show variables like "secure_file_pri%";
|
||||
Variable_name Value
|
||||
secure_file_priv MYSQLTEST_VARDIR/
|
||||
select @@secure_file_priv;
|
||||
@@secure_file_priv
|
||||
MYSQLTEST_VARDIR/
|
||||
set @@secure_file_priv= 0;
|
||||
ERROR HY000: Variable 'secure_file_priv' is a read only variable
|
||||
truncate table t1;
|
||||
@@ -456,6 +450,13 @@ LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
|
||||
|
||||
set session sql_mode=@OLD_SQL_MODE;
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# Bug #51893: crash with certain characters given to load_file
|
||||
# function on windows
|
||||
#
|
||||
select load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A);
|
||||
load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D142
|
||||
NULL
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
@@ -484,4 +485,15 @@ SET character_set_filesystem=default;
|
||||
select @@character_set_filesystem;
|
||||
@@character_set_filesystem
|
||||
binary
|
||||
#
|
||||
# Bug #51850: crash/memory overlap when using load data infile and set
|
||||
# col equal to itself!
|
||||
#
|
||||
CREATE TABLE t1(col0 LONGBLOB);
|
||||
SELECT 'test' INTO OUTFILE 't1.txt';
|
||||
LOAD DATA INFILE 't1.txt' IGNORE INTO TABLE t1 SET col0=col0;
|
||||
SELECT * FROM t1;
|
||||
col0
|
||||
test
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@@ -199,7 +199,7 @@ SELECT @@general_log, @@log;
|
||||
1 1
|
||||
SET GLOBAL log = 0;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log' is deprecated and will be removed in MySQL 7.0. Please use '@@general_log' instead
|
||||
Warning 1287 '@@log' is deprecated and will be removed in a future release. Please use '@@general_log' instead
|
||||
SHOW VARIABLES LIKE 'general_log';
|
||||
Variable_name Value
|
||||
general_log OFF
|
||||
@@ -230,7 +230,7 @@ SELECT @@slow_query_log, @@log_slow_queries;
|
||||
0 0
|
||||
SET GLOBAL log_slow_queries = 0;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log_slow_queries' is deprecated and will be removed in MySQL 7.0. Please use '@@slow_query_log' instead
|
||||
Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead
|
||||
SHOW VARIABLES LIKE 'slow_query_log';
|
||||
Variable_name Value
|
||||
slow_query_log OFF
|
||||
@@ -283,16 +283,16 @@ SET GLOBAL slow_query_log_file = @old_slow_query_log_file;
|
||||
deprecated:
|
||||
SET GLOBAL log = 0;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log' is deprecated and will be removed in MySQL 7.0. Please use '@@general_log' instead
|
||||
Warning 1287 '@@log' is deprecated and will be removed in a future release. Please use '@@general_log' instead
|
||||
SET GLOBAL log_slow_queries = 0;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log_slow_queries' is deprecated and will be removed in MySQL 7.0. Please use '@@slow_query_log' instead
|
||||
Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead
|
||||
SET GLOBAL log = DEFAULT;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log' is deprecated and will be removed in MySQL 7.0. Please use '@@general_log' instead
|
||||
Warning 1287 '@@log' is deprecated and will be removed in a future release. Please use '@@general_log' instead
|
||||
SET GLOBAL log_slow_queries = DEFAULT;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log_slow_queries' is deprecated and will be removed in MySQL 7.0. Please use '@@slow_query_log' instead
|
||||
Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead
|
||||
not deprecated:
|
||||
SELECT @@global.general_log_file INTO @my_glf;
|
||||
SELECT @@global.slow_query_log_file INTO @my_sqlf;
|
||||
|
47
mysql-test/r/log_tables_upgrade.result
Normal file
47
mysql-test/r/log_tables_upgrade.result
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# Bug#49823: mysql_upgrade fatal error due to general_log / slow_low CSV NULL
|
||||
#
|
||||
USE test;
|
||||
SET @saved_general_log = @@GLOBAL.general_log;
|
||||
SET GLOBAL general_log = OFF;
|
||||
USE mysql;
|
||||
FLUSH TABLES;
|
||||
REPAIR TABLE test.bug49823;
|
||||
Table Op Msg_type Msg_text
|
||||
test.bug49823 repair status OK
|
||||
RENAME TABLE general_log TO renamed_general_log;
|
||||
RENAME TABLE test.bug49823 TO general_log;
|
||||
mtr.global_suppressions OK
|
||||
mtr.test_suppressions OK
|
||||
mysql.columns_priv OK
|
||||
mysql.db OK
|
||||
mysql.event OK
|
||||
mysql.func OK
|
||||
mysql.general_log
|
||||
Error : You can't use locks with log tables.
|
||||
status : OK
|
||||
mysql.help_category OK
|
||||
mysql.help_keyword OK
|
||||
mysql.help_relation OK
|
||||
mysql.help_topic OK
|
||||
mysql.host OK
|
||||
mysql.ndb_binlog_index OK
|
||||
mysql.plugin OK
|
||||
mysql.proc OK
|
||||
mysql.procs_priv OK
|
||||
mysql.renamed_general_log OK
|
||||
mysql.servers OK
|
||||
mysql.slow_log
|
||||
Error : You can't use locks with log tables.
|
||||
status : OK
|
||||
mysql.tables_priv OK
|
||||
mysql.time_zone OK
|
||||
mysql.time_zone_leap_second OK
|
||||
mysql.time_zone_name OK
|
||||
mysql.time_zone_transition OK
|
||||
mysql.time_zone_transition_type OK
|
||||
mysql.user OK
|
||||
DROP TABLE general_log;
|
||||
RENAME TABLE renamed_general_log TO general_log;
|
||||
SET GLOBAL general_log = @saved_general_log;
|
||||
USE test;
|
@@ -2171,4 +2171,83 @@ Trigger sql_mode SQL Original Statement character_set_client collation_connectio
|
||||
tr1 CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo() latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1, t2, t3;
|
||||
#
|
||||
# BUG#48265 - MRG_MYISAM problem (works in 5.0.85, does't work in 5.1.40)
|
||||
#
|
||||
CREATE DATABASE `test/1`;
|
||||
CREATE TABLE `test/1`.`t/1`(a INT);
|
||||
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM m1;
|
||||
a
|
||||
SHOW CREATE TABLE m1;
|
||||
Table Create Table
|
||||
m1 CREATE TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`test/1`.`t/1`)
|
||||
DROP TABLE m1;
|
||||
CREATE TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM `test/1`.m1;
|
||||
a
|
||||
SHOW CREATE TABLE `test/1`.m1;
|
||||
Table Create Table
|
||||
m1 CREATE TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t/1`)
|
||||
DROP TABLE `test/1`.m1;
|
||||
DROP TABLE `test/1`.`t/1`;
|
||||
CREATE TEMPORARY TABLE `test/1`.`t/1`(a INT);
|
||||
CREATE TEMPORARY TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM m1;
|
||||
a
|
||||
SHOW CREATE TABLE m1;
|
||||
Table Create Table
|
||||
m1 CREATE TEMPORARY TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`test/1`.`t/1`)
|
||||
DROP TABLE m1;
|
||||
CREATE TEMPORARY TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
|
||||
SELECT * FROM `test/1`.m1;
|
||||
a
|
||||
SHOW CREATE TABLE `test/1`.m1;
|
||||
Table Create Table
|
||||
m1 CREATE TEMPORARY TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t/1`)
|
||||
DROP TABLE `test/1`.m1;
|
||||
DROP TABLE `test/1`.`t/1`;
|
||||
DROP DATABASE `test/1`;
|
||||
CREATE TABLE `t@1`(a INT);
|
||||
SELECT * FROM m1;
|
||||
a
|
||||
SHOW CREATE TABLE m1;
|
||||
Table Create Table
|
||||
m1 CREATE TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t@1`)
|
||||
DROP TABLE `t@1`;
|
||||
CREATE DATABASE `test@1`;
|
||||
CREATE TABLE `test@1`.`t@1`(a INT);
|
||||
FLUSH TABLE m1;
|
||||
SELECT * FROM m1;
|
||||
a
|
||||
SHOW CREATE TABLE m1;
|
||||
Table Create Table
|
||||
m1 CREATE TABLE `m1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`test@1`.`t@1`)
|
||||
DROP TABLE m1;
|
||||
DROP TABLE `test@1`.`t@1`;
|
||||
DROP DATABASE `test@1`;
|
||||
#
|
||||
# Bug#51494c rash with join, explain and 'sounds like' operator
|
||||
#
|
||||
CREATE TABLE t1 (a INT) ENGINE=MYISAM;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
CREATE TABLE t2 (b INT NOT NULL,c INT,d INT,e BLOB NOT NULL,
|
||||
KEY idx0 (d, c)) ENGINE=MERGE;
|
||||
EXPLAIN SELECT * FROM t1 NATURAL RIGHT JOIN
|
||||
t2 WHERE b SOUNDS LIKE e AND d = 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
DROP TABLE t2, t1;
|
||||
End of 5.1 tests
|
||||
|
@@ -198,4 +198,15 @@ def IF(i, d, d) IF(i, d, d) 10 10 10 Y 128 0 63
|
||||
def IFNULL(d, d) IFNULL(d, d) 10 10 10 Y 128 0 63
|
||||
def LEAST(d, d) LEAST(d, d) 10 10 10 Y 128 0 63
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#41788 mysql_fetch_field returns org_table == table by a view
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT);
|
||||
CREATE VIEW v1 AS SELECT f1 FROM t1;
|
||||
SELECT f1 FROM v1 va;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test v1 va f1 f1 3 11 0 Y 32768 0 63
|
||||
f1
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@@ -634,4 +634,15 @@ select count(*) from t3 /* must be 1 */;
|
||||
count(*)
|
||||
1
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# Bug#49534: multitable IGNORE update with sql_safe_updates error
|
||||
# causes debug assertion
|
||||
#
|
||||
CREATE TABLE t1( a INT, KEY( a ) );
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
SET SESSION sql_safe_updates = 1;
|
||||
# Must not cause failed assertion
|
||||
UPDATE IGNORE t1, t1 t1a SET t1.a = 1 WHERE t1a.a = 1;
|
||||
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
|
||||
DROP TABLE t1;
|
||||
end of tests
|
||||
|
@@ -1868,6 +1868,19 @@ CHECKSUM TABLE t1 EXTENDED;
|
||||
Table Checksum
|
||||
test.t1 467455460
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#48438 - crash with error in unioned query against merge table and view...
|
||||
#
|
||||
SET GLOBAL table_open_cache=3;
|
||||
CREATE TABLE t1(a INT);
|
||||
SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4 FOR UPDATE;
|
||||
1
|
||||
SELECT TABLE_ROWS, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
|
||||
TABLE_ROWS DATA_LENGTH
|
||||
0 0
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL table_open_cache=DEFAULT;
|
||||
End of 5.0 tests
|
||||
create table t1 (a int not null, key `a` (a) key_block_size=1024);
|
||||
show create table t1;
|
||||
@@ -2331,6 +2344,8 @@ INSERT INTO t1 SELECT a+1280,b FROM t1;
|
||||
INSERT INTO t1 SELECT a+2560,b FROM t1;
|
||||
INSERT INTO t1 SELECT a+5120,b FROM t1;
|
||||
SET myisam_sort_buffer_size=4;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '4'
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair error myisam_sort_buffer_size is too small
|
||||
@@ -2344,4 +2359,89 @@ CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#49628 - corrupt table after legal SQL, LONGTEXT column
|
||||
#
|
||||
CREATE TABLE t1(a INT, b LONGTEXT, UNIQUE(a));
|
||||
REPLACE INTO t1 VALUES
|
||||
(1, REPEAT('a', 129015)),(1, NULL),
|
||||
(2, NULL),(3, NULL),(4, NULL),(5, NULL),(6, NULL),(7, NULL),
|
||||
(1, REPEAT('b', 129016)),(1, NULL),
|
||||
(1, REPEAT('c', 129015)),(1, REPEAT('d', 129015));
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#51304: checksum table gives different results
|
||||
# for same data when using bit fields
|
||||
#
|
||||
CREATE TABLE t1(a INT, b BIT(1));
|
||||
INSERT INTO t1 VALUES(1, 0), (2, 1);
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
FLUSH TABLES;
|
||||
CHECKSUM TABLE t1 EXTENDED;
|
||||
Table Checksum
|
||||
test.t1 3775188275
|
||||
CHECKSUM TABLE t2 EXTENDED;
|
||||
Table Checksum
|
||||
test.t2 3775188275
|
||||
CHECKSUM TABLE t3 EXTENDED;
|
||||
Table Checksum
|
||||
test.t3 3775188275
|
||||
DROP TABLE t1, t2, t3;
|
||||
#
|
||||
# BUG#51307 - widespread corruption with partitions and insert...select
|
||||
#
|
||||
CREATE TABLE t1(a CHAR(255), KEY(a));
|
||||
SELECT * FROM t1, t1 AS a1;
|
||||
a a
|
||||
SET myisam_sort_buffer_size=4;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '4'
|
||||
INSERT INTO t1 VALUES
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
|
||||
('0'),('0'),('0'),('0'),('0'),('0'),('0');
|
||||
Warnings:
|
||||
Error 1034 myisam_sort_buffer_size is too small
|
||||
Error 1034 Number of rows changed from 0 to 157
|
||||
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
INSERT INTO t1 VALUES('1');
|
||||
SELECT * FROM t1, t1 AS a1 WHERE t1.a=1 AND a1.a=1;
|
||||
a a
|
||||
1 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#47444 - --myisam_repair_threads>1can result in all index
|
||||
# cardinalities=1
|
||||
#
|
||||
SET myisam_repair_threads=2;
|
||||
SET myisam_sort_buffer_size=4096;
|
||||
CREATE TABLE t1(a CHAR(255), KEY(a), KEY(a), KEY(a));
|
||||
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(0),(1),(2),(3);
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
|
||||
CARDINALITY
|
||||
14
|
||||
14
|
||||
14
|
||||
DROP TABLE t1;
|
||||
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||
End of 5.1 tests
|
||||
|
@@ -479,7 +479,7 @@ FLUSH LOGS;
|
||||
RESET MASTER;
|
||||
FLUSH LOGS;
|
||||
#
|
||||
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is exist
|
||||
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified exists
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
@@ -532,7 +532,7 @@ DELIMITER ;
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
#
|
||||
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is not exist
|
||||
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified does not exist
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
@@ -565,5 +565,76 @@ DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
#
|
||||
# Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified exists
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
SET @@session.pseudo_thread_id=999999999/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
||||
SET @@session.sql_mode=0/*!*/;
|
||||
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||
SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
SavePoint mixed_cases
|
||||
/*!*/;
|
||||
use db1/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
INSERT INTO db1.t2 VALUES("in savepoint mixed_cases")
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
INSERT INTO db1.t1 VALUES(40)
|
||||
/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
ROLLBACK TO mixed_cases
|
||||
/*!*/;
|
||||
use db1/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
INSERT INTO db1.t2 VALUES("after rollback to")
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
INSERT INTO db1.t1 VALUES(50)
|
||||
/*!*/;
|
||||
COMMIT/*!*/;
|
||||
DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
#
|
||||
# Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified does not exist
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
SET @@session.pseudo_thread_id=999999999/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
||||
SET @@session.sql_mode=0/*!*/;
|
||||
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||
SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
SavePoint mixed_cases
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
ROLLBACK TO mixed_cases
|
||||
/*!*/;
|
||||
COMMIT/*!*/;
|
||||
DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
End of 5.0 tests
|
||||
End of 5.1 tests
|
||||
|
@@ -2365,7 +2365,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@@ -2458,7 +2458,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@@ -2553,7 +2553,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
|
||||
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
|
||||
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
|
||||
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
@@ -2634,7 +2634,7 @@ BEGIN
|
||||
### @79=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@@ -2727,7 +2727,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@@ -2807,7 +2807,7 @@ BEGIN
|
||||
### @78=b'00000000' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
|
||||
### @79=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@@ -2900,7 +2900,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@@ -2980,7 +2980,7 @@ BEGIN
|
||||
### @78=b'00000111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
|
||||
### @79=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@@ -3073,7 +3073,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
|
||||
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
|
||||
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
|
||||
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
@@ -3153,7 +3153,7 @@ BEGIN
|
||||
### @78=NULL /* TIMESTAMP meta=63489 nullable=1 is_null=1 */
|
||||
### @79=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@@ -3246,7 +3246,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@@ -3326,7 +3326,7 @@ BEGIN
|
||||
### @78=b'00000110' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
|
||||
### @79=4 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
|
||||
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
|
||||
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
|
||||
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
@@ -3419,7 +3419,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@@ -3512,7 +3512,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@@ -3605,7 +3605,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
|
||||
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
|
||||
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
|
||||
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
|
||||
@@ -3698,7 +3698,7 @@ BEGIN
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
|
||||
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
|
||||
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
|
||||
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
|
||||
|
@@ -148,9 +148,10 @@ hello
|
||||
hello
|
||||
;;;;;;;;
|
||||
# MySQL: -- The
|
||||
mysqltest: At line 1: End of line junk detected: "6"
|
||||
mysqltest: At line 1: End of line junk detected: "6"
|
||||
mysqltest: At line 1: Missing delimiter
|
||||
mysqltest: At line 1: Extra argument '6' passed to 'sleep'
|
||||
mysqltest: At line 1: Extra argument '6' passed to 'sleep'
|
||||
mysqltest: At line 1: Extra argument 'A comment
|
||||
show status' passed to 'sleep'
|
||||
mysqltest: At line 1: End of line junk detected: "sleep 7
|
||||
# Another comment
|
||||
"
|
||||
@@ -217,6 +218,12 @@ source database
|
||||
echo message echo message
|
||||
|
||||
mysqltest: At line 1: Missing argument in exec
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
X
|
||||
3
|
||||
MySQL
|
||||
"MySQL"
|
||||
MySQL: The
|
||||
@@ -349,8 +356,10 @@ here is the sourced script
|
||||
here is the sourced script
|
||||
"hello"
|
||||
"hello"
|
||||
mysqltest: At line 1: Missing argument to sleep
|
||||
mysqltest: At line 1: Missing argument to real_sleep
|
||||
mysqltest: At line 2: Invalid argument to sleep "xyz"
|
||||
mysqltest: At line 2: Invalid argument to real_sleep "xyz"
|
||||
mysqltest: At line 1: Missing required argument 'sleep_delay' to command 'sleep'
|
||||
mysqltest: At line 1: Missing required argument 'sleep_delay' to command 'real_sleep'
|
||||
mysqltest: At line 1: Invalid argument to sleep "abc"
|
||||
mysqltest: At line 1: Invalid argument to real_sleep "abc"
|
||||
1
|
||||
@@ -378,6 +387,10 @@ test
|
||||
test2
|
||||
test3
|
||||
test4
|
||||
outer
|
||||
true-inner
|
||||
true-inner again
|
||||
true-outer
|
||||
Counter is greater than 0, (counter=10)
|
||||
Counter is not 0, (counter=0)
|
||||
1
|
||||
@@ -418,6 +431,9 @@ mysqltest: At line 1: Wrong number of arguments to replace_column in 'replace_co
|
||||
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a b'
|
||||
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a 1'
|
||||
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 b c '
|
||||
select "LONG_STRING" as x;
|
||||
x
|
||||
LONG_STRING
|
||||
mysqltest: At line 1: Invalid integer argument "10!"
|
||||
mysqltest: At line 1: Invalid integer argument "a"
|
||||
mysqltest: At line 1: Missing required argument 'connection name' to command 'connect'
|
||||
@@ -524,7 +540,28 @@ a D
|
||||
1 1
|
||||
1 4
|
||||
drop table t1;
|
||||
create table t1 ( f1 char(10));
|
||||
insert into t1 values ("Abcd");
|
||||
select * from t1;
|
||||
f1
|
||||
Abcd
|
||||
select * from t2;;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
select * from t1;
|
||||
f1
|
||||
Abcd
|
||||
select * from t1;;
|
||||
Result coming up
|
||||
f1
|
||||
Abcd
|
||||
select * from t1;;
|
||||
f1
|
||||
Abcd
|
||||
mysqltest: At line 2: Cannot run query on connection between send and reap
|
||||
select * from t1;;
|
||||
drop table t1;
|
||||
mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file'
|
||||
mysqltest: At line 1: Missing required argument 'directory' to command 'remove_files_wildcard'
|
||||
mysqltest: At line 1: Missing required argument 'filename' to command 'write_file'
|
||||
mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found
|
||||
Content for test_file1
|
||||
@@ -554,6 +591,8 @@ hello
|
||||
mysqltest: At line 1: Max delimiter length(16) exceeded
|
||||
hello
|
||||
hello
|
||||
val is 5
|
||||
val is 5
|
||||
mysqltest: At line 1: test of die
|
||||
Some output
|
||||
create table t1( a int, b char(255), c timestamp);
|
||||
@@ -681,6 +720,29 @@ INSERT INTO t1 SELECT f1 - 256 FROM t1;
|
||||
INSERT INTO t1 SELECT f1 - 512 FROM t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
select "500g bl<62>b<EFBFBD>rsyltet<65>y" as "will be lower cased";
|
||||
will be lower cased
|
||||
500g bl<62>b<EFBFBD>rsyltet<65>y
|
||||
SELECT "UPPER" AS "WILL NOT BE lower cased";
|
||||
WILL NOT BE lower cased
|
||||
UPPER
|
||||
UP
|
||||
SELECT 0 as "UP AGAIN";
|
||||
UP AGAIN
|
||||
0
|
||||
select "abcdef" as "uvwxyz";
|
||||
uvwxyz
|
||||
abcdef
|
||||
select "xyz" as name union select "abc" as name order by name desc;
|
||||
name
|
||||
abc
|
||||
xyz
|
||||
select 1 as "some new text";
|
||||
some new text
|
||||
1
|
||||
select 0 as "will not lower case <20><><EFBFBD>";
|
||||
will not lower case <20><><EFBFBD>
|
||||
0
|
||||
CREATE TABLE t1(
|
||||
a int, b varchar(255), c datetime
|
||||
);
|
||||
@@ -727,6 +789,8 @@ mysqltest: At line 1: change user failed: Access denied for user 'root'@'localho
|
||||
file1.txt
|
||||
file1.txt
|
||||
file2.txt
|
||||
file11.txt
|
||||
dir-list.txt
|
||||
SELECT 'c:\\a.txt' AS col;
|
||||
col
|
||||
z
|
||||
|
2
mysql-test/r/no_binlog.result
Normal file
2
mysql-test/r/no_binlog.result
Normal file
@@ -0,0 +1,2 @@
|
||||
SHOW BINARY LOGS;
|
||||
ERROR HY000: You are not using binary logging
|
@@ -2088,4 +2088,15 @@ SELECT 1 FROM t1 JOIN t1 AS t2 USING (a) FOR UPDATE;
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#51868 - crash with myisam_use_mmap and partitioned myisam tables
|
||||
#
|
||||
SET GLOBAL myisam_use_mmap=1;
|
||||
CREATE TABLE t1(a INT) PARTITION BY HASH(a) PARTITIONS 1;
|
||||
INSERT INTO t1 VALUES(0);
|
||||
FLUSH TABLE t1;
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES(0);
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL myisam_use_mmap=default;
|
||||
End of 5.1 tests
|
||||
|
57
mysql-test/r/partition_debug_sync.result
Normal file
57
mysql-test/r/partition_debug_sync.result
Normal file
@@ -0,0 +1,57 @@
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
#
|
||||
# Bug#42438: Crash ha_partition::change_table_ptr
|
||||
# Test when remove partitioning is done while drop table is waiting
|
||||
# for the table.
|
||||
# Con 1
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
CREATE TABLE t1
|
||||
(a INTEGER,
|
||||
b INTEGER NOT NULL,
|
||||
KEY (b))
|
||||
ENGINE = MYISAM
|
||||
/*!50100 PARTITION BY RANGE (a)
|
||||
(PARTITION p0 VALUES LESS THAN (2),
|
||||
PARTITION p1 VALUES LESS THAN (20),
|
||||
PARTITION p2 VALUES LESS THAN (100),
|
||||
PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
|
||||
SET DEBUG_SYNC= 'alter_table_before_create_table_no_lock SIGNAL removing_partitioning WAIT_FOR waiting_for_alter';
|
||||
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL partitioning_removed';
|
||||
ALTER TABLE t1 REMOVE PARTITIONING;
|
||||
# Con default
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitioning';
|
||||
SET DEBUG_SYNC= 'waiting_for_table SIGNAL waiting_for_alter';
|
||||
SET DEBUG_SYNC= 'rm_table_part2_before_delete_table WAIT_FOR partitioning_removed';
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# Con 1
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
#
|
||||
# Bug#42438: Crash ha_partition::change_table_ptr
|
||||
# Test when remove partitioning is failing due to drop table is already
|
||||
# in progress.
|
||||
CREATE TABLE t2
|
||||
(a INTEGER,
|
||||
b INTEGER NOT NULL,
|
||||
KEY (b))
|
||||
ENGINE = MYISAM
|
||||
/*!50100 PARTITION BY RANGE (a)
|
||||
(PARTITION p0 VALUES LESS THAN (2),
|
||||
PARTITION p1 VALUES LESS THAN (20),
|
||||
PARTITION p2 VALUES LESS THAN (100),
|
||||
PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
|
||||
SET DEBUG_SYNC= 'before_lock_tables_takes_lock SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
|
||||
SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
|
||||
ALTER TABLE t2 REMOVE PARTITIONING;
|
||||
# Con default
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions';
|
||||
SET DEBUG_SYNC= 'waiting_for_table SIGNAL waiting_for_alter';
|
||||
SET DEBUG_SYNC= 'rm_table_part2_before_binlog SIGNAL delete_done';
|
||||
DROP TABLE IF EXISTS t2;
|
||||
# Con 1
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
# Con default
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
End of 5.1 tests
|
@@ -1,4 +1,46 @@
|
||||
drop table if exists t1;
|
||||
#
|
||||
# Bug#50392: insert_id is not reset for partitioned tables
|
||||
# auto_increment on duplicate entry
|
||||
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY);
|
||||
SET INSERT_ID= 13;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID= 12;
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
12
|
||||
13
|
||||
14
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY(a);
|
||||
SET INSERT_ID= 13;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID= 12;
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
|
||||
/*!50100 PARTITION BY KEY (a) */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
12
|
||||
13
|
||||
14
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a));
|
||||
INSERT INTO t1 VALUES (1),(1);
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
|
31
mysql-test/r/partition_example.result
Normal file
31
mysql-test/r/partition_example.result
Normal file
@@ -0,0 +1,31 @@
|
||||
install plugin example soname 'ha_example.so';
|
||||
create table t1 (a int not null)
|
||||
engine=example
|
||||
partition by list (a)
|
||||
(partition p0 values in (1), partition p1 values in (2));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL
|
||||
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1
|
||||
/*!50100 PARTITION BY LIST (a)
|
||||
(PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE,
|
||||
PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) */
|
||||
drop table t1;
|
||||
create table t1 (a int not null)
|
||||
engine=example ull=12340
|
||||
partition by list (a)
|
||||
(partition p0 values in (1), partition p1 values in (2));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL
|
||||
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340
|
||||
/*!50100 PARTITION BY LIST (a)
|
||||
(PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE,
|
||||
PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) */
|
||||
drop table t1;
|
||||
select 1;
|
||||
1
|
||||
1
|
||||
uninstall plugin example;
|
@@ -1,4 +1,73 @@
|
||||
drop table if exists t1;
|
||||
drop table if exists t1, t2;
|
||||
#
|
||||
# Bug#51830: Incorrect partition pruning on range partition (regression)
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL)
|
||||
ENGINE = InnoDB
|
||||
PARTITION BY RANGE(a)
|
||||
(PARTITION p10 VALUES LESS THAN (10),
|
||||
PARTITION p30 VALUES LESS THAN (30),
|
||||
PARTITION p50 VALUES LESS THAN (50),
|
||||
PARTITION p70 VALUES LESS THAN (70),
|
||||
PARTITION p90 VALUES LESS THAN (90));
|
||||
INSERT INTO t1 VALUES (10),(30),(50);
|
||||
INSERT INTO t1 VALUES (70);
|
||||
INSERT INTO t1 VALUES (80);
|
||||
INSERT INTO t1 VALUES (89);
|
||||
INSERT INTO t1 VALUES (90);
|
||||
ERROR HY000: Table has no partition for value 90
|
||||
INSERT INTO t1 VALUES (100);
|
||||
ERROR HY000: Table has no partition for value 100
|
||||
insert INTO t1 VALUES (110);
|
||||
ERROR HY000: Table has no partition for value 110
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#50104: Partitioned table with just 1 partion works with fk
|
||||
#
|
||||
CREATE TABLE t2 (
|
||||
id INT,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB ;
|
||||
CREATE TABLE t1 (
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
parent_id INT DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
KEY parent_id (parent_id)
|
||||
) ENGINE=InnoDB;
|
||||
ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 1;
|
||||
ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
|
||||
ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning
|
||||
ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 2;
|
||||
ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
|
||||
ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning
|
||||
DROP TABLE t1, t2;
|
||||
create table t1 (a int not null,
|
||||
b datetime not null,
|
||||
primary key (a,b))
|
||||
|
@@ -270,7 +270,7 @@ a
|
||||
8
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 7;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
|
||||
SELECT * FROM t1 WHERE a > 1;
|
||||
a
|
||||
2
|
||||
@@ -327,13 +327,13 @@ a
|
||||
8
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
|
||||
SELECT * FROM t1 WHERE a > 7;
|
||||
a
|
||||
8
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 7;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY)
|
||||
PARTITION BY RANGE (a) (
|
||||
@@ -556,7 +556,7 @@ a
|
||||
7
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
|
||||
SELECT * FROM t1 WHERE a > 1;
|
||||
a
|
||||
2
|
||||
@@ -601,13 +601,13 @@ a
|
||||
7
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
|
||||
SELECT * FROM t1 WHERE a > 6;
|
||||
a
|
||||
7
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index
|
||||
DROP TABLE t1;
|
||||
# test of RANGE and index
|
||||
CREATE TABLE t1 (a DATE, KEY(a))
|
||||
@@ -757,10 +757,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 7 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 7 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index
|
||||
@@ -1086,10 +1086,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 7 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 7 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index
|
||||
@@ -1101,7 +1101,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL,p1001-01-01 range a a 4 NULL 2 Using where; Using index
|
||||
1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 7 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 Using where; Using index
|
||||
@@ -2101,6 +2101,21 @@ insert into t7 values (10),(30),(50);
|
||||
explain partitions select * from t7 where a < 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a < 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a <= 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a = 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a >= 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a > 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a < 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -2110,9 +2125,33 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t7 where a = 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30 system NULL NULL NULL NULL 1
|
||||
explain partitions select * from t7 where a >= 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a > 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a < 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a <= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a = 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a >= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a < 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a <= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a = 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -2122,6 +2161,9 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t7 where a >= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 91;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 11 and a < 29;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -2137,6 +2179,21 @@ insert into t7 values (10),(30),(50);
|
||||
explain partitions select * from t7 where a < 5;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a < 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a <= 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a = 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a >= 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a > 9;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a < 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -2146,9 +2203,33 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t7 where a = 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30 system NULL NULL NULL NULL 1
|
||||
explain partitions select * from t7 where a >= 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a > 10;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a < 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a <= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a = 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a >= 89;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a < 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a <= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t7 where a = 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
@@ -2158,6 +2239,9 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t7 where a >= 90;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 91;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain partitions select * from t7 where a > 11 and a < 29;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
|
@@ -1,4 +1,18 @@
|
||||
drop table if exists t1, t2;
|
||||
#
|
||||
# Bug#48229: group by performance issue of partitioned table
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a INT,
|
||||
b INT,
|
||||
KEY a (a,b)
|
||||
)
|
||||
PARTITION BY HASH (a) PARTITIONS 1;
|
||||
INSERT INTO t1 VALUES (0, 580092), (3, 894076), (4, 805483), (4, 913540), (6, 611137), (8, 171602), (9, 599495), (9, 746305), (10, 272829), (10, 847519), (12, 258869), (12, 929028), (13, 288970), (15, 20971), (15, 105839), (16, 788272), (17, 76914), (18, 827274), (19, 802258), (20, 123677), (20, 587729), (22, 701449), (25, 31565), (25, 230782), (25, 442887), (25, 733139), (25, 851020);
|
||||
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100, 3) GROUP BY a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int)
|
||||
partition by range (a)
|
||||
( partition p0 values less than (maxvalue));
|
||||
|
@@ -62,4 +62,64 @@ select @@global.example_ulong_var;
|
||||
set session sql_mode=@old_sql_mode;
|
||||
set session old=bla;
|
||||
ERROR HY000: Variable 'old' is a read only variable
|
||||
#legal values
|
||||
CREATE TABLE t1 ( a int complex='c,f,f,f' ) ENGINE=example ULL=10000 STR='dskj' one_or_two='one' YESNO=0;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `complex`='c,f,f,f'
|
||||
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=10000 `STR`='dskj' `one_or_two`='one' `YESNO`=0
|
||||
drop table t1;
|
||||
SET @OLD_SQL_MODE=@@SQL_MODE;
|
||||
SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
|
||||
#illegal value fixed
|
||||
CREATE TABLE t1 (a int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS;
|
||||
Warnings:
|
||||
Warning 1651 Incorrect value '10000000000000000000' for option 'ULL'
|
||||
Warning 1651 Incorrect value 'ttt' for option 'one_or_two'
|
||||
Warning 1651 Incorrect value 'SSS' for option 'YESNO'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=10000000000000000000 `one_or_two`='ttt' `YESNO`=SSS
|
||||
#alter table
|
||||
alter table t1 ULL=10000000;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `one_or_two`='ttt' `YESNO`=SSS `ULL`=10000000
|
||||
alter table t1 change a a int complex='c,c,c';
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `complex`='c,c,c'
|
||||
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `one_or_two`='ttt' `YESNO`=SSS `ULL`=10000000
|
||||
drop table t1;
|
||||
#illegal value error
|
||||
SET SQL_MODE='';
|
||||
CREATE TABLE t1 (a int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS;
|
||||
ERROR HY000: Incorrect value '10000000000000000000' for option 'ULL'
|
||||
CREATE TABLE t1 (a int) ENGINE=example ULL=10.00;
|
||||
ERROR 42000: Only integers allowed as number here near '10.00' at line 1
|
||||
CREATE TABLE t1 (a int) ENGINE=example ULL=1e2;
|
||||
ERROR 42000: Only integers allowed as number here near '1e2' at line 1
|
||||
CREATE TABLE t1 (a int) ENGINE=example ULL=0x1234;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=4660
|
||||
ALTER TABLE t1 ULL=DEFAULT;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
||||
select 1;
|
||||
1
|
||||
1
|
||||
UNINSTALL PLUGIN example;
|
||||
|
10
mysql-test/r/plugin_not_embedded.result
Normal file
10
mysql-test/r/plugin_not_embedded.result
Normal file
@@ -0,0 +1,10 @@
|
||||
#
|
||||
# Bug#51770: UNINSTALL PLUGIN requires no privileges
|
||||
#
|
||||
GRANT INSERT ON mysql.plugin TO bug51770@localhost;
|
||||
INSTALL PLUGIN example SONAME 'ha_example.so';
|
||||
UNINSTALL PLUGIN example;
|
||||
ERROR 42000: DELETE command denied to user 'bug51770'@'localhost' for table 'plugin'
|
||||
GRANT DELETE ON mysql.plugin TO bug51770@localhost;
|
||||
UNINSTALL PLUGIN example;
|
||||
DROP USER bug51770@localhost;
|
@@ -157,24 +157,24 @@ execute stmt1 ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
execute stmt1 ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
deallocate prepare stmt1;
|
||||
@@ -1197,13 +1197,13 @@ SET @aux= "SELECT COUNT(*)
|
||||
prepare my_stmt from @aux;
|
||||
execute my_stmt;
|
||||
COUNT(*)
|
||||
39
|
||||
41
|
||||
execute my_stmt;
|
||||
COUNT(*)
|
||||
39
|
||||
41
|
||||
execute my_stmt;
|
||||
COUNT(*)
|
||||
39
|
||||
41
|
||||
deallocate prepare my_stmt;
|
||||
drop procedure if exists p1|
|
||||
drop table if exists t1|
|
||||
@@ -1789,7 +1789,7 @@ prepare stmt from "create view v1 (c,d,e,f) as select a,b,a in (select a+2 from
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) AS `a+2` from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` AS `a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
c d e f
|
||||
drop view v1;
|
||||
@@ -1797,7 +1797,7 @@ execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) AS `a+2` from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` AS `a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
c d e f
|
||||
drop view v1;
|
||||
@@ -2991,4 +2991,17 @@ select @plaintext;
|
||||
bcd
|
||||
deallocate prepare encode;
|
||||
deallocate prepare decode;
|
||||
#
|
||||
# Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
|
||||
#
|
||||
CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
|
||||
INSERT INTO t1 VALUES (0, 0),(0, 0);
|
||||
PREPARE stmt FROM "SELECT 1 FROM t1 WHERE
|
||||
ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234))";
|
||||
EXECUTE stmt;
|
||||
1
|
||||
EXECUTE stmt;
|
||||
1
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests.
|
||||
|
@@ -193,4 +193,17 @@ show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 2
|
||||
drop table t1;
|
||||
#
|
||||
# Bug46615 Assertion in Query_cache::invalidate in INSERT in a VIEW of a MERGE table
|
||||
#
|
||||
CREATE TABLE t1 (c1 INT, c2 INT);
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SET AUTOCOMMIT=OFF;
|
||||
CREATE VIEW t1_view AS SELECT c1 FROM t1 NATURAL JOIN t2 ;
|
||||
INSERT INTO t1_view (c1, c2) SELECT c1, c2 FROM t1;
|
||||
ERROR 42S22: Unknown column 'c2' in 'field list'
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP VIEW t1_view;
|
||||
SET AUTOCOMMIT=DEFAULT;
|
||||
set GLOBAL query_cache_size=default;
|
||||
|
@@ -457,3 +457,12 @@ abc 1 abc 1
|
||||
select host,user from mysql.user where (host,user) = ('localhost','test');
|
||||
host user
|
||||
drop table t1,t2;
|
||||
#
|
||||
# Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
|
||||
#
|
||||
CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
|
||||
INSERT INTO t1 VALUES (0, 0),(0, 0);
|
||||
SELECT 1 FROM t1 WHERE ROW(a, b) >=
|
||||
ROW('1', (SELECT 1 FROM t1 WHERE a > 1234));
|
||||
1
|
||||
DROP TABLE t1;
|
||||
|
@@ -4049,10 +4049,10 @@ join_0.c1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by '0','0','0','0','0'
|
||||
Note 1003 select NULL AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by NULL,NULL,NULL,NULL,NULL
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1003 select '0' AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by '0','0','0','0','0'
|
||||
Note 1003 select NULL AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by NULL,NULL,NULL,NULL,NULL
|
||||
DROP TABLE t1;
|
||||
SELECT 1 AS ` `;
|
||||
|
||||
@@ -4647,17 +4647,17 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1
|
||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1
|
||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1
|
||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#45266: Uninitialized variable lead to an empty result.
|
||||
|
@@ -4053,10 +4053,10 @@ join_0.c1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by '0','0','0','0','0'
|
||||
Note 1003 select NULL AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by NULL,NULL,NULL,NULL,NULL
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1003 select '0' AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by '0','0','0','0','0'
|
||||
Note 1003 select NULL AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by NULL,NULL,NULL,NULL,NULL
|
||||
DROP TABLE t1;
|
||||
SELECT 1 AS ` `;
|
||||
|
||||
@@ -4651,17 +4651,17 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1
|
||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1
|
||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1
|
||||
Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#45266: Uninitialized variable lead to an empty result.
|
||||
|
4784
mysql-test/r/select_pkeycache.result
Normal file
4784
mysql-test/r/select_pkeycache.result
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1293,7 +1293,7 @@ drop database mysqltest;
|
||||
show full plugin;
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Warning 1287 The syntax 'SHOW PLUGIN' is deprecated and will be removed in MySQL 6.0. Please use 'SHOW PLUGINS' instead
|
||||
Warning 1287 'SHOW PLUGIN' is deprecated and will be removed in a future release. Please use 'SHOW PLUGINS' instead
|
||||
show plugin;
|
||||
show plugins;
|
||||
create database `mysqlttest\1`;
|
||||
|
@@ -9,3 +9,30 @@ SELECT USER();
|
||||
USER()
|
||||
#
|
||||
SHOW PROCESSLIST;
|
||||
#
|
||||
# Bug #37168: Missing variable - skip_name_resolve
|
||||
#
|
||||
SHOW VARIABLES LIKE 'skip_name_resolve';
|
||||
Variable_name Value
|
||||
skip_name_resolve ON
|
||||
SHOW GLOBAL VARIABLES LIKE 'skip_name_resolve';
|
||||
Variable_name Value
|
||||
skip_name_resolve ON
|
||||
SHOW SESSION VARIABLES LIKE 'skip_name_resolve';
|
||||
Variable_name Value
|
||||
skip_name_resolve ON
|
||||
SELECT @@skip_name_resolve;
|
||||
@@skip_name_resolve
|
||||
1
|
||||
SELECT @@LOCAL.skip_name_resolve;
|
||||
ERROR HY000: Variable 'skip_name_resolve' is a GLOBAL variable
|
||||
SELECT @@GLOBAL.skip_name_resolve;
|
||||
@@GLOBAL.skip_name_resolve
|
||||
1
|
||||
SET @@skip_name_resolve=0;
|
||||
ERROR HY000: Variable 'skip_name_resolve' is a read only variable
|
||||
SET @@LOCAL.skip_name_resolve=0;
|
||||
ERROR HY000: Variable 'skip_name_resolve' is a read only variable
|
||||
SET @@GLOBAL.skip_name_resolve=0;
|
||||
ERROR HY000: Variable 'skip_name_resolve' is a read only variable
|
||||
End of 5.1 tests
|
||||
|
@@ -44,4 +44,33 @@ SELECT f2 ();
|
||||
f2 ()
|
||||
NULL
|
||||
DROP SCHEMA testdb;
|
||||
USE test;
|
||||
#
|
||||
# Bug#50423: Crash on second call of a procedure dropping a trigger
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TRIGGER IF EXISTS tr1;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
CREATE TABLE t1 (f1 INTEGER);
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
|
||||
CREATE PROCEDURE p1 () DROP TRIGGER tr1;
|
||||
CALL p1 ();
|
||||
CALL p1 ();
|
||||
ERROR HY000: Trigger does not exist
|
||||
DROP TABLE t1;
|
||||
DROP PROCEDURE p1;
|
||||
#
|
||||
# Bug#50423: Crash on second call of a procedure dropping a trigger
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TRIGGER IF EXISTS tr1;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
CREATE TABLE t1 (f1 INTEGER);
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
|
||||
CREATE PROCEDURE p1 () DROP TRIGGER tr1;
|
||||
CALL p1 ();
|
||||
CALL p1 ();
|
||||
ERROR HY000: Trigger does not exist
|
||||
DROP TABLE t1;
|
||||
DROP PROCEDURE p1;
|
||||
End of 5.1 tests
|
||||
|
@@ -1643,7 +1643,7 @@ create table t1 (a int) type=MyISAM;
|
||||
drop table t1;
|
||||
end|
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'TYPE=storage_engine' is deprecated and will be removed in MySQL 6.0. Please use 'ENGINE=storage_engine' instead
|
||||
Warning 1287 'TYPE=storage_engine' is deprecated and will be removed in a future release. Please use 'ENGINE=storage_engine' instead
|
||||
call p1();
|
||||
call p1();
|
||||
drop procedure p1;
|
||||
|
@@ -4304,10 +4304,10 @@ call bug13012()|
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 backup status OK
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 restore status OK
|
||||
drop procedure bug13012|
|
||||
create view v1 as select * from t1|
|
||||
@@ -6940,9 +6940,8 @@ create procedure p() begin end;
|
||||
call p();
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,?,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH
|
||||
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,IGNORE_BAD_TABLE_OPTIONS,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH
|
||||
set @@sql_mode= @old_mode;
|
||||
select replace(@full_mode, '?', 'NOT_USED') into @full_mode;
|
||||
select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode;
|
||||
select name from mysql.proc where name = 'p' and sql_mode = @full_mode;
|
||||
name
|
||||
|
@@ -191,6 +191,8 @@ max_updates, max_connections, max_user_connections)
|
||||
VALUES('%', 'mysqltest_1', password(''), 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N',
|
||||
'N', 'N', 'N', 'Y', 'Y', 'N', 'N', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', 'Y', 'Y', 'N', '',
|
||||
'', '', '', '0', '0', '0', '0');
|
||||
Warnings:
|
||||
Warning 1364 Field 'auth_string' doesn't have a default value
|
||||
FLUSH PRIVILEGES;
|
||||
CREATE PROCEDURE p1(i INT) BEGIN END;
|
||||
DROP PROCEDURE p1;
|
||||
@@ -216,6 +218,17 @@ SELECT RELEASE_LOCK('Bug44521');
|
||||
RELEASE_LOCK('Bug44521')
|
||||
1
|
||||
DROP PROCEDURE p;
|
||||
CREATE TABLE t1(a int);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
CREATE FUNCTION f1 (inp TEXT) RETURNS INT NO SQL RETURN sleep(60);
|
||||
CREATE VIEW v1 AS SELECT f1('a') FROM t1;
|
||||
SELECT * FROM v1;;
|
||||
SELECT * FROM v1;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
ERROR 70100: Query execution was interrupted
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
DROP FUNCTION f1;
|
||||
# ------------------------------------------------------------------
|
||||
# -- End of 5.1 tests
|
||||
# ------------------------------------------------------------------
|
||||
|
@@ -535,7 +535,7 @@ use db_bug7787|
|
||||
CREATE PROCEDURE p1()
|
||||
SHOW INNODB STATUS; |
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'SHOW INNODB STATUS' is deprecated and will be removed in MySQL 6.0. Please use 'SHOW ENGINE INNODB STATUS' instead
|
||||
Warning 1287 'SHOW INNODB STATUS' is deprecated and will be removed in a future release. Please use 'SHOW ENGINE INNODB STATUS' instead
|
||||
GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost|
|
||||
DROP DATABASE db_bug7787|
|
||||
drop user user_bug7787@localhost|
|
||||
|
@@ -67,7 +67,7 @@ set @save_general_log=@@global.general_log;
|
||||
set @@global.general_log=0;
|
||||
set @@global.userstat=1;
|
||||
flush status;
|
||||
create table t1 (a int, primary key (a), b int default 0) engine=myisam;
|
||||
create table t1 (a int, primary key (a), b int default 0) engine=innodb;
|
||||
insert into t1 (a) values (1),(2),(3),(4);
|
||||
update t1 set b=1;
|
||||
update t1 set b=5 where a=2;
|
||||
@@ -96,10 +96,10 @@ Rows_read 6
|
||||
Rows_sent 1
|
||||
show status like "ha%";
|
||||
Variable_name Value
|
||||
Handler_commit 10
|
||||
Handler_commit 19
|
||||
Handler_delete 1
|
||||
Handler_discover 0
|
||||
Handler_prepare 10
|
||||
Handler_prepare 18
|
||||
Handler_read_first 0
|
||||
Handler_read_key 3
|
||||
Handler_read_next 0
|
||||
@@ -127,20 +127,40 @@ test t1 6 13 13
|
||||
show index_statistics;
|
||||
Table_schema Table_name Index_name Rows_read
|
||||
test t1 PRIMARY 2
|
||||
select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT,
|
||||
ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS,
|
||||
UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS,
|
||||
ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS,
|
||||
ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;
|
||||
TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS ROWS_READ ROWS_SENT ROWS_DELETED ROWS_INSERTED ROWS_UPDATED SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES
|
||||
1 0 6 2 1 8 5 3 11 9 10 2 0 0 0 1
|
||||
select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT,
|
||||
ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS,
|
||||
UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS,
|
||||
ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS,
|
||||
ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;
|
||||
TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS ROWS_READ ROWS_SENT ROWS_DELETED ROWS_INSERTED ROWS_UPDATED SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES
|
||||
1 0 6 2 1 8 5 3 11 9 10 2 0 0 0 1
|
||||
select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;;
|
||||
TOTAL_CONNECTIONS 1
|
||||
CONCURRENT_CONNECTIONS 0
|
||||
ROWS_READ 6
|
||||
ROWS_SENT 2
|
||||
ROWS_DELETED 1
|
||||
ROWS_INSERTED 8
|
||||
ROWS_UPDATED 5
|
||||
SELECT_COMMANDS 3
|
||||
UPDATE_COMMANDS 11
|
||||
OTHER_COMMANDS 7
|
||||
COMMIT_TRANSACTIONS 19
|
||||
ROLLBACK_TRANSACTIONS 2
|
||||
DENIED_CONNECTIONS 0
|
||||
LOST_CONNECTIONS 0
|
||||
ACCESS_DENIED 0
|
||||
EMPTY_QUERIES 1
|
||||
select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;;
|
||||
TOTAL_CONNECTIONS 1
|
||||
CONCURRENT_CONNECTIONS 0
|
||||
ROWS_READ 6
|
||||
ROWS_SENT 2
|
||||
ROWS_DELETED 1
|
||||
ROWS_INSERTED 8
|
||||
ROWS_UPDATED 5
|
||||
SELECT_COMMANDS 3
|
||||
UPDATE_COMMANDS 11
|
||||
OTHER_COMMANDS 7
|
||||
COMMIT_TRANSACTIONS 19
|
||||
ROLLBACK_TRANSACTIONS 2
|
||||
DENIED_CONNECTIONS 0
|
||||
LOST_CONNECTIONS 0
|
||||
ACCESS_DENIED 0
|
||||
EMPTY_QUERIES 1
|
||||
flush table_statistics;
|
||||
flush index_statistics;
|
||||
select * from information_schema.index_statistics;
|
||||
|
@@ -34,7 +34,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1249 Select 2 was reduced during optimization
|
||||
Note 1003 select (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
|
||||
Note 1003 select (select 0 union select 0) AS `(SELECT (SELECT 0 UNION SELECT 0))`
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
|
||||
ERROR 42S22: Reference 'a' not supported (forward reference in item list)
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
|
||||
@@ -52,7 +52,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1' AS `a`) = 1)
|
||||
Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1') = 1)
|
||||
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
1
|
||||
1
|
||||
@@ -189,7 +189,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
|
||||
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` AS `a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) AS `max(t2.a)*4` from `test`.`t2`)) order by `a`)
|
||||
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`)) order by `a`)
|
||||
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
|
||||
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
|
||||
3 1
|
||||
@@ -205,7 +205,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select (select `test`.`t3`.`a` AS `a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
|
||||
Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
|
||||
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
|
||||
a
|
||||
2
|
||||
@@ -226,7 +226,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) AS `min(t3.a)` from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) AS `avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))` from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
|
||||
Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
|
||||
select * from t3 where exists (select * from t2 where t2.b=t3.a);
|
||||
a
|
||||
7
|
||||
@@ -316,7 +316,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select (select '2' AS `a` from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` AS `a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
|
||||
Note 1003 select (select '2' from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
|
||||
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
|
||||
@@ -334,7 +334,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 AS `Not_used` from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
|
||||
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
|
||||
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
|
||||
ERROR 23000: Column 'a' in field list is ambiguous
|
||||
drop table t1,t2,t3;
|
||||
@@ -369,7 +369,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
|
||||
3 SUBQUERY t8 const PRIMARY PRIMARY 37 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' AS `email` from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
|
||||
t8 WHERE pseudo='joce');
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
@@ -401,7 +401,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||
date
|
||||
2002-08-03
|
||||
@@ -745,7 +745,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `1` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 AS `3` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
|
||||
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
|
||||
id
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
|
||||
@@ -908,7 +908,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (a float);
|
||||
select 10.5 IN (SELECT * from t1 LIMIT 1);
|
||||
@@ -1020,19 +1020,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select rand() AS `RAND()` from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select encrypt('test') AS `ENCRYPT('test')` from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select benchmark(1,1) AS `BENCHMARK(1,1)` from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`mot` varchar(30) character set latin1 NOT NULL default '',
|
||||
@@ -1127,7 +1127,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() AS `rand()` from `test`.`t1` limit 1) AS `(select rand() from t1 limit 1)` from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() from `test`.`t1` limit 1) from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
|
||||
drop table t1;
|
||||
select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
@@ -1181,7 +1181,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
INSERT INTO t1 (pseudo) VALUES ('test1');
|
||||
SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
0 IN (SELECT 1 FROM t1 a)
|
||||
@@ -1191,7 +1191,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`i` int(11) NOT NULL default '0',
|
||||
@@ -1236,7 +1236,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using index condition
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) AS `MAX(salary)` from `test`.`t1`))
|
||||
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
ID int(10) unsigned NOT NULL auto_increment,
|
||||
@@ -1502,7 +1502,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max('0') from `test`.`t2`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max(NULL) from `test`.`t2`)))
|
||||
select * from t3 where a >= some (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where a >= some (select b from t2);
|
||||
@@ -1510,7 +1510,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min('0') from `test`.`t2`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min(NULL) from `test`.`t2`)))
|
||||
select * from t3 where a >= all (select b from t2 group by 1);
|
||||
a
|
||||
6
|
||||
@@ -1521,7 +1521,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select '0' AS `b` from `test`.`t2` group by 1)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select NULL from `test`.`t2` group by 1)))
|
||||
select * from t3 where a >= some (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where a >= some (select b from t2 group by 1);
|
||||
@@ -1529,7 +1529,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select '0' AS `b` from `test`.`t2` group by 1)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select NULL from `test`.`t2` group by 1)))
|
||||
select * from t3 where NULL >= any (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2);
|
||||
@@ -1572,7 +1572,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) AS `max(b)` from `test`.`t2` group by `test`.`t2`.`a`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`)))
|
||||
drop table t2, t3;
|
||||
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
|
||||
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
|
||||
@@ -1749,7 +1749,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` AS `id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
|
||||
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
|
||||
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
|
||||
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
|
||||
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
|
||||
@@ -2285,7 +2285,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 AS `Not_used` from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
|
||||
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (t1_a int);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
@@ -2826,7 +2826,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
@@ -2838,7 +2838,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a char(5), b char(5));
|
||||
INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
|
||||
@@ -4325,13 +4325,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,1 in ( <materialize> (select 1 AS `1` from `test`.`t1` group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `materialized subselect`.`1`)))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,1 in ( <materialize> (select 1 from `test`.`t1` group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `materialized subselect`.`1`)))))
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,1 in ( <materialize> (select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `materialized subselect`.`1`)))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,1 in ( <materialize> (select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `materialized subselect`.`1`)))))
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#45061: Incorrectly market field caused wrong result.
|
||||
@@ -4818,4 +4818,105 @@ FROM t1,t1 a
|
||||
);
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #45989 take 2 : memory leak after explain encounters an
|
||||
# error in the query
|
||||
#
|
||||
CREATE TABLE t1(a LONGTEXT);
|
||||
INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
|
||||
INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
|
||||
EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1,
|
||||
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1
|
||||
WHERE t1.a = d1.a;
|
||||
ERROR 42S22: Unknown column 'd1.a' in 'where clause'
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests.
|
||||
Set up test tables.
|
||||
CREATE TABLE t1 (
|
||||
t1_id INT UNSIGNED,
|
||||
PRIMARY KEY(t1_id)
|
||||
) Engine=MyISAM;
|
||||
INSERT INTO t1 (t1_id) VALUES (1), (2), (3), (4), (5);
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
CREATE TABLE t3 (
|
||||
t3_id INT UNSIGNED AUTO_INCREMENT,
|
||||
t1_id INT UNSIGNED,
|
||||
amount DECIMAL(16,2),
|
||||
PRIMARY KEY(t3_id),
|
||||
KEY(t1_id)
|
||||
) Engine=MyISAM;
|
||||
INSERT INTO t3 (t1_id, t3_id, amount)
|
||||
VALUES (1, 1, 100.00), (2, 2, 200.00), (4, 4, 400.00);
|
||||
This is the 'inner query' running by itself.
|
||||
Produces correct results.
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
SELECT * FROM (the same inner query)
|
||||
Produces correct results.
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
) AS t;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
Now make t2.t1_id part of a key.
|
||||
ALTER TABLE t2 ADD PRIMARY KEY(t1_id);
|
||||
Same inner query by itself.
|
||||
Still correct results.
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
SELECT * FROM (the same inner query), now with indexes on the LEFT JOIN
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
) AS t;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
@@ -30,7 +30,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) AS `max(ie)` from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2`
|
||||
explain extended
|
||||
select a, oref from t2
|
||||
where a in (select max(ie) from t1 where oref=t2.oref group by grp);
|
||||
@@ -39,7 +39,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) AS `max(ie)` from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))
|
||||
select a, oref, a in (
|
||||
select max(ie) from t1 where oref=t2.oref group by grp union
|
||||
select max(ie) from t1 where oref=t2.oref group by grp
|
||||
@@ -70,7 +70,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(`test`.`t3`.`a`,<exists>(select max(`test`.`t1`.`ie`) AS `max(ie)` from `test`.`t1` where (`test`.`t1`.`oref` = 4) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3`
|
||||
Note 1003 select <in_optimizer>(`test`.`t3`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = 4) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3`
|
||||
set @@optimizer_switch=@save_optimizer_switch;
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int, oref int, key(a));
|
||||
@@ -160,7 +160,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond(((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) having trigcond(<is_not_null_test>(`test`.`t1`.`a`)))) AS `Z` from `test`.`t3`
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond(((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) having trigcond(<is_not_null_test>(`test`.`t1`.`a`)))) AS `Z` from `test`.`t3`
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int NOT NULL, b int NOT NULL, key(a));
|
||||
insert into t1 values
|
||||
@@ -188,7 +188,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t2 ref a a 4 test.t1.b 1 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`))))) AS `Z` from `test`.`t3`
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`))))) AS `Z` from `test`.`t3`
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (oref int, grp int);
|
||||
insert into t1 (oref, grp) values
|
||||
@@ -212,7 +212,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 't2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select count(0) AS `count(*)` from `test`.`t1` group by `test`.`t1`.`grp` having ((`test`.`t1`.`grp` = `test`.`t2`.`oref`) and trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0))))))) AS `Z` from `test`.`t2`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having ((`test`.`t1`.`grp` = `test`.`t2`.`oref`) and trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0))))))) AS `Z` from `test`.`t2`
|
||||
drop table t1, t2;
|
||||
create table t1 (a int, b int, primary key (a));
|
||||
insert into t1 values (1,1), (3,1),(100,1);
|
||||
@@ -261,7 +261,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) and trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`)))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`))))) AS `Z` from `test`.`t2`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) and trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`)))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`))))) AS `Z` from `test`.`t2`
|
||||
select a,b, oref,
|
||||
(a,b) in (select a,b from t1,t4 where c=t2.oref) Z
|
||||
from t2;
|
||||
@@ -708,7 +708,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (not(<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` where ((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)) having <is_not_null_test>(`test`.`t1`.`a`))))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (not(<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 from `test`.`t1` where ((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)) having <is_not_null_test>(`test`.`t1`.`a`))))))
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1));
|
||||
a
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1 WHERE a > 4));
|
||||
@@ -879,7 +879,7 @@ Level Code Message
|
||||
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2
|
||||
Error 1054 Unknown column 'c' in 'field list'
|
||||
Note 1003 select `c` AS `c` from (select (select count(`test`.`t1`.`a`) AS `COUNT(a)` from (select count(`test`.`t1`.`b`) AS `COUNT(b)` from `test`.`t1`) `x` group by `t1`.`c`) AS `(SELECT COUNT(a) FROM
|
||||
Note 1003 select `c` AS `c` from (select (select count(`test`.`t1`.`a`) from (select count(`test`.`t1`.`b`) AS `COUNT(b)` from `test`.`t1`) `x` group by `t1`.`c`) AS `(SELECT COUNT(a) FROM
|
||||
(SELECT COUNT(b) FROM t1) AS x GROUP BY c
|
||||
)` from `test`.`t1` group by `test`.`t1`.`b`) `y`
|
||||
DROP TABLE t1;
|
||||
|
@@ -34,7 +34,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) AS `max(ie)` from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2`
|
||||
explain extended
|
||||
select a, oref from t2
|
||||
where a in (select max(ie) from t1 where oref=t2.oref group by grp);
|
||||
@@ -43,7 +43,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) AS `max(ie)` from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))
|
||||
select a, oref, a in (
|
||||
select max(ie) from t1 where oref=t2.oref group by grp union
|
||||
select max(ie) from t1 where oref=t2.oref group by grp
|
||||
@@ -74,7 +74,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(`test`.`t3`.`a`,<exists>(select max(`test`.`t1`.`ie`) AS `max(ie)` from `test`.`t1` where (`test`.`t1`.`oref` = 4) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3`
|
||||
Note 1003 select <in_optimizer>(`test`.`t3`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = 4) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3`
|
||||
set @@optimizer_switch=@save_optimizer_switch;
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int, oref int, key(a));
|
||||
@@ -164,7 +164,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond(((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) having trigcond(<is_not_null_test>(`test`.`t1`.`a`)))) AS `Z` from `test`.`t3`
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond(((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) having trigcond(<is_not_null_test>(`test`.`t1`.`a`)))) AS `Z` from `test`.`t3`
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int NOT NULL, b int NOT NULL, key(a));
|
||||
insert into t1 values
|
||||
@@ -192,7 +192,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t2 ref a a 4 test.t1.b 1 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`))))) AS `Z` from `test`.`t3`
|
||||
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<in_optimizer>(`test`.`t3`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`))))) AS `Z` from `test`.`t3`
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (oref int, grp int);
|
||||
insert into t1 (oref, grp) values
|
||||
@@ -216,7 +216,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1276 Field or reference 't2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select count(0) AS `count(*)` from `test`.`t1` group by `test`.`t1`.`grp` having ((`test`.`t1`.`grp` = `test`.`t2`.`oref`) and trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0))))))) AS `Z` from `test`.`t2`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>(`test`.`t2`.`a`,<exists>(select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having ((`test`.`t1`.`grp` = `test`.`t2`.`oref`) and trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0))))))) AS `Z` from `test`.`t2`
|
||||
drop table t1, t2;
|
||||
create table t1 (a int, b int, primary key (a));
|
||||
insert into t1 values (1,1), (3,1),(100,1);
|
||||
@@ -265,7 +265,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) and trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`)))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`))))) AS `Z` from `test`.`t2`
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) and trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`)))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`))))) AS `Z` from `test`.`t2`
|
||||
select a,b, oref,
|
||||
(a,b) in (select a,b from t1,t4 where c=t2.oref) Z
|
||||
from t2;
|
||||
@@ -712,7 +712,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (not(<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` where ((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)) having <is_not_null_test>(`test`.`t1`.`a`))))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (not(<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 from `test`.`t1` where ((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)) having <is_not_null_test>(`test`.`t1`.`a`))))))
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1));
|
||||
a
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1 WHERE a > 4));
|
||||
@@ -883,7 +883,7 @@ Level Code Message
|
||||
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2
|
||||
Error 1054 Unknown column 'c' in 'field list'
|
||||
Note 1003 select `c` AS `c` from (select (select count(`test`.`t1`.`a`) AS `COUNT(a)` from (select count(`test`.`t1`.`b`) AS `COUNT(b)` from `test`.`t1`) `x` group by `t1`.`c`) AS `(SELECT COUNT(a) FROM
|
||||
Note 1003 select `c` AS `c` from (select (select count(`test`.`t1`.`a`) from (select count(`test`.`t1`.`b`) AS `COUNT(b)` from `test`.`t1`) `x` group by `t1`.`c`) AS `(SELECT COUNT(a) FROM
|
||||
(SELECT COUNT(b) FROM t1) AS x GROUP BY c
|
||||
)` from `test`.`t1` group by `test`.`t1`.`b`) `y`
|
||||
DROP TABLE t1;
|
||||
|
@@ -80,7 +80,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select (select 1 AS `1` from `test`.`t2` where (`test`.`t2`.`d` = '0')) AS `RESULT` from `test`.`t1`
|
||||
Note 1003 select (select 1 from `test`.`t2` where 0) AS `RESULT` from `test`.`t1`
|
||||
first equivalent variant
|
||||
SELECT (SELECT 1 FROM t2 WHERE d = IFNULL(c,NULL)) AS RESULT FROM t1 GROUP BY c ;
|
||||
RESULT
|
||||
@@ -91,7 +91,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select (select 1 AS `1` from `test`.`t2` where (`test`.`t2`.`d` = ifnull('0',NULL))) AS `RESULT` from `test`.`t1` group by '0'
|
||||
Note 1003 select (select 1 from `test`.`t2` where 0) AS `RESULT` from `test`.`t1` group by NULL
|
||||
second equivalent variant
|
||||
SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 GROUP BY c ;
|
||||
RESULT
|
||||
@@ -102,7 +102,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select (select 1 AS `1` from `test`.`t2` where (`test`.`t2`.`d` = '0')) AS `RESULT` from `test`.`t1` group by '0'
|
||||
Note 1003 select (select 1 from `test`.`t2` where 0) AS `RESULT` from `test`.`t1` group by NULL
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# BUG#45928 "Differing query results depending on MRR and
|
||||
|
@@ -41,7 +41,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` AS `b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`)))))
|
||||
select * from t1 where a1 in (select b1 from t2 where b1 > '0');
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -52,7 +52,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` AS `b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`)))))
|
||||
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -63,7 +63,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`b2`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`b2`)))))
|
||||
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -74,7 +74,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,min(`test`.`t2`.`b2`) AS `min(b2)` from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`min(b2)`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`min(b2)`)))))
|
||||
select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -85,7 +85,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1i index NULL it1i3 18 NULL 3 100.00 Using where; Using index
|
||||
2 SUBQUERY t2i index it2i1,it2i3 it2i1 9 NULL 5 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select `test`.`t2i`.`b1` AS `b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`)))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select `test`.`t2i`.`b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`)))))
|
||||
select * from t1i where a1 in (select b1 from t2i where b1 > '0');
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -96,7 +96,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1i index NULL it1i3 18 NULL 3 100.00 Using where; Using index
|
||||
2 SUBQUERY t2i range it2i1,it2i3 it2i1 9 NULL 3 100.00 Using where; Using index for group-by
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select `test`.`t2i`.`b1` AS `b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`)))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select `test`.`t2i`.`b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`)))))
|
||||
select * from t1i where a1 in (select b1 from t2i where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -107,7 +107,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1i index NULL it1i3 18 NULL 3 100.00 Using where; Using index
|
||||
2 SUBQUERY t2i index it2i1,it2i3 it2i3 18 NULL 5 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`b2`)))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`b2`)))))
|
||||
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -118,7 +118,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1i index NULL it1i3 18 NULL 3 100.00 Using where; Using index
|
||||
2 SUBQUERY t2i range it2i1,it2i3 it2i3 18 NULL 3 100.00 Using where; Using index for group-by
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`b2`)))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`b2`)))))
|
||||
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -129,7 +129,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1i index NULL it1i3 18 NULL 3 100.00 Using where; Using index
|
||||
2 SUBQUERY t2i range it2i1,it2i3 it2i3 18 NULL 3 100.00 Using where; Using index for group-by
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,min(`test`.`t2i`.`b2`) AS `min(b2)` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`min(b2)`)))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`min(b2)`)))))
|
||||
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -140,7 +140,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2i range NULL it2i3 9 NULL 3 100.00 Using index for group-by
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,max(`test`.`t2i`.`b2`) AS `max(b2)` from `test`.`t2i` group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`max(b2)`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`max(b2)`)))))
|
||||
select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2i range it2i1,it2i3 it2i3 18 NULL 3 100.00 Using where; Using index for group-by
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,min(`test`.`t2i`.`b2`) AS `min(b2)` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`min(b2)`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`min(b2)`)))))
|
||||
select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -209,7 +209,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`b2`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`b2`)))))
|
||||
select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -220,7 +220,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1i index NULL it1i3 18 NULL 3 100.00 Using where; Using index
|
||||
2 SUBQUERY t2i index NULL it2i3 18 NULL 5 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`b2`)))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`b2`)))))
|
||||
select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -275,7 +275,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
4 SUBQUERY t2i index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`b2`))))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1`.`a2` = `materialized subselect`.`c2`))))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`b2`))))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1`.`a2` = `materialized subselect`.`c2`))))))
|
||||
select * from t1
|
||||
where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and
|
||||
(a1, a2) in (select c1, c2 from t3
|
||||
@@ -294,7 +294,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
4 SUBQUERY t2i index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index
|
||||
2 SUBQUERY t2i index it2i1,it2i3 it2i3 18 NULL 5 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`b2`))))) and <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1` AS `c1`,`test`.`t3i`.`c2` AS `c2` from `test`.`t3i` where <in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where ((`test`.`t3i`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3i`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`c2`))))))
|
||||
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`b2`))))) and <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1`,`test`.`t3i`.`c2` from `test`.`t3i` where <in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where ((`test`.`t3i`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3i`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`c2`))))))
|
||||
select * from t1i
|
||||
where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
|
||||
(a1, a2) in (select c1, c2 from t3i
|
||||
@@ -317,7 +317,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
4 SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
3 SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `materialized subselect`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `materialized subselect`.`c2`)))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`b2`))))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1`.`a2` = `materialized subselect`.`c2`))))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `materialized subselect`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `materialized subselect`.`c2`)))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`b2`))))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1`.`a2` = `materialized subselect`.`c2`))))))
|
||||
select * from t1
|
||||
where (a1, a2) in (select b1, b2 from t2
|
||||
where b2 in (select c2 from t3 where c2 LIKE '%02') or
|
||||
@@ -342,7 +342,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 AS `Not_used` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` AS `c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `materialized subselect`.`c2`)))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3c`.`c1` AS `c1`,`test`.`t3c`.`c2` AS `c2` from `test`.`t3` `t3c` where <in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),(`test`.`t3c`.`c1`,`test`.`t3c`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3c`.`c1` in <temporary table> on distinct_key where ((`test`.`t3c`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3c`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1`.`a2` = `materialized subselect`.`c2`))))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `materialized subselect`.`c2`)))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3c`.`c1`,`test`.`t3c`.`c2` from `test`.`t3` `t3c` where <in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),(`test`.`t3c`.`c1`,`test`.`t3c`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3c`.`c1` in <temporary table> on distinct_key where ((`test`.`t3c`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3c`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1`.`a2` = `materialized subselect`.`c2`))))))
|
||||
select * from t1
|
||||
where (a1, a2) in (select b1, b2 from t2
|
||||
where b2 in (select c2 from t3 t3a where c1 = a1) or
|
||||
@@ -378,7 +378,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
8 SUBQUERY t2i index it2i1,it2i3 it2i3 18 NULL 5 100.00 Using where; Using index
|
||||
NULL UNION RESULT <union1,7> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `materialized subselect`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `materialized subselect`.`c2`)))))) group by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`b2`))))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1`.`a2` = `materialized subselect`.`c2`))))))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`b2`))))) and <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1` AS `c1`,`test`.`t3i`.`c2` AS `c2` from `test`.`t3i` where <in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where ((`test`.`t3i`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3i`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`c2`)))))))
|
||||
Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `materialized subselect`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `materialized subselect`.`c2`)))))) group by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1`.`a2` = `materialized subselect`.`b2`))))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1`.`a2` = `materialized subselect`.`c2`))))))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`b2`))))) and <in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1`,`test`.`t3i`.`c2` from `test`.`t3i` where <in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where ((`test`.`t3i`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3i`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1i`.`a2` = `materialized subselect`.`c2`)))))))
|
||||
(select * from t1
|
||||
where (a1, a2) in (select b1, b2 from t2
|
||||
where b2 in (select c2 from t3 where c2 LIKE '%02') or
|
||||
@@ -407,7 +407,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1`.`a2` = `materialized subselect`.`c2`))))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `materialized subselect`.`c1`) and (`test`.`t1`.`a2` = `materialized subselect`.`c2`))))))
|
||||
select * from t1
|
||||
where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and
|
||||
(a1, a2) in (select c1, c2 from t3
|
||||
@@ -430,7 +430,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`c1` = `test`.`t1`.`a1`) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1` AS `b1`,`test`.`t2i`.`b2` AS `b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `materialized subselect`.`c1`) and (`test`.`t3`.`c2` = `materialized subselect`.`c2`))))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`c1` = `test`.`t1`.`a1`) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `materialized subselect`.`b1`) and (`test`.`t3`.`c2` = `materialized subselect`.`b2`))))) ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `materialized subselect`.`c1`) and (`test`.`t3`.`c2` = `materialized subselect`.`c2`))))))
|
||||
select * from t1, t3
|
||||
where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and
|
||||
(c1, c2) in (select c1, c2 from t3
|
||||
@@ -452,7 +452,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>(`test`.`t3`.`c1`,<exists>(select 1 AS `Not_used` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t3`.`c1`) = `test`.`t1`.`a1`)) union select 1 AS `Not_used` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t3`.`c1`) = `test`.`t2`.`b1`))))
|
||||
Note 1003 select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <in_optimizer>(`test`.`t3`.`c1`,<exists>(select 1 from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t3`.`c1`) = `test`.`t1`.`a1`)) union select 1 from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t3`.`c1`) = `test`.`t2`.`b1`))))
|
||||
select * from t3
|
||||
where c1 in (select a1 from t1 where a1 > '0' UNION select b1 from t2 where b1 < '9');
|
||||
c1 c2
|
||||
@@ -476,14 +476,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t1.a2' of SELECT #6 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where ((<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 AS `Not_used` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` AS `c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `materialized subselect`.`c2`)))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t3c`.`c1` AS `c1`,`test`.`t3c`.`c2` AS `c2` from `test`.`t3` `t3c` where (<in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),<exists>(<index_lookup>(<cache>(`test`.`t3c`.`c1`) in t2i on it2i3 where (((`test`.`t2i`.`b2` > '0') or (`test`.`t2i`.`b2` = `test`.`t1`.`a2`)) and (<cache>(`test`.`t3c`.`c1`) = `test`.`t2i`.`b1`) and (<cache>(`test`.`t3c`.`c2`) = `test`.`t2i`.`b2`))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t3c`.`c1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t3c`.`c2`)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((<in_optimizer>(`test`.`t2`.`b2`,<exists>(select 1 from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`)))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `materialized subselect`.`c2`)))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`)))) and <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t3c`.`c1`,`test`.`t3c`.`c2` from `test`.`t3` `t3c` where (<in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),<exists>(<index_lookup>(<cache>(`test`.`t3c`.`c1`) in t2i on it2i3 where (((`test`.`t2i`.`b2` > '0') or (`test`.`t2i`.`b2` = `test`.`t1`.`a2`)) and (<cache>(`test`.`t3c`.`c1`) = `test`.`t2i`.`b1`) and (<cache>(`test`.`t3c`.`c2`) = `test`.`t2i`.`b2`))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t3c`.`c1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t3c`.`c2`)))))
|
||||
explain extended
|
||||
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01' AS `1 - 01`,'2 - 01' AS `2 - 01` having ((<cache>(`test`.`t1`.`a1`) = '1 - 01') and (<cache>(`test`.`t1`.`a2`) = '2 - 01'))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having ((<cache>(`test`.`t1`.`a1`) = '1 - 01') and (<cache>(`test`.`t1`.`a2`) = '2 - 01'))))
|
||||
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -493,7 +493,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01' AS `1 - 01`,'2 - 01' AS `2 - 01` having ((<cache>(`test`.`t1`.`a1`) = '1 - 01') and (<cache>(`test`.`t1`.`a2`) = '2 - 01'))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having ((<cache>(`test`.`t1`.`a1`) = '1 - 01') and (<cache>(`test`.`t1`.`a2`) = '2 - 01'))))
|
||||
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual);
|
||||
a1 a2
|
||||
1 - 01 2 - 01
|
||||
@@ -515,7 +515,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY columns index NULL PRIMARY 4 NULL 2 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by (select `test`.`columns`.`col` AS `col` from `test`.`columns` limit 1)
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by (select `test`.`columns`.`col` from `test`.`columns` limit 1)
|
||||
select * from t1 group by (select col from columns limit 1);
|
||||
a1 a2
|
||||
1 - 00 2 - 00
|
||||
@@ -536,7 +536,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
2 SUBQUERY columns index NULL PRIMARY 4 NULL 2 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` order by (select `test`.`columns`.`col` AS `col` from `test`.`columns` limit 1)
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` order by (select `test`.`columns`.`col` from `test`.`columns` limit 1)
|
||||
select * from t1 order by (select col from columns limit 1);
|
||||
a1 a2
|
||||
1 - 00 2 - 00
|
||||
@@ -583,7 +583,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,<exists>(select 1 AS `Not_used` from `test`.`t2_16` where ((`test`.`t2_16`.`b1` > '0') and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`))))
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,<exists>(select 1 from `test`.`t2_16` where ((`test`.`t2_16`.`b1` > '0') and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_16
|
||||
where a1 in (select b1 from t2_16 where b1 > '0');
|
||||
@@ -597,7 +597,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),<exists>(select `test`.`t2_16`.`b1` AS `b1`,`test`.`t2_16`.`b2` AS `b2` from `test`.`t2_16` where ((`test`.`t2_16`.`b1` > '0') and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`) and (<cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`))))
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),<exists>(select `test`.`t2_16`.`b1`,`test`.`t2_16`.`b2` from `test`.`t2_16` where ((`test`.`t2_16`.`b1` > '0') and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`) and (<cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_16
|
||||
where (a1,a2) in (select b1, b2 from t2_16 where b1 > '0');
|
||||
@@ -611,7 +611,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select substr(`test`.`t2_16`.`b1`,1,16) AS `substring(b1,1,16)` from `test`.`t2_16` where (`test`.`t2_16`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_16`.`a1` = `materialized subselect`.`substring(b1,1,16)`)))))
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select substr(`test`.`t2_16`.`b1`,1,16) from `test`.`t2_16` where (`test`.`t2_16`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_16`.`a1` = `materialized subselect`.`substring(b1,1,16)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_16
|
||||
where a1 in (select substring(b1,1,16) from t2_16 where b1 > '0');
|
||||
@@ -625,7 +625,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,<exists>(select group_concat(`test`.`t2_16`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_16` group by `test`.`t2_16`.`b2` having (<cache>(`test`.`t1_16`.`a1`) = <ref_null_helper>(group_concat(`test`.`t2_16`.`b1` separator ',')))))
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,<exists>(select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` having (<cache>(`test`.`t1_16`.`a1`) = <ref_null_helper>(group_concat(`test`.`t2_16`.`b1` separator ',')))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_16
|
||||
where a1 in (select group_concat(b1) from t2_16 group by b2);
|
||||
@@ -640,7 +640,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select group_concat(`test`.`t2_16`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_16` group by `test`.`t2_16`.`b2` ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_16`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_16`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_16
|
||||
where a1 in (select group_concat(b1) from t2_16 group by b2);
|
||||
@@ -662,7 +662,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer
|
||||
4 SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(concat(`test`.`t1`.`a1`,'x'),<exists>(select 1 AS `Not_used` from `test`.`t1_16` where (<in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),<exists>(select `test`.`t2_16`.`b1` AS `b1`,`test`.`t2_16`.`b2` AS `b2` from `test`.`t2_16` join `test`.`t2` where ((`test`.`t2`.`b2` = substr(`test`.`t2_16`.`b2`,1,6)) and <in_optimizer>(`test`.`t2`.`b1`,`test`.`t2`.`b1` in ( <materialize> (select `test`.`t3`.`c1` AS `c1` from `test`.`t3` where (`test`.`t3`.`c2` > '0') ), <primary_index_lookup>(`test`.`t2`.`b1` in <temporary table> on distinct_key where ((`test`.`t2`.`b1` = `materialized subselect`.`c1`))))) and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`) and (<cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`)))) and (<cache>(concat(`test`.`t1`.`a1`,'x')) = left(`test`.`t1_16`.`a1`,8)))))
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <in_optimizer>(concat(`test`.`t1`.`a1`,'x'),<exists>(select 1 from `test`.`t1_16` where (<in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),<exists>(select `test`.`t2_16`.`b1`,`test`.`t2_16`.`b2` from `test`.`t2_16` join `test`.`t2` where ((`test`.`t2`.`b2` = substr(`test`.`t2_16`.`b2`,1,6)) and <in_optimizer>(`test`.`t2`.`b1`,`test`.`t2`.`b1` in ( <materialize> (select `test`.`t3`.`c1` from `test`.`t3` where (`test`.`t3`.`c2` > '0') ), <primary_index_lookup>(`test`.`t2`.`b1` in <temporary table> on distinct_key where ((`test`.`t2`.`b1` = `materialized subselect`.`c1`))))) and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`) and (<cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`)))) and (<cache>(concat(`test`.`t1`.`a1`,'x')) = left(`test`.`t1_16`.`a1`,8)))))
|
||||
drop table t1_16, t2_16, t3_16;
|
||||
set @blob_len = 512;
|
||||
set @suffix_len = @blob_len - @prefix_len;
|
||||
@@ -696,7 +696,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,<exists>(select 1 AS `Not_used` from `test`.`t2_512` where ((`test`.`t2_512`.`b1` > '0') and (<cache>(`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1`))))
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,<exists>(select 1 from `test`.`t2_512` where ((`test`.`t2_512`.`b1` > '0') and (<cache>(`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1`))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_512
|
||||
where a1 in (select b1 from t2_512 where b1 > '0');
|
||||
@@ -710,7 +710,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`),<exists>(select `test`.`t2_512`.`b1` AS `b1`,`test`.`t2_512`.`b2` AS `b2` from `test`.`t2_512` where ((`test`.`t2_512`.`b1` > '0') and (<cache>(`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1`) and (<cache>(`test`.`t1_512`.`a2`) = `test`.`t2_512`.`b2`))))
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`),<exists>(select `test`.`t2_512`.`b1`,`test`.`t2_512`.`b2` from `test`.`t2_512` where ((`test`.`t2_512`.`b1` > '0') and (<cache>(`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1`) and (<cache>(`test`.`t1_512`.`a2`) = `test`.`t2_512`.`b2`))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_512
|
||||
where (a1,a2) in (select b1, b2 from t2_512 where b1 > '0');
|
||||
@@ -724,7 +724,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select substr(`test`.`t2_512`.`b1`,1,512) AS `substring(b1,1,512)` from `test`.`t2_512` where (`test`.`t2_512`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `materialized subselect`.`substring(b1,1,512)`)))))
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select substr(`test`.`t2_512`.`b1`,1,512) from `test`.`t2_512` where (`test`.`t2_512`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `materialized subselect`.`substring(b1,1,512)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_512
|
||||
where a1 in (select substring(b1,1,512) from t2_512 where b1 > '0');
|
||||
@@ -738,7 +738,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_512
|
||||
where a1 in (select group_concat(b1) from t2_512 group by b2);
|
||||
@@ -751,7 +751,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_512
|
||||
where a1 in (select group_concat(b1) from t2_512 group by b2);
|
||||
@@ -789,7 +789,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,<exists>(select 1 AS `Not_used` from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and (<cache>(`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1`))))
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,<exists>(select 1 from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and (<cache>(`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1`))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1024
|
||||
where a1 in (select b1 from t2_1024 where b1 > '0');
|
||||
@@ -803,7 +803,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>((`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`),<exists>(select `test`.`t2_1024`.`b1` AS `b1`,`test`.`t2_1024`.`b2` AS `b2` from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and (<cache>(`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1`) and (<cache>(`test`.`t1_1024`.`a2`) = `test`.`t2_1024`.`b2`))))
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>((`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`),<exists>(select `test`.`t2_1024`.`b1`,`test`.`t2_1024`.`b2` from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and (<cache>(`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1`) and (<cache>(`test`.`t1_1024`.`a2`) = `test`.`t2_1024`.`b2`))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1024
|
||||
where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0');
|
||||
@@ -817,7 +817,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in (select 1 AS `Not_used` from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and (<cache>(`test`.`t1_1024`.`a1`) = substr(`test`.`t2_1024`.`b1`,1,1024)))))
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in (select 1 from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and (<cache>(`test`.`t1_1024`.`a1`) = substr(`test`.`t2_1024`.`b1`,1,1024)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1024
|
||||
where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0');
|
||||
@@ -831,7 +831,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1024`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1024`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1024
|
||||
where a1 in (select group_concat(b1) from t2_1024 group by b2);
|
||||
@@ -844,7 +844,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1024`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1024`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1024
|
||||
where a1 in (select group_concat(b1) from t2_1024 group by b2);
|
||||
@@ -882,7 +882,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,<exists>(select 1 AS `Not_used` from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and (<cache>(`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1`))))
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,<exists>(select 1 from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and (<cache>(`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1`))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1025
|
||||
where a1 in (select b1 from t2_1025 where b1 > '0');
|
||||
@@ -896,7 +896,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>((`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`),<exists>(select `test`.`t2_1025`.`b1` AS `b1`,`test`.`t2_1025`.`b2` AS `b2` from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and (<cache>(`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1`) and (<cache>(`test`.`t1_1025`.`a2`) = `test`.`t2_1025`.`b2`))))
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>((`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`),<exists>(select `test`.`t2_1025`.`b1`,`test`.`t2_1025`.`b2` from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and (<cache>(`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1`) and (<cache>(`test`.`t1_1025`.`a2`) = `test`.`t2_1025`.`b2`))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1025
|
||||
where (a1,a2) in (select b1, b2 from t2_1025 where b1 > '0');
|
||||
@@ -910,7 +910,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in (select 1 AS `Not_used` from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and (<cache>(`test`.`t1_1025`.`a1`) = substr(`test`.`t2_1025`.`b1`,1,1025)))))
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in (select 1 from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and (<cache>(`test`.`t1_1025`.`a1`) = substr(`test`.`t2_1025`.`b1`,1,1025)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1025
|
||||
where a1 in (select substring(b1,1,1025) from t2_1025 where b1 > '0');
|
||||
@@ -924,7 +924,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1025`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1025`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1025
|
||||
where a1 in (select group_concat(b1) from t2_1025 group by b2);
|
||||
@@ -937,7 +937,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') AS `group_concat(b1)` from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1025`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1025`.`a1` = `materialized subselect`.`group_concat(b1)`)))))
|
||||
select left(a1,7), left(a2,7)
|
||||
from t1_1025
|
||||
where a1 in (select group_concat(b1) from t2_1025 group by b2);
|
||||
@@ -959,7 +959,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1bit ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2bit ALL NULL NULL NULL NULL 3 100.00
|
||||
Warnings:
|
||||
Note 1003 select conv(`test`.`t1bit`.`a1`,10,2) AS `bin(a1)`,conv(`test`.`t1bit`.`a2`,10,2) AS `bin(a2)` from `test`.`t1bit` where <in_optimizer>((`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`),(`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`) in ( <materialize> (select `test`.`t2bit`.`b1` AS `b1`,`test`.`t2bit`.`b2` AS `b2` from `test`.`t2bit` ), <primary_index_lookup>(`test`.`t1bit`.`a1` in <temporary table> on distinct_key where ((`test`.`t1bit`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1bit`.`a2` = `materialized subselect`.`b2`)))))
|
||||
Note 1003 select conv(`test`.`t1bit`.`a1`,10,2) AS `bin(a1)`,conv(`test`.`t1bit`.`a2`,10,2) AS `bin(a2)` from `test`.`t1bit` where <in_optimizer>((`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`),(`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`) in ( <materialize> (select `test`.`t2bit`.`b1`,`test`.`t2bit`.`b2` from `test`.`t2bit` ), <primary_index_lookup>(`test`.`t1bit`.`a1` in <temporary table> on distinct_key where ((`test`.`t1bit`.`a1` = `materialized subselect`.`b1`) and (`test`.`t1bit`.`a2` = `materialized subselect`.`b2`)))))
|
||||
select bin(a1), bin(a2)
|
||||
from t1bit
|
||||
where (a1, a2) in (select b1, b2 from t2bit);
|
||||
@@ -982,7 +982,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1bb ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2bb ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` where <in_optimizer>((`test`.`t1bb`.`a1`,`test`.`t1bb`.`a2`),<exists>(select `test`.`t2bb`.`b1` AS `b1`,`test`.`t2bb`.`b2` AS `b2` from `test`.`t2bb` where ((<cache>(`test`.`t1bb`.`a1`) = `test`.`t2bb`.`b1`) and (<cache>(`test`.`t1bb`.`a2`) = `test`.`t2bb`.`b2`))))
|
||||
Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` where <in_optimizer>((`test`.`t1bb`.`a1`,`test`.`t1bb`.`a2`),<exists>(select `test`.`t2bb`.`b1`,`test`.`t2bb`.`b2` from `test`.`t2bb` where ((<cache>(`test`.`t1bb`.`a1`) = `test`.`t2bb`.`b1`) and (<cache>(`test`.`t1bb`.`a2`) = `test`.`t2bb`.`b2`))))
|
||||
select bin(a1), a2
|
||||
from t1bb
|
||||
where (a1, a2) in (select b1, b2 from t2bb);
|
||||
@@ -1030,7 +1030,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`c`)))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`c`)))))
|
||||
select a from t1 where a in (select c from t2 where d >= 20);
|
||||
a
|
||||
2
|
||||
@@ -1044,7 +1044,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using where; Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`c`)))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`c`)))))
|
||||
select a from t1 where a in (select c from t2 where d >= 20);
|
||||
a
|
||||
2
|
||||
@@ -1058,7 +1058,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using where; Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`c`)))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`c`)))))
|
||||
select a from t1 where a in (select c from t2 where d >= 20);
|
||||
a
|
||||
2
|
||||
@@ -1071,7 +1071,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`c`)))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`c`)))))
|
||||
select a from t1 group by a having a in (select c from t2 where d >= 20);
|
||||
a
|
||||
2
|
||||
@@ -1083,7 +1083,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`c`)))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `materialized subselect`.`c`)))))
|
||||
select a from t1 group by a having a in (select c from t2 where d >= 20);
|
||||
a
|
||||
2
|
||||
@@ -1097,7 +1097,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` where (<nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` AS `e` from `test`.`t3` where (max(`test`.`t1`.`b`) = `test`.`t3`.`e`) having (<cache>(`test`.`t2`.`d`) >= <ref_null_helper>(`test`.`t3`.`e`))))) and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 from `test`.`t2` where (<nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where (max(`test`.`t1`.`b`) = `test`.`t3`.`e`) having (<cache>(`test`.`t2`.`d`) >= <ref_null_helper>(`test`.`t3`.`e`))))) and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`))))
|
||||
select a from t1 group by a
|
||||
having a in (select c from t2 where d >= some(select e from t3 where max(b)=e));
|
||||
a
|
||||
@@ -1112,7 +1112,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` where (<nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select 1 AS `Not_used` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))) and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 from `test`.`t2` where (<nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select 1 from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))) and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`))))
|
||||
select a from t1
|
||||
where a in (select c from t2 where d >= some(select e from t3 where b=e));
|
||||
a
|
||||
|
@@ -38,7 +38,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1249 Select 2 was reduced during optimization
|
||||
Note 1003 select (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
|
||||
Note 1003 select (select 0 union select 0) AS `(SELECT (SELECT 0 UNION SELECT 0))`
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
|
||||
ERROR 42S22: Reference 'a' not supported (forward reference in item list)
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
|
||||
@@ -56,7 +56,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1' AS `a`) = 1)
|
||||
Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1') = 1)
|
||||
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
1
|
||||
1
|
||||
@@ -193,7 +193,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
|
||||
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` AS `a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) AS `max(t2.a)*4` from `test`.`t2`)) order by `a`)
|
||||
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`)) order by `a`)
|
||||
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
|
||||
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
|
||||
3 1
|
||||
@@ -209,7 +209,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select (select `test`.`t3`.`a` AS `a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
|
||||
Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
|
||||
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
|
||||
a
|
||||
2
|
||||
@@ -230,7 +230,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) AS `min(t3.a)` from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) AS `avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))` from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
|
||||
Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
|
||||
select * from t3 where exists (select * from t2 where t2.b=t3.a);
|
||||
a
|
||||
7
|
||||
@@ -320,7 +320,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select (select '2' AS `a` from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` AS `a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
|
||||
Note 1003 select (select '2' from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
|
||||
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
|
||||
@@ -338,7 +338,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 AS `Not_used` from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
|
||||
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
|
||||
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
|
||||
ERROR 23000: Column 'a' in field list is ambiguous
|
||||
drop table t1,t2,t3;
|
||||
@@ -373,7 +373,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
|
||||
3 SUBQUERY t8 const PRIMARY PRIMARY 37 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' AS `email` from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
|
||||
t8 WHERE pseudo='joce');
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
@@ -405,7 +405,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||
date
|
||||
2002-08-03
|
||||
@@ -749,7 +749,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `1` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 AS `3` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
|
||||
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
|
||||
id
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
|
||||
@@ -912,7 +912,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (a float);
|
||||
select 10.5 IN (SELECT * from t1 LIMIT 1);
|
||||
@@ -1024,19 +1024,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select rand() AS `RAND()` from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select encrypt('test') AS `ENCRYPT('test')` from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select benchmark(1,1) AS `BENCHMARK(1,1)` from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`mot` varchar(30) character set latin1 NOT NULL default '',
|
||||
@@ -1131,7 +1131,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() AS `rand()` from `test`.`t1` limit 1) AS `(select rand() from t1 limit 1)` from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() from `test`.`t1` limit 1) from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
|
||||
drop table t1;
|
||||
select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
@@ -1185,7 +1185,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
INSERT INTO t1 (pseudo) VALUES ('test1');
|
||||
SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
0 IN (SELECT 1 FROM t1 a)
|
||||
@@ -1195,7 +1195,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`i` int(11) NOT NULL default '0',
|
||||
@@ -1240,7 +1240,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using index condition
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) AS `MAX(salary)` from `test`.`t1`))
|
||||
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
ID int(10) unsigned NOT NULL auto_increment,
|
||||
@@ -1506,7 +1506,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max('0') from `test`.`t2`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max(NULL) from `test`.`t2`)))
|
||||
select * from t3 where a >= some (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where a >= some (select b from t2);
|
||||
@@ -1514,7 +1514,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min('0') from `test`.`t2`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min(NULL) from `test`.`t2`)))
|
||||
select * from t3 where a >= all (select b from t2 group by 1);
|
||||
a
|
||||
6
|
||||
@@ -1525,7 +1525,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select '0' AS `b` from `test`.`t2` group by 1)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select NULL from `test`.`t2` group by 1)))
|
||||
select * from t3 where a >= some (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where a >= some (select b from t2 group by 1);
|
||||
@@ -1533,7 +1533,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select '0' AS `b` from `test`.`t2` group by 1)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select NULL from `test`.`t2` group by 1)))
|
||||
select * from t3 where NULL >= any (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2);
|
||||
@@ -1576,7 +1576,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) AS `max(b)` from `test`.`t2` group by `test`.`t2`.`a`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`)))
|
||||
drop table t2, t3;
|
||||
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
|
||||
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
|
||||
@@ -1753,7 +1753,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` AS `id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
|
||||
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
|
||||
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
|
||||
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
|
||||
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
|
||||
@@ -2289,7 +2289,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 AS `Not_used` from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
|
||||
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (t1_a int);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
@@ -2830,7 +2830,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
@@ -2842,7 +2842,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a char(5), b char(5));
|
||||
INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
|
||||
@@ -4329,13 +4329,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 AS `1` from `test`.`t1` group by `test`.`t1`.`a` having 1))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 from `test`.`t1` group by `test`.`t1`.`a` having 1))
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having 1))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having 1))
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#45061: Incorrectly market field caused wrong result.
|
||||
@@ -4822,7 +4822,108 @@ FROM t1,t1 a
|
||||
);
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #45989 take 2 : memory leak after explain encounters an
|
||||
# error in the query
|
||||
#
|
||||
CREATE TABLE t1(a LONGTEXT);
|
||||
INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
|
||||
INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
|
||||
EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1,
|
||||
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1
|
||||
WHERE t1.a = d1.a;
|
||||
ERROR 42S22: Unknown column 'd1.a' in 'where clause'
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests.
|
||||
Set up test tables.
|
||||
CREATE TABLE t1 (
|
||||
t1_id INT UNSIGNED,
|
||||
PRIMARY KEY(t1_id)
|
||||
) Engine=MyISAM;
|
||||
INSERT INTO t1 (t1_id) VALUES (1), (2), (3), (4), (5);
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
CREATE TABLE t3 (
|
||||
t3_id INT UNSIGNED AUTO_INCREMENT,
|
||||
t1_id INT UNSIGNED,
|
||||
amount DECIMAL(16,2),
|
||||
PRIMARY KEY(t3_id),
|
||||
KEY(t1_id)
|
||||
) Engine=MyISAM;
|
||||
INSERT INTO t3 (t1_id, t3_id, amount)
|
||||
VALUES (1, 1, 100.00), (2, 2, 200.00), (4, 4, 400.00);
|
||||
This is the 'inner query' running by itself.
|
||||
Produces correct results.
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
SELECT * FROM (the same inner query)
|
||||
Produces correct results.
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
) AS t;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
Now make t2.t1_id part of a key.
|
||||
ALTER TABLE t2 ADD PRIMARY KEY(t1_id);
|
||||
Same inner query by itself.
|
||||
Still correct results.
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
SELECT * FROM (the same inner query), now with indexes on the LEFT JOIN
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
) AS t;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
set optimizer_switch=default;
|
||||
show variables like 'optimizer_switch';
|
||||
Variable_name Value
|
||||
|
@@ -38,7 +38,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1249 Select 2 was reduced during optimization
|
||||
Note 1003 select (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
|
||||
Note 1003 select (select 0 union select 0) AS `(SELECT (SELECT 0 UNION SELECT 0))`
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
|
||||
ERROR 42S22: Reference 'a' not supported (forward reference in item list)
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
|
||||
@@ -56,7 +56,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1' AS `a`) = 1)
|
||||
Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1') = 1)
|
||||
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
1
|
||||
1
|
||||
@@ -193,7 +193,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
|
||||
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` AS `a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) AS `max(t2.a)*4` from `test`.`t2`)) order by `a`)
|
||||
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`)) order by `a`)
|
||||
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
|
||||
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
|
||||
3 1
|
||||
@@ -209,7 +209,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select (select `test`.`t3`.`a` AS `a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
|
||||
Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
|
||||
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
|
||||
a
|
||||
2
|
||||
@@ -230,7 +230,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) AS `min(t3.a)` from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) AS `avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))` from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
|
||||
Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
|
||||
select * from t3 where exists (select * from t2 where t2.b=t3.a);
|
||||
a
|
||||
7
|
||||
@@ -320,7 +320,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select (select '2' AS `a` from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` AS `a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
|
||||
Note 1003 select (select '2' from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
|
||||
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
|
||||
@@ -338,7 +338,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 AS `Not_used` from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
|
||||
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
|
||||
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
|
||||
ERROR 23000: Column 'a' in field list is ambiguous
|
||||
drop table t1,t2,t3;
|
||||
@@ -373,7 +373,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
|
||||
3 SUBQUERY t8 const PRIMARY PRIMARY 37 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' AS `email` from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
|
||||
t8 WHERE pseudo='joce');
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
@@ -405,7 +405,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||
date
|
||||
2002-08-03
|
||||
@@ -749,7 +749,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `1` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 AS `3` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
|
||||
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
|
||||
id
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
|
||||
@@ -912,7 +912,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (a float);
|
||||
select 10.5 IN (SELECT * from t1 LIMIT 1);
|
||||
@@ -1024,19 +1024,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select rand() AS `RAND()` from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select encrypt('test') AS `ENCRYPT('test')` from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select benchmark(1,1) AS `BENCHMARK(1,1)` from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`mot` varchar(30) character set latin1 NOT NULL default '',
|
||||
@@ -1131,7 +1131,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() AS `rand()` from `test`.`t1` limit 1) AS `(select rand() from t1 limit 1)` from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() from `test`.`t1` limit 1) from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
|
||||
drop table t1;
|
||||
select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
@@ -1185,7 +1185,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
INSERT INTO t1 (pseudo) VALUES ('test1');
|
||||
SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
0 IN (SELECT 1 FROM t1 a)
|
||||
@@ -1195,7 +1195,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`i` int(11) NOT NULL default '0',
|
||||
@@ -1240,7 +1240,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using index condition
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) AS `MAX(salary)` from `test`.`t1`))
|
||||
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
ID int(10) unsigned NOT NULL auto_increment,
|
||||
@@ -1323,7 +1323,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 100.00
|
||||
2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int, b int, index a (a,b));
|
||||
create table t2 (a int, index a (a));
|
||||
@@ -1366,7 +1366,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
|
||||
insert into t1 values (3,31);
|
||||
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
a
|
||||
@@ -1506,7 +1506,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max('0') from `test`.`t2`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max(NULL) from `test`.`t2`)))
|
||||
select * from t3 where a >= some (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where a >= some (select b from t2);
|
||||
@@ -1514,7 +1514,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min('0') from `test`.`t2`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min(NULL) from `test`.`t2`)))
|
||||
select * from t3 where a >= all (select b from t2 group by 1);
|
||||
a
|
||||
6
|
||||
@@ -1525,7 +1525,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select '0' AS `b` from `test`.`t2` group by 1)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select NULL from `test`.`t2` group by 1)))
|
||||
select * from t3 where a >= some (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where a >= some (select b from t2 group by 1);
|
||||
@@ -1533,7 +1533,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select '0' AS `b` from `test`.`t2` group by 1)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select NULL from `test`.`t2` group by 1)))
|
||||
select * from t3 where NULL >= any (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2);
|
||||
@@ -1576,7 +1576,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) AS `max(b)` from `test`.`t2` group by `test`.`t2`.`a`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`)))
|
||||
drop table t2, t3;
|
||||
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
|
||||
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
|
||||
@@ -1753,7 +1753,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` AS `id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
|
||||
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
|
||||
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
|
||||
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
|
||||
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
|
||||
@@ -2289,7 +2289,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 AS `Not_used` from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
|
||||
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (t1_a int);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
@@ -2830,19 +2830,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = 'N') and (<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) and (<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`))))
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = 'N') and (<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) and (<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`))))
|
||||
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a char(5), b char(5));
|
||||
INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
|
||||
@@ -4329,13 +4329,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 AS `1` from `test`.`t1` group by `test`.`t1`.`a` having 1))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 from `test`.`t1` group by `test`.`t1`.`a` having 1))
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having 1))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having 1))
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#45061: Incorrectly market field caused wrong result.
|
||||
@@ -4822,7 +4822,108 @@ FROM t1,t1 a
|
||||
);
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #45989 take 2 : memory leak after explain encounters an
|
||||
# error in the query
|
||||
#
|
||||
CREATE TABLE t1(a LONGTEXT);
|
||||
INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
|
||||
INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
|
||||
EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1,
|
||||
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1
|
||||
WHERE t1.a = d1.a;
|
||||
ERROR 42S22: Unknown column 'd1.a' in 'where clause'
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests.
|
||||
Set up test tables.
|
||||
CREATE TABLE t1 (
|
||||
t1_id INT UNSIGNED,
|
||||
PRIMARY KEY(t1_id)
|
||||
) Engine=MyISAM;
|
||||
INSERT INTO t1 (t1_id) VALUES (1), (2), (3), (4), (5);
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
CREATE TABLE t3 (
|
||||
t3_id INT UNSIGNED AUTO_INCREMENT,
|
||||
t1_id INT UNSIGNED,
|
||||
amount DECIMAL(16,2),
|
||||
PRIMARY KEY(t3_id),
|
||||
KEY(t1_id)
|
||||
) Engine=MyISAM;
|
||||
INSERT INTO t3 (t1_id, t3_id, amount)
|
||||
VALUES (1, 1, 100.00), (2, 2, 200.00), (4, 4, 400.00);
|
||||
This is the 'inner query' running by itself.
|
||||
Produces correct results.
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
SELECT * FROM (the same inner query)
|
||||
Produces correct results.
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
) AS t;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
Now make t2.t1_id part of a key.
|
||||
ALTER TABLE t2 ADD PRIMARY KEY(t1_id);
|
||||
Same inner query by itself.
|
||||
Still correct results.
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
SELECT * FROM (the same inner query), now with indexes on the LEFT JOIN
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
) AS t;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
set optimizer_switch=default;
|
||||
show variables like 'optimizer_switch';
|
||||
Variable_name Value
|
||||
|
@@ -38,7 +38,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1249 Select 2 was reduced during optimization
|
||||
Note 1003 select (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
|
||||
Note 1003 select (select 0 union select 0) AS `(SELECT (SELECT 0 UNION SELECT 0))`
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
|
||||
ERROR 42S22: Reference 'a' not supported (forward reference in item list)
|
||||
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
|
||||
@@ -56,7 +56,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1' AS `a`) = 1)
|
||||
Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1') = 1)
|
||||
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||
1
|
||||
1
|
||||
@@ -193,7 +193,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
|
||||
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` AS `a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) AS `max(t2.a)*4` from `test`.`t2`)) order by `a`)
|
||||
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`)) order by `a`)
|
||||
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
|
||||
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
|
||||
3 1
|
||||
@@ -209,7 +209,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select (select `test`.`t3`.`a` AS `a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
|
||||
Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
|
||||
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
|
||||
a
|
||||
2
|
||||
@@ -230,7 +230,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) AS `min(t3.a)` from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) AS `avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))` from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
|
||||
Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
|
||||
select * from t3 where exists (select * from t2 where t2.b=t3.a);
|
||||
a
|
||||
7
|
||||
@@ -320,7 +320,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select (select '2' AS `a` from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` AS `a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
|
||||
Note 1003 select (select '2' from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
|
||||
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
|
||||
@@ -338,7 +338,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 AS `Not_used` from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
|
||||
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
|
||||
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
|
||||
ERROR 23000: Column 'a' in field list is ambiguous
|
||||
drop table t1,t2,t3;
|
||||
@@ -373,7 +373,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
|
||||
3 SUBQUERY t8 const PRIMARY PRIMARY 37 1 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' AS `email` from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
|
||||
t8 WHERE pseudo='joce');
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
@@ -405,7 +405,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||
date
|
||||
2002-08-03
|
||||
@@ -749,7 +749,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `1` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 AS `3` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
|
||||
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
|
||||
id
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
|
||||
@@ -912,7 +912,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (a float);
|
||||
select 10.5 IN (SELECT * from t1 LIMIT 1);
|
||||
@@ -1024,19 +1024,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select rand() AS `RAND()` from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select encrypt('test') AS `ENCRYPT('test')` from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select benchmark(1,1) AS `BENCHMARK(1,1)` from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`mot` varchar(30) character set latin1 NOT NULL default '',
|
||||
@@ -1131,7 +1131,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() AS `rand()` from `test`.`t1` limit 1) AS `(select rand() from t1 limit 1)` from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() from `test`.`t1` limit 1) from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
|
||||
drop table t1;
|
||||
select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
@@ -1185,7 +1185,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
INSERT INTO t1 (pseudo) VALUES ('test1');
|
||||
SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
0 IN (SELECT 1 FROM t1 a)
|
||||
@@ -1195,7 +1195,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`i` int(11) NOT NULL default '0',
|
||||
@@ -1240,7 +1240,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using index condition
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) AS `MAX(salary)` from `test`.`t1`))
|
||||
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
ID int(10) unsigned NOT NULL auto_increment,
|
||||
@@ -1302,7 +1302,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
a
|
||||
2
|
||||
@@ -1312,7 +1312,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
||||
a
|
||||
2
|
||||
@@ -1323,7 +1323,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 SUBQUERY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using index
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t3` where (`test`.`t1`.`b` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where (`test`.`t1`.`b` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int, b int, index a (a,b));
|
||||
create table t2 (a int, index a (a));
|
||||
@@ -1345,7 +1345,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 index NULL a 10 NULL 10004 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
a
|
||||
2
|
||||
@@ -1355,7 +1355,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 index NULL a 10 NULL 10004 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
|
||||
a
|
||||
2
|
||||
@@ -1366,7 +1366,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 SUBQUERY t3 index a a 5 NULL 3 100.00 Using index
|
||||
2 SUBQUERY t1 index NULL a 10 NULL 10004 100.00 Using where; Using index; Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t3` where (`test`.`t1`.`b` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where (`test`.`t1`.`b` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
insert into t1 values (3,31);
|
||||
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
a
|
||||
@@ -1382,7 +1382,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
|
||||
2 SUBQUERY t1 index NULL a 10 NULL 10005 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `materialized subselect`.`a`)))))
|
||||
drop table t0, t1, t2, t3;
|
||||
create table t1 (a int, b int);
|
||||
create table t2 (a int, b int);
|
||||
@@ -1506,7 +1506,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max('0') from `test`.`t2`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max(NULL) from `test`.`t2`)))
|
||||
select * from t3 where a >= some (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where a >= some (select b from t2);
|
||||
@@ -1514,7 +1514,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min('0') from `test`.`t2`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min(NULL) from `test`.`t2`)))
|
||||
select * from t3 where a >= all (select b from t2 group by 1);
|
||||
a
|
||||
6
|
||||
@@ -1525,7 +1525,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select '0' AS `b` from `test`.`t2` group by 1)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select NULL from `test`.`t2` group by 1)))
|
||||
select * from t3 where a >= some (select b from t2 group by 1);
|
||||
a
|
||||
explain extended select * from t3 where a >= some (select b from t2 group by 1);
|
||||
@@ -1533,7 +1533,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select '0' AS `b` from `test`.`t2` group by 1)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select NULL from `test`.`t2` group by 1)))
|
||||
select * from t3 where NULL >= any (select b from t2);
|
||||
a
|
||||
explain extended select * from t3 where NULL >= any (select b from t2);
|
||||
@@ -1576,7 +1576,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) AS `max(b)` from `test`.`t2` group by `test`.`t2`.`a`)))
|
||||
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`)))
|
||||
drop table t2, t3;
|
||||
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
|
||||
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
|
||||
@@ -1753,7 +1753,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` AS `id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
|
||||
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
|
||||
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
|
||||
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
|
||||
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
|
||||
@@ -2289,7 +2289,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 AS `Not_used` from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
|
||||
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (t1_a int);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
@@ -2830,19 +2830,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = 'N') ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where ((`test`.`t1`.`one` = `materialized subselect`.`one`) and (`test`.`t1`.`two` = `materialized subselect`.`two`)))))
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = 'N') ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where ((`test`.`t1`.`one` = `materialized subselect`.`one`) and (`test`.`t1`.`two` = `materialized subselect`.`two`)))))
|
||||
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a char(5), b char(5));
|
||||
INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
|
||||
@@ -4329,13 +4329,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,1 in ( <materialize> (select 1 AS `1` from `test`.`t1` group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `materialized subselect`.`1`)))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,1 in ( <materialize> (select 1 from `test`.`t1` group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `materialized subselect`.`1`)))))
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,1 in ( <materialize> (select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `materialized subselect`.`1`)))))
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,1 in ( <materialize> (select 1 from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `materialized subselect`.`1`)))))
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#45061: Incorrectly market field caused wrong result.
|
||||
@@ -4822,7 +4822,108 @@ FROM t1,t1 a
|
||||
);
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #45989 take 2 : memory leak after explain encounters an
|
||||
# error in the query
|
||||
#
|
||||
CREATE TABLE t1(a LONGTEXT);
|
||||
INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
|
||||
INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
|
||||
EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1,
|
||||
(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1
|
||||
WHERE t1.a = d1.a;
|
||||
ERROR 42S22: Unknown column 'd1.a' in 'where clause'
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests.
|
||||
Set up test tables.
|
||||
CREATE TABLE t1 (
|
||||
t1_id INT UNSIGNED,
|
||||
PRIMARY KEY(t1_id)
|
||||
) Engine=MyISAM;
|
||||
INSERT INTO t1 (t1_id) VALUES (1), (2), (3), (4), (5);
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
CREATE TABLE t3 (
|
||||
t3_id INT UNSIGNED AUTO_INCREMENT,
|
||||
t1_id INT UNSIGNED,
|
||||
amount DECIMAL(16,2),
|
||||
PRIMARY KEY(t3_id),
|
||||
KEY(t1_id)
|
||||
) Engine=MyISAM;
|
||||
INSERT INTO t3 (t1_id, t3_id, amount)
|
||||
VALUES (1, 1, 100.00), (2, 2, 200.00), (4, 4, 400.00);
|
||||
This is the 'inner query' running by itself.
|
||||
Produces correct results.
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
SELECT * FROM (the same inner query)
|
||||
Produces correct results.
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
) AS t;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
Now make t2.t1_id part of a key.
|
||||
ALTER TABLE t2 ADD PRIMARY KEY(t1_id);
|
||||
Same inner query by itself.
|
||||
Still correct results.
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
SELECT * FROM (the same inner query), now with indexes on the LEFT JOIN
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
t1.t1_id,
|
||||
IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
|
||||
FROM
|
||||
t1
|
||||
LEFT JOIN t2 ON t2.t1_id=t1.t1_id
|
||||
GROUP BY
|
||||
t1.t1_id
|
||||
) AS t;
|
||||
t1_id total_amount
|
||||
1 100.00
|
||||
2 200.00
|
||||
3 0.00
|
||||
4 400.00
|
||||
5 0.00
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
set optimizer_switch=default;
|
||||
show variables like 'optimizer_switch';
|
||||
Variable_name Value
|
||||
|
@@ -811,11 +811,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and <nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select 1 AS `Not_used` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and <nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select 1 from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and <nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select 1 AS `Not_used` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and <nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select 1 from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))
|
||||
select a from t1
|
||||
where a in (select c from t2 where d >= some(select e from t3 where b=e));
|
||||
a
|
||||
|
@@ -815,11 +815,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and <nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select 1 AS `Not_used` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and <nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select 1 from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and <nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select 1 AS `Not_used` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and <nop>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select 1 from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))))
|
||||
select a from t1
|
||||
where a in (select c from t2 where d >= some(select e from t3 where b=e));
|
||||
a
|
||||
|
@@ -168,4 +168,16 @@ Warning 1618 <DATA DIRECTORY> option ignored
|
||||
Warning 1618 <INDEX DIRECTORY> option ignored
|
||||
DROP TABLE t1;
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
||||
#
|
||||
# BUG#40980 - Drop table can remove another MyISAM table's
|
||||
# data and index files
|
||||
#
|
||||
CREATE TABLE user(a INT) DATA DIRECTORY='MYSQL_TMP_DIR/mysql'
|
||||
INDEX DIRECTORY='MYSQL_TMP_DIR/mysql';
|
||||
FLUSH TABLE user;
|
||||
# Symlinking mysql database to tmpdir
|
||||
FLUSH TABLE mysql.user;
|
||||
DROP TABLE user;
|
||||
FLUSH TABLE mysql.user;
|
||||
SELECT * FROM mysql.user;
|
||||
End of 5.1 tests
|
||||
|
@@ -118,6 +118,8 @@ user CREATE TABLE `user` (
|
||||
`max_updates` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`max_connections` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`max_user_connections` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`plugin` char(60) CHARACTER SET latin1 NOT NULL DEFAULT '',
|
||||
`auth_string` text COLLATE utf8_bin NOT NULL,
|
||||
PRIMARY KEY (`Host`,`User`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
|
||||
show create table func;
|
||||
@@ -200,7 +202,7 @@ proc CREATE TABLE `proc` (
|
||||
`definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
|
||||
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
|
||||
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
@@ -225,7 +227,7 @@ event CREATE TABLE `event` (
|
||||
`ends` datetime DEFAULT NULL,
|
||||
`status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED',
|
||||
`on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
|
||||
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
|
||||
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
|
||||
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`originator` int(10) unsigned NOT NULL,
|
||||
`time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
|
||||
|
@@ -141,7 +141,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.a2.id 2 100.00 Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.a2.id' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where ((`f`.`id` = `a2`.`id`) and (`a2`.`attr2` between 12 and 14) and (`a2`.`fromdate` = (select max(`test`.`t2`.`fromdate`) AS `MAX(fromdate)` from `test`.`t2` where (`test`.`t2`.`id` = `a2`.`id`))))
|
||||
Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where ((`f`.`id` = `a2`.`id`) and (`a2`.`attr2` between 12 and 14) and (`a2`.`fromdate` = (select max(`test`.`t2`.`fromdate`) from `test`.`t2` where (`test`.`t2`.`id` = `a2`.`id`))))
|
||||
This should use one table:
|
||||
explain select id from v2 where id=2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.f.id 2 100.00 Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.f.id' of SELECT #3 was resolved in SELECT #1
|
||||
Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where ((`f`.`id` = `a2`.`id`) and (`a2`.`attr2` between 12 and 14) and (`a2`.`fromdate` = (select max(`test`.`t2`.`fromdate`) AS `MAX(fromdate)` from `test`.`t2` where (`test`.`t2`.`id` = `f`.`id`))))
|
||||
Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where ((`f`.`id` = `a2`.`id`) and (`a2`.`attr2` between 12 and 14) and (`a2`.`fromdate` = (select max(`test`.`t2`.`fromdate`) from `test`.`t2` where (`test`.`t2`.`id` = `f`.`id`))))
|
||||
drop view v1, v2;
|
||||
drop table t0, t1, t2;
|
||||
create table t1 (a int);
|
||||
|
182
mysql-test/r/table_options.result
Normal file
182
mysql-test/r/table_options.result
Normal file
@@ -0,0 +1,182 @@
|
||||
drop table if exists t1;
|
||||
SET @OLD_SQL_MODE=@@SQL_MODE;
|
||||
SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
|
||||
create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1='1v1';
|
||||
Warnings:
|
||||
Warning 1650 Unknown option 'fkey'
|
||||
Warning 1650 Unknown option 'dff'
|
||||
Warning 1650 Unknown option 'tkey1'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `fkey`=vvv,
|
||||
KEY `akey` (`a`) `dff`=vvv
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey1`='1v1'
|
||||
drop table t1;
|
||||
#reassiginig options in the same line
|
||||
create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1 TKEY1=DEFAULT tkey1=1v2 tkey2=2v1;
|
||||
Warnings:
|
||||
Warning 1650 Unknown option 'fkey'
|
||||
Warning 1650 Unknown option 'dff'
|
||||
Warning 1650 Unknown option 'tkey1'
|
||||
Warning 1650 Unknown option 'tkey2'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `fkey`=vvv,
|
||||
KEY `akey` (`a`) `dff`=vvv
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey1`=1v2 `tkey2`=2v1
|
||||
#add option
|
||||
alter table t1 tkey4=4v1;
|
||||
Warnings:
|
||||
Warning 1650 Unknown option 'tkey4'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `fkey`=vvv,
|
||||
KEY `akey` (`a`) `dff`=vvv
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey1`=1v2 `tkey2`=2v1 `tkey4`=4v1
|
||||
#remove options
|
||||
alter table t1 tkey3=DEFAULT tkey4=DEFAULT;
|
||||
Warnings:
|
||||
Warning 1650 Unknown option 'tkey3'
|
||||
Warning 1650 Unknown option 'tkey4'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `fkey`=vvv,
|
||||
KEY `akey` (`a`) `dff`=vvv
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey1`=1v2 `tkey2`=2v1
|
||||
drop table t1;
|
||||
create table t1 (a int fkey1=v1, key akey (a) kkey1=v1) tkey1=1v1 tkey1=1v2 TKEY1=DEFAULT tkey2=2v1 tkey3=3v1;
|
||||
Warnings:
|
||||
Warning 1650 Unknown option 'fkey1'
|
||||
Warning 1650 Unknown option 'kkey1'
|
||||
Warning 1650 Unknown option 'TKEY1'
|
||||
Warning 1650 Unknown option 'tkey2'
|
||||
Warning 1650 Unknown option 'tkey3'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `fkey1`=v1,
|
||||
KEY `akey` (`a`) `kkey1`=v1
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1
|
||||
#change field with option with the same value
|
||||
alter table t1 change a a int `FKEY1`='v1';
|
||||
Warnings:
|
||||
Warning 1650 Unknown option 'FKEY1'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `FKEY1`='v1',
|
||||
KEY `akey` (`a`) `kkey1`=v1
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1
|
||||
#change field with option with a different value
|
||||
alter table t1 change a a int fkey1=v2;
|
||||
Warnings:
|
||||
Warning 1650 Unknown option 'fkey1'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `fkey1`=v2,
|
||||
KEY `akey` (`a`) `kkey1`=v1
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1
|
||||
#new column no options
|
||||
alter table t1 add column b int;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `fkey1`=v2,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
KEY `akey` (`a`) `kkey1`=v1
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1
|
||||
#new key with options
|
||||
alter table t1 add key bkey (b) kkey2=v1;
|
||||
Warnings:
|
||||
Warning 1650 Unknown option 'kkey2'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `fkey1`=v2,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
KEY `akey` (`a`) `kkey1`=v1,
|
||||
KEY `bkey` (`b`) `kkey2`=v1
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1
|
||||
#new column with options
|
||||
alter table t1 add column c int fkey1=v1 fkey2=v2;
|
||||
Warnings:
|
||||
Warning 1650 Unknown option 'fkey1'
|
||||
Warning 1650 Unknown option 'fkey2'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `fkey1`=v2,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
`c` int(11) DEFAULT NULL `fkey1`=v1 `fkey2`=v2,
|
||||
KEY `akey` (`a`) `kkey1`=v1,
|
||||
KEY `bkey` (`b`) `kkey2`=v1
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1
|
||||
#new key no options
|
||||
alter table t1 add key ckey (c);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `fkey1`=v2,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
`c` int(11) DEFAULT NULL `fkey1`=v1 `fkey2`=v2,
|
||||
KEY `akey` (`a`) `kkey1`=v1,
|
||||
KEY `bkey` (`b`) `kkey2`=v1,
|
||||
KEY `ckey` (`c`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1
|
||||
#drop column
|
||||
alter table t1 drop b;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `fkey1`=v2,
|
||||
`c` int(11) DEFAULT NULL `fkey1`=v1 `fkey2`=v2,
|
||||
KEY `akey` (`a`) `kkey1`=v1,
|
||||
KEY `ckey` (`c`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1
|
||||
#add column with options after delete
|
||||
alter table t1 add column b int fkey2=v1;
|
||||
Warnings:
|
||||
Warning 1650 Unknown option 'fkey2'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `fkey1`=v2,
|
||||
`c` int(11) DEFAULT NULL `fkey1`=v1 `fkey2`=v2,
|
||||
`b` int(11) DEFAULT NULL `fkey2`=v1,
|
||||
KEY `akey` (`a`) `kkey1`=v1,
|
||||
KEY `ckey` (`c`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1
|
||||
#add key
|
||||
alter table t1 add key bkey (b) kkey2=v2;
|
||||
Warnings:
|
||||
Warning 1650 Unknown option 'kkey2'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL `fkey1`=v2,
|
||||
`c` int(11) DEFAULT NULL `fkey1`=v1 `fkey2`=v2,
|
||||
`b` int(11) DEFAULT NULL `fkey2`=v1,
|
||||
KEY `akey` (`a`) `kkey1`=v1,
|
||||
KEY `ckey` (`c`),
|
||||
KEY `bkey` (`b`) `kkey2`=v2
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey2`=2v1 `tkey3`=3v1
|
||||
drop table t1;
|
||||
create table t1 (a int) tkey1=100;
|
||||
Warnings:
|
||||
Warning 1650 Unknown option 'tkey1'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `tkey1`=100
|
||||
drop table t1;
|
||||
#error on unknown option
|
||||
SET SQL_MODE='';
|
||||
create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1;
|
||||
ERROR HY000: Unknown option 'fkey'
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
@@ -2060,4 +2060,68 @@ ERROR 42S02: Table 'test.a_nonextisting_table' doesn't exist
|
||||
SELECT * FROM t2;
|
||||
a b
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#51650 crash with user variables and triggers
|
||||
#
|
||||
DROP TRIGGER IF EXISTS trg1;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
CREATE TABLE t1 (b VARCHAR(50) NOT NULL);
|
||||
CREATE TABLE t2 (a VARCHAR(10) NOT NULL DEFAULT '');
|
||||
CREATE TRIGGER trg1 AFTER INSERT ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
SELECT 1 FROM t1 c WHERE
|
||||
(@bug51650 IS NULL OR @bug51650 != c.b) AND c.b = NEW.a LIMIT 1 INTO @foo;
|
||||
END//
|
||||
SET @bug51650 = 1;
|
||||
INSERT IGNORE INTO t2 VALUES();
|
||||
Warnings:
|
||||
Warning 1329 No data - zero rows fetched, selected, or processed
|
||||
INSERT IGNORE INTO t1 SET b = '777';
|
||||
INSERT IGNORE INTO t2 SET a = '111';
|
||||
Warnings:
|
||||
Warning 1329 No data - zero rows fetched, selected, or processed
|
||||
SET @bug51650 = 1;
|
||||
INSERT IGNORE INTO t2 SET a = '777';
|
||||
DROP TRIGGER trg1;
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (id INT NOT NULL);
|
||||
CREATE TABLE t2 (id INT NOT NULL);
|
||||
INSERT t1 VALUES (1),(2),(3);
|
||||
UPDATE t1 SET id=NULL;
|
||||
Warnings:
|
||||
Warning 1048 Column 'id' cannot be null
|
||||
Warning 1048 Column 'id' cannot be null
|
||||
Warning 1048 Column 'id' cannot be null
|
||||
CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
|
||||
INSERT INTO t2 VALUES (3);
|
||||
UPDATE t1 SET id=NULL;
|
||||
Warnings:
|
||||
Warning 1048 Column 'id' cannot be null
|
||||
Warning 1048 Column 'id' cannot be null
|
||||
Warning 1048 Column 'id' cannot be null
|
||||
DROP TRIGGER t1_bu;
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# Bug#50755: Crash if stored routine def contains version comments
|
||||
#
|
||||
DROP DATABASE IF EXISTS db1;
|
||||
DROP TRIGGER IF EXISTS trg1;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
CREATE DATABASE db1;
|
||||
USE db1;
|
||||
CREATE TABLE t1 (b INT);
|
||||
CREATE TABLE t2 (a INT);
|
||||
CREATE TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERT/*!INTO*/t1 VALUES (1);
|
||||
# Used to crash
|
||||
SHOW TRIGGERS IN db1;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
Warnings:
|
||||
Warning 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VALUES (1)' at line 1
|
||||
INSERT INTO t2 VALUES (1);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VALUES (1)' at line 1
|
||||
SELECT * FROM t1;
|
||||
b
|
||||
# Work around Bug#45235
|
||||
DROP DATABASE db1;
|
||||
USE test;
|
||||
End of 5.1 tests.
|
||||
|
@@ -785,4 +785,19 @@ t1 CREATE TABLE `t1` (
|
||||
KEY `a` (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
#
|
||||
# Bug#50591 bit(31) causes Duplicate entry '1-NULL' for key 'group_key'
|
||||
#
|
||||
CREATE TABLE t1(a INT, b BIT(7) NOT NULL);
|
||||
INSERT INTO t1 VALUES (NULL, 0),(NULL, 0);
|
||||
SELECT SUM(a) FROM t1 GROUP BY b, a;
|
||||
SUM(a)
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT, b BIT(7) NOT NULL, c BIT(8) NOT NULL);
|
||||
INSERT INTO t1 VALUES (NULL, 0, 0),(NULL, 0, 0);
|
||||
SELECT SUM(a) FROM t1 GROUP BY c, b, a;
|
||||
SUM(a)
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@@ -891,11 +891,11 @@ CREATE TABLE b15776 (a year(-2));
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2))' at line 1
|
||||
CREATE TABLE b15776 (a timestamp(4294967294));
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'TIMESTAMP(4294967294)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
|
||||
Warning 1287 'TIMESTAMP(4294967294)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
|
||||
DROP TABLE b15776;
|
||||
CREATE TABLE b15776 (a timestamp(4294967295));
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'TIMESTAMP(4294967295)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
|
||||
Warning 1287 'TIMESTAMP(4294967295)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
|
||||
DROP TABLE b15776;
|
||||
CREATE TABLE b15776 (a timestamp(4294967296));
|
||||
ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user