我用tableplus做我的管理员。
目前,在生产和本地主机开发中,使用了10.3的docker映像。
因为tableplus将其postgres 10驱动程序升级到10.5,所以我不能再使用pg_restore恢复使用10.5 --format=custom转储的备份文件
有关如何使用tableplus进行备份,请参见图像。以及它如何使用10.5驱动程序

我得到的错误消息是pg_restore: [archiver] unsupported version (1.14) in file header
我试过的
我尝试在localhost中简单地将dockerfile中postgres的标记从10.3更改为10.5,但它没有工作。
原始文件
FROM postgres:10.3
COPY ./maintenance /usr/local/bin/maintenance
RUN chmod +x /usr/local/bin/maintenance/*
RUN mv /usr/local/bin/maintenance/* /usr/local/bin \
&& rmdir /usr/local/bin/maintenance至
FROM postgres:10.5
COPY ./maintenance /usr/local/bin/maintenance
RUN chmod +x /usr/local/bin/maintenance/*
RUN mv /usr/local/bin/maintenance/* /usr/local/bin \
&& rmdir /usr/local/bin/maintenance我的开发主机系统是macOS。
在我的开发停靠postgres中有许多现有的数据库和模式。因此,我现在很困惑如何在不破坏旧数据的情况下安全升级。
能给你建议吗?
另外,我认为长远的目标是找出如何在码头外(即在我的主机系统内)拥有数据文件,这样每次我想要升级postgres的码头形象时,我都可以安全地做到这一点。
我也想问一下如何切换到这样的设置。
发布于 2020-07-08 07:09:13
如果我正确地理解了您,您希望将10.5中的自定义格式转储还原到10.3数据库中。
如果存档格式在10.3到10.5之间发生变化,这是不可能的。
作为解决办法,您可以使用没有“存档版本”的“普通格式”转储(选项--format=plain)。但是恢复过程中的任何问题都是由您来解决的,因为降级PostgreSQL是不支持的。
您应该始终在开发和生产中使用相同的版本,并且应该始终使用最新的次要版本(当前为10.13)。其他一切都是自找麻烦。

将备份文件复制到postgres容器docker cp ~/path/to/dump/in-host-system/2020-07-08-1.dump <name_of_postgres_container>:/backups
docker exec -it <name_of_postgres_container> bash
psql -U username -d dbname < backups/2020-07-08-1.dump那会有用的
https://stackoverflow.com/questions/62788860
复制相似问题