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

Commit ac4896e

Browse files
committed
Cannot specify compress-level option without compress-alg option
1 parent 7483bbe commit ac4896e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

configure.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ writeBackupCatalogConfig(FILE *out, pgBackupConfig *config)
154154
fprintf(out, "#Compression parameters:\n");
155155

156156
fprintf(out, "compress-algorithm = %s\n", deparse_compress_alg(config->compress_alg));
157-
fprintf(out, "compress-level = %d\n", config->compress_level);
157+
158+
if (compress_level != config->compress_level)
159+
fprintf(out, "compress-level = %d\n", compress_level);
160+
else
161+
fprintf(out, "compress-level = %d\n", config->compress_level);
158162
}
159163

160164
void

pg_probackup.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,13 @@ main(int argc, char *argv[])
353353
if (num_threads < 1)
354354
num_threads = 1;
355355

356+
if (backup_subcmd != SET_CONFIG)
357+
{
358+
if (compress_level != DEFAULT_COMPRESS_LEVEL
359+
&& compress_alg == NONE_COMPRESS)
360+
elog(ERROR, "Cannot specify compress-level option without compress-alg option");
361+
}
362+
356363
if (compress_level < 0 || compress_level > 9)
357364
elog(ERROR, "--compress-level value must be in the range from 0 to 9");
358365

0 commit comments

Comments
 (0)