]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Use min/max bounds defined by Zstd for compression level
authorMichael Paquier <michael@paquier.xyz>
Thu, 22 Sep 2022 11:03:30 +0000 (20:03 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 22 Sep 2022 11:03:30 +0000 (20:03 +0900)
commitade925e1693a595ef1c278583fa699ca6fc1ff45
tree6e7be7def3c8cb804d7310cf228beec2d3f3c92f
parent901ef14afe981065a0c5c61b1759d36482869d98
Use min/max bounds defined by Zstd for compression level

The bounds hardcoded in compression.c since ffd5365 (minimum at 1 and
maximum at 22) do not match the reality of what zstd is able to
handle, these values being available via ZSTD_maxCLevel() and
ZSTD_minCLevel() at run-time.  The maximum of 22 is actually correct
in recent versions, but the minimum was not as the library can go down
to -131720 by design.  This commit changes the code to use the run-time
values in the code instead of some hardcoded ones.

Zstd seems to assume that these bounds could change in the future, and
Postgres will be able to adapt automatically to such changes thanks to
what's being done in this commit.

Reported-by: Justin Prysby
Discussion: https://postgr.es/m/20220922033716.GL31833@telsasoft.com
Backpatch-through: 15
doc/src/sgml/protocol.sgml
src/common/compression.c