Skip to content

Commit 93be682

Browse files
committed
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.
1 parent 5454c89 commit 93be682

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/history_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,12 +435,12 @@ func testHistory(t *testing.T, numNodes int) {
435435

436436
assert.Equal(t, expected, got, "downtime history should match expected result")
437437
}, 5*time.Second, 200*time.Millisecond) {
438-
t.Logf("\n%s", utils.MustT(t).String(utils.PrettySelect(db,
438+
t.Logf("\n%s", utils.MustT(t).String(utils.PrettySelect(db, db.Rebind(
439439
"SELECT h.event_time, h.event_type FROM history h"+
440440
" JOIN host ON host.id = h.host_id"+
441441
" LEFT JOIN downtime_history d ON d.downtime_id = h.downtime_history_id"+
442442
" WHERE host.name = ?"+
443-
" ORDER BY h.event_time", hostname)))
443+
" ORDER BY h.event_time"), hostname)))
444444
}
445445

446446
testConsistency(t, stream)

0 commit comments

Comments
 (0)