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 955ACD1D6CC for ; Mon, 22 Mar 2004 09:20:29 +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 10358-05 for ; Mon, 22 Mar 2004 05:20:34 -0400 (AST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.173]) by svr1.postgresql.org (Postfix) with ESMTP id B8876D1D38B for ; Mon, 22 Mar 2004 05:20:25 -0400 (AST) Received: from [212.227.126.161] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1B5Lbl-0000sZ-00 for pgsql-sql@postgresql.org; Mon, 22 Mar 2004 10:20:33 +0100 Received: from [80.131.212.119] (helo=goofy.thiele-intern) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1B5Lbk-0000AL-00 for pgsql-sql@postgresql.org; Mon, 22 Mar 2004 10:20:32 +0100 Date: Mon, 22 Mar 2004 10:20:31 +0100 From: Erik Thiele To: pgsql-sql@postgresql.org Subject: special integrity constraints Message-Id: <20040322102031.6a6f0b77.erik@thiele-hydraulik.de> 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/209 X-Sequence-Number: 17308 hi, i have two tables create table a (x integer); create table b (y real); i have the special constraint that the sum of the number of rows in table a plus the number of rows in table b must be even. so there is a posibility of adding one element to a and one element to b, and again the constraint is met. but this of course does not work, since between adding the element to a and adding the element to b, the constraint is not met. so i cannot use a trigger. what i need is the execution of a check procedure at commit time. is that somehow possible? my database has much more tables than just a and b, and most time the other tables are modified and not a or b, so it would be nice to execute the constraint checking procedure only if a or b was modified. yes :) this question i asked in my former mail too, but I think it looked like there was a workaround and my problem was wrong. so i created this new kind of problem here to make things clearer. cu Erik -- Erik Thiele