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've looked around and the solutions I've found are complicated custom functions. The other solution to my problem is to just do
delete from foo where x=1; INSERT INTO foo (x, y, z) VALUES (1, 2, 3) ON CONFLICT replace;
which isn't semantically equivalent but works for my case.
I'd just prefer the ON CONFLICT
rule if it doesn't require a custom function.