diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml
index 2133bf7..868e09f 100644
--- a/doc/src/sgml/ref/pgbench.sgml
+++ b/doc/src/sgml/ref/pgbench.sgml
@@ -817,60 +817,6 @@ pgbench options> dbname>
- \setrandom varname> min> max> [ uniform | { gaussian | exponential } parameter> ]
-
-
-
-
- Sets variable varname> to a random integer value
- between the limits min> and max> inclusive.
- Each limit can be either an integer constant or a
- :>variablename> reference to a variable
- having an integer value.
-
-
-
-
-
-
- \setrandom n 1 10> or \setrandom n 1 10 uniform>
- is equivalent to \set n random(1, 10)> and uses a uniform
- distribution.
-
-
-
-
-
- \setrandom n 1 10 exponential 3.0> is equivalent to
- \set n random_exponential(1, 10, 3.0)> and uses an
- exponential distribution.
-
-
-
-
-
- \setrandom n 1 10 gaussian 2.0> is equivalent to
- \set n random_gaussian(1, 10, 2.0)>, and uses a gaussian
- distribution.
-
-
-
-
- See the documentation of these functions below for further information
- about the precise shape of these distributions, depending on the value
- of the parameter.
-
-
-
- Example:
-
-\setrandom aid 1 :naccounts gaussian 5.0
-
-
-
-
-
-
\sleep number> [ us | ms | s ]
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 8a2ada9..9f71ce1 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -1916,148 +1916,7 @@ top:
fprintf(stderr, "\n");
}
- /*
- * Note: this section could be removed, as the same functionnality
- * is available through \set xxx random_gaussian(...)
- */
- if (pg_strcasecmp(argv[0], "setrandom") == 0)
- {
- char *var;
- int64 min,
- max;
- double parameter = 0;
- char res[64];
-
- if (*argv[2] == ':')
- {
- if ((var = getVariable(st, argv[2] + 1)) == NULL)
- {
- fprintf(stderr, "%s: undefined variable \"%s\"\n",
- argv[0], argv[2]);
- st->ecnt++;
- return true;
- }
- min = strtoint64(var);
- }
- else
- min = strtoint64(argv[2]);
-
- if (*argv[3] == ':')
- {
- if ((var = getVariable(st, argv[3] + 1)) == NULL)
- {
- fprintf(stderr, "%s: undefined variable \"%s\"\n",
- argv[0], argv[3]);
- st->ecnt++;
- return true;
- }
- max = strtoint64(var);
- }
- else
- max = strtoint64(argv[3]);
-
- if (max < min)
- {
- fprintf(stderr, "%s: \\setrandom maximum is less than minimum\n",
- argv[0]);
- st->ecnt++;
- return true;
- }
-
- /*
- * Generate random number functions need to be able to subtract
- * max from min and add one to the result without overflowing.
- * Since we know max > min, we can detect overflow just by
- * checking for a negative result. But we must check both that the
- * subtraction doesn't overflow, and that adding one to the result
- * doesn't overflow either.
- */
- if (max - min < 0 || (max - min) + 1 < 0)
- {
- fprintf(stderr, "%s: \\setrandom range is too large\n",
- argv[0]);
- st->ecnt++;
- return true;
- }
-
- if (argc == 4 || /* uniform without or with "uniform" keyword */
- (argc == 5 && pg_strcasecmp(argv[4], "uniform") == 0))
- {
-#ifdef DEBUG
- printf("min: " INT64_FORMAT " max: " INT64_FORMAT " random: " INT64_FORMAT "\n", min, max, getrand(thread, min, max));
-#endif
- snprintf(res, sizeof(res), INT64_FORMAT, getrand(thread, min, max));
- }
- else if (argc == 6 &&
- ((pg_strcasecmp(argv[4], "gaussian") == 0) ||
- (pg_strcasecmp(argv[4], "exponential") == 0)))
- {
- if (*argv[5] == ':')
- {
- if ((var = getVariable(st, argv[5] + 1)) == NULL)
- {
- fprintf(stderr, "%s: invalid parameter: \"%s\"\n",
- argv[0], argv[5]);
- st->ecnt++;
- return true;
- }
- parameter = strtod(var, NULL);
- }
- else
- parameter = strtod(argv[5], NULL);
-
- if (pg_strcasecmp(argv[4], "gaussian") == 0)
- {
- if (parameter < MIN_GAUSSIAN_PARAM)
- {
- fprintf(stderr, "gaussian parameter must be at least %f (not \"%s\")\n", MIN_GAUSSIAN_PARAM, argv[5]);
- st->ecnt++;
- return true;
- }
-#ifdef DEBUG
- printf("min: " INT64_FORMAT " max: " INT64_FORMAT " random: " INT64_FORMAT "\n",
- min, max,
- getGaussianRand(thread, min, max, parameter));
-#endif
- snprintf(res, sizeof(res), INT64_FORMAT,
- getGaussianRand(thread, min, max, parameter));
- }
- else if (pg_strcasecmp(argv[4], "exponential") == 0)
- {
- if (parameter <= 0.0)
- {
- fprintf(stderr,
- "exponential parameter must be greater than zero (not \"%s\")\n",
- argv[5]);
- st->ecnt++;
- return true;
- }
-#ifdef DEBUG
- printf("min: " INT64_FORMAT " max: " INT64_FORMAT " random: " INT64_FORMAT "\n",
- min, max,
- getExponentialRand(thread, min, max, parameter));
-#endif
- snprintf(res, sizeof(res), INT64_FORMAT,
- getExponentialRand(thread, min, max, parameter));
- }
- }
- else /* this means an error somewhere in the parsing phase... */
- {
- fprintf(stderr, "%s: invalid arguments for \\setrandom\n",
- argv[0]);
- st->ecnt++;
- return true;
- }
-
- if (!putVariable(st, argv[0], argv[1], res))
- {
- st->ecnt++;
- return true;
- }
-
- st->listen = true;
- }
- else if (pg_strcasecmp(argv[0], "set") == 0)
+ if (pg_strcasecmp(argv[0], "set") == 0)
{
char res[64];
PgBenchExpr *expr = commands[st->state]->expr;
@@ -2708,49 +2567,9 @@ process_commands(char *buf, const char *source, const int lineno)
if (pg_strcasecmp(my_commands->argv[0], "setrandom") == 0)
{
- /*--------
- * parsing:
- * \setrandom variable min max [uniform]
- * \setrandom variable min max (gaussian|exponential) parameter
- */
-
- if (my_commands->argc < 4)
- {
- syntax_error(source, lineno, my_commands->line, my_commands->argv[0],
- "missing arguments", NULL, -1);
- }
-
- /* argc >= 4 */
-
- if (my_commands->argc == 4 || /* uniform without/with
- * "uniform" keyword */
- (my_commands->argc == 5 &&
- pg_strcasecmp(my_commands->argv[4], "uniform") == 0))
- {
- /* nothing to do */
- }
- else if ( /* argc >= 5 */
- (pg_strcasecmp(my_commands->argv[4], "gaussian") == 0) ||
- (pg_strcasecmp(my_commands->argv[4], "exponential") == 0))
- {
- if (my_commands->argc < 6)
- {
- syntax_error(source, lineno, my_commands->line, my_commands->argv[0],
- "missing parameter", my_commands->argv[4], -1);
- }
- else if (my_commands->argc > 6)
- {
- syntax_error(source, lineno, my_commands->line, my_commands->argv[0],
- "too many arguments", my_commands->argv[4],
- my_commands->cols[6]);
- }
- }
- else /* cannot parse, unexpected arguments */
- {
- syntax_error(source, lineno, my_commands->line, my_commands->argv[0],
- "unexpected argument", my_commands->argv[4],
- my_commands->cols[4]);
- }
+ syntax_error(source, lineno, my_commands->line, my_commands->argv[0],
+ "\\setrandom is not supported anymore, "
+ "use \\set with the random() function\n", NULL, -1);
}
else if (pg_strcasecmp(my_commands->argv[0], "set") == 0)
{