Add a test case for reconnect_select_db_after_pubsub
Fixed a subtle error where commands issued within the idle event handler