From cc83da4cd1e9ffae1cd679c3edeb8c5b922855e0 Mon Sep 17 00:00:00 2001 From: Alexey Yerin Date: Mon, 26 Apr 2021 23:24:25 +0300 Subject: [PATCH] db: match placeholders with columns Soju inserts 9 columns but only with 8 placeholders. This causes channels not being saved properly and also logging errors like this: downstream ...: failed to create or update channel ...: 8 values for 9 columns --- db.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db.go b/db.go index 4147a7c..608e599 100644 --- a/db.go +++ b/db.go @@ -596,7 +596,7 @@ func (db *DB) StoreChannel(networkID int64, ch *Channel) error { } else { var res sql.Result res, err = db.db.Exec(`INSERT INTO Channel(network, name, key, detached, detached_internal_msgid, relay_detached, reattach_on, detach_after, detach_on) - VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`, networkID, ch.Name, key, ch.Detached, toNullString(ch.DetachedInternalMsgID), ch.RelayDetached, ch.ReattachOn, detachAfter, ch.DetachOn) if err != nil { return err