aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2022-01-27 09:46:17 -0500
committerRobert Haas <rhaas@postgresql.org>2022-01-27 11:05:48 -0500
commitdabf63bc9a5b71f61c2c8712c85d33fdc06efa8c (patch)
treeff7c38b2819f1c3ccf6529013bfa2a356cf699dc /src
parentacea505186e65dff33db69517d36a02c7b4f0283 (diff)
downloadpostgresql-dabf63bc9a5b71f61c2c8712c85d33fdc06efa8c.tar.gz
postgresql-dabf63bc9a5b71f61c2c8712c85d33fdc06efa8c.zip
pg_basebackup: Fix a couple of recently-introduced bugs.
The server expects the compression level to be between 1 and 9, but Z_DEFAULT_COMPRESSION is -1, so we must not try to send that value to the server. Because pg_basebackup's -R option is implemented on the client side, it can't be used in combination with a backup target. Error out if someone tries that, instead of silently ignoring the option. Both issues were reported by Tushar Ahuja; patch by me. Discussion: http://postgr.es/m/CA+TgmoaMwgdx8HxBjF8hmbohVvPL_0H5LqNrSq0uU+7BKp_Q2A@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_basebackup/pg_basebackup.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 46f6f53e9b9..851f03ca81a 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -1871,6 +1871,12 @@ BaseBackup(void)
exit(1);
}
+ if (writerecoveryconf)
+ {
+ pg_log_error("recovery configuration cannot be written when a backup target is used");
+ exit(1);
+ }
+
AppendPlainCommandOption(&buf, use_new_option_syntax, "TABLESPACE_MAP");
if ((colon = strchr(backup_target, ':')) == NULL)
@@ -1913,7 +1919,7 @@ BaseBackup(void)
}
AppendStringCommandOption(&buf, use_new_option_syntax,
"COMPRESSION", compressmethodstr);
- if (compresslevel != 0)
+ if (compresslevel != 0 && compresslevel != Z_DEFAULT_COMPRESSION)
AppendIntegerCommandOption(&buf, use_new_option_syntax,
"COMPRESSION_LEVEL", compresslevel);
}