mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-03 10:57:19 +02:00
Revert "Fix bug in checking of IDENTIFY_SYSTEM result."
This reverts commit 083d29c65b
.
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.
This commit is contained in:
parent
c41996b18c
commit
e0d010f64c
@ -131,7 +131,7 @@ libpqrcv_identify_system(TimeLineID *primary_tli)
|
|||||||
"the primary server: %s",
|
"the primary server: %s",
|
||||||
PQerrorMessage(streamConn))));
|
PQerrorMessage(streamConn))));
|
||||||
}
|
}
|
||||||
if (PQnfields(res) < 4 || PQntuples(res) != 1)
|
if (PQnfields(res) < 3 || PQntuples(res) != 1)
|
||||||
{
|
{
|
||||||
int ntuples = PQntuples(res);
|
int ntuples = PQntuples(res);
|
||||||
int nfields = PQnfields(res);
|
int nfields = PQnfields(res);
|
||||||
@ -140,7 +140,7 @@ libpqrcv_identify_system(TimeLineID *primary_tli)
|
|||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errmsg("invalid response from primary server"),
|
(errmsg("invalid response from primary server"),
|
||||||
errdetail("Could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields.",
|
errdetail("Could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields.",
|
||||||
ntuples, nfields, 4, 1)));
|
ntuples, nfields, 3, 1)));
|
||||||
}
|
}
|
||||||
primary_sysid = PQgetvalue(res, 0, 0);
|
primary_sysid = PQgetvalue(res, 0, 0);
|
||||||
*primary_tli = pg_atoi(PQgetvalue(res, 0, 1), 4, 0);
|
*primary_tli = pg_atoi(PQgetvalue(res, 0, 1), 4, 0);
|
||||||
|
@ -1644,11 +1644,11 @@ BaseBackup(void)
|
|||||||
progname, "IDENTIFY_SYSTEM", PQerrorMessage(conn));
|
progname, "IDENTIFY_SYSTEM", PQerrorMessage(conn));
|
||||||
disconnect_and_exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
if (PQntuples(res) != 1 || PQnfields(res) < 4)
|
if (PQntuples(res) != 1 || PQnfields(res) < 3)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
_("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
|
_("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
|
||||||
progname, PQntuples(res), PQnfields(res), 1, 4);
|
progname, PQntuples(res), PQnfields(res), 1, 3);
|
||||||
disconnect_and_exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
sysidentifier = pg_strdup(PQgetvalue(res, 0, 0));
|
sysidentifier = pg_strdup(PQgetvalue(res, 0, 0));
|
||||||
|
@ -287,11 +287,11 @@ StreamLog(void)
|
|||||||
progname, "IDENTIFY_SYSTEM", PQerrorMessage(conn));
|
progname, "IDENTIFY_SYSTEM", PQerrorMessage(conn));
|
||||||
disconnect_and_exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
if (PQntuples(res) != 1 || PQnfields(res) < 4)
|
if (PQntuples(res) != 1 || PQnfields(res) < 3)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
_("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
|
_("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
|
||||||
progname, PQntuples(res), PQnfields(res), 1, 4);
|
progname, PQntuples(res), PQnfields(res), 1, 3);
|
||||||
disconnect_and_exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
servertli = atoi(PQgetvalue(res, 0, 1));
|
servertli = atoi(PQgetvalue(res, 0, 1));
|
||||||
|
@ -472,11 +472,11 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
|
|||||||
PQclear(res);
|
PQclear(res);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (PQntuples(res) != 1 || PQnfields(res) < 4)
|
if (PQntuples(res) != 1 || PQnfields(res) < 3)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
_("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
|
_("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
|
||||||
progname, PQntuples(res), PQnfields(res), 1, 4);
|
progname, PQntuples(res), PQnfields(res), 1, 3);
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user