diff options
author | Michael Paquier <michael@paquier.xyz> | 2018-07-27 13:40:24 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2018-07-27 13:40:24 +0900 |
commit | 39d51fe87dae843574fa2349128679800bfe7ccd (patch) | |
tree | a81cd2dc72b8baad0e7d27c8eca78fd58f6708b1 /src/bin/pgbench/exprparse.y | |
parent | 9f77ad2672f1be0c475428db7bf52b572af3c65f (diff) | |
download | postgresql-39d51fe87dae843574fa2349128679800bfe7ccd.tar.gz postgresql-39d51fe87dae843574fa2349128679800bfe7ccd.zip |
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.
Diffstat (limited to 'src/bin/pgbench/exprparse.y')
-rw-r--r-- | src/bin/pgbench/exprparse.y | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bin/pgbench/exprparse.y b/src/bin/pgbench/exprparse.y index 66288632d11..f7c56cc6a31 100644 --- a/src/bin/pgbench/exprparse.y +++ b/src/bin/pgbench/exprparse.y @@ -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); |