On Fri, Apr 24, 2015 at 6:38 AM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
> I wrote a little overview text on how unique and exclusion constraints are
> enforced. Most of the information can be gleaned from comments elsewhere,
> but I think it's helpful to have it in one place. Makes it easier to compare
> how unique and exclusion constraints work. The harmless deadlocks with
> exclusion constraints are not explained elsewhere AFAICS.
FWIW, both Jeff Davis and Tom Lane were well aware of this issue back
when exclusion constraints went in - it was judged to be acceptable at
the time, which I agree with. I happened to discuss this with Jeff in
New York recently. I agree that it should definitely be documented
like this (and the fact that ordinary unique indexes are unaffected,
too).
> This is also in preparation for Peter's INSERT ON CONFLICT patch. That will
> add another section explaining how the deadlocks and livelocks are avoided.
> That's easier to understand after you grok the potential for deadlocks with
> exclusion constraints.
Makes sense.
> This also removes a comment from 1989 claiming that the code should be moved
> elsewhere. I think the code is in the right place.
+1
--
Peter Geoghegan