]> granicus.if.org Git - postgresql/commitdiff
Fix inappropriate error messages for Hot Standby misconfiguration errors.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 6 Sep 2012 01:49:08 +0000 (21:49 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 6 Sep 2012 01:49:08 +0000 (21:49 -0400)
Give the correct name of the GUC parameter being complained of.
Also, emit a more suitable SQLSTATE (INVALID_PARAMETER_VALUE,
not the default INTERNAL_ERROR).

Gurjeet Singh, errcode adjustment by me

src/backend/access/transam/xlog.c

index 911ea8a286537c48a9812b6dbdb8ac3e07c68fcb..787eda2a61ec793b947469b1303d476c27d30430 100644 (file)
@@ -5989,9 +5989,10 @@ GetXLogReceiptTime(TimestampTz *rtime, bool *fromStream)
  */
 #define RecoveryRequiresIntParameter(param_name, currValue, minValue) \
 do { \
-       if (currValue < minValue) \
+       if ((currValue) < (minValue)) \
                ereport(ERROR, \
-                               (errmsg("hot standby is not possible because " \
+                               (errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
+                                errmsg("hot standby is not possible because " \
                                                "%s = %d is a lower setting than on the master server " \
                                                "(its value was %d)", \
                                                param_name, \
@@ -6032,10 +6033,10 @@ CheckRequiredParameterValues(void)
                RecoveryRequiresIntParameter("max_connections",
                                                                         MaxConnections,
                                                                         ControlFile->MaxConnections);
-               RecoveryRequiresIntParameter("max_prepared_xacts",
+               RecoveryRequiresIntParameter("max_prepared_transactions",
                                                                         max_prepared_xacts,
                                                                         ControlFile->max_prepared_xacts);
-               RecoveryRequiresIntParameter("max_locks_per_xact",
+               RecoveryRequiresIntParameter("max_locks_per_transaction",
                                                                         max_locks_per_xact,
                                                                         ControlFile->max_locks_per_xact);
        }