Callerid_entries: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'

I’ve’ got a HA configuration of two Sangoma 400 systems running FreePBX v13.0.195.4. I’ve purchased the CallerID Management module. I created the first entry no problem.However, when I go to create the second entry I get the following error:

PDOException
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘0’ for key ‘PRIMARY’
File:/drbd/httpd/www/html/admin/modules/callerid/Callerid.class.php:121

When I look at the table, I see the following:
mysql> select * from callerid_entries;
±—±------------------------±-------±-----------------±-----------±-----+
| id | name | prefix | cidname | cidnum | perm |
±—±------------------------±-------±-----------------±-----------±-----+
| 0 | Collections NV 775 *401 | *401 | Cash Factory USA | [REDACTED] | 0 |
±—±------------------------±-------±-----------------±-----------±-----+
1 row in set (0.00 sec)

mysql> describe callerid_entries;
±--------±------------±-----±----±--------±------+
| Field | Type | Null | Key | Default | Extra |
±--------±------------±-----±----±--------±------+
| id | int(11) | NO | PRI | NULL | |
| name | varchar(50) | YES | | NULL | |
| prefix | varchar(50) | YES | | NULL | |
| cidname | varchar(50) | YES | | NULL | |
| cidnum | varchar(50) | YES | | NULL | |
| perm | varchar(25) | YES | | NULL | |
±--------±------------±-----±----±--------±------+

It would appear that the id column isn’t auto-incrementing. I’ve used this module on other systems without issue. I know that I can probably modify the table so that it does auto increment but that seems heavy handed. Any suggestions?

So I went ahead and used the following command to make the column auto-increment and so far everything seems fine.

alter table callerid_entries modify column id int auto_increment;

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.