Re: Deferred RI trigger for non-key UPDATEs and subxacts - Mailing list pgsql-patches

From Gregory Stark
Subject Re: Deferred RI trigger for non-key UPDATEs and subxacts
Date
Msg-id 87odicfwuf.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Deferred RI trigger for non-key UPDATEs and subxacts  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-patches
"Gregory Stark" <stark@enterprisedb.com> writes:

> On the other hand what happens if you have constraints not deferred, insert a
> record, then set constraints deferred and update it?

After having a coffee this is obviously not a problem since if you have
constraints not deferred then the constraint was checked immediately. We don't
have to do the constraint in that case even if the row was inserted by us but
that's an optimization that probably nobody cares about.

If you go the other direction from deferred to not deferred then the
constraint will be checked when you set the constraint to immediate so it's
safe to skip the constraint check if the keys match subsequently regardless of
whether we inserted the record.

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com


pgsql-patches by date:

Previous
From: NikhilS
Date:
Subject: Re: CREATE TABLE LIKE INCLUDING INDEXES support
Next
From: Stefan Kaltenbrunner
Date:
Subject: bogus unixware compiler warnings