Skip to content

Commit dcc9820

Browse files
committed
Avoid throwing away the error message in syncrep_yyerror.
Commit 473a575 purported to make this function stash the error message in *syncrep_parse_result_p, but it didn't actually. As a result, an attempt to set synchronous_standby_names to any value that does not parse resulted in a generic "parser failed." message rather than anything more specific. This fixes that. Discussion: http://postgr.es/m/CA+TgmoYF9wPNZ-Q_EMfib_espgHycY-eX__6Tzo2GpYpVXqCdQ@mail.gmail.com Backpatch-through: 18
1 parent 3151c26 commit dcc9820

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/backend/replication/syncrep_scanner.l

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,16 @@ syncrep_yyerror(SyncRepConfigData **syncrep_parse_result_p, char **syncrep_parse
157157
{
158158
struct yyguts_t *yyg = (struct yyguts_t *) yyscanner; /* needed for yytext
159159
* macro */
160-
char *syncrep_parse_error_msg = *syncrep_parse_error_msg_p;
161160

162161
/* report only the first error in a parse operation */
163-
if (syncrep_parse_error_msg)
162+
if (*syncrep_parse_error_msg_p)
164163
return;
165164
if (yytext[0])
166-
syncrep_parse_error_msg = psprintf("%s at or near \"%s\"",
167-
message, yytext);
165+
*syncrep_parse_error_msg_p = psprintf("%s at or near \"%s\"",
166+
message, yytext);
168167
else
169-
syncrep_parse_error_msg = psprintf("%s at end of input",
170-
message);
168+
*syncrep_parse_error_msg_p = psprintf("%s at end of input",
169+
message);
171170
}
172171

173172
void

0 commit comments

Comments
 (0)