[ZBX-6355] Background image upload fails with "Duplicate entry xx for key PRIMARY" Created: 2013 Mar 06  Updated: 2017 May 30  Resolved: 2013 Mar 06

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.0.5
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Jens Berthold Assignee: Unassigned
Resolution: Won't fix Votes: 0
Labels: database, images, import, upload
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian 6.0.3
mysql Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (x86_64)
PHP 5.3.3-7+squeeze3 with Suhosin-Patch (cli)



 Description   

When trying to upload a background image, I get the following error:
Error in query [INSERT INTO images (imageid, name, imagetype, image) VALUES (42, 'Hintergrund Netzwerkplan', 2, '...')] [Duplicate entry '42' for key 'PRIMARY']

Looking into table "images" shows me that the last image with imagetype "2" (background) has imageid 41.
But there are icon images (imagetype "1") up until imageid 228.

So it seems to me the import logic does something like "select imageid from images where imagetype = 2" instead of "select imageid from images".



 Comments   
Comment by richlv [ 2013 Mar 06 ]

select * from ids where table_name='images';

Comment by Jens Berthold [ 2013 Mar 06 ]

Yes, meanwhile I also found it by crawling through the code. I changed the "nextid" in the database (which doesn't hold the next, but the highest currently used id) and now it works.
Thank you!

Comment by Jens Berthold [ 2013 Mar 06 ]

Closing the issue as it was a specific fault in my database and I cannot tell if that was Zabbix' fault or my own.

Generated at Sat Apr 20 02:40:08 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.