diff options
Diffstat (limited to 'mysql-test/t/win.test')
-rw-r--r-- | mysql-test/t/win.test | 71 |
1 files changed, 67 insertions, 4 deletions
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index c2022499acf..c353cd8b599 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -1966,10 +1966,6 @@ SELECT i AS fld FROM t1 UNION SELECT COUNT(*) AS fld FROM t1; DROP TABLE t1; --echo # ---echo # Start of 10.3 tests ---echo # - ---echo # --echo # MDEV-13240 Wrong warning with MAX(datetime_field) OVER (...) --echo # @@ -1977,3 +1973,70 @@ CREATE TABLE t1 (dt DATETIME); INSERT INTO t1 VALUES ('2017-05-17'); SELECT MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-13358 FIRST_VALUE throws SQL Error (1292): Incorrect datetime value +--echo # +CREATE TABLE IF NOT EXISTS `fv_test` ( + `SOME_DATE` datetime NOT NULL + ); + +INSERT INTO `fv_test` (`SOME_DATE`) VALUES ('2017-07-20 12:47:56'); + +CREATE TABLE fv_result +SELECT +FIRST_VALUE(SOME_DATE) OVER(ORDER BY SOME_DATE DESC) AS somedate +FROM fv_test; + +SHOW CREATE TABLE fv_result; + +SELECT * FROM fv_result; + +DROP TABLE fv_test, fv_result; + +--echo # +--echo # MDEV-13649: Server crashes in set_field_to_null_with_conversions or in Field::set_notnull +--echo # + +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (0),(1),(2); +SELECT LEAD(a) OVER (PARTITION BY a) as lead, + a AND LEAD(a) OVER (PARTITION BY a) AS a_and_lead_part +FROM t1; + +SELECT a OR LEAD(a) OVER (ORDER BY a) AS a_or_lead_order +FROM t1 +ORDER BY a; + +SELECT a AND LEAD(a) OVER (ORDER BY a) AS a_and_lead_order +FROM t1 +ORDER BY a; + +SELECT a XOR LEAD(a) OVER (ORDER BY a) AS a_xor_lead_order +FROM t1 +ORDER BY a; + +SELECT NOT LEAD(a) OVER (ORDER BY a) AS not_lead_order +FROM t1 +ORDER BY a; + +SELECT LEAD(a) OVER (ORDER BY a) is not null AS is_not_null_lead_order +FROM t1 +ORDER BY a; + +drop table t1; + +--echo # +--echo # MDEV-13354: Server crashes in find_field_in_tables upon PS with window function and subquery +--echo # + +CREATE TABLE t1 (i INT, a char); +INSERT INTO t1 VALUES (1, 'a'),(2, 'b'); +PREPARE stmt FROM "SELECT row_number() over (partition by i order by i), i FROM (SELECT * from t1) as sq"; +EXECUTE stmt; + +DROP TABLE t1; + +--echo # +--echo # Start of 10.3 tests +--echo # |