X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 20C15D1E9BC for ; Mon, 22 Mar 2004 21:23:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 71539-10 for ; Mon, 22 Mar 2004 17:23:14 -0400 (AST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.189]) by svr1.postgresql.org (Postfix) with ESMTP id B42F9D1E9B0 for ; Mon, 22 Mar 2004 17:23:02 -0400 (AST) Received: from [212.227.126.207] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1B5SB1-0007Yb-00; Mon, 22 Mar 2004 17:21:23 +0100 Received: from [80.131.212.119] (helo=goofy.thiele-intern) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1B5SB0-0005wp-00; Mon, 22 Mar 2004 17:21:22 +0100 Date: Mon, 22 Mar 2004 17:21:21 +0100 From: Erik Thiele To: Bruno Wolff III Cc: pgsql-sql@postgresql.org Subject: Re: special integrity constraints Message-Id: <20040322172121.72ecf58b.erik@thiele-hydraulik.de> In-Reply-To: <20040322151211.GA2962@wolff.to> References: <20040322102031.6a6f0b77.erik@thiele-hydraulik.de> <20040322112604.GA31222@wolff.to> <20040322141042.0aeb936d.erik@thiele-hydraulik.de> <20040322151211.GA2962@wolff.to> Organization: Thiele-Hydraulik X-Mailer: Sylpheed version 0.9.7 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:323d4a9045def897d7bf2e2f3ae17486 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/224 X-Sequence-Number: 17323 On Mon, 22 Mar 2004 09:12:11 -0600 Bruno Wolff III wrote: > On Mon, Mar 22, 2004 at 14:10:42 +0100, > Erik Thiele wrote: > > > > it means (((count_rows(a)+count_rows(b)) modulo 2) == 0) > > OK, that means my FK suggestion won't help. The other suggestion about > putting triggers on "a" and "b" to update a count in another table > that has a deferred check constraint on it may be your best bet. > This will be a source of contention, but that may or may not be all > that important depending on how often you are updating "a" and "b". > there is no such thing as a deferred check constraint: DEFERRABLE NOT DEFERRABLE This controls whether the constraint can be deferred. A constraint that is not deferrable will be checked immediately after every command. Checking of constraints that are deferrable may be postponed until the end of the transaction (using the SET CONSTRAINTS command). NOT DEFERRABLE is the default. !!! Only foreign key constraints currently accept this clause. All other constraint types are not deferrable. !!! cu erik -- Erik Thiele