OpenNMS/opennms — pull request #130 by greem (2014-10-10 11:24:40+00:00)
Title: Removed extraneous closing parenthesis

With it, the delete barfed:

DELETE
FROM events
WHERE NOT EXISTS (
SELECT svclosteventid
FROM outages
WHERE svclosteventid = events.eventid
UNION
SELECT svcregainedeventid
FROM outages
WHERE svcregainedeventid = events.eventid
UNION
SELECT eventid
FROM notifications
WHERE eventid = events.eventid)
AND eventtime < now() - interval '6 weeks');
ERROR: syntax error at or near ")"
LINE 15: AND eventtime < now() - interval '6 weeks');
^