Ignore duplicate entries when rebuilding the alert version table (#20579)
Stelios Fragkakis committed
Jun 30, 2025 at 16:17 UTC
1845d8ac7823cacc10fbbfb6b1495a90aeb92be8
1 file changed
+1
-1
src/database/sqlite/sqlite_aclk_alert.c
+1
-1
@@ -577,7 +577,7 @@ done:
577
}
578
579
#define SQL_REBUILD_HOST_ALERT_VERSION_TABLE \
580
- "INSERT INTO alert_version (health_log_id, unique_id, status, version, date_submitted) " \
580
+ "INSERT OR IGNORE INTO alert_version (health_log_id, unique_id, status, version, date_submitted) " \
581
" SELECT hl.health_log_id, hld.unique_id, hld.new_status, hld.when_key, UNIXEPOCH() " \
582
" FROM health_log hl, health_log_detail hld WHERE " \
583
" hl.host_id = @host_id AND hld.health_log_id = hl.health_log_id AND hld.transition_id = hl.last_transition_id"