0

在 mysql 上,假设我想将表建筑从 db1 重命名为 db2

rename table db1.buildings to db2.buildings;

在 postgres 上,我知道如何重命名同一个数据库中的表

alter table buildings rename to newbuildings;

是否可以在 postgres 上从 db1 重命名为 db2?

4

2 回答 2

2

使用ALTER TABLE SET SCHEMA

ALTER TABLE db1.buildings SET SCHEMA db2;
于 2020-04-21T18:21:53.307 回答
1

我找到了另一个解决方案

pg_dump db1 -t buildings| psql db2
于 2020-04-21T18:49:12.530 回答