Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0038c1e

Browse files
committed
Use ereport(ERROR) instead of Assert() to emit syncrep_parser error.
The existing code would either Assert or generate an invalid SyncRepConfig variable, neither of which is desirable. A regular error should be thrown instead. This commit silences compiler warning in non assertion-enabled builds. Per report from Jeff Janes. Suggested fix by Tom Lane.
1 parent f73b2bb commit 0038c1e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/backend/replication/syncrep.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -886,9 +886,14 @@ SyncRepUpdateConfig(void)
886886
*/
887887
syncrep_scanner_init(SyncRepStandbyNames);
888888
parse_rc = syncrep_yyparse();
889-
Assert(parse_rc == 0);
890889
syncrep_scanner_finish();
891890

891+
if (parse_rc != 0)
892+
ereport(ERROR,
893+
(errcode(ERRCODE_SYNTAX_ERROR),
894+
errmsg_internal("synchronous_standby_names parser returned %d",
895+
parse_rc)));
896+
892897
SyncRepConfig = syncrep_parse_result;
893898
syncrep_parse_result = NULL;
894899
}

0 commit comments

Comments
 (0)