mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
By introducing an explicit "AS" to set output names in the SELECT column list, there are no issues with reserved names. Unfortunately, this happened on PostgreSQL in the older version 13 with the reserved name "name". Adding "AS" mitigates this issue. Furthermore, I have put each column name in its own line for the SELECT queries to ease the readability of the query itself and of future diffs. Fixes #884.
18 lines
638 B
SQL
18 lines
638 B
SQL
SELECT
|
|
n.notification_id,
|
|
n.notification_reason,
|
|
UNIX_TIMESTAMP(n.end_time) AS end_time,
|
|
n.end_time_usec,
|
|
n.state,
|
|
COALESCE(n.output, '') AS output,
|
|
n.long_output,
|
|
n.contacts_notified,
|
|
o.objecttype_id,
|
|
o.name1,
|
|
COALESCE(o.name2, '') AS name2
|
|
FROM icinga_notifications n USE INDEX (PRIMARY)
|
|
INNER JOIN icinga_objects o ON o.object_id=n.object_id
|
|
WHERE n.notification_id BETWEEN :fromid AND :toid
|
|
AND n.notification_id <= :cache_limit AND n.notification_id > :checkpoint -- where we were interrupted
|
|
ORDER BY n.notification_id -- this way we know what has already been migrated from just the last row's ID
|
|
LIMIT :bulk
|