Make the constraint explicit rather than inferred (#1506)
This commit is contained in:
parent
bf8ebf8ad2
commit
1e7cd8c484
@ -277,9 +277,9 @@ func (s *sqlStore) initDB() error {
|
|||||||
s.readOffset = readOffset
|
s.readOffset = readOffset
|
||||||
write, err := s.db.Prepare(fmt.Sprintf(`INSERT INTO %s.%s(key, value, expiry)
|
write, err := s.db.Prepare(fmt.Sprintf(`INSERT INTO %s.%s(key, value, expiry)
|
||||||
VALUES ($1, $2::bytea, $3)
|
VALUES ($1, $2::bytea, $3)
|
||||||
ON CONFLICT (key)
|
ON CONFLICT ON CONSTRAINT %s_pkey
|
||||||
DO UPDATE
|
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 {
|
if err != nil {
|
||||||
return errors.Wrap(err, "Write statement couldn't be prepared")
|
return errors.Wrap(err, "Write statement couldn't be prepared")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user