~emersion/soju-dev

fix postgres/StoreNetwork positional arguments v1 APPLIED

sentriz: 1
 fix postgres/StoreNetwork positional arguments

 1 files changed, 1 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/soju-dev/patches/39123/mbox | git am -3
Learn more about email & git

[PATCH] fix postgres/StoreNetwork positional arguments Export this patch

---
hi! when updating a network i was getting this error:

    [728] ERROR:  inconsistent types deduced for parameter $14 at character 290
    [728] DETAIL:  bytea versus boolean
    [728] STATEMENT:  
        UPDATE "Network"
        SET name = $2, addr = $3, nick = $4, username = $5, realname = $6, certfp = $7, pass = $8,
                connect_commands = $9, sasl_mechanism = $10, sasl_plain_username = $11,
                sasl_plain_password = $12, sasl_external_cert = $13, sasl_external_key = $14,
                auto_away = $14, enabled = $15
        WHERE id = $1

it looks like in the postgres StoreNetwork query we have arg $14 listed twice. 
this patch fixes that and is working for me so far. thanks!

 database/postgres.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/database/postgres.go b/database/postgres.go
index 6faa695..e18cc05 100644
--- a/database/postgres.go
+++ b/database/postgres.go
@@ -574,7 +574,7 @@ func (db *PostgresDB) StoreNetwork(ctx context.Context, userID int64, network *N
			SET name = $2, addr = $3, nick = $4, username = $5, realname = $6, certfp = $7, pass = $8,
				connect_commands = $9, sasl_mechanism = $10, sasl_plain_username = $11,
				sasl_plain_password = $12, sasl_external_cert = $13, sasl_external_key = $14,
				auto_away = $14, enabled = $15
				auto_away = $15, enabled = $16
			WHERE id = $1`,
			network.ID, netName, network.Addr, nick, netUsername, realname, certfp, pass, connectCommands,
			saslMechanism, saslPlainUsername, saslPlainPassword, network.SASL.External.CertBlob,
-- 
2.39.2
Pushed, thanks!