]> granicus.if.org Git - postgresql/commitdiff
Use ereport(ERROR) instead of Assert() to emit syncrep_parser error.
authorFujii Masao <fujii@postgresql.org>
Mon, 11 Apr 2016 06:52:27 +0000 (15:52 +0900)
committerFujii Masao <fujii@postgresql.org>
Mon, 11 Apr 2016 06:52:27 +0000 (15:52 +0900)
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.

src/backend/replication/syncrep.c

index cb6b5e5317896159310624faf47cbace1921e7fc..3c9142eddca1407dc088ebe91d9357adb3162fcf 100644 (file)
@@ -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;
 }