Re: to suspend constraints

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Jowisz <jowisz(at)USUNTO(dot)rozanka(dot)wroc(dot)pl>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: to suspend constraints
Date: 2003-03-27 05:59:52
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Wed, 26 Mar 2003, Jowisz wrote:

> Does anyone knows, is there any possibility to turn off temporarily (to
> suspend) constraints checking? I couldn't find this in docs. Or maybe there
> isn't way to do things like this...

Not in any easy user-accessable way that I know of (apart from dropping a
constraint and re-adding it).

If you're willing to go through some moderately painful changing of system
tables, you can stop foreign keys (and all user defined triggers) by
setting reltriggers to 0 in pg_class, but you have to be careful to set it
back to the correct value. You can (at least in current sources) do
something similar for check constraints with relchecks AFAICS. NOT NULL
can be controlled with attnotnull in the pg_attribute row for the
particular attribute. I don't know of a reasonable way to turn off unique
(flipping indisunique in the pg_index row seems to not take effect
immediately if the index has been used in your session, and I'm really not
sure it's safe in any case).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lakshmi S. 2003-03-27 06:09:58 create type problem!
Previous Message Christopher Kings-Lynne 2003-03-27 01:55:34 Solution to UPDATE...INSERT problem