Don't try to affect rows when adding items for postgres-stream
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2021-05-13 23:22:28 +02:00
parent 76edad3e8d
commit 9267535f9c
Signed by: peter
GPG Key ID: 374322D56E5209E8

View File

@ -207,7 +207,7 @@ func (p *postgresStream) AddItem(item microsub.Item) (bool, error) {
result, err := conn.ExecContext(context.Background(), ` result, err := conn.ExecContext(context.Background(), `
INSERT INTO "items" ("channel_id", "uid", "data", "published_at", "created_at") INSERT INTO "items" ("channel_id", "uid", "data", "published_at", "created_at")
VALUES ($1, $2, $3, $4, DEFAULT) VALUES ($1, $2, $3, $4, DEFAULT)
ON CONFLICT ON CONSTRAINT "items_uid_key" DO UPDATE SET "updated_at" = now() ON CONFLICT ON CONSTRAINT "items_uid_key" DO NOTHING
`, p.channelID, item.ID, &item, t) `, p.channelID, item.ID, &item, t)
if err != nil { if err != nil {
return false, fmt.Errorf("while adding item: %w", err) return false, fmt.Errorf("while adding item: %w", err)