Before going deeper into the patch, let me give you some findings.
PGconn->target_server_type is not freed in freePGconn().
Could you add PGTARGETSERVERTYPE environment variable? Like other variables,
it will ease testing, since users can change the behavior without altering the
connection string here and there.
I think it would be better to expose the server state via ParameterStatus
protocol message like standard_conforming_strings, instead of running "SELECT
pg_is_in_recovery()". We shouldn't want to add one round trip to check the
server type (master, standby). postmaster can return the server type based on
its state (pmState); PM_RUN is master, and PM_HOT_STANDBY is standby. In
addition, as an impractical concern, DBA can revoke EXECUTE privilege on
pg_is_in_recovery() from non-superusers.
Sent via pgsql-hackers mailing list (firstname.lastname@example.org)
To make changes to your subscription: