Commit d0535d80 authored by Sergey Petrunya's avatar Sergey Petrunya

Test case backport for: Bug#42580 - Innodb's ORDER BY ..LIMIT returns no rows...

Test case backport for: Bug#42580 - Innodb's ORDER BY ..LIMIT returns no rows for null-safe operator <=> NULL
parent 71be71da
--echo #
--echo # Bug#42580 - Innodb's ORDER BY ..LIMIT returns no rows for
--echo # null-safe operator <=> NULL
--echo #
CREATE TABLE t1(
c1 DATE NOT NULL,
c2 DATE NULL,
c3 DATETIME,
c4 TIMESTAMP,
PRIMARY KEY(c1),
UNIQUE(c2)
);
--echo
INSERT INTO t1 VALUES('0000-00-00', '0000-00-00', '2008-01-04', '2008-01-05');
INSERT INTO t1 VALUES('2007-05-25', '2007-05-25', '2007-05-26', '2007-05-26');
INSERT INTO t1 VALUES('2008-01-01', NULL , '2008-01-02', '2008-01-03');
INSERT INTO t1 VALUES('2008-01-17', NULL , NULL , '2009-01-29');
INSERT INTO t1 VALUES('2009-01-29', '2009-01-29', '2009-01-29', '2009-01-29');
--echo
SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c1,c2;
--echo
SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c1,c2 LIMIT 2;
--echo
DROP TABLE t1;
set @save_storage_engine= @@storage_engine;
set storage_engine=InnoDB;
#
# Bug#42580 - Innodb's ORDER BY ..LIMIT returns no rows for
# null-safe operator <=> NULL
#
CREATE TABLE t1(
c1 DATE NOT NULL,
c2 DATE NULL,
c3 DATETIME,
c4 TIMESTAMP,
PRIMARY KEY(c1),
UNIQUE(c2)
);
INSERT INTO t1 VALUES('0000-00-00', '0000-00-00', '2008-01-04', '2008-01-05');
INSERT INTO t1 VALUES('2007-05-25', '2007-05-25', '2007-05-26', '2007-05-26');
INSERT INTO t1 VALUES('2008-01-01', NULL , '2008-01-02', '2008-01-03');
INSERT INTO t1 VALUES('2008-01-17', NULL , NULL , '2009-01-29');
INSERT INTO t1 VALUES('2009-01-29', '2009-01-29', '2009-01-29', '2009-01-29');
SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c1,c2;
c1 c2 c3 c4
2008-01-01 NULL 2008-01-02 00:00:00 2008-01-03 00:00:00
2008-01-17 NULL NULL 2009-01-29 00:00:00
SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c1,c2 LIMIT 2;
c1 c2 c3 c4
2008-01-01 NULL 2008-01-02 00:00:00 2008-01-03 00:00:00
2008-01-17 NULL NULL 2009-01-29 00:00:00
DROP TABLE t1;
set storage_engine= @save_storage_engine;
set @save_storage_engine= @@storage_engine;
set storage_engine=Maria;
#
# Bug#42580 - Innodb's ORDER BY ..LIMIT returns no rows for
# null-safe operator <=> NULL
#
CREATE TABLE t1(
c1 DATE NOT NULL,
c2 DATE NULL,
c3 DATETIME,
c4 TIMESTAMP,
PRIMARY KEY(c1),
UNIQUE(c2)
);
INSERT INTO t1 VALUES('0000-00-00', '0000-00-00', '2008-01-04', '2008-01-05');
INSERT INTO t1 VALUES('2007-05-25', '2007-05-25', '2007-05-26', '2007-05-26');
INSERT INTO t1 VALUES('2008-01-01', NULL , '2008-01-02', '2008-01-03');
INSERT INTO t1 VALUES('2008-01-17', NULL , NULL , '2009-01-29');
INSERT INTO t1 VALUES('2009-01-29', '2009-01-29', '2009-01-29', '2009-01-29');
SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c1,c2;
c1 c2 c3 c4
2008-01-01 NULL 2008-01-02 00:00:00 2008-01-03 00:00:00
2008-01-17 NULL NULL 2009-01-29 00:00:00
SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c1,c2 LIMIT 2;
c1 c2 c3 c4
2008-01-01 NULL 2008-01-02 00:00:00 2008-01-03 00:00:00
2008-01-17 NULL NULL 2009-01-29 00:00:00
DROP TABLE t1;
set storage_engine= @save_storage_engine;
#
# Bug#42580 - Innodb's ORDER BY ..LIMIT returns no rows for
# null-safe operator <=> NULL
#
CREATE TABLE t1(
c1 DATE NOT NULL,
c2 DATE NULL,
c3 DATETIME,
c4 TIMESTAMP,
PRIMARY KEY(c1),
UNIQUE(c2)
);
INSERT INTO t1 VALUES('0000-00-00', '0000-00-00', '2008-01-04', '2008-01-05');
INSERT INTO t1 VALUES('2007-05-25', '2007-05-25', '2007-05-26', '2007-05-26');
INSERT INTO t1 VALUES('2008-01-01', NULL , '2008-01-02', '2008-01-03');
INSERT INTO t1 VALUES('2008-01-17', NULL , NULL , '2009-01-29');
INSERT INTO t1 VALUES('2009-01-29', '2009-01-29', '2009-01-29', '2009-01-29');
SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c1,c2;
c1 c2 c3 c4
2008-01-01 NULL 2008-01-02 00:00:00 2008-01-03 00:00:00
2008-01-17 NULL NULL 2009-01-29 00:00:00
SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c1,c2 LIMIT 2;
c1 c2 c3 c4
2008-01-01 NULL 2008-01-02 00:00:00 2008-01-03 00:00:00
2008-01-17 NULL NULL 2009-01-29 00:00:00
DROP TABLE t1;
#
# ICP/InnoDB tests (Index Condition Pushdown)
#
--source include/have_innodb.inc
set @save_storage_engine= @@storage_engine;
set storage_engine=InnoDB;
--source include/icp_tests.inc
set storage_engine= @save_storage_engine;
#
# ICP/Maria tests (Index Condition Pushdown)
#
--source include/have_maria.inc
set @save_storage_engine= @@storage_engine;
set storage_engine=Maria;
--source include/icp_tests.inc
set storage_engine= @save_storage_engine;
#
# ICP/MyISAM tests (Index Condition Pushdown)
#
--source include/icp_tests.inc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment