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

Commit5c837dd

Browse files
committed
Rethink flex flags for syncrep_scanner.l.
Using flex's -i switch to achieve case-insensitivity is not a very safepractice, because the scanner's behavior may then depend on the localethat flex was invoked in. In the particular example at hand, that'snot academic: the possible matches for "FIRST" will be different in aTurkish locale than elsewhere. Do it the hard way instead, as ourother scanners do.Also, drop use of -b -CF -p, because this scanner is only used whenparsing the contents of a GUC variable. That's not done often, andthe amount of text to be parsed can be expected to be trivial, soprioritizing scanner speed over code size seems like quite the wrongtradeoff. Using flex's default optimization options reduces thesize of syncrep_gram.o by more than 50%.The case-insensitivity problem is new in HEAD (cf commit3901fd7).The poor choice of optimization flags exists also in 9.6, but it doesn'tseem important enough to back-patch.Discussion:https://postgr.es/m/24403.1495225931@sss.pgh.pa.us
1 parenta95410e commit5c837dd

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

‎src/backend/replication/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ include $(top_srcdir)/src/backend/common.mk
2424
# repl_scanner is compiled as part of repl_gram
2525
repl_gram.o: repl_scanner.c
2626

27-
# syncrep_scanner iscomplied as part of syncrep_gram
27+
# syncrep_scanner iscompiled as part of syncrep_gram
2828
syncrep_gram.o: syncrep_scanner.c
29-
syncrep_scanner.c: FLEXFLAGS = -CF -p -i
30-
syncrep_scanner.c: FLEX_NO_BACKUP=yes
3129

3230
# repl_gram.c, repl_scanner.c, syncrep_gram.c and syncrep_scanner.c
3331
# are in the distribution tarball, so they are not cleaned here.
32+
# (Our parent Makefile takes care of them during maintainer-clean.)

‎src/backend/replication/syncrep_scanner.l

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ xdinside[^"]+
6464
%%
6565
{space}+{/* ignore */ }
6666

67-
ANY{return ANY; }
68-
FIRST{return FIRST; }
67+
/* brute-force case insensitivity is safer than relying on flex -i */
68+
69+
[Aa][Nn][Yy]{return ANY; }
70+
[Ff][Ii][Rr][Ss][Tt]{return FIRST; }
6971

7072
{xdstart}{
7173
initStringInfo(&xdbuf);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp