Skip to content

Commit ecbdc4c

Browse files
committed
Forbid invalid combination of options in pg_basebackup.
Commit 56c7d8d allowed pg_basebackup to stream WAL in tar mode. But there is the restriction that WAL streaming in tar mode works only when the value - (dash) is not specified as output directory. This means that the combination of three options "-D -", "-F t" and "-X stream" is invalid. However, previously, even when those options were specified at the same time, pg_basebackup background process unexpectedly started streaming WAL. And then it exited with an error. This commit changes pg_basebackup so that it errors out on such invalid combination of options at the beginning. Reviewed by Magnus Hagander, and patch by me.
1 parent c080b22 commit ecbdc4c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/bin/pg_basebackup/pg_basebackup.c

+10
Original file line numberDiff line numberDiff line change
@@ -2268,6 +2268,16 @@ main(int argc, char **argv)
22682268
exit(1);
22692269
}
22702270

2271+
if (format == 't' && streamwal && strcmp(basedir, "-") == 0)
2272+
{
2273+
fprintf(stderr,
2274+
_("%s: cannot stream transaction logs in tar mode to stdout\n"),
2275+
progname);
2276+
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
2277+
progname);
2278+
exit(1);
2279+
}
2280+
22712281
if (replication_slot && !streamwal)
22722282
{
22732283
fprintf(stderr,

0 commit comments

Comments
 (0)