在pg中,定义父子表后,子表可以随便删除,但是父表删除时,必须使用cascade级联删除或者先把子表都删了,示例如下:
postgres=# drop table cities; error: cannot drop table cities because other objects depend on it detail: table capitals depends on table cities hint: use drop ... cascade to drop the dependent objects too. postgres=# drop table cities cascade; notice: drop cascades to table capitals drop table postgres=#