Commit c8774408 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-17968 Error 174 "Fatal error during initialization of handler" from...

MDEV-17968 Error 174 "Fatal error during initialization of handler" from storage engine Aria upon DELETE from partitioned table
parent c353b2a8
......@@ -1129,5 +1129,19 @@ Warnings:
Warning 1292 Truncated incorrect datetime value: 'N/A'
DROP TABLE t1;
#
# MDEV-17972 Assertion `is_valid_value_slow()' failed in Datetime::Datetime
#
SET time_zone='+00:00';
CREATE TABLE t1 (a TIMESTAMP(6)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('2001-01-01 10:20:30');
FLUSH TABLES;
MYD
FF77777777FFFFFF
SELECT a, CAST(a AS DATETIME) AS dt0, CAST(a AS DATETIME(6)) AS dt6 FROM t1;
a dt0 dt6
2033-07-07 03:01:11.999999 2033-07-07 03:01:11 2033-07-07 03:01:11.999999
DROP TABLE t1;
SET time_zone=DEFAULT;
#
# End of 10.4 tests
#
......@@ -718,6 +718,28 @@ INSERT INTO t1 VALUES (1,'2018-06-19 00:00:00');
SELECT NULLIF(b, 'N/A') AS f, MAX(a) FROM t1 GROUP BY f;
DROP TABLE t1;
--echo #
--echo # MDEV-17972 Assertion `is_valid_value_slow()' failed in Datetime::Datetime
--echo #
let $MYSQLD_DATADIR= `select @@datadir`;
SET time_zone='+00:00';
CREATE TABLE t1 (a TIMESTAMP(6)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('2001-01-01 10:20:30');
FLUSH TABLES;
--remove_file $MYSQLD_DATADIR/test/t1.MYD
--disable_query_log
# Write a data file with one record:
# 0xFF - record flags
# 0x77777777 - TIMESTAMP integer part
# 0xFFFFFF - TIMESTAMP bad fractional part
--eval SELECT CONCAT(0xFF,0x77777777,0xFFFFFF) INTO OUTFILE '$MYSQLD_DATADIR/test/t1.MYD' FIELDS TERMINATED BY '' ESCAPED BY '' LINES TERMINATED BY ''
--eval SELECT HEX(LOAD_FILE('$MYSQLD_DATADIR/test/t1.MYD')) AS MYD
--enable_query_log
SELECT a, CAST(a AS DATETIME) AS dt0, CAST(a AS DATETIME(6)) AS dt6 FROM t1;
DROP TABLE t1;
SET time_zone=DEFAULT;
--echo #
--echo # End of 10.4 tests
--echo #
......@@ -20,6 +20,19 @@
#include "myisampack.h"
#include "my_time.h"
static uint my_max_usec_value[7]
{
0,
900000,
990000,
999000,
999900,
999990,
999999
};
/*** MySQL56 TIME low-level memory and disk representation routines ***/
/*
......@@ -397,19 +410,21 @@ void my_timestamp_from_binary(struct timeval *tm, const uchar *ptr, uint dec)
case 0:
default:
tm->tv_usec= 0;
break;
return;
case 1:
case 2:
tm->tv_usec= ((int) ptr[4]) * 10000;
break;
case 3:
case 4:
tm->tv_usec= mi_sint2korr(ptr + 4) * 100;
tm->tv_usec= (uint) mi_uint2korr(ptr + 4) * 100;
break;
case 5:
case 6:
tm->tv_usec= mi_sint3korr(ptr + 4);
tm->tv_usec= (uint) mi_uint3korr(ptr + 4);
}
// The binary data my be corrupt. Cut fractional seconds to the valid range.
set_if_smaller(tm->tv_usec, my_max_usec_value[dec]);
}
......
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