Attached documentation patch is intended to close-out the INSERT ...
ON CONFLICT documentation items from the 9.5 open item list. I also
attach a patch that makes a minor adjustment to an error message
concerning deferred constraints; the problem came to my attention as I
worked on the documentation patch (where the same minor inaccuracy is
corrected).
The documentation patch improves the generally readability of the
INSERT documentation, while fixing a number of minor errors. It also
adds a "Tip" box that explains that unique index inference should be
preferred over explicitly naming a constraint. Early signs are that
some users are naming constraints directly where that isn't necessary
at all, which seems bad because it gives up all the flexibility of
inference for no benefit. Inference is very forgiving in the event of
migrations where there may be multiple more-or-less equivalent unique
indexes, an edge-case that I worked hard to make inference handle
well. Inference also does the right thing with a partial unique index
and otherwise equivalent non-partial unique index -- one can imagine
that occurring when an application refines a business rule as part of
application refactoring. Naming a constraint directly was always
understood to be a kind of escape hatch, as I believe Heikki put it at
one point.
The docpatch also addresses limitations of INSERT ... ON CONFLICT with
partitioning based on table inheritance. These was some concern
expressed about this [1], which I also mean to address with the
documentation patch.
[1]
http://www.postgresql.org/message-id/flat/CAHGQGwFUCWwSU7dtc2aRdRk73ztyr_jY5cPOyts+K8xKJ92X4Q@mail.gmail.com#CAHGQGwFUCWwSU7dtc2aRdRk73ztyr_jY5cPOyts+K8xKJ92X4Q@mail.gmail.com
--
Peter Geoghegan