diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/main/empty_table.test | |
parent | Initial commit. (diff) | |
download | mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/empty_table.test')
-rw-r--r-- | mysql-test/main/empty_table.test | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/mysql-test/main/empty_table.test b/mysql-test/main/empty_table.test new file mode 100644 index 00000000..85638bc2 --- /dev/null +++ b/mysql-test/main/empty_table.test @@ -0,0 +1,62 @@ +# +# Some special cases with empty tables +# + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr)); +--disable_ps2_protocol +select count(*) from t1; +select * from t1; +select * from t1 limit 0; +--enable_ps2_protocol +show status like "Empty_queries"; +drop table t1; + +# +# Accessing a non existing table should not increase Empty_queries +# + +--disable_ps2_protocol +--error 1146 +select * from t2; +--enable_ps2_protocol +show status like "Empty_queries"; + +--echo # End of 4.1 tests + +--echo # +--echo # MDEV-30333 Wrong result with not_null_range_scan and LEFT JOIN with empty table +--echo # + +set @save_optimizer_switch=@@optimizer_switch; +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 (b) VALUES (1),(2); +CREATE TABLE t2 (c INT) ENGINE=MyISAM; +SET optimizer_switch= 'not_null_range_scan=off'; # Default +explain extended SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +SET optimizer_switch = 'not_null_range_scan=on'; +explain extended SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +flush tables; +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +drop table t1,t2; + +--echo # Second test in MDEV-30333 + +CREATE TABLE t1 (a int, b varchar(10)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (69,'foo'),(71,'bar'); +CREATE TABLE t2 (c int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(2); +CREATE TABLE t3 (d int, e int, KEY(e)) ENGINE=MyISAM; +SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t3.e = t3.d ON 1; +SET optimizer_switch = 'not_null_range_scan=on'; +SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t3.e = t3.d ON 1; +DROP TABLE t1, t2, t3; +set @@optimizer_switch=@save_optimizer_switch; + +--echo End of 10.5 tests + |