[MDEV-4997] Rare autoincrement issue Created: 2013-09-05  Updated: 2013-10-24  Due: 2013-10-07  Resolved: 2013-10-24

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.32
Fix Version/s: None

Type: Bug Priority: Major
Reporter: denshade (Inactive) Assignee: Sergei Golubchik
Resolution: Cannot Reproduce Votes: 0
Labels: None


 Description   

I do an insert, we don't specify the id so it uses autoincrement.

INSERT INTO table_name (model, url, download_count, created_at, updated_at, user_id, asset_id) VALUES (?, ?, ?, ?, ?, ?, ?)

with params ["value1", "aaaa, 1, "2013-09-02 07:33:11", "2013-09-02 18:47:16", 25595, 899]

It causes a duplicate entry: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5'

The status of the table is OK:
db_xxx.table_name check status OK

Here is the show create:

CREATE TABLE `table_name` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `asset_id` int(11) DEFAULT NULL,
  `model` varchar(31) COLLATE utf8_unicode_ci NOT NULL,
  `url` varchar(127) COLLATE utf8_unicode_ci NOT NULL,
  `download_count` int(11) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_7A5DB31DA76ED395` (`user_id`),
  KEY `IDX_7A5DB31D5DA1941` (`asset_id`),
  CONSTRAINT `FK_7A5DB31D5DA1941` FOREIGN KEY (`asset_id`) REFERENCES `asset` (`id`),
  CONSTRAINT `FK_7A5DB31DA76ED395` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci



 Comments   
Comment by Sergei Golubchik [ 2013-09-07 ]

I couldn't repeat the bug based on the information you provided.
Please try to create a repeatable test case.

Generated at Thu Feb 08 07:00:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.