I recently moved to Postgres and am getting intermittent errors of the form:
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'
What can I do to get around this (apart from going back to the old Postgres Addon, which is a temporary solution I suppose).
Heroku Postgres offers a number of different plans, each of which provides the highest security standards. Ultimately, Heroku Postgres is a great option for any developer looking to build, scale, or maintain their databases without having to take infrastructure into consideration.
If no --version flag is set, the upgrade will default to 14. Performing a pg:upgrade requires app downtime on the order of 30 minutes.
For Hobby plans, all newly provisioned databases will default to PostgreSQL 14.
All production plans (Standard, Premium, Private and Shield) are encrypted at rest with AES-256, block-level storage encryption.
Ideally your app should be transparently coping with database errors by re-trying its work without bugging the user. If an idle DB backend is shut down from under it, it shouldn't care, it should just make a new connection and start the transaction again. I don't know how practical Rails and ActiveRecord makes that though.
See also the question What's the cause of "PGError: FATAL: terminating connection due to administrator command" on heroku?.
It seems that Heroku will kill sometimes backends and restart servers when they're doing maintenance, which might explain your issues if your use is very infrequent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With