我有一个简单的删除并添加一个封装在事务中的约束,如下所示:
begin;
alter table movies drop constraint actor_check;
alter table movies add constraint actor_check check ( "actor" not like '%Harpo Marx%'
and "actor" not like '%Chico Marx%'
and "actor" not like '%Groucho Marx%'
and "actor" not like '%Zeppo Marx%');
end;
但是交易出错了:
BEGIN
Time: 70ms
ALTER TABLE
Time: 364ms
DELETE 0
Time: 1.283s
ERROR: relation "movies" (61): duplicate constraint name: "actor_check"
SQLSTATE: 42710
ERROR: relation "movies" (61): duplicate constraint name: "actor_check"
SQLSTATE: 42710
Failed running "sql"
请指教