MySQL Forums
Forum List  »  Quality Assurance

Very, very weird key bug.
Posted by: Grzegorz Sojka
Date: September 13, 2007 06:37AM

Hello, guys.

Today my MySQL instance (5.0.18-standard) behaved very, very weird.

There's following table:
TABLE `events` (
`id` bigint(20) NOT NULL auto_increment,
`type` smallint(6) default NULL,
`day` smallint(6) NOT NULL default '0',
`hour` tinyint(4) NOT NULL default '0',
`minute` tinyint(3) unsigned default '0',
`parameters` text,
PRIMARY KEY (`id`),
KEY `day` (`day`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

It contains about half a million records, each representing an event from last seven days. So `day` field contains days numbers for last week (currenty 2010 - 2017). Please note 'day' key is NOT unique.

Suddenly, out of the blue, table stopped accepting records saying:
Duplicate entry '2017' for key 'day'.
There was already about 60,000 of records with `day`=2017. Why would it refuse more?

So I tried to add record with `day` = 2018. It worked. Then I tried to add few more records with `day` = 2018 - still worked. So I removed all '2018' records and then I tried again to add '2017' - it worked and bug didn't happen anymore.

So my question is - why the hell not unique index starts to refusing accepting records due to 'duplicate key'?

Options: ReplyQuote


Subject
Views
Written By
Posted
Very, very weird key bug.
3490
September 13, 2007 06:37AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.