[ZBX-4574] ctemplate->unlink fails when targetids = null Created: 2012 Jan 23  Updated: 2017 May 30  Resolved: 2012 Mar 14

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 1.9.8 (beta)
Fix Version/s: 1.9.9 (beta)

Type: Incident report Priority: Major
Reporter: Timo A. Hummel Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates ZBX-4573 API call to delete templates doesn't ... Closed

 Description   

When targetids in ctemplate->unlink is set to null, the generated SQL statement fails because the following statement is generated:

SELECT DISTINCT g.graphid,g.name,g.flags,h.name as host FROM graphs g WHERE EXISTS (SELECT ggi.graphid FROM graphs_items ggi,items ii WHERE ggi.graphid=g.templateid AND ii.itemid=ggi.itemid AND (ii.hostid IN ('10002')) ) AND (g.flags IN ('0','1'))

Because h is not included in all cases (=when targetids is null), the SQL statement fails. As I honestly have no idea what happens where and why due to no documentation, I have no idea how to fix that. For my bug reporting issues, I simply have set the following near line 2092:

$sql_from = ' graphs g,hosts h';



 Comments   
Comment by Timo A. Hummel [ 2012 Jan 23 ]

The file is class.ctemplate.php

Comment by Alexei Vladishev [ 2012 Feb 24 ]

See also ZBX-4573

Comment by Alexey Fukalov [ 2012 Mar 14 ]

Fixed in ZBX-4519.

Generated at Fri Apr 26 08:14:44 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.