aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-01-24 12:09:46 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2022-01-24 12:09:46 -0500
commitc94c6612da573d2789855b77a47da45a4a19cfbd (patch)
tree00a28c6b521661c1b33973aaffdf5dbf90cfbde8
parent0cbc50737864177a29430be41e5b134a29e77554 (diff)
downloadpostgresql-c94c6612da573d2789855b77a47da45a4a19cfbd.tar.gz
postgresql-c94c6612da573d2789855b77a47da45a4a19cfbd.zip
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/1874781.1643035952@sss.pgh.pa.us
-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 452ad9fc278..6fca2a91b63 100644
--- a/src/backend/replication/repl_scanner.l
+++ b/src/backend/replication/repl_scanner.l
@@ -245,6 +245,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