Postgres error: 'could not access status of transaction' when PostgREST runs LISTEN
Last edited: 10/14/2026
错误 #
🌐 The error
你会在数据库日志中看到这个:
🌐 You'll see this in your database logs:
- 错误:
could not access status of transaction - 细节:
Could not open file "pg_xact/[ID]": No such file or directory - 应用: PostgREST(显示为
PostgREST 13.0.5或类似名称) - 命令:
LISTEN
如果你看到第一个错误信息没有 pg_xact 的详细信息,或者在 PostgREST 之外看到它,可能是一个不同的问题。
🌐 If you see the first error message without the pg_xact detail, or outside PostgREST, it may be a different issue.
发生了什么 #
🌐 What's happening
这是一个上游 Postgres bug,但也影响 PostgREST。通知队列会卡住,并尝试访问不再存在的旧事务 ID。
🌐 This is an upstream Postgres bug but affects PostgREST. The notification queue gets stuck and tries to access old transaction IDs that no longer exist.
修复 #
🌐 Fix
在SQL 编辑器中运行此命令:
🌐 Run this command in the SQL editor:
select pg_notification_queue_usage();这会清除卡住的队列。你的数据 API 会再次响应,错误也应该会停止。
🌐 This clears the stuck queue. Your Data API will become responsive again, and the errors should stop.
如果再发生一次 #
🌐 If it happens again
再运行一次上面的命令。
🌐 Run the command above again.
如果你升级到 PostgREST v14.8 以上,日志会包含一个 HINT,告诉你运行 SELECT pg_notification_queue_usage();。你可以在 基础设施设置 中升级 PostgREST 和 Postgres。
🌐 If you upgrade to PostgREST v14.8+, the logs will include a HINT that tells you to run SELECT pg_notification_queue_usage();. You can upgrade PostgREST and Postgres in Infrastructure Settings.