更新时间:2023-02-12 23:31:23
您应该使用-无所有者
选项,这会停止 pg_restore
尝试将对象的所有权设置为原始所有者。相反,对象将由-role
You should use the --no-owner
option, this stops pg_restore
trying to set the ownership of the objects to the original owner. Instead the objects will be owned by the user specified by --role
createdb -p 5433 -T template0 db_name
pg_restore -p 5433 --no-owner --role=owner2 -d db_name db_name.dump