X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B184353578 for ; Wed, 30 Mar 2005 23:51:33 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77296-06 for ; Wed, 30 Mar 2005 22:51:27 +0000 (GMT) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id 691C652A37 for ; Wed, 30 Mar 2005 23:51:26 +0100 (BST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1DGm1s-0007Ww-00; Wed, 30 Mar 2005 17:51:16 -0500 To: Bruno Wolff III Cc: Michael Fuhr , frank@joerdens.de, pgsql-sql@postgresql.org Subject: Re: can you change an FK constraint from NOT DEFERRABLE to DEFERRABLE References: <20050330090732.GA10376@mail.archi-me-des.de> <20050330103311.GB10376@mail.archi-me-des.de> <20050330175232.GB17708@wolff.to> <20050330175242.GA36241@winnie.fuhr.org> <20050330190255.GA19669@wolff.to> In-Reply-To: <20050330190255.GA19669@wolff.to> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 30 Mar 2005 17:51:16 -0500 Message-ID: <87sm2cwxwb.fsf@stark.xeocode.com> Lines: 23 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/401 X-Sequence-Number: 20880 Bruno Wolff III writes: > It does look like you can only ADD and DROP constraints, not directly > alter or replace them. So making a reference deferable is go to require > a DROP and ADD which will need to recheck the constraint. I asked the same question a few days ago on pgsql-general. In short, if you want to skip the rechecking you have to update system tables directly and you have to do two of them. The updates you want would look something like these. But these would do *all* your constraints, make sure to get only the ones you really want to change: update pg_constraint set condeferrable = 't' where contype = 'f' update pg_trigger set tgdeferrable=true where tgisconstraint = true I think an ALTER CONSTRAINT to change these settings as well as the ON {UPDATE,DELETE} behaviour would be neat. -- greg