From 93be68242cee5e1da701020894e6277591223212 Mon Sep 17 00:00:00 2001 From: Alvar Penning Date: Tue, 17 Dec 2024 11:46:06 +0100 Subject: [PATCH] test: Rebind Log Output Query for PostgreSQL While debugging a totally unrelated issue, I stumbled over the following PostgreSQL output: > [97] ERROR: syntax error at or near "ORDER" at character 173 > [97] STATEMENT: SELECT h.event_time, h.event_type FROM history h > JOIN host ON host.id = h.host_id > LEFT JOIN downtime_history d ON d.downtime_id = h.downtime_history_id > WHERE host.name = ? > ORDER BY h.event_time The relevant code misses a db.Rebind as the "?" character is for MySQL. --- tests/history_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/history_test.go b/tests/history_test.go index 8590bc3f8..25b50b335 100644 --- a/tests/history_test.go +++ b/tests/history_test.go @@ -435,12 +435,12 @@ func testHistory(t *testing.T, numNodes int) { assert.Equal(t, expected, got, "downtime history should match expected result") }, 5*time.Second, 200*time.Millisecond) { - t.Logf("\n%s", utils.MustT(t).String(utils.PrettySelect(db, + t.Logf("\n%s", utils.MustT(t).String(utils.PrettySelect(db, db.Rebind( "SELECT h.event_time, h.event_type FROM history h"+ " JOIN host ON host.id = h.host_id"+ " LEFT JOIN downtime_history d ON d.downtime_id = h.downtime_history_id"+ " WHERE host.name = ?"+ - " ORDER BY h.event_time", hostname))) + " ORDER BY h.event_time"), hostname))) } testConsistency(t, stream)