historian: Remove DATETIME conversion and add timestamp to grouping

Postgres requires the HAVING statement to match a GROUP BY statement and the
DATETIME function doesn't exist on postgres.
This commit is contained in:
Christian Decker
2020-10-27 15:32:01 +01:00
parent 91f7eafabb
commit 3daa588be0

View File

@@ -117,7 +117,7 @@ WHERE
FROM
channel_updates u
WHERE
u.timestamp >= DATETIME('{}')
u.timestamp >= '{}'
GROUP BY
u.scid
)
@@ -159,9 +159,10 @@ SELECT
FROM
node_announcements n
WHERE
n.timestamp >= DATETIME('{}')
n.timestamp >= '{}'
GROUP BY
n.node_id
n.node_id,
n.timestamp
HAVING
n.timestamp = MAX(n.timestamp)
ORDER BY timestamp DESC