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 C3EBBD1D8A5 for ; Mon, 22 Mar 2004 10:27:01 +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 32670-03 for ; Mon, 22 Mar 2004 06:27:06 -0400 (AST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.173]) by svr1.postgresql.org (Postfix) with ESMTP id 9309ED1C4EB for ; Mon, 22 Mar 2004 06:26:58 -0400 (AST) Received: from [212.227.126.161] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1B5Me4-0003jL-00; Mon, 22 Mar 2004 11:27:00 +0100 Received: from [80.131.212.119] (helo=goofy.thiele-intern) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1B5Me3-00062U-00; Mon, 22 Mar 2004 11:27:00 +0100 Date: Mon, 22 Mar 2004 11:26:59 +0100 From: Erik Thiele To: Achilleus Mantzios Cc: pgsql-sql@postgresql.org Subject: Re: special integrity constraints Message-Id: <20040322112659.4553df76.erik@thiele-hydraulik.de> In-Reply-To: References: <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=ISO-8859-15 Content-Transfer-Encoding: quoted-printable X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:323d4a9045def897d7bf2e2f3ae17486 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/211 X-Sequence-Number: 17310 On Mon, 22 Mar 2004 12:13:29 +0200 (EET) Achilleus Mantzios wrote: > O kyrios Erik Thiele egrapse stis Mar 22, 2004 : >=20 > Did you check out the DEFERRABLE option on the constraint? >=20 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.=20 !!!! Only foreign key constraints currently accept this clause. All other constraint types are not deferrable. !!!! my constraint is not a foreign key constraint.... cya! erik > > hi, > >=20 > > i have two tables > >=20 > > create table a (x integer); > > create table b (y real); > >=20 > > 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. > >=20 > > so there is a posibility of adding one element to a and one element > > to b, and again the constraint is met. > >=20 > > 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. > >=20 > > so i cannot use a trigger. > >=20 > > what i need is the execution of a check procedure at commit time. is > > that somehow possible? > >=20 > > 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. > >=20 > > 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. > >=20 > >=20 > > cu > > Erik > >=20 > >=20 > >=20 >=20 > --=20 > -Achilleus >=20 --=20 Erik Thiele Horst Thiele Maschinenbau-Hydraulische Ger=E4te GmbH Im Kampfrad 2 - 74196 Neuenstadt Tel.: 07139/4801-19 Fax.: 07139/4801-29 email: erik@thiele-hydraulik.de Internet: http://www.thiele-hydraulik.de/