summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2022-01-24 17:09:46 +0000
committerTom Lane2022-01-24 17:09:46 +0000
commit3c06ec6d1412a6ebf05ee0566b5c05969f0b541f (patch)
tree484aa12cfbc481fa54705c5687ddfee258e69c09
parentf032f63e727c1ab07603b3d1cd88d50f850d5738 (diff)
Remember to reset yy_start state when firing up repl_scanner.l.
Without this, we get odd behavior when the previous cycle of lexing exited in a non-default exclusive state. Every other copy of this code is aware that it has to do BEGIN(INITIAL), but repl_scanner.l did not get that memo. The real-world impact of this is probably limited, since most replication clients would abandon their connection after getting a syntax error. Still, it's a bug. This mistake is old, so back-patch to all supported branches. Discussion: https://postgr.es/m/[email protected]
-rw-r--r--src/backend/replication/repl_scanner.l3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/replication/repl_scanner.l b/src/backend/replication/repl_scanner.l
index c80f158095..81ac41e9d4 100644
--- a/src/backend/replication/repl_scanner.l
+++ b/src/backend/replication/repl_scanner.l
@@ -247,6 +247,9 @@ replication_scanner_init(const char *str)
memcpy(scanbuf, str, slen);
scanbuf[slen] = scanbuf[slen + 1] = YY_END_OF_BUFFER_CHAR;
scanbufhandle = yy_scan_buffer(scanbuf, slen + 2);
+
+ /* Make sure we start in proper state */
+ BEGIN(INITIAL);
}
void