Skip to content
RED SAG Skills
medium10 pts · first answer countsindexingsql

ON CONFLICT needs a unique index

INSERT INTO stock (sku, qty) VALUES ($1, $2) ON CONFLICT (sku) DO UPDATE SET qty = stock.qty + EXCLUDED.qty fails with "there is no unique or exclusion constraint matching the ON CONFLICT specification". What is missing?

Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions