--echo# Verify that TRUNCATE PARTITION gives error
evalCREATETABLEt1
(aBIGINTAUTO_INCREMENTPRIMARYKEY,
bVARCHAR(255))
ENGINE=$engine
PARTITIONBYKEY(a)
(PARTITIONLT1000,
PARTITIONLT2000,
PARTITIONMAX);
INSERTINTOt1VALUES(NULL,"First"),(NULL,"Second"),(999,"Last in LT1000"),(NULL,"First in LT2000"),(NULL,"Second in LT2000"),(1999,"Last in LT2000"),(NULL,"First in MAX"),(NULL,"Second in MAX");
INSERTINTOt1VALUES(NULL,"First"),(NULL,"Second"),(999,"Last in LT1000"),(NULL,"First in LT2000"),(NULL,"Second in LT2000"),(1999,"Last in LT2000"),(NULL,"First in MAX"),(NULL,"Second in MAX");
SHOWCREATETABLEt1;
SELECT*FROMt1ORDERBYa;
ALTERTABLEt1ANALYZEPARTITIONMAX;
--echo# Truncate without FLUSH
ALTERTABLEt1TRUNCATEPARTITIONMAX;
INSERTINTOt1VALUES(NULL,"First after TRUNCATE MAX (1)");
SELECT*FROMt1WHEREa>=2000;
--echo# Truncate with FLUSH after
ALTERTABLEt1TRUNCATEPARTITIONMAX;
FLUSHTABLES;
INSERTINTOt1VALUES(NULL,"First after TRUNCATE MAX (2)");
SELECT*FROMt1WHEREa>=2000;
--echo# Truncate with FLUSH before
FLUSHTABLES;
ALTERTABLEt1TRUNCATEPARTITIONMAX;
INSERTINTOt1VALUES(NULL,"First after TRUNCATE MAX (3)");
SELECT*FROMt1WHEREa>=2000;
--echo# Truncate with FLUSH after INSERT
FLUSHTABLES;
ALTERTABLEt1TRUNCATEPARTITIONMAX;
INSERTINTOt1VALUES(NULL,"First after TRUNCATE MAX (4)");
SELECT*FROMt1WHEREa>=2000;
--echo# Truncate without FLUSH
ALTERTABLEt1TRUNCATEPARTITIONLT1000;
INSERTINTOt1VALUES(NULL,"First after TRUNCATE LT1000 (1)");
SELECT*FROMt1ORDERBYa;
--echo# Truncate with FLUSH after
ALTERTABLEt1TRUNCATEPARTITIONLT1000;
FLUSHTABLES;
INSERTINTOt1VALUES(NULL,"First after TRUNCATE LT1000 (2)");
SELECT*FROMt1ORDERBYa;
--echo# Truncate with FLUSH before
FLUSHTABLES;
ALTERTABLEt1TRUNCATEPARTITIONLT1000;
INSERTINTOt1VALUES(NULL,"First after TRUNCATE LT1000 (3)");
SELECT*FROMt1ORDERBYa;
--echo# Truncate with FLUSH after INSERT
FLUSHTABLES;
ALTERTABLEt1TRUNCATEPARTITIONLT1000;
INSERTINTOt1VALUES(NULL,"First after TRUNCATE LT1000 (4)");
SELECT*FROMt1ORDERBYa;
--echo# Truncate without FLUSH
ALTERTABLEt1TRUNCATEPARTITIONLT2000;
INSERTINTOt1VALUES(NULL,"First after TRUNCATE LT2000 (1)");
SELECT*FROMt1ORDERBYa;
--echo# Truncate with FLUSH after
ALTERTABLEt1TRUNCATEPARTITIONLT2000;
FLUSHTABLES;
INSERTINTOt1VALUES(NULL,"First after TRUNCATE LT2000 (2)");
SELECT*FROMt1ORDERBYa;
--echo# Truncate with FLUSH before
FLUSHTABLES;
ALTERTABLEt1TRUNCATEPARTITIONLT2000;
INSERTINTOt1VALUES(NULL,"First after TRUNCATE LT2000 (3)");
SELECT*FROMt1ORDERBYa;
--echo# Truncate with FLUSH after INSERT
FLUSHTABLES;
ALTERTABLEt1TRUNCATEPARTITIONLT2000;
INSERTINTOt1VALUES(NULL,"First after TRUNCATE LT2000 (4)");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");