[ZBX-5311] deleting a proxy which is used in a discovery rule generates SQL error Created: 2012 Jul 11  Updated: 2017 May 30  Resolved: 2012 Jul 16

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.0.2rc1
Fix Version/s: 2.0.2rc1, 2.1.0

Type: Incident report Priority: Major
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: proxy, sql
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

trunk rev 28795


Issue Links:
Duplicate

 Description   

Set "Discovery by proxy" to a proxy and try to delete the proxy:

You will see an error:

Error in query [DELETE FROM hosts WHERE (hostid IN ('10109')) ] [Cannot delete or update a parent row: a foreign key constraint fails (`zabbix`.`drules`, CONSTRAINT `c_drules_1` FOREIGN KEY (`proxy_hostid`) REFERENCES `hosts` (`hostid`))]
SQL statement execution has failed "DELETE FROM hosts WHERE (hostid IN ('10109')) " [CProxy.delete -> DB.delete]



 Comments   
Comment by Toms (Inactive) [ 2012 Jul 13 ]

Fixed in dev. branch: svn://svn.zabbix.com/branches/dev/ZBX-5311

Comment by Alexey Fukalov [ 2012 Jul 13 ]

(1)
Please review my changes in rev. 28856

<Toms> to big changes.

<Vedmak> All changes are related only to current bug.

<pavels> CLOSED.

Comment by Toms (Inactive) [ 2012 Jul 13 ]

(2) comment "cannot delete proxy if it is used in host" proxies are not used in hosts, rather hosts are assigned to proxies

<Vedmak> RESOLVED

<pavels> I've corrected the error messages a bit, please review r28945.

<Vedmak> CLOSED

Comment by Toms (Inactive) [ 2012 Jul 13 ]

(3) now CProxy.php it is really not clear when else in line 309 should happen

<Vedmak> It's almost same as before. To make it better there are needed 'big changes' but it's not related to this issue. RESOLVED

<pavels> CLOSED.

Comment by Toms (Inactive) [ 2012 Jul 13 ]

(4) With so large changes all 3 checks should be written by those standards which implies here. And also new guidelines should be taken into account. http://zabbix.org/wiki/Docs/specs/coding_style#Input_validation

<Vedmak> RESOLVED for delete action

<pavels> Please review my changes in r28945.

<Vedmak> CLOSED

Comment by Pavels Jelisejevs (Inactive) [ 2012 Jul 17 ]

Please review my changes in r28946 and (2), (4). If everything is ok, you can merge.

TESTED.

Comment by Alexey Fukalov [ 2012 Jul 17 ]

Fixed in pre-2.0.2rc1 r28947, pre-2.1.0rc1 r28948

Generated at Thu Apr 25 09:24:36 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.