1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Avoid throwing away the error message in syncrep_yyerror.

Commit 473a575e05 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
This commit is contained in:
Robert Haas
2025-07-24 13:30:43 -04:00
parent 3151c264d4
commit dcc9820a35

View File

@ -157,17 +157,16 @@ syncrep_yyerror(SyncRepConfigData **syncrep_parse_result_p, char **syncrep_parse
{
struct yyguts_t *yyg = (struct yyguts_t *) yyscanner; /* needed for yytext
* macro */
char *syncrep_parse_error_msg = *syncrep_parse_error_msg_p;
/* report only the first error in a parse operation */
if (syncrep_parse_error_msg)
if (*syncrep_parse_error_msg_p)
return;
if (yytext[0])
syncrep_parse_error_msg = psprintf("%s at or near \"%s\"",
message, yytext);
*syncrep_parse_error_msg_p = psprintf("%s at or near \"%s\"",
message, yytext);
else
syncrep_parse_error_msg = psprintf("%s at end of input",
message);
*syncrep_parse_error_msg_p = psprintf("%s at end of input",
message);
}
void