Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3899caf

Browse files
committed
Fix broken definition for function name in pgbench's exprscan.l.
As written, this would accept e.g. 123e9 as a function name. Asidefrom being mildly astonishing, that would come back to haunt us ifwe ever try to add float constants to the expression syntax. Insistthat function names start with letters (or at least non-digits).In passing reset yyline as well as yycol when starting a new expression.This variable is useless since it's used nowhere, but if we're goingto have it we should have it act sanely.
1 parentfd45d16 commit3899caf

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

‎src/bin/pgbench/exprscan.l

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ static int expr_col = 0;
3535
%optionwarn
3636
%optionprefix="expr_yy"
3737

38+
alpha[a-zA-Z_]
39+
digit[0-9]
40+
alnum[a-zA-Z0-9_]
3841
space[\t\r\f]
3942

4043
%%
@@ -48,17 +51,17 @@ space[ \t\r\f]
4851
")"{ yycol += yyleng;return')'; }
4952
","{ yycol += yyleng;return','; }
5053

51-
:[a-zA-Z0-9_]+{
54+
:{alnum}+{
5255
yycol += yyleng;
5356
yylval.str =pg_strdup(yytext +1);
5457
return VARIABLE;
5558
}
56-
[0-9]+{
59+
{digit}+{
5760
yycol += yyleng;
5861
yylval.ival =strtoint64(yytext);
5962
return INTEGER;
6063
}
61-
[a-zA-Z0-9_]+{
64+
{alpha}{alnum}+{
6265
yycol += yyleng;
6366
yylval.str =pg_strdup(yytext);
6467
return FUNCTION;
@@ -107,8 +110,8 @@ expr_scanner_init(const char *str, const char *source,
107110
expr_command = (char *) cmd;
108111
expr_col = (int) ecol;
109112

110-
/* resetcolumn count for this scan */
111-
yycol =0;
113+
/* reseterror pointers for this scan */
114+
yycol =yyline =0;
112115

113116
/*
114117
* Might be left over after error

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp