mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03:00
Fix handling of pgbench's hash when no argument is provided
Depending on the platform used, this can cause a crash in the worst case, or an unhelpful error message, so fail gracefully. Author: Fabien Coelho Discussion: https://postgr.es/m/alpine.DEB.2.21.1807262302550.29874@lancre Backpatch: 11-, where hash() has been added in pgbench.
This commit is contained in:
@ -467,7 +467,7 @@ make_func(yyscan_t yyscanner, int fnumber, PgBenchExprList *args)
|
||||
|
||||
/* hash functions with optional seed argument */
|
||||
case PGBENCH_NARGS_HASH:
|
||||
if (len > 2)
|
||||
if (len < 1 || len > 2)
|
||||
expr_yyerror_more(yyscanner, "unexpected number of arguments",
|
||||
PGBENCH_FUNCTIONS[fnumber].fname);
|
||||
|
||||
|
Reference in New Issue
Block a user