~emersion/soju-dev

pg: handle both constraints on network updates v1 SUPERSEDED

Hubert Hirtz: 1
 pg: handle both constraints on network updates

 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/25667/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] pg: handle both constraints on network updates Export this patch

---
 db_postgres.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/db_postgres.go b/db_postgres.go
index fba7496..0437a68 100644
--- a/db_postgres.go
+++ b/db_postgres.go
@@ -283,7 +283,7 @@ func (db *PostgresDB) StoreNetwork(userID int64, network *Network) error {
		                    sasl_mechanism, sasl_plain_username, sasl_plain_password, sasl_external_cert,
		                    sasl_external_key, enabled)
		VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)
		ON CONFLICT ("user", name)
		ON CONFLICT
		DO UPDATE SET name = $2, addr = $3, nick = $4, username = $5, realname = $6, pass = $7,
		              connect_commands = $8, sasl_mechanism = $9, sasl_plain_username = $10,
		              sasl_plain_password = $11, sasl_external_cert = $12, sasl_external_key = $13,
-- 
2.33.0
Thanks for the patch! Although it seems PostgreSQL isn't happy with
that (the tests are proving useful already!):

    --- FAIL: TestServer/postgres (0.07s)
        server_test.go:72: failed to store test network: pq: ON CONFLICT DO UPDATE requires inference specification or constraint name