如何修复将 PostgreSQL 从 11.20 升级到 12.15 时出现“type abstime does not exist”错误?

问题描述 投票:0回答:1

尝试将 PostgreSQL 从 11.20 升级到 12.15 并遇到以下错误

pg_restore:错误:无法执行查询:错误:类型“abstime”不存在

我确实了解数据类型abstime、reltime 和tinterval 已被postgres 在增强或版本升级中删除。但我相信社区中一定有人遇到过这个问题并设法找到解决方案。

社区中是否有任何人可以提供帮助,希望取得进展并保证安全。

尝试查看知识库文章但找不到任何解决方案。正在寻找解决方案

postgresql postgresql-11 postgresql-12
1个回答
2
投票

将所有出现的

abstime
替换为
timestamp(0) with time zone
。您必须在升级之前在 v11 数据库中执行此操作,除非您想手动编辑转储文件。

abstime

 在被删除时已被弃用近 20 年,并且存在 Y2038 问题。

这是如上所述转换列的命令:

ALTER TABLE table_name ALTER column_name TYPE timestamp(0) with time zone;
    
© www.soinside.com 2019 - 2024. All rights reserved.