target_session_attrs

A libpq connection parameter to specify whether a connection must be to a primary

target_session_attrs is a libpq connection parameter to specify whether a connection can be to a read-only standby server. It is intended for use in combination with the host parameter, when specifying multiple hosts to connect to.

target_session_attrs was added in PostgreSQL 10.

Usage

Possible values are (PostgreSQL 10 and later):

  • any
  • read-write

and from PostgreSQL 14 also:

  • read-only
  • primary
  • standby
  • prefer-standby

Change history

Categories

Database connections, Replication