rails/rails — pull request #3258 by ileitch (2011-10-08 17:13:03+00:00)
Title: Postgres: Do not attempt to deallocate a statement if the connection is no longer active.

The PostgreSQL adapter attempts to clear out the statement cache on `reconnect!`, which in turn issues a `DEALLOCATE` query for each cached statement. If the connection has been lost, the query results in an `PGError` being raised.

This change first checks the connection is OK before attempting to `DEALLOCATE` the statement.

Fixes issue #3160