Simon Riggs <simon@2ndQuadrant.com> writes:
> Another thing that has occurred to me is that RI checks are currently
> resolved at end of statement and could end up rejecting any/all rows
> loaded. If we break down the load into subtransaction pieces we would
> really want the RI checks on the rows to be performed during the
> subtransaction that makes them. The good thing about that is that it
> would lend itself to holding successful checks in a hash table to allow
> a fast path optimization of continual re-checks of same values.
If we did that it would guarantee that cases like self-referential RI
would fail. (Think parent-child links in a tree, for example.)
I see the point about wishing that such checks would be part of the
per-row error handling, but we can't just unconditionally do things
that way.
regards, tom lane