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 4AD97D1DCA5 for ; Mon, 22 Mar 2004 16:25:45 +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 75076-08 for ; Mon, 22 Mar 2004 12:25:52 -0400 (AST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.173]) by svr1.postgresql.org (Postfix) with ESMTP id 9B3AFD1DC24 for ; Mon, 22 Mar 2004 12:25:42 -0400 (AST) Received: from [212.227.126.209] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1B5SFF-0004tO-00; Mon, 22 Mar 2004 17:25:45 +0100 Received: from [80.131.212.119] (helo=goofy.thiele-intern) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1B5SFF-00038z-00; Mon, 22 Mar 2004 17:25:45 +0100 Date: Mon, 22 Mar 2004 17:25:44 +0100 From: Erik Thiele To: Stephan Szabo Cc: achill@matrix.gatewaynet.com, pgsql-sql@postgresql.org Subject: Re: special integrity constraints Message-Id: <20040322172544.0a9b34d4.erik@thiele-hydraulik.de> In-Reply-To: <20040322061854.W56073@megazone.bigpanda.com> References: <20040322102031.6a6f0b77.erik@thiele-hydraulik.de> <20040322112659.4553df76.erik@thiele-hydraulik.de> <20040322061854.W56073@megazone.bigpanda.com> 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/222 X-Sequence-Number: 17321 On Mon, 22 Mar 2004 06:21:28 -0800 (PST) Stephan Szabo wrote: > > On Mon, 22 Mar 2004, Erik Thiele wrote: > > > On Mon, 22 Mar 2004 12:13:29 +0200 (EET) > > Achilleus Mantzios wrote: > > > > > O kyrios Erik Thiele egrapse stis Mar 22, 2004 : > > > > > > Did you check out the DEFERRABLE option on the 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. !!!! > > > > my constraint is not a foreign key constraint.... > > However, foreign keys are implemented using "constraint triggers". They're > really not documented much (because they're a not really separately > supported implementation detail), but you can theoretically make > triggers that are deferred to immediately before commit time. could you paste some code? create table a (x integer); create or replace function alwaysfail() returns opaque as ' begin raise exception ''no no i dont want to''; end; ' language 'plpgsql'; MAGIC COMMAND INSERT HERE, INSTALL CALL OF alwaysfail() ON MODIFICATION OF TABLE a AT COMMIT TIME; begin transaction; insert into a values(4); (ok) insert into a values(10); (ok) commit; (no no i dont want to) is that possible? cu erik -- Erik Thiele