1# Testing of potential problems in Aria and alter table 2 3-- source include/have_maria.inc 4 5drop table if exists t1; 6 7# 8# MDEV-4970 Wrong result with Aria table populated with disabled keys 9# 10 11CREATE TABLE t1 (pk INT, d DATETIME, PRIMARY KEY(pk), KEY(d)) ENGINE=Aria; 12ALTER TABLE t1 DISABLE KEYS; 13INSERT INTO t1 VALUES (1,'2000-01-01 22:22:22'),(2,'2012-12-21 12:12:12'); 14INSERT INTO t1 VALUES (3, '2008-07-24'); 15ALTER TABLE t1 ENABLE KEYS; 16 17SELECT t1a.pk FROM t1 AS t1a LEFT JOIN t1 AS t1b ON t1a.pk = t1b.pk; 18SELECT * FROM t1 AS t1a LEFT JOIN t1 AS t1b ON t1a.pk = t1b.pk; 19DROP TABLE t1; 20 21CREATE TABLE t1 (pk INT PRIMARY KEY, i INT, KEY(i)) ENGINE=Aria; 22ALTER TABLE t1 DISABLE KEYS; 23INSERT INTO t1 VALUES (1,11); 24INSERT INTO t1 VALUES (2,0),(3,33),(4,0),(5,55),(6,66),(7,0),(8,88),(9,99); 25ALTER TABLE t1 ENABLE KEYS; 26SELECT * FROM t1 WHERE i = 0 OR pk BETWEEN 6 AND 10; 27DROP TABLE t1; 28 29# 30# MDEV-14943 31# Assertion `block->type == PAGECACHE_EMPTY_PAGE || block->type == type || 32# type == PAGECACHE_LSN_PAGE || type == PAGECACHE_READ_UNKNOWN_PAGE || 33# block->type == PAGECACHE_READ_UNKNOWN_PAGE' failed in pagecache_read upon 34# CREATE ... SELECT from Aria table 35# 36 37CREATE TABLE t1 (f INT) ENGINE=Aria transactional=1; 38SHOW CREATE TABLE t1; 39INSERT INTO t1 VALUES (1),(2); 40--error ER_BAD_FIELD_ERROR 41ALTER TABLE t1 ORDER BY unknown_column; 42SHOW CREATE TABLE t1; 43CREATE TABLE t2 SELECT * FROM t1; 44DROP TABLE t1, t2; 45 46--echo # 47--echo # MDEV-19055 Assertion `(_my_thread_var())->thr_errno != 0' failed in pagecache_read 48--echo # 49 50--disable_warnings 51CREATE OR REPLACE TABLE t1 (x INT) ENGINE=Aria; 52CREATE TEMPORARY TABLE t2 (a TIME) ENGINE=Aria; 53ALTER TABLE t2 ADD b DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP; 54ALTER TABLE t2 ADD CHECK (b = 4); 55INSERT IGNORE INTO t2 () VALUES (),(),(),(); 56ALTER IGNORE TABLE t2 ADD c INT; 57SELECT count(a),sum(a) FROM t2; 58DELETE FROM t2 ORDER BY c LIMIT 1; 59INSERT IGNORE INTO t2 SELECT * FROM t2; 60OPTIMIZE TABLE t2; 61SELECT count(a),sum(a) FROM t2; 62INSERT IGNORE INTO t2 SELECT * FROM t2; 63SET SQL_MODE= 'STRICT_ALL_TABLES'; 64SELECT count(a),sum(a) FROM t2; 65--error ER_TRUNCATED_WRONG_VALUE 66ALTER TABLE t2 CHANGE IF EXISTS d c INT; 67SELECT count(a),sum(a) FROM t2; 68ALTER IGNORE TABLE t2 ADD IF NOT EXISTS e BIT; 69ALTER TABLE t1 MODIFY IF EXISTS xx INT; 70INSERT IGNORE INTO t2 () VALUES (),(),(),(); 71SELECT count(a),sum(a) FROM t2; 72--enable_warnings 73check table t1; 74check table t2; 75DROP TABLE t1,t2; 76 77--echo # 78--echo # MDEV-17576 79--echo # Assertion `share->reopen == 1' failed in maria_extra upon ALTER on 80--echo # Aria table with triggers and locks 81--echo # 82 83CREATE TABLE t1 (a INT) ENGINE=Aria; 84CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t1 SELECT * FROM t1; 85LOCK TABLE t1 WRITE; 86ALTER TABLE t1 FORCE, LOCK=EXCLUSIVE; 87DROP TRIGGER tr; 88DROP TABLE t1; 89 90--echo # 91--echo # End of 10.2 test 92--echo # 93