List:General Discussion« Previous MessageNext Message »
From:Rodrigo Ferreira Date:March 2 2011 2:04pm
Subject:Two Identical Values on Primary Key Column
View as plain text  
Hi all,

I have just experienced a strange problem with mysql production database. The table
faqsessions have a primary key on column `Code` and the above select return 2 rows!

mysql>
mysql>
mysql> show create table faqsessions;
+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table       | Create
Table                                                                                                                                                                                                                                    
|
+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| faqsessions | CREATE TABLE `faqsessions` (
  `Code` int(11) unsigned NOT NULL auto_increment,
  `sid` int(11) NOT NULL,
  `ip` text NOT NULL,
  `time` int(11) NOT NULL,
  PRIMARY KEY  (`Code`)
) ENGINE=InnoDB AUTO_INCREMENT=1567573 DEFAULT CHARSET=latin1 |
+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql>
mysql>
mysql> select * from faqsessions where time in (1268650281, 1268650260);
+--------+--------+--------------+------------+
| Code   | sid    |
ip           |
time       |
+--------+--------+--------------+------------+
| 611179 | 312713 | 66.249.68.87 | 1268650281 |
| 611179 | 312713 | 66.249.68.89 | 1268650260 |
+--------+--------+--------------+------------+
2 rows in set (1.49 sec)

mysql>
mysql>
mysql> select * from faqsessions where Code = 611179;
+--------+--------+--------------+------------+
| Code   | sid    |
ip           |
time       |
+--------+--------+--------------+------------+
| 611179 | 312713 | 66.249.68.87 | 1268650281 |
+--------+--------+--------------+------------+
1 row in set (0.00 sec)

Any idea?

Rodrigo Ferreira
CMDBA, CMDEV




      
Thread
Two Identical Values on Primary Key ColumnRodrigo Ferreira2 Mar
  • Re: Two Identical Values on Primary Key ColumnJohan De Meersman2 Mar
    • Re: Two Identical Values on Primary Key ColumnRodrigo Ferreira2 Mar