【发布时间】:2018-11-10 22:50:19
【问题描述】:
我需要更改已创建的唯一索引以将其设置为可延迟。在 postgres 9.6 中。基本上,我会这样做:
DROP TABLE IF EXISTS test;
CREATE TABLE test (id integer);
ALTER TABLE test ADD CONSTRAINT unique_id unique(id);
ALTER TABLE test ALTER CONSTRAINT unique_id DEFERRABLE INITIALLY DEFERRED;
但我明白了
ERROR: constraint "unique_id" of relation "test" is not a foreign key constraint
文档似乎没有提到无法执行此类操作。我错过了什么?
【问题讨论】:
标签: postgresql indexing unique postgresql-9.6