time of constraint checking

Поиск
Список
Период
Сортировка
От Markus Bertheau
Тема time of constraint checking
Дата
Msg-id 1098287892.2649.15.camel@dicaprio.akademie1.de
обсуждение исходный текст
Ответы Re: time of constraint checking  (Markus Bertheau <twanger@bluetwanger.de>)
Re: time of constraint checking  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-sql
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>



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Scott Marlowe"
Дата:
Сообщение: Re: [GENERAL] SQL update function faililed in Webmin Interface
Следующее
От: Markus Bertheau
Дата:
Сообщение: Re: time of constraint checking