Skip to content

Commit 0037714

Browse files
committed
Tests for MDEV-15881 Assertion `is_valid_value_slow()' failed in Datetime::Datetime or corrupt data after ALTER with indexed persistent column
The patch for "MDEV-18486 Database crash on a table with indexed virtual column" fixed MDEV-15881 as well. So adding tests only.
1 parent 1a5ba2a commit 0037714

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

mysql-test/suite/vcol/r/vcol_keys_myisam.result

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,3 +383,28 @@ select * from t1;
383383
id hexid
384384
100 64
385385
drop table t1;
386+
#
387+
# MDEV-15881 Assertion `is_valid_value_slow()' failed in Datetime::Datetime or corrupt data after ALTER with indexed persistent column
388+
#
389+
CREATE TABLE t1 (i INT, d1 DATE, d2 DATE NOT NULL, t TIMESTAMP, KEY(t)) ENGINE=MyISAM;
390+
INSERT INTO t1 VALUES (1,'2023-03-16','2023-03-15','2012-12-12 12:12:12');
391+
ALTER TABLE t1 MODIFY t FLOAT AS (i) PERSISTENT;
392+
SELECT i, d1, d2 FROM t1 INTO OUTFILE 'load_t1';
393+
DELETE FROM t1;
394+
LOAD DATA INFILE 'load_t1' INTO TABLE t1 (i,d1,d2);
395+
SELECT * FROM t1 WHERE d2 < d1;
396+
i d1 d2 t
397+
1 2023-03-16 2023-03-15 1
398+
DROP TABLE t1;
399+
CREATE TABLE t1 (
400+
i INT DEFAULT NULL,
401+
d1 DATE DEFAULT NULL,
402+
d2 DATE NOT NULL,
403+
t FLOAT GENERATED ALWAYS AS (i) STORED,
404+
KEY (t)
405+
) ENGINE=MyISAM;
406+
LOAD DATA INFILE 'load_t1' INTO TABLE t1 (i,d1,d2);
407+
SELECT * FROM t1 WHERE d2 < d1;
408+
i d1 d2 t
409+
1 2023-03-16 2023-03-15 1
410+
DROP TABLE t1;

mysql-test/suite/vcol/t/vcol_keys_myisam.test

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,31 @@ create table t1 ( id int primary key,
272272
insert into t1 (id) select 100;
273273
select * from t1;
274274
drop table t1;
275+
276+
277+
--echo #
278+
--echo # MDEV-15881 Assertion `is_valid_value_slow()' failed in Datetime::Datetime or corrupt data after ALTER with indexed persistent column
279+
--echo #
280+
281+
CREATE TABLE t1 (i INT, d1 DATE, d2 DATE NOT NULL, t TIMESTAMP, KEY(t)) ENGINE=MyISAM;
282+
INSERT INTO t1 VALUES (1,'2023-03-16','2023-03-15','2012-12-12 12:12:12');
283+
ALTER TABLE t1 MODIFY t FLOAT AS (i) PERSISTENT;
284+
SELECT i, d1, d2 FROM t1 INTO OUTFILE 'load_t1';
285+
DELETE FROM t1;
286+
LOAD DATA INFILE 'load_t1' INTO TABLE t1 (i,d1,d2);
287+
SELECT * FROM t1 WHERE d2 < d1;
288+
DROP TABLE t1;
289+
290+
CREATE TABLE t1 (
291+
i INT DEFAULT NULL,
292+
d1 DATE DEFAULT NULL,
293+
d2 DATE NOT NULL,
294+
t FLOAT GENERATED ALWAYS AS (i) STORED,
295+
KEY (t)
296+
) ENGINE=MyISAM;
297+
LOAD DATA INFILE 'load_t1' INTO TABLE t1 (i,d1,d2);
298+
SELECT * FROM t1 WHERE d2 < d1;
299+
DROP TABLE t1;
300+
# Cleanup
301+
--let $datadir= `SELECT @@datadir`
302+
--remove_file $datadir/test/load_t1

0 commit comments

Comments
 (0)