Add support for target_session_attrs
PostgreSQL 10 will include a connection time parameter as part of libpq to say whether your connection must be routed to a master node. The idea is that the pooler can assume everyone is a read connection unless they signal they are going to write. Here's the documentation from https://www.postgresql.org/docs/devel/static/libpq-connect.html#libpq-connect-target-session-attrs
target_session_attrs If this parameter is set to read-write, only a connection in which read-write transactions are accepted by default is considered acceptable. The query show transaction_read_only will be sent upon any successful connection; if it returns on, the connection will be closed. If multiple hosts were specified in the connection string, any remaining servers will be tried just as if the connection attempt had failed. The default value of this parameter, any, regards all connections as acceptable.
There are some samples at http://paquier.xyz/postgresql-2/postgres-10-libpq-read-write/ that demonstrate this means to allow libpq itself work to search multiple hosts for the master and require no failover proxy as all. That will work for some small environments and lets core Postgres say it has a complete fail-over solution for them. There's still a need for larger sites to have a program like crunchy-proxy in the middle instead, where clients only connect to one address with transparent failover behind that, and there are APIs for the failover that integrate into a larger environment.
Regardless, eventually target_session_attrs could (and arguably should) be the standard way to label applications connections for routing purposes. That will eliminate the need to tag the query text with comments the way crunchy-proxy does now. The current comment-based approach is still useful today because it's going to take a while before enough software can use this. The drivers for JDBC, Ruby, etc. will all need updates before they can handle this feature.