pgsql: Guard against division by zero in test_int128 module.

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Guard against division by zero in test_int128 module.
Date: 2025-10-25 10:11:16
Message-ID: E1vCbEy-003QP1-0n@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Guard against division by zero in test_int128 module.

When testing 128/32-bit division in the test_int128 test module, make
sure that we don't attempt to divide by zero.

While at it, use pg_prng_int64() and pg_prng_int32() to generate the
random numbers required for the tests, rather than pg_prng_uint64().
This eliminates the need for any implicit or explicit type casts.

Author: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Reported-by: Andres Freund <andres(at)anarazel(dot)de>
Discussion: https://postgr.es/m/da4wqngd6gwz5s4yf5y5f75xj7gpja62l4dbp6w4j3vs7fcjue@upvolcu4e6o2

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7e2af1fb1118a547bd831fca3afbc3ff80ebf089

Modified Files
--------------
src/test/modules/test_int128/test_int128.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2025-10-25 22:01:16 pgsql: Fix incorrect logic for caching ResultRelInfos for triggers
Previous Message Michael Paquier 2025-10-25 00:10:24 pgsql: pg_rewind: Skip copy of WAL segments generated before point of d