aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pgbench/exprscan.l
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pgbench/exprscan.l')
-rw-r--r--src/bin/pgbench/exprscan.l21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/bin/pgbench/exprscan.l b/src/bin/pgbench/exprscan.l
index 61c20364ed1..51a9f8f86f7 100644
--- a/src/bin/pgbench/exprscan.l
+++ b/src/bin/pgbench/exprscan.l
@@ -195,16 +195,31 @@ notnull [Nn][Oo][Tt][Nn][Uu][Ll][Ll]
yylval->bval = false;
return BOOLEAN_CONST;
}
+"9223372036854775808" {
+ /*
+ * Special handling for PG_INT64_MIN, which can't
+ * accurately be represented here, as the minus sign is
+ * lexed separately and INT64_MIN can't be represented as
+ * a positive integer.
+ */
+ return MAXINT_PLUS_ONE_CONST;
+ }
{digit}+ {
- yylval->ival = strtoint64(yytext);
+ if (!strtoint64(yytext, true, &yylval->ival))
+ expr_yyerror_more(yyscanner, "bigint constant overflow",
+ strdup(yytext));
return INTEGER_CONST;
}
{digit}+(\.{digit}*)?([eE][-+]?{digit}+)? {
- yylval->dval = atof(yytext);
+ if (!strtodouble(yytext, true, &yylval->dval))
+ expr_yyerror_more(yyscanner, "double constant overflow",
+ strdup(yytext));
return DOUBLE_CONST;
}
\.{digit}+([eE][-+]?{digit}+)? {
- yylval->dval = atof(yytext);
+ if (!strtodouble(yytext, true, &yylval->dval))
+ expr_yyerror_more(yyscanner, "double constant overflow",
+ strdup(yytext));
return DOUBLE_CONST;
}
{alpha}{alnum}* {