This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

Support for non auto_increment keys

This documentation says "ARCHIVE allows a maximum of one key. The key can be a PRIMARY KEY on an AUTO_INCREMENT column. However, it has a limitation ...".

This sounds like AUTO_INCREMENT is an optional setting that causes a limitation, but trying to create an archive without auto increment gives an error:

CREATE TABLE t1 (id int NOT NULL, PRIMARY KEY (id)) ENGINE = ARCHIVE;

Error: Can't create table `test`.`t1` (errno: 140 "Wrong create options")

Just adding AUTO_INCREMENT solves the problem.

So, is this a bug or AUTO_INCREMENT is mandatory for ARCHIVE tables? If so, the documentation should say MUST, not CAN.

Answer Answered by Elena Stepanova in this comment.

It is not a bug but a part of the limitation. The key can be a PRIMARY KEY (or it can be an ordinary non-unique index), but either way it must be on an AUTO_INCREMENT column.

I agree that this part is worth rephrasing, for clarity.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.