[imp] "Integrity constraint violation" messages when moving emails

Jens-Uwe Mozdzen jmozdzen at nde.ag
Mon Mar 10 17:21:27 UTC 2014


Hi *,

I'm trying to track down the source of error messages that have been  
haunting our Horde5 installation since some time. They appear  
randomly, but often, and always when trying to move a mail message to  
another folder:

--- cut here ---
2014-03-10T18:11:05+01:00 ERR: HORDE [imp] SQL QUERY FAILED:  
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry  
'0' for key 'PRIMARY'
         INSERT INTO horde_imap_client_data (hostspec, mailbox, port, username)
           VALUES ('imap.company.com', 'INBOX/path/to/taget/folder',
           '143', 'jmozdzen at nde.ag') [pid 14859 on line 200 of  
"/usr/share/php5/PEAR/Horde/Db/Adapter/Pdo/Base.php"]
--- cut here ---

That PHP file is from Horde_Db. OTOH, that's only the place where the  
query is actually executed, not where it's built. All code is PEAR's  
latest (i.e. Horde_Imap_Client 2.18.6), updated a few minutes ago. The  
error appeared first with older code.

The table in question does not have an auto-increment on the primary key:

--- cut here ---
mysql> describe horde_imap_client_data;
+-----------+------------------+------+-----+---------+-------+
| Field     | Type             | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+-------+
| messageid | int(10) unsigned | NO   | PRI | 0       |       |
| hostspec  | varchar(255)     | NO   | MUL | NULL    |       |
| mailbox   | varchar(255)     | NO   |     | NULL    |       |
| modified  | bigint(20)       | YES  |     | NULL    |       |
| port      | int(11)          | NO   |     | NULL    |       |
| username  | varchar(255)     | NO   |     | NULL    |       |
+-----------+------------------+------+-----+---------+-------+
--- cut here ---

so not specifying a messageid will lead to a messageid of "0". Is this  
already the source of the problem?

Deleting the entry with messageid==0 will not fix the problem.

According to "horde-db-migrate", all schemata are up to date, here's  
the info on Horde_Imap_Client:

--- cut here ---
[  INFO  ] Current Horde_Imap_Client schema version: 2
[  INFO  ] Ending Horde_Imap_Client schema version: 2
--- cut here ---

Is this something known (and probably fixed in the just released code)  
or should I spend some time debugging this and open a bug report?

Regards,
Jens
-- 
Jens-U. Mozdzen                         voice   : +49-40-559 51 75
NDE Netzdesign und -entwicklung AG      fax     : +49-40-559 51 77
Postfach 61 03 15                       mobile  : +49-179-4 98 21 98
D-22423 Hamburg                         e-mail  : jmozdzen at nde.ag

         Vorsitzende des Aufsichtsrates: Angelika Mozdzen
           Sitz und Registergericht: Hamburg, HRB 90934
                   Vorstand: Jens-U. Mozdzen
                    USt-IdNr. DE 814 013 983



More information about the imp mailing list