pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <ringerc@ringerc.id.au>
To: emilu@encs.concordia.ca
Cc: pgsql-sql@postgresql.org
Subject: Re: how to temporally disable foreign key constraint check
Date: Sat, 22 Oct 2011 07:51:27 +0800
Message-ID: <4EA2057F.3000002@ringerc.id.au> (raw)
In-Reply-To: <4EA17562.4030202@encs.concordia.ca>
References: <4EA17562.4030202@encs.concordia.ca>

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




view thread (5+ messages)

Message-ID: <4EA2057F.3000002@ringerc.id.au>
Permalink:  ../4EA2057F.3000002@ringerc.id.au/
Also on:    postgresql.org/message-id/4EA2057F.3000002@ringerc.id.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ringerc@ringerc.id.au, emilu@encs.concordia.ca
  Subject: Re: how to temporally disable foreign key constraint check
  In-Reply-To: <4EA2057F.3000002@ringerc.id.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox