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 E7978D1EBBE for ; Mon, 22 Mar 2004 15:09: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 38447-10 for ; Mon, 22 Mar 2004 11:09:14 -0400 (AST) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id A0942D1EAFD for ; Mon, 22 Mar 2004 11:09:04 -0400 (AST) Received: (qmail 3023 invoked by uid 500); 22 Mar 2004 15:12:11 -0000 Date: Mon, 22 Mar 2004 09:12:11 -0600 From: Bruno Wolff III To: Erik Thiele Cc: pgsql-sql@postgresql.org Subject: Re: special integrity constraints Message-ID: <20040322151211.GA2962@wolff.to> Mail-Followup-To: Erik Thiele , pgsql-sql@postgresql.org References: <20040322102031.6a6f0b77.erik@thiele-hydraulik.de> <20040322112604.GA31222@wolff.to> <20040322141042.0aeb936d.erik@thiele-hydraulik.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040322141042.0aeb936d.erik@thiele-hydraulik.de> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/219 X-Sequence-Number: 17318 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".