diff --git a/postgres/postgres.go b/postgres/postgres.go index bb88a6bb..b44ac67a 100644 --- a/postgres/postgres.go +++ b/postgres/postgres.go @@ -98,7 +98,7 @@ func New(config ...Config) *Storage { db: db, gcInterval: cfg.GCInterval, sqlSelect: fmt.Sprintf(`SELECT v, e FROM %s WHERE k=$1;`, cfg.Table), - sqlInsert: fmt.Sprintf("INSERT INTO %s (k, v, e) VALUES ($1, $2, $3) ON CONFLICT (id) DO UPDATE SET v = $4, e = $5", cfg.Table), + sqlInsert: fmt.Sprintf("INSERT INTO %s (k, v, e) VALUES ($1, $2, $3) ON CONFLICT (k) DO UPDATE SET v = $4, e = $5", cfg.Table), sqlDelete: fmt.Sprintf("DELETE FROM %s WHERE k=$1", cfg.Table), sqlClear: fmt.Sprintf("DELETE FROM %s;", cfg.Table), sqlGC: fmt.Sprintf("DELETE FROM %s WHERE e <= $1", cfg.Table),