]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Switch maximum of GUC huge_page_size to MAX_KILOBYTES
authorMichael Paquier <michael@paquier.xyz>
Sat, 27 Jun 2026 02:45:56 +0000 (11:45 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sat, 27 Jun 2026 02:45:56 +0000 (11:45 +0900)
As documented in guc.h, MAX_KILOBYTES is used to cap GUC parameters that
are measured in kilobytes of memory.  This way, size_t values can fit in
builds where sizeof(size_t) is 4 bytes.

Unfortunately, huge_page_size has missed this aspect, causing
calculation failures when setting this GUC to a value higher than
MAX_KILOBYTES, up to INT_MAX.

Oversight in d2bddc2500fb.  No backpatch is done, based on the lack of
complaints.

Reported-by: Daria Shanina <vilensipkdm@gmail.com>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/20260626.132415.904994526137946499.horikyota.ntt@gmail.com

src/backend/utils/misc/guc_parameters.dat

index 7b1eb6e61bcac2ab5f883ccd8236d01ccaecbd17..3c1e6b31bf8c0857900f4366fbbef4a3d9afb1a4 100644 (file)
   variable => 'huge_page_size',
   boot_val => '0',
   min => '0',
-  max => 'INT_MAX',
+  max => 'MAX_KILOBYTES',
   check_hook => 'check_huge_page_size',
 },