TRUNCATE on a partitioned Aria table does not reset AUTO_INCREMENT
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
New
|
Low
|
Michael Widenius |
Bug Description
TRUNCATE TABLE on an Aria table does not reset auto-increment value as it does for other engines, including MyISAM and InnoDB.
(see http://
Reproducible on current MariaDB 5.1 - 5.5.
Test case:
CREATE TABLE t ( i INT NOT NULL AUTO_INCREMENT, KEY(i) )
ENGINE=Aria
PARTITION BY HASH(i) PARTITIONS 2;
INSERT INTO t VALUES (NULL),
SHOW CREATE TABLE t;
SELECT * FROM t;
TRUNCATE TABLE t;
SHOW CREATE TABLE t;
INSERT INTO t VALUES (NULL),(NULL);
SELECT * FROM t;
DROP TABLE t;
# End of test case
# Expected output (after truncate):
# TRUNCATE TABLE t;
# SHOW CREATE TABLE t;
# Table Create Table
# t CREATE TABLE `t` (
# `i` int(11) NOT NULL AUTO_INCREMENT,
# KEY `i` (`i`)
# ) ENGINE=Aria DEFAULT CHARSET=latin1
# /*!50100 PARTITION BY HASH (i)
# PARTITIONS 2 */
# INSERT INTO t VALUES (NULL),(NULL);
# SELECT * FROM t;
# i
# 1
# 2
# Actual output (after truncate):
# TRUNCATE TABLE t;
# SHOW CREATE TABLE t;
# Table Create Table
# t CREATE TABLE `t` (
# `i` int(11) NOT NULL AUTO_INCREMENT,
# KEY `i` (`i`)
# ) ENGINE=Aria AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
# /*!50100 PARTITION BY HASH (i)
# PARTITIONS 2 */
# INSERT INTO t VALUES (NULL),(NULL);
# SELECT * FROM t;
# i
# 4
# 5