1

Topic: Solve Amavisd duplicate entry issue

Hi, all.

If you integrated Amavisd with MySQL (@storage_sql_dsn) by following our wiki tutorial before 2011-02-17, you will some error log in mail log like below:

1. Feb 17 03:29:19 gw amavis[27760]: (27760-02) (!)WARN save_info_final: sql exec: err=1062, 23000, DBD::mysql::st execute failed: Duplicate entry '0-6N6HdTgjTr8R-0' for key 'PRIMARY' at (eval 115) line 166, <GEN38> line 172.

This is caused by incorrect SQL structure, you can simply fix it by executing below commands:

$ mysql -uroot -p
mysql> USE amavisd;
mysql> ALTER TABLE msgrcpt DROP PRIMARY KEY;
mysql> CREATE INDEX idx_mail_id ON msgrcpt (mail_id);

Sorry about this trouble.

P.S. Amavisd-new-2.7.0 beta version already solves this issue.