postgresql – Postgres入门级问题

postgresql – Postgres入门级问题,第1张

概述我最近搬到了Postgres并且遇到了形式的间歇性错误: PGError: FATAL: terminating connection due to administrator commandSSL connection has been closed unexpectedly: SELECT a.attname, format_type(a.atttypid, a.attt 我最近搬到了Postgres并且遇到了形式的间歇性错误:

PGError: FATAL:  terminating connection due to administrator commandSSL connection has been closed unexpectedly:         SELECT a.attname,format_type(a.atttypID,a.atttypmod),d.adsrc,a.attnotnull          FROM pg_attribute a left JOIN pg_attrdef d            ON a.attrelID = d.adrelID AND a.attnum = d.adnum         WHERE a.attrelID = '"xxxxxx"'::regclass           AND a.attnum > 0 AND NOT a.attisdropped         ORDER BY a.attnumvendor/bundle/ruby/1.9.1/gems/activerecord-3.0.11/lib/active_record/connection_adapters/postgresql_adapter.rb:505:in `exec'

我能做些什么来绕过这个(除了回到旧的Postgres Addon,这是我认为的临时解决方案).

解决方法 理想情况下,您的应用程序应该通过重新尝试其工作而不会误导用户来透明地处理数据库错误.如果空闲数据库后端从它下面关闭,它应该不关心,它应该只是建立一个新连接并再次启动事务.我不知道Rails和ActiveRecord如何实现这一点.

另见问题What’s the cause of “PGError: FATAL: terminating connection due to administrator command” on heroku?.

似乎Heroku会在他们进行维护时有时会杀死后端并重新启动服务器,这可能会解释您的问题,如果您的使用非常罕见.

总结

以上是内存溢出为你收集整理的postgresql – Postgres入门级问题全部内容,希望文章能够帮你解决postgresql – Postgres入门级问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1160983.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-01
下一篇 2022-06-01

发表评论

登录后才能评论

评论列表(0条)

保存