Is there an easy way in postgres to do the equivalent of the following in sqlite?
INSERT INTO foo (x, y, z) VALUES (1, 2, 3) ON CONFLICT replace;
I looked around, and the solutions I found are complex user-defined functions. Another solution to my problem is just to make
delete from foo where x=1; INSERT INTO foo (x, y, z) VALUES (1, 2, 3) ON CONFLICT replace;
which is not semantically equivalent, but works for my case.
I would prefer a rule ON CONFLICTif it does not require a special function.
source
share