Re: how to temporally disable foreign key constraint check

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: emilu(at)encs(dot)concordia(dot)ca
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: how to temporally disable foreign key constraint check
Date: 2011-10-21 23:51:27
Message-ID: 4EA2057F.3000002@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 10/21/2011 09:36 PM, Emi Lu wrote:
> Good morning,
>
>
> Is there a way to temporally disabled foreign key constraints something
> like
>
> SET FOREIGN_KEY_CHECKS=0
>
> When population is done, will set FOREIGN_KEY_CHECKS=1

If you really, really want to do this you can do it by disabling the
triggers that enforce the checks on particular tables. This must be done
table-by-table, there's no global way to do it.

Use ALTER TABLE ... DISABLE TRIGGER to do it. See:

http://www.postgresql.org/docs/current/static/sql-altertable.html

--
Craig Ringer

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Linos 2011-10-22 10:41:31 advice on how to store variable attributes
Previous Message Thomas Kellerer 2011-10-21 17:04:14 Re: how to temporally disable foreign key constraint check