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

Commit c41996b

Browse files
committed
Fix bug in checking of IDENTIFY_SYSTEM result.
5a991ef added new column into the result of IDENTIFY_SYSTEM command. But it was not reflected into several codes checking that result. Specifically though the number of columns in the result was increased to 4, it was still compared with 3 in some replication codes. Back-patch to 9.4 where the number of columns in IDENTIFY_SYSTEM result was increased. Report from Michael Paquier
1 parent 151ce45 commit c41996b

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) < 3 || PQntuples(res) != 1)
134+
if (PQnfields(res) < 4 || 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, 3, 1)));
143+
ntuples, nfields, 4, 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) < 3)
1647+
if (PQntuples(res) != 1 || PQnfields(res) < 4)
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, 3);
1651+
progname, PQntuples(res), PQnfields(res), 1, 4);
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
@@ -287,11 +287,11 @@ StreamLog(void)
287287
progname, "IDENTIFY_SYSTEM", PQerrorMessage(conn));
288288
disconnect_and_exit(1);
289289
}
290-
if (PQntuples(res) != 1 || PQnfields(res) < 3)
290+
if (PQntuples(res) != 1 || PQnfields(res) < 4)
291291
{
292292
fprintf(stderr,
293293
_("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
294-
progname, PQntuples(res), PQnfields(res), 1, 3);
294+
progname, PQntuples(res), PQnfields(res), 1, 4);
295295
disconnect_and_exit(1);
296296
}
297297
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
@@ -472,11 +472,11 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
472472
PQclear(res);
473473
return false;
474474
}
475-
if (PQntuples(res) != 1 || PQnfields(res) < 3)
475+
if (PQntuples(res) != 1 || PQnfields(res) < 4)
476476
{
477477
fprintf(stderr,
478478
_("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
479-
progname, PQntuples(res), PQnfields(res), 1, 3);
479+
progname, PQntuples(res), PQnfields(res), 1, 4);
480480
PQclear(res);
481481
return false;
482482
}

0 commit comments

Comments
 (0)