Commit eb213ac
committed
Prevent duplicate escape-string warnings when using pg_stat_statements.
contrib/pg_stat_statements will sometimes run the core lexer a second time
on submitted statements. Formerly, if you had standard_conforming_strings
turned off, this led to sometimes getting two copies of any warnings
enabled by escape_string_warning. While this is probably no longer a big
deal in the field, it's a pain for regression testing.
To fix, change the lexer so it doesn't consult the escape_string_warning
GUC variable directly, but looks at a copy in the core_yy_extra_type state
struct. Then, pg_stat_statements can change that copy to disable warnings
while it's redoing the lexing.
It seemed like a good idea to make this happen for all three of the GUCs
consulted by the lexer, not just escape_string_warning. There's not an
immediate use-case for callers to adjust the other two AFAIK, but making
it possible is easy enough and seems like good future-proofing.
Arguably this is a bug fix, but there doesn't seem to be enough interest to
justify a back-patch. We'd not be able to back-patch exactly as-is anyway,
for fear of breaking ABI compatibility of the struct. (We could perhaps
back-patch the addition of only escape_string_warning by adding it at the
end of the struct, where there's currently alignment padding space.)1 parent f5f2c2d commit eb213ac
File tree
3 files changed
+24
-7
lines changed- contrib/pg_stat_statements
- src
- backend/parser
- include/parser
3 files changed
+24
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2816 | 2816 | | |
2817 | 2817 | | |
2818 | 2818 | | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
2819 | 2822 | | |
2820 | 2823 | | |
2821 | 2824 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
508 | | - | |
| 508 | + | |
509 | 509 | | |
510 | 510 | | |
511 | 511 | | |
| |||
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
523 | | - | |
| 523 | + | |
524 | 524 | | |
525 | 525 | | |
526 | 526 | | |
| |||
622 | 622 | | |
623 | 623 | | |
624 | 624 | | |
625 | | - | |
626 | | - | |
| 625 | + | |
| 626 | + | |
627 | 627 | | |
628 | 628 | | |
629 | 629 | | |
| |||
1074 | 1074 | | |
1075 | 1075 | | |
1076 | 1076 | | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
1077 | 1081 | | |
1078 | 1082 | | |
1079 | 1083 | | |
| |||
1433 | 1437 | | |
1434 | 1438 | | |
1435 | 1439 | | |
1436 | | - | |
| 1440 | + | |
1437 | 1441 | | |
1438 | 1442 | | |
1439 | 1443 | | |
| |||
1443 | 1447 | | |
1444 | 1448 | | |
1445 | 1449 | | |
1446 | | - | |
| 1450 | + | |
1447 | 1451 | | |
1448 | 1452 | | |
1449 | 1453 | | |
| |||
1458 | 1462 | | |
1459 | 1463 | | |
1460 | 1464 | | |
1461 | | - | |
| 1465 | + | |
1462 | 1466 | | |
1463 | 1467 | | |
1464 | 1468 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
80 | 90 | | |
81 | 91 | | |
82 | 92 | | |
| |||
0 commit comments