Skip to content

Commit c476288

Browse files
committed
Revert "Fix bug in checking of IDENTIFY_SYSTEM result."
This reverts commit 083d29c. The commit changed the code so that it causes an errors when IDENTIFY_SYSTEM returns three columns. But which prevents us from using the replication-related utilities against the server with older version. This is not what we want. For that compatibility, we allow the utilities to receive three columns as the result of IDENTIFY_SYSTEM eventhough it actually returns four columns in 9.4 or later. Pointed out by Andres Freund.
1 parent 083d29c commit c476288

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ libpqrcv_identify_system(TimeLineID *primary_tli)
131131
"the primary server: %s",
132132
PQerrorMessage(streamConn))));
133133
}
134-
if (PQnfields(res) < 4 || PQntuples(res) != 1)
134+
if (PQnfields(res) < 3 || PQntuples(res) != 1)
135135
{
136136
int ntuples = PQntuples(res);
137137
int nfields = PQnfields(res);
@@ -140,7 +140,7 @@ libpqrcv_identify_system(TimeLineID *primary_tli)
140140
ereport(ERROR,
141141
(errmsg("invalid response from primary server"),
142142
errdetail("Could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields.",
143-
ntuples, nfields, 4, 1)));
143+
ntuples, nfields, 3, 1)));
144144
}
145145
primary_sysid = PQgetvalue(res, 0, 0);
146146
*primary_tli = pg_atoi(PQgetvalue(res, 0, 1), 4, 0);

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,11 +1644,11 @@ BaseBackup(void)
16441644
progname, "IDENTIFY_SYSTEM", PQerrorMessage(conn));
16451645
disconnect_and_exit(1);
16461646
}
1647-
if (PQntuples(res) != 1 || PQnfields(res) < 4)
1647+
if (PQntuples(res) != 1 || PQnfields(res) < 3)
16481648
{
16491649
fprintf(stderr,
16501650
_("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
1651-
progname, PQntuples(res), PQnfields(res), 1, 4);
1651+
progname, PQntuples(res), PQnfields(res), 1, 3);
16521652
disconnect_and_exit(1);
16531653
}
16541654
sysidentifier = pg_strdup(PQgetvalue(res, 0, 0));

src/bin/pg_basebackup/pg_receivexlog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,11 @@ StreamLog(void)
290290
progname, "IDENTIFY_SYSTEM", PQerrorMessage(conn));
291291
disconnect_and_exit(1);
292292
}
293-
if (PQntuples(res) != 1 || PQnfields(res) < 4)
293+
if (PQntuples(res) != 1 || PQnfields(res) < 3)
294294
{
295295
fprintf(stderr,
296296
_("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
297-
progname, PQntuples(res), PQnfields(res), 1, 4);
297+
progname, PQntuples(res), PQnfields(res), 1, 3);
298298
disconnect_and_exit(1);
299299
}
300300
servertli = atoi(PQgetvalue(res, 0, 1));

src/bin/pg_basebackup/receivelog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,11 +499,11 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
499499
PQclear(res);
500500
return false;
501501
}
502-
if (PQntuples(res) != 1 || PQnfields(res) < 4)
502+
if (PQntuples(res) != 1 || PQnfields(res) < 3)
503503
{
504504
fprintf(stderr,
505505
_("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
506-
progname, PQntuples(res), PQnfields(res), 1, 4);
506+
progname, PQntuples(res), PQnfields(res), 1, 3);
507507
PQclear(res);
508508
return false;
509509
}

0 commit comments

Comments
 (0)