From 1e7cd8c484b598e71df0f491fc7e12722b66bf39 Mon Sep 17 00:00:00 2001 From: Jake Sanders Date: Wed, 8 Apr 2020 23:52:35 +0100 Subject: [PATCH] Make the constraint explicit rather than inferred (#1506) --- store/cockroach/cockroach.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/store/cockroach/cockroach.go b/store/cockroach/cockroach.go index 4aa68ac5..47038639 100644 --- a/store/cockroach/cockroach.go +++ b/store/cockroach/cockroach.go @@ -277,9 +277,9 @@ func (s *sqlStore) initDB() error { s.readOffset = readOffset write, err := s.db.Prepare(fmt.Sprintf(`INSERT INTO %s.%s(key, value, expiry) VALUES ($1, $2::bytea, $3) - ON CONFLICT (key) + ON CONFLICT ON CONSTRAINT %s_pkey DO UPDATE - SET value = EXCLUDED.value, expiry = EXCLUDED.expiry;`, s.database, s.table)) + SET value = EXCLUDED.value, expiry = EXCLUDED.expiry;`, s.database, s.table, s.table)) if err != nil { return errors.Wrap(err, "Write statement couldn't be prepared") }