Skip to content

Commit 18730f8

Browse files
committed
Fix inappropriate error messages for Hot Standby misconfiguration errors.
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
1 parent 26f4fc0 commit 18730f8

File tree

1 file changed

+5
-4
lines changed
  • src/backend/access/transam

1 file changed

+5
-4
lines changed

src/backend/access/transam/xlog.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5944,9 +5944,10 @@ GetXLogReceiptTime(TimestampTz *rtime, bool *fromStream)
59445944
*/
59455945
#define RecoveryRequiresIntParameter(param_name, currValue, minValue) \
59465946
do { \
5947-
if (currValue < minValue) \
5947+
if ((currValue) < (minValue)) \
59485948
ereport(ERROR, \
5949-
(errmsg("hot standby is not possible because " \
5949+
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
5950+
errmsg("hot standby is not possible because " \
59505951
"%s = %d is a lower setting than on the master server " \
59515952
"(its value was %d)", \
59525953
param_name, \
@@ -5987,10 +5988,10 @@ CheckRequiredParameterValues(void)
59875988
RecoveryRequiresIntParameter("max_connections",
59885989
MaxConnections,
59895990
ControlFile->MaxConnections);
5990-
RecoveryRequiresIntParameter("max_prepared_xacts",
5991+
RecoveryRequiresIntParameter("max_prepared_transactions",
59915992
max_prepared_xacts,
59925993
ControlFile->max_prepared_xacts);
5993-
RecoveryRequiresIntParameter("max_locks_per_xact",
5994+
RecoveryRequiresIntParameter("max_locks_per_transaction",
59945995
max_locks_per_xact,
59955996
ControlFile->max_locks_per_xact);
59965997
}

0 commit comments

Comments
 (0)