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

Commitdb37ab2

Browse files
committed
Fix pgbench lexer's "continuation" rule to cope with Windows newlines.
Our general practice in frontend code is to accept input with eitherUnix-style newlines (\n) or DOS-style (\r\n). pgbench was mostly downwith that, but its rule for line continuations (backslash-newline) wasnot. This had been masked on Windows buildfarm machines before commit0ba06e0 by use of Windows text mode to read files. We could have fixedit by forcing text mode again, but it's better to fix the parsing codeso that Windows-style text files on Unix systems don't cause problems.Back-patch to v10 where pgbench grew line continuations.Discussion:https://postgr.es/m/17194.1537191697@sss.pgh.pa.us
1 parentf9907c6 commitdb37ab2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

‎src/bin/pgbench/exprscan.l

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ nonspace[^ \t\r\f\v\n]
6969
newline[\n]
7070

7171
/* Line continuation marker */
72-
continuation\\{newline}
72+
continuation\\\r?{newline}
7373

7474
/* case insensitive keywords */
7575
and[Aa][Nn][Dd]
@@ -122,8 +122,12 @@ notnull[Nn][Oo][Tt][Nn][Uu][Ll][Ll]
122122
* a continuation marker just after a word:
123123
*/
124124
{nonspace}+{continuation}{
125-
/* Found "word\\\n", emit and return just "word" */
126-
psqlscan_emit(cur_state, yytext, yyleng -2);
125+
/* Found "word\\\r?\n", emit and return just "word" */
126+
intwordlen = yyleng -2;
127+
if (yytext[wordlen] =='\r')
128+
wordlen--;
129+
Assert(yytext[wordlen] =='\\');
130+
psqlscan_emit(cur_state, yytext, wordlen);
127131
return1;
128132
}
129133

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp