From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Markus Bertheau <twanger(at)bluetwanger(dot)de> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: time of constraint checking |
Date: | 2004-10-20 16:56:03 |
Message-ID: | 20041020095039.N4154@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Wed, 20 Oct 2004, Markus Bertheau wrote:
> 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"
Unique constraints are currently non-compliant in that it checks on each
changed row rather than at the end of the statement. I thought this was
mentioned somewhere, but it might make sense to mention it in the
compatibility section.
> Also, are deferrable constraints other that FK constraints in the works?
I don't think anyone's looking at it right now.
From | Date | Subject | |
---|---|---|---|
Next Message | Gifford Hesketh | 2004-10-20 22:03:22 | "copy from" in "create function" |
Previous Message | Markus Bertheau | 2004-10-20 16:16:04 | Re: time of constraint checking |