1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Fix check on test function's arguments

The function won't cope with nkinds == 0, it leads to division by
zero.  It's just a test function though, so this is harmless and
there's no need to backport.

Author: Yuriy Grigoryev <ju.grigorev@ftdata.ru>
Reviewed-by: Sho Ito <i.sho.0628@gmail.com>
Discussion: https://www.postgresql.org/message-id/1905e9d709554733b418d06a4806436f@localhost.localdomain
This commit is contained in:
Heikki Linnakangas
2026-10-10 00:29:02 +03:00
parent f6065c56d4
commit 5f36942fd3

View File

@@ -213,14 +213,14 @@ test_resowner_many(PG_FUNCTION_ARGS)
ManyTestResourceKind *after_kinds;
/* Sanity check the arguments */
if (nkinds < 0)
elog(ERROR, "nkinds must be >= 0");
if (nkinds <= 0)
elog(ERROR, "nkinds must be > 0");
if (nremember_bl < 0)
elog(ERROR, "nremember_bl must be >= 0");
if (nforget_bl < 0 || nforget_bl > nremember_bl)
elog(ERROR, "nforget_bl must between 0 and 'nremember_bl'");
if (nremember_al < 0)
elog(ERROR, "nremember_al must be greater than zero");
elog(ERROR, "nremember_al must be >= 0");
if (nforget_al < 0 || nforget_al > nremember_al)
elog(ERROR, "nforget_al must between 0 and 'nremember_al'");