MDEV-35489 Assertion `!ldate->neg' or unexpected result upon extracting unit from invalid value

The patch for MDEV-23687 easlier fixed this problem. Adding tests only.
This commit is contained in:
Alexander Barkov 2024-11-25 16:13:16 +04:00
parent 2e404c9850
commit 20eba06d9b
2 changed files with 33 additions and 0 deletions

View file

@ -1503,5 +1503,28 @@ Warnings:
Warning 1292 Incorrect datetime value: '100000:00:00'
SET SESSION old_mode=DEFAULT;
#
# MDEV-35489 Assertion `!ldate->neg' or unexpected result upon extracting unit from invalid value
#
SELECT EXTRACT(DAY FROM TIMESTAMP(-177498480000));
EXTRACT(DAY FROM TIMESTAMP(-177498480000))
NULL
Warnings:
Warning 1292 Incorrect datetime value: '-177498480000'
SELECT EXTRACT(DAY FROM TIMESTAMP(-177498480001));
EXTRACT(DAY FROM TIMESTAMP(-177498480001))
NULL
Warnings:
Warning 1292 Incorrect datetime value: '-177498480001'
SELECT EXTRACT(DAY FROM TIMESTAMP(-200000000000));
EXTRACT(DAY FROM TIMESTAMP(-200000000000))
NULL
Warnings:
Warning 1292 Incorrect datetime value: '-200000000000'
SELECT EXTRACT(DAY FROM TIMESTAMP(-221938034527));
EXTRACT(DAY FROM TIMESTAMP(-221938034527))
NULL
Warnings:
Warning 1292 Incorrect datetime value: '-221938034527'
#
# End of 10.5 tests
#

View file

@ -528,6 +528,16 @@ SELECT CAST('100000:00:00' AS DATE);
SELECT EXTRACT(DAY FROM CAST('100000:00:00' AS DATE));
SET SESSION old_mode=DEFAULT;
--echo #
--echo # MDEV-35489 Assertion `!ldate->neg' or unexpected result upon extracting unit from invalid value
--echo #
SELECT EXTRACT(DAY FROM TIMESTAMP(-177498480000));
SELECT EXTRACT(DAY FROM TIMESTAMP(-177498480001));
SELECT EXTRACT(DAY FROM TIMESTAMP(-200000000000));
SELECT EXTRACT(DAY FROM TIMESTAMP(-221938034527));
--echo #
--echo # End of 10.5 tests
--echo #