You need to enable JavaScript to run this app. 如何解决向Heroku推送Postgres数据库时pg_restore报错1(无法识别数据块类型0)的问题
优惠活动
大模型
产品
解决方案
定价
更多

如何解决向Heroku推送Postgres数据库时pg_restore报错1(无法识别数据块类型0)的问题

本地Postgres推送Heroku时heroku pg:push执行报错

基础操作信息

实际执行的推送命令为:
heroku pg:push my_database DATABASE_URL
注:命令中my_database参数已替换为本地实际使用的项目数据库名称

运行报错输出

命令执行过程中pg_restore组件返回如下异常日志:

pg_restore: creating DEFAULT "public.user_snacklist id"
pg_restore: processing data for table "public.favorites"
pg_restore: error: unrecognized data block type (0) while searching archive
 !    pg_restore errored with 1

已尝试的排障动作

  • 删除Heroku账号下已配置的Postgres插件,重新创建插件后重试推送
  • 修改本地数据库结构,移除所有含空值的列后重新执行推送

以上两次尝试均未解决当前报错。

当前排查进展与诉求

目前初步推测故障根源可能出在数据库的favorites表,但和同伴协同排查后暂未定位到有效触发原因,需要该场景下的针对性解决指引。


内容的提问来源于stack exchange,提问作者wkromar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.27 17:06:03