FIX: PostgreSQL fallback was broken due to Rails masking exception (#9633)

The PR https://github.com/rails/rails/pull/36612 changes the raised exception
if the error message includes the target database name.

Since the error message contains the hostname, this could be triggered when
the hostname contains the database name.
This commit is contained in:
Rafael dos Santos Silva
2020-05-04 21:34:25 -03:00
committed by GitHub
parent 0ee796f66d
commit d59d170452

View File

@ -154,7 +154,7 @@ module ActiveRecord
begin
connection = postgresql_connection(config)
fallback_handler.initialized ||= true
rescue PG::ConnectionBad => e
rescue ::ActiveRecord::NoDatabaseError, PG::ConnectionBad => e
fallback_handler.master_down
fallback_handler.verify_master