Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4aecd22

Browse files
committed
Make pg_receivexlog silent with 9.3 and older servers
A pointless and confusing error message is shown to the user whenattempting to identify a 9.3 or older remote server with a 9.5/9.6pg_receivexlog, because the return signature of IDENTIFY_SYSTEM waschanged in 9.4. There's no good reason for the warning message, soshuffle code around to keep it quiet.(pg_recvlogical is also affected by this commit, but since it obviouslycannot work with 9.3 that doesn't actually matter much.)Backpatch to 9.5.Reported by Marco Nenciarini, who also wrote the initial patch. Furthertweaked by Robert Haas and Fujii Masao; reviewed by Michael Paquier andCraig Ringer.
1 parent9211919 commit4aecd22

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

‎src/bin/pg_basebackup/streamutil.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,10 @@ GetConnection(void)
233233
/*
234234
* Run IDENTIFY_SYSTEM through a given connection and give back to caller
235235
* some result information if requested:
236-
* - Start LSN position
237-
* - Current timeline ID
238236
* - System identifier
239-
* - Plugin name
237+
* - Current timeline ID
238+
* - Start LSN position
239+
* - Database name (NULL in servers prior to 9.4)
240240
*/
241241
bool
242242
RunIdentifySystem(PGconn*conn,char**sysid,TimeLineID*starttli,
@@ -294,15 +294,21 @@ RunIdentifySystem(PGconn *conn, char **sysid, TimeLineID *starttli,
294294
/* Get database name, only available in 9.4 and newer versions */
295295
if (db_name!=NULL)
296296
{
297-
if (PQnfields(res)<4)
298-
fprintf(stderr,
299-
_("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
300-
progname,PQntuples(res),PQnfields(res),1,4);
297+
*db_name=NULL;
298+
if (PQserverVersion(conn) >=90400)
299+
{
300+
if (PQnfields(res)<4)
301+
{
302+
fprintf(stderr,
303+
_("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
304+
progname,PQntuples(res),PQnfields(res),1,4);
301305

302-
if (PQgetisnull(res,0,3))
303-
*db_name=NULL;
304-
else
305-
*db_name=pg_strdup(PQgetvalue(res,0,3));
306+
PQclear(res);
307+
return false;
308+
}
309+
if (!PQgetisnull(res,0,3))
310+
*db_name=pg_strdup(PQgetvalue(res,0,3));
311+
}
306312
}
307313

308314
PQclear(res);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp