我似乎无法得到这个权利,我试图修改一个字段为外键,级联删除…我做错了什么?
ALTER TABLE my_table ADD CONSTRAINT $4 FOREIGN KEY my_field REFERENCES my_foreign_table ON DELETE CASCADE;
这将有助于如果你张贴的错误消息。但我想你只是错过括号:
ALTER TABLE my_table ADD CONSTRAINT my_fk FOREIGN KEY (my_field) REFERENCES my_foreign_table ON DELETE CASCADE;