Re: Deferrable constraint checking with SAVEPOINT?

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Mike Toews <mwtoews(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Deferrable constraint checking with SAVEPOINT?
Date: 2010-06-08 08:04:35
Message-ID: AANLkTim1DABePGnpfPrSeDOlF9afwSaC9KxZxsfNzm-d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8 June 2010 03:02, Mike Toews <mwtoews(at)gmail(dot)com> wrote:
> Hi,
>
> I have a question that is not specified in the docs[1]. I am using
> deferrable constraints in a transaction with SET CONSTRAINTS ALL
> DEFERRED. Now I know that DEFERRED constraints are not checked until
> transaction COMMIT (i.e., the end), however are they checked with
> SAVEPOINT (i.e., part-way in)?
>

No, SAVEPOINTs will not force a check. A SAVEPOINT is nothing like a
COMMIT (it's more like a nested BEGIN). The only things that will
cause deferred constraints to be checked are a COMMIT or a SET
CONSTRAINTS .. IMMEDIATE.

Regards,
Dean

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Gage 2010-06-08 09:04:07 Cognitive dissonance
Previous Message Tom Lane 2010-06-08 03:54:09 Re: What's the best type of index for an ENUM column?