INSERT ... ON CONFLICT documentation clean-up patch

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: INSERT ... ON CONFLICT documentation clean-up patch
Date: 2015-10-12 00:54:24
Message-ID: CAM3SWZScpWzQ-7EJC77vwqzZ1GO8GNmURQ1QqDQ3wRn7AbW1Cg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)mail(dot)gmail(dot)com#CAHGQGwFUCWwSU7dtc2aRdRk73ztyr_jY5cPOyts+K8xKJ92X4Q@mail.gmail.com
--
Peter Geoghegan

Attachment Content-Type Size
0002-Minor-copy-editing-of-INSERT-documentation.patch text/x-patch 9.3 KB
0001-Adjust-deferrable-constraints-error-message.patch text/x-patch 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-10-12 01:30:24 Re: Release of CVEs
Previous Message Noah Misch 2015-10-11 23:56:18 Re: Parallel Seq Scan