>> If you want to connect to a server where the transaction is read-only, then shouldn't the connection parameter be something like >>"target_session_attrs=readonly"? That represents exactly what the code does.
>FWIW I find this to be a reasonable compromise. To keep the analogy
>with the current patch it would be more something like "target_session_attrs=read_write|any".
I have taken this suggestion now renamed target_server_type to target_session_attrs with possible 2 values "read-write", "any".
May be we could expand to "readonly" and "prefer-readonly" in next patch proposal. Attaching the patch for same.