diff options
author | Fujii Masao | 2016-04-11 06:52:27 +0000 |
---|---|---|
committer | Fujii Masao | 2016-04-11 06:52:27 +0000 |
commit | 0038c1e2181b520a9307aae6587e110468072392 (patch) | |
tree | 20a9f4178c345825cabac04c88ffac12f964041f | |
parent | f73b2bbbdcb387aa90ff619fe03d1924ed82b868 (diff) |
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.
-rw-r--r-- | src/backend/replication/syncrep.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c index cb6b5e53178..3c9142eddca 100644 --- a/src/backend/replication/syncrep.c +++ b/src/backend/replication/syncrep.c @@ -886,9 +886,14 @@ SyncRepUpdateConfig(void) */ syncrep_scanner_init(SyncRepStandbyNames); parse_rc = syncrep_yyparse(); - Assert(parse_rc == 0); syncrep_scanner_finish(); + if (parse_rc != 0) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg_internal("synchronous_standby_names parser returned %d", + parse_rc))); + SyncRepConfig = syncrep_parse_result; syncrep_parse_result = NULL; } |