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

Commit3ea7e01

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 parentc374017 commit3ea7e01

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
@@ -67,7 +67,7 @@ nonspace[^ \t\r\f\v\n]
6767
newline[\n]
6868

6969
/* Line continuation marker */
70-
continuation\\{newline}
70+
continuation\\\r?{newline}
7171

7272
/* Exclusive states */
7373
%xEXPR
@@ -104,8 +104,12 @@ continuation\\{newline}
104104
* a continuation marker just after a word:
105105
*/
106106
{nonspace}+{continuation}{
107-
/* Found "word\\\n", emit and return just "word" */
108-
psqlscan_emit(cur_state, yytext, yyleng -2);
107+
/* Found "word\\\r?\n", emit and return just "word" */
108+
intwordlen = yyleng -2;
109+
if (yytext[wordlen] =='\r')
110+
wordlen--;
111+
Assert(yytext[wordlen] =='\\');
112+
psqlscan_emit(cur_state, yytext, wordlen);
109113
return1;
110114
}
111115

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp