mirror of
https://github.com/postgres/postgres.git
synced 2025-05-01 01:04:50 +03:00
Check number of fields in IDENTIFY_SYSTEM response
Jaime Casanova
This commit is contained in:
parent
356fddfa0f
commit
c14534957b
@ -918,10 +918,10 @@ BaseBackup(void)
|
|||||||
progname, PQerrorMessage(conn));
|
progname, PQerrorMessage(conn));
|
||||||
disconnect_and_exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
if (PQntuples(res) != 1)
|
if (PQntuples(res) != 1 || PQnfields(res) != 3)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not identify system, got %i rows\n"),
|
fprintf(stderr, _("%s: could not identify system, got %i rows and %i fields\n"),
|
||||||
progname, PQntuples(res));
|
progname, PQntuples(res), PQnfields(res));
|
||||||
disconnect_and_exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
sysidentifier = strdup(PQgetvalue(res, 0, 0));
|
sysidentifier = strdup(PQgetvalue(res, 0, 0));
|
||||||
@ -1130,7 +1130,7 @@ BaseBackup(void)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not parse xlog end position \"%s\"\n"),
|
fprintf(stderr, _("%s: could not parse xlog end position \"%s\"\n"),
|
||||||
progname, xlogend);
|
progname, xlogend);
|
||||||
exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
InterlockedIncrement(&has_xlogendptr);
|
InterlockedIncrement(&has_xlogendptr);
|
||||||
|
|
||||||
@ -1162,6 +1162,7 @@ BaseBackup(void)
|
|||||||
/*
|
/*
|
||||||
* End of copy data. Final result is already checked inside the loop.
|
* End of copy data. Final result is already checked inside the loop.
|
||||||
*/
|
*/
|
||||||
|
PQclear(res);
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
@ -235,10 +235,10 @@ StreamLog(void)
|
|||||||
progname, PQerrorMessage(conn));
|
progname, PQerrorMessage(conn));
|
||||||
disconnect_and_exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
if (PQntuples(res) != 1)
|
if (PQntuples(res) != 1 || PQnfields(res) != 3)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not identify system, got %i rows\n"),
|
fprintf(stderr, _("%s: could not identify system, got %i rows and %i fields\n"),
|
||||||
progname, PQntuples(res));
|
progname, PQntuples(res), PQnfields(res));
|
||||||
disconnect_and_exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
timeline = atoi(PQgetvalue(res, 0, 1));
|
timeline = atoi(PQgetvalue(res, 0, 1));
|
||||||
|
@ -235,6 +235,13 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, char *sysi
|
|||||||
PQclear(res);
|
PQclear(res);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (PQnfields(res) != 3 || PQntuples(res) != 1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, _("%s: could not identify system, got %i rows and %i fields\n"),
|
||||||
|
progname, PQntuples(res), PQnfields(res));
|
||||||
|
PQclear(res);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (strcmp(sysidentifier, PQgetvalue(res, 0, 0)) != 0)
|
if (strcmp(sysidentifier, PQgetvalue(res, 0, 0)) != 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: system identifier does not match between base backup and streaming connection\n"), progname);
|
fprintf(stderr, _("%s: system identifier does not match between base backup and streaming connection\n"), progname);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user