加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql – Postgres入门级问题

发布时间:2020-12-13 16:01:15 所属栏目:百科 来源:网络整理
导读:我最近搬到了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
我最近搬到了Postgres并且遇到了形式的间歇性错误:

PGError: FATAL:  terminating connection due to administrator command
SSL 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.attnum

vendor/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会在他们进行维护时有时会杀死后端并重新启动服务器,这可能会解释您的问题,如果您的使用非常罕见.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读