"Lodewijk Voege" <lvoege@gmail.com> writes:
> I hacked up a patch that handles these two cases:
> - for such an INSERT/SELECT, check constant FKs only once.
This sounds like a clever idea. It seems the abstraction violation is worth it
to me.
> - for an INSERT/SELECT from/to the same table, don't check FKs that are
> carried over as is at all. (it'd be nice to extend this to fields that
> have the same FK constraint, rather than the current patch' strict
> same-table, same-field condition)
I'm not sure this is safe. It means you're not locking the target row. If
someone else comes along and deletes both the original source record and the
target record before you've gotten around to inserting the new record...
-- Gregory Stark EnterpriseDB http://www.enterprisedb.com