aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2013-01-15 15:45:52 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2013-01-15 15:45:52 +0200
commitffda05977a93f9b3f8a6b05657ba2f16decb6b23 (patch)
tree61f2a6cb43cc79460ce2943a2c32b177d1d1a77d /src
parent1b794d3f3286036eec1d09d5cbea989162657331 (diff)
downloadpostgresql-ffda05977a93f9b3f8a6b05657ba2f16decb6b23.tar.gz
postgresql-ffda05977a93f9b3f8a6b05657ba2f16decb6b23.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_basebackup/receivelog.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/bin/pg_basebackup/receivelog.c b/src/bin/pg_basebackup/receivelog.c
index cf9cea1e2df..88d0c136b07 100644
--- a/src/bin/pg_basebackup/receivelog.c
+++ b/src/bin/pg_basebackup/receivelog.c
@@ -342,6 +342,21 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
int64 last_status = -1;
XLogRecPtr blockpos = InvalidXLogRecPtr;
+ /*
+ * The message format used in streaming replication changed in 9.3, so we
+ * cannot stream from older servers. Don't know if we would work with
+ * newer versions, but let's not take the risk.
+ */
+ if (PQserverVersion(conn) / 100 != PG_VERSION_NUM / 100)
+ {
+ const char *serverver = PQparameterStatus(conn, "server_version");
+ fprintf(stderr, _("%s: incompatible server version %s; streaming is only supported with server version %s\n"),
+ progname,
+ serverver ? serverver : "'unknown'",
+ PG_MAJORVERSION);
+ return false;
+ }
+
if (sysidentifier != NULL)
{
/* Validate system identifier and timeline hasn't changed */