在另一台服务器中恢复 PostgreSQL 数据库模式时遇到问题。更准确地说,一些表似乎没有与它们在原始数据库中使用的相同的外键约束。例如,该ON DELETE CASCADE
子句似乎已从所有约束定义中完全消失。
问问题
146 次
1 回答
1
That's probably because the dumping procedure didn't backup the ON DELETE CASCADE
clauses in your table definitions.
Firstly you should delete the foreign key constraints on your tables and then go on to altering them:
Something like the following:
ALTER TABLE ONLY *your_table* DROP CONSTRAINT your_constraint;
After that, recreate the constraints with something like:
ALTER TABLE ONLY your_table ADD CONSTRAINT your_constraint (...ON DELETE CASCADE, etc..);
于 2013-04-25T07:53:16.530 回答