pgpass_v1.patch

application/octet-stream

Filename: pgpass_v1.patch
Type: application/octet-stream
Part: 0
Message: Re: SR slaves and .pgpass

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: context
Series: patch v1
File+
doc/src/sgml/high-availability.sgml 3 0
doc/src/sgml/libpq.sgml 3 0
doc/src/sgml/recovery-config.sgml 4 0
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c 7 0
*** a/doc/src/sgml/high-availability.sgml
--- b/doc/src/sgml/high-availability.sgml
***************
*** 819,825 **** host    replication     foo             192.168.1.100/32        md5
      <para>
       The host name and port number of the primary, connection user name,
       and password are specified in the <filename>recovery.conf</> file or
!      the corresponding environment variable on the standby.
       For example, if the primary is running on host IP <literal>192.168.1.50</>,
       port <literal>5432</literal>, the superuser's name for replication is
       <literal>foo</>, and the password is <literal>foopass</>, the administrator
--- 819,827 ----
      <para>
       The host name and port number of the primary, connection user name,
       and password are specified in the <filename>recovery.conf</> file or
!      in a separate <filename>~/.pgpass</> on the standby (In the latter case,
!      <replaceable>database</> field in a <filename>~/.pgpass</> file must be
!      <literal>replication</> or <literal>*</>).
       For example, if the primary is running on host IP <literal>192.168.1.50</>,
       port <literal>5432</literal>, the superuser's name for replication is
       <literal>foo</>, and the password is <literal>foopass</>, the administrator
*** a/doc/src/sgml/libpq.sgml
--- b/doc/src/sgml/libpq.sgml
***************
*** 6233,6239 **** myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
     A host name of <literal>localhost</> matches both TCP (host name
     <literal>localhost</>) and Unix domain socket (<literal>pghost</> empty
     or the default socket directory) connections coming from the local
!    machine.
    </para>
  
    <para>
--- 6233,6241 ----
     A host name of <literal>localhost</> matches both TCP (host name
     <literal>localhost</>) and Unix domain socket (<literal>pghost</> empty
     or the default socket directory) connections coming from the local
!    machine. A database name of <literal>replication</> matches both
!    the connection to the real database named <literal>replication</>
!    and the connection for replication purpose.
    </para>
  
    <para>
*** a/doc/src/sgml/recovery-config.sgml
--- b/doc/src/sgml/recovery-config.sgml
***************
*** 268,276 **** restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"'  # Windows
            primary (see
            <xref linkend="streaming-replication-authentication">).
            A password needs to be provided too, if the primary demands password
!           authentication.  (The password can be provided either in
            the <varname>primary_conninfo</varname> string or in a separate
!           <filename>~/.pgpass</> file on the standby server.)
            Do not specify a database name in the
            <varname>primary_conninfo</varname> string.
           </para>
--- 268,278 ----
            primary (see
            <xref linkend="streaming-replication-authentication">).
            A password needs to be provided too, if the primary demands password
!           authentication.  The password can be provided either in
            the <varname>primary_conninfo</varname> string or in a separate
!           <filename>~/.pgpass</> file on the standby server (In the latter case,
!           <replaceable>database</> field in a <filename>~/.pgpass</> file must be
!           <literal>replication</> or <literal>*</>).
            Do not specify a database name in the
            <varname>primary_conninfo</varname> string.
           </para>
*** a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
--- b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
***************
*** 77,83 **** _PG_init(void)
  static bool
  libpqrcv_connect(char *conninfo, XLogRecPtr startpoint)
  {
! 	char		conninfo_repl[MAXCONNINFO + 18];
  	char	   *primary_sysid;
  	char		standby_sysid[32];
  	TimeLineID	primary_tli;
--- 77,83 ----
  static bool
  libpqrcv_connect(char *conninfo, XLogRecPtr startpoint)
  {
! 	char		conninfo_repl[MAXCONNINFO + 37];
  	char	   *primary_sysid;
  	char		standby_sysid[32];
  	TimeLineID	primary_tli;
***************
*** 85,92 **** libpqrcv_connect(char *conninfo, XLogRecPtr startpoint)
  	PGresult   *res;
  	char		cmd[64];
  
! 	/* Connect using deliberately undocumented parameter: replication */
! 	snprintf(conninfo_repl, sizeof(conninfo_repl), "%s replication=true", conninfo);
  
  	streamConn = PQconnectdb(conninfo_repl);
  	if (PQstatus(streamConn) != CONNECTION_OK)
--- 85,96 ----
  	PGresult   *res;
  	char		cmd[64];
  
! 	/*
! 	 * Connect using deliberately undocumented parameter: replication.
! 	 * Specify "replication" as the database name for .pgpass lookup.
! 	 */
! 	snprintf(conninfo_repl, sizeof(conninfo_repl), "%s dbname=replication replication=true",
! 			 conninfo);
  
  	streamConn = PQconnectdb(conninfo_repl);
  	if (PQstatus(streamConn) != CONNECTION_OK)