X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5891E32AF80 for ; Wed, 20 Oct 2004 16:58:29 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04314-02 for ; Wed, 20 Oct 2004 15:58:22 +0000 (GMT) Received: from web11.manitu.net (web11.manitu.net [217.11.48.111]) by svr1.postgresql.org (Postfix) with ESMTP id 7AB3032A173 for ; Wed, 20 Oct 2004 16:58:21 +0100 (BST) Received: from [62.165.4.166] (dicaprio.akademie1.de [62.165.4.166]) (authenticated) by web11.manitu.net (8.10.2-SOL3/8.10.2) with ESMTP id i9KFwHw03054 for ; Wed, 20 Oct 2004 17:58:18 +0200 Subject: time of constraint checking From: Markus Bertheau To: pgsql-sql@postgresql.org Content-Type: text/plain Message-Id: <1098287892.2649.15.camel@dicaprio.akademie1.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 20 Oct 2004 17:58:12 +0200 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200410/146 X-Sequence-Number: 19249 Hi, http://www.postgresql.org/docs/current/static/sql-createtable.html says, down at the explanation of DEFERRABLE, that constraints are checked after every command. Why does the following not work then: CREATE TABLE foo ( pos INT UNIQUE ); INSERT INTO foo (pos) VALUES (1); INSERT INTO foo (pos) VALUES (2); UPDATE foo SET pos = CASE WHEN pos = 2 THEN 1 ELSE 2 END; ERROR: duplicate key violates unique constraint "foo_pos_key" Also, are deferrable constraints other that FK constraints in the works? I also noticed, that the docs don't state whether INITIALLY IMMEDIATE or INITIALLY DEFERRED is the default. Thanks. -- Markus Bertheau