pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Bertheau <twanger@bluetwanger.de>
To: pgsql-sql@postgresql.org
Subject: time of constraint checking
Date: Wed, 20 Oct 2004 17:58:12 +0200
Message-ID: <1098287892.2649.15.camel@dicaprio.akademie1.de> (raw)

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 <twanger@bluetwanger.de>




view thread (3+ messages)  latest in thread

Message-ID: <1098287892.2649.15.camel@dicaprio.akademie1.de>
Permalink:  ../1098287892.2649.15.camel@dicaprio.akademie1.de/
Also on:    postgresql.org/message-id/1098287892.2649.15.camel@dicaprio.akademie1.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: twanger@bluetwanger.de
  Subject: Re: time of constraint checking
  In-Reply-To: <1098287892.2649.15.camel@dicaprio.akademie1.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox