我需要修改已经创建的唯一索引,将其设置为可延迟。在PostgreSQL 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
文档似乎没有提到不能执行此操作,我错过了什么吗?