Thread

  1. Review comments on createPartitions() in pgbench.c

    vellaipandiyan sm <vellaipandiyan.sm@gmail.com> — 2026-05-15T04:15:42Z

    Hello developer people,
    
    I was reviewing the createPartitions() function in pgbench.c and noticed a
    few potential robustness concerns that may be worth reviewing.
    
    Observations:
    
       -
    
       possible overflow readability concern in the part_size calculation
       -
    
       reliance on Assert(partitions > 0) for runtime safety
       -
    
       PQExpBuffer reuse without explicit resetPQExpBuffer()
       -
    
       possible edge-case considerations for uneven RANGE partition boundaries
    
    I have not yet reproduced a failure case, so these are currently review
    observations rather than confirmed bugs.
    
    Possible improvement for the calculation section:
    
    int64 total = (int64) naccounts * scale;
    int64 part_size = (total + partitions - 1) / partitions;
    
    Thank you for your work on PostgreSQL.
    
    Regards,
    Vellaipandiyan