TRUNCATE on a partitioned Aria table does not reset AUTO_INCREMENT

Bug #997397 reported by Elena Stepanova on 2012-05-09
6
This bug affects 1 person
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://kb.askmonty.org/en/truncate-table or http://dev.mysql.com/doc/refman/5.5/en/truncate-table.html)

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),(NULL),(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

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers