Robert Haas <robertmhaas@gmail.com> wrote:
>And if, in the meantime, MERGE can only handle the cases where there
>is a unique index, then it can only handle the cases INSERT .. ON
>CONFLICT UPDATE can cover, which makes it, as far as I can see,
>syntactic sugar over what we already have. Maybe it's not entirely -
>you might be planning to make some minor functional enhancements - but
>it's not clear what those are, and I feel like whatever it is could be
>done with less work and more elegance by just extending the INSERT ..
>ON CONFLICT UPDATE syntax.
+1
Marko Tiikkaja's INSERT ... ON CONFLICT SELECT patch, which is in the
current CF [1], moves things in this direction. I myself have
occasionally wondered if it was worth adding an alternative DO DELETE
conflict_action. This could appear alongside DO UPDATE, and be applied
using MERGE-style conditions.
All of these things seem like small adjuncts to ON CONFLICT because
they're all just an alternative way of modifying or projecting the tuple
that is locked by ON CONFLICT. Everything new would have to happen after
the novel ON CONFLICT handling has already completed.
The only reason that I haven't pursued this is because it doesn't seem
that compelling. I mention it now because It's worth acknowledging that
ON CONFLICT could be pushed a bit further in this direction. Of course,
this still falls far short of making ON CONFLICT entirely like MERGE.
[1] https://commitfest.postgresql.org/15/1241/
--
Peter Geoghegan
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers