pgsql: Modestly improve pgbench's checking for invalid ranges. - Mailing list pgsql-committers

From Robert Haas
Subject pgsql: Modestly improve pgbench's checking for invalid ranges.
Date
Msg-id E1QpNfQ-0002AR-BR@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Modestly improve pgbench's checking for invalid ranges.

The old check against MAX_RANDOM_VALUE is clearly irrelevant since
getrand() no longer calls random().  Instead, check whether min and max
are close enough together to avoid an overflow inside getrand(), as
suggested by Tom Lane.  This is still somewhat silly, because we're
using atoi(), which doesn't check for overflow anyway and (at least on
my system) will cheerfully return 0 when given "4294967296".  But that's
a problem for another commit.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/68cbb9f4e70b7b7ed515b5c63bafbe47d9617bf0

Modified Files
--------------
contrib/pgbench/pgbench.c |   18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)


pgsql-committers by date:

Previous
From: Robert Haas
Date:
Subject: pgsql: Tweak PQresStatus() to avoid a clang compiler warning.
Next
From: Robert Haas
Date:
Subject: pgsql: Allow per-column foreign data wrapper options.