Re: Deferred RI trigger for non-key UPDATEs and subxacts

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Affan Salman" <affan(at)enterprisedb(dot)com>, <pgsql-patches(at)postgresql(dot)org>, "Stephan Szabo" <sszabo(at)megazone(dot)bigpanda(dot)com>
Subject: Re: Deferred RI trigger for non-key UPDATEs and subxacts
Date: 2007-07-16 10:48:24
Message-ID: 87odicfwuf.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


"Gregory Stark" <stark(at)enterprisedb(dot)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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Stefan Kaltenbrunner 2007-07-16 11:11:18 bogus unixware compiler warnings
Previous Message NikhilS 2007-07-16 10:20:09 Re: CREATE TABLE LIKE INCLUDING INDEXES support