Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 32897B5DBD0 for ; Fri, 21 Oct 2011 12:47:29 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 27561-08 for ; Fri, 21 Oct 2011 15:47:22 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from oldperseverance.encs.concordia.ca (oldperseverance.encs.concordia.ca [132.205.96.94]) by mail.postgresql.org (Postfix) with ESMTP id B5705B5DBCE for ; Fri, 21 Oct 2011 12:47:22 -0300 (ADT) Received: from cacao.encs.concordia.ca (emilu@cacao.encs.concordia.ca [132.205.47.225]) by oldperseverance.encs.concordia.ca (envelope-from emilu@encs.concordia.ca) (8.13.7/8.13.7) with ESMTP id p9LFlJeG029621; Fri, 21 Oct 2011 11:47:19 -0400 Message-ID: <4EA19407.5080208@encs.concordia.ca> Date: Fri, 21 Oct 2011 11:47:19 -0400 From: Emi Lu Reply-To: emilu@encs.concordia.ca User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20101125 Lightning/1.0b1 Thunderbird/3.0.11 MIME-Version: 1.0 To: "Oliveiros d'Azevedo Cristina" CC: pgsql-sql@postgresql.org Subject: Re: how to temporally disable foreign key constraint check References: <4EA17562.4030202@encs.concordia.ca> <49712385AAF34516B1CA6890916206DE@marktestcr.marktest.pt> In-Reply-To: <49712385AAF34516B1CA6890916206DE@marktestcr.marktest.pt> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.58 on oldperseverance.encs.concordia.ca at 2011/10/21 11:47:19 EDT X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201110/46 X-Sequence-Number: 35930 Not really, sorry :( What I am looking for is no DB structure changes. But only disabling foreign key constraint check/verify for period of time and then recover it. Similar to mysql's "set FOREIGN_KEY_CHECKS = true/false" Emi On 10/21/2011 10:58 AM, Oliveiros d'Azevedo Cristina wrote: > Something like > > ALTER TABLE t_yourtable DROP CONSTRAINT > and then > ALTER TABLE t_yourtable ADD FOREIGN KEY > ? > > Best, > Oliveiros > > ----- Original Message ----- From: "Emi Lu" > To: > Sent: Friday, October 21, 2011 2:36 PM > Subject: [SQL] how to temporally disable foreign key constraint check > > >> 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 >> >> Thanks a lot! >> Emi >> >> -- >> Emi Lu, ENCS, Concordia University, Montreal H3G 1M8 >> emilu@encs.concordia.ca +1 514 848-2424 x5884 >> >> -- >> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) >> To make changes to your subscription: >> http://www.postgresql.org/mailpref/pgsql-sql -- Emi Lu, ENCS, Concordia University, Montreal H3G 1M8 emilu@encs.concordia.ca +1 514 848-2424 x5884