Hi,

I was attempting to set up a high availability system using DNS and target_session_attrs. I was using a DNS setup similar to below and was trying to use the connection strings `psql postgresql://user@pg.database.com/db_name?target_session=read-write` to have clients dynamically connect to the primary or `psql postgresql://user@pg.database.com/db_name?target_session=read-only` to have clients connect to a read replica. 

The problem that I found with this setup is that if libpq is unable to get a matching target_session_attr on the first connection attempt it does not consider any further addresses for the given host. This patch is designed to provide an option that allows libpq to look at additional addresses for a given host if the target_session_attr check fails for previous addresses.

Would appreciate any feedback on the applicability/relevancy of the goal here or the implementation.
 
Example DNS setup
________________________________
Name                  | Type    | Record
______________|______|___________
pg.database.com | A        | ip_address_1
pg.database.com | A        | ip_address_2
pg.database.com | A        | ip_address_3
pg.database.com | A        | ip_address_4