[ZBX-25957] Error occurs when importing files with different interfaces and discovery Created: 2025 Jan 29  Updated: 2025 Feb 19

Status: READY TO DEVELOP
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 7.4.0alpha1
Fix Version/s: 7.0.11rc1, 7.2.5rc1, 7.4.0alpha2 (master)

Type: Problem report Priority: Minor
Reporter: Juliana Iljina Assignee: Zabbix Development Team
Resolution: Unresolved Votes: 0
Labels: hostinterfaces, import
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File screenshot-1.png     PNG File screenshot-2.png     File zbx_export_hosts 1.yaml     File zbx_export_hosts 2.yaml    
Team: Team C
Sprint: Sprint candidates
Story Points: 1

 Description   

An error occurs when importing files with different interfaces and discovery in the first file.

Steps to reproduce:
1. Go to Hosts;
2. Import first file zbx_export_hosts 1.yaml from attachments;
3. Import second file zbx_export_hosts 2.yaml .

Result:

Error in logs:

pg_query(): Query failed: ERROR:  update or delete on table "interface" violates foreign key constraint "c_items_4" on table "items"
DETAIL:  Key (interfaceid)=(80) is still referenced from table "items". [zabbix.php:17 -> require_once() -> ZBase->run() -> ZBase->processRequest() -> CController->run() -> CControllerPopupImport->doAction() -> CApiWrapper->__call() -> CFrontendApiWrapper->callMethod() -> CApiWrapper->callMethod() -> CApiWrapper->callClientMethod() -> CLocalApiClient->callMethod() -> CConfiguration->import() -> CConfigurationImport->import() -> CConfigurationImport->processHosts() -> CHostImporter->import() -> CHost->update() -> CHost->updateForce() -> CHost->massUpdate() -> CHostInterface->replaceHostInterfaces() -> CHostInterface->delete() -> DB::delete() -> DBexecute() -> pg_query() -> CConfigFile->{closure}() in include/db.inc.php:255]
  • If you delete the discovery from File 1 and leave the host empty, the error will not occur.
  • If you add an item instead , the system triggers the correct notification:


Generated at Mon Feb 24 09:17:01 EET 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.