2009-08-26 12:59:49 +02:00
|
|
|
# Created for verifying bug#20577.
|
|
|
|
# expects TABLE t1 (... , a DATE, ...)
|
|
|
|
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a < '1001-01-01';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a <= '1001-01-01';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a >= '1001-01-01';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a > '1001-01-01';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a = '1001-01-01';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a < '1001-00-00';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a <= '1001-00-00';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a >= '1001-00-00';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a > '1001-00-00';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a = '1001-00-00';
|
2009-09-01 14:53:27 +02:00
|
|
|
--echo # Disabling warnings for the invalid date
|
|
|
|
--disable_warnings
|
2009-08-26 12:59:49 +02:00
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a < '1999-02-31';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a <= '1999-02-31';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a >= '1999-02-31';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a > '1999-02-31';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a = '1999-02-31';
|
2009-09-01 14:53:27 +02:00
|
|
|
--enable_warnings
|
2009-08-26 12:59:49 +02:00
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
|
|
|
|
--sorted_result
|
|
|
|
SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
|
|
|
|
if ($explain_partitions)
|
|
|
|
{
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-01-01';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00';
|
2009-09-01 14:53:27 +02:00
|
|
|
--echo # Disabling warnings for the invalid date
|
|
|
|
--disable_warnings
|
2009-08-26 12:59:49 +02:00
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31';
|
2009-09-01 14:53:27 +02:00
|
|
|
--enable_warnings
|
2009-08-26 12:59:49 +02:00
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
|
|
|
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
|
|
|
|
}
|