Re: getting all constraint violations - Mailing list pgsql-general

From Tom Lane
Subject Re: getting all constraint violations
Date
Msg-id 22452.1274469022@sss.pgh.pa.us
Whole thread Raw
In response to Re: getting all constraint violations  ("Gauthier, Dave" <dave.gauthier@intel.com>)
Responses Re: getting all constraint violations  ("Gauthier, Dave" <dave.gauthier@intel.com>)
List pgsql-general
"Gauthier, Dave" <dave.gauthier@intel.com> writes:
> Is there a way to temporarily suspend constraint checking for a particular constraint inside of the transaction, try
theinsert again, capture the next violation, then the next, etc... then rollback after all have been collected? 

You could do something like

    BEGIN;
    ALTER TABLE DROP CONSTRAINT ...
    INSERT ...
    ROLLBACK;

The major deficiency of this is that the ALTER TABLE would grab
exclusive lock on the table, so this doesn't scale if you need to
have several insertions happening in parallel.

            regards, tom lane

pgsql-general by date:

Previous
From: Richard Broersma
Date:
Subject: Re: getting all constraint violations
Next
From: "Gauthier, Dave"
Date:
Subject: Re: getting all constraint violations