postgresql:是否可以将 table 从 db1 重命名为 db2?
postgresql: is possible to rename a table from db1 to db2?
在 mysql 假设我想将 table 建筑物从 db1 重命名为 db2
rename table db1.buildings to db2.buildings;
在 postgres 上,我知道如何在同一个数据库中重命名 table
alter table buildings rename to newbuildings;
是否可以在 postgres 上将 db1 重命名为 db2?
ALTER TABLE db1.buildings SET SCHEMA db2;
我找到了另一个解决方案
pg_dump db1 -t buildings| psql db2
在 mysql 假设我想将 table 建筑物从 db1 重命名为 db2
rename table db1.buildings to db2.buildings;
在 postgres 上,我知道如何在同一个数据库中重命名 table
alter table buildings rename to newbuildings;
是否可以在 postgres 上将 db1 重命名为 db2?
ALTER TABLE db1.buildings SET SCHEMA db2;
我找到了另一个解决方案
pg_dump db1 -t buildings| psql db2