1.删除分表报错有依赖不能删除
DROP TABLE products;
NOTICE: constraint orders_product_no_fkey on table orders depends on table products
ERROR: cannot drop table products because other objects depend on it
HINT: Use DROP ... CASCADE to drop the dependent objects too.
原因如下,有外部依赖这个表,需要使用以下语句强制删除
The error message contains a useful hint: if you do not want to bother deleting all the dependent objects individually, you can run
DROP TABLE products CASCADE;
2.更改表名
alter table 表名 rename to 新表名
3.更改字段名
alter table 表名 rename 字段名 to 新字段名