Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ffda059

Browse files
committed
Give a proper error message if connecting to incompatible server.
The WAL streaming message format changed in 9.3, so 9.3 pg_basebackup or pg_receivelog won't work against older servers.
1 parent 1b794d3 commit ffda059

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/bin/pg_basebackup/receivelog.c

+15
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,21 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
342342
int64 last_status = -1;
343343
XLogRecPtr blockpos = InvalidXLogRecPtr;
344344

345+
/*
346+
* The message format used in streaming replication changed in 9.3, so we
347+
* cannot stream from older servers. Don't know if we would work with
348+
* newer versions, but let's not take the risk.
349+
*/
350+
if (PQserverVersion(conn) / 100 != PG_VERSION_NUM / 100)
351+
{
352+
const char *serverver = PQparameterStatus(conn, "server_version");
353+
fprintf(stderr, _("%s: incompatible server version %s; streaming is only supported with server version %s\n"),
354+
progname,
355+
serverver ? serverver : "'unknown'",
356+
PG_MAJORVERSION);
357+
return false;
358+
}
359+
345360
if (sysidentifier != NULL)
346361
{
347362
/* Validate system identifier and timeline hasn't changed */

0 commit comments

Comments
 (0)