PostgREST not recognizing new columns, tables, views or functions
如果 PostgREST 因无法识别新的数据库列、表、视图或函数而返回错误,并且记录类似如下的错误:
🌐 If PostgREST is returning errors by not recognizing new database columns, tables, views or functions, and logging errors similar to:
124/Dec/2025:18:16:33 -0500: Failed listening for database notifications on the "pgrst" channel. ERROR: could not access status of transaction 12037872 DETAIL: Could not open file "pg_xact/000B": No such file or directory.那这表明 PostgREST 的模式缓存已经过时了。
🌐 Then this indicates that there's a stale PostgREST schema cache.
为什么会这样 #
🌐 Why this happens
当一个潜在的 Postgres 通知队列问题阻止 PostgREST 在模式更改后接收缓存重新加载信号时,就可能发生这种情况。
🌐 This can occur when an underlying Postgres notification queue issue prevents PostgREST from receiving cache reload signals after schema changes.
怎么修这个 #
🌐 How to fix this
通过 SQL 编辑器 或直接客户端执行以下 SQL 命令:
🌐 Execute the following SQL command via the SQL Editor or a direct client:
1select pg_notification_queue_usage();这个命令会直接刷新 Postgres 的通知队列,促使 PostgREST 使用最新的数据库架构来更新它的架构缓存。这个过程不会造成干扰,也不需要重启数据库实例或 PostgREST 服务。
🌐 This command directly refreshes the Postgres notification queue, prompting PostgREST to update its schema cache with the latest database schema. This process is non-disruptive and does not require a database instance or PostgREST service restart.