mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	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
This commit is contained in:
		@@ -5944,9 +5944,10 @@ GetXLogReceiptTime(TimestampTz *rtime, bool *fromStream)
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
#define RecoveryRequiresIntParameter(param_name, currValue, minValue) \
 | 
					#define RecoveryRequiresIntParameter(param_name, currValue, minValue) \
 | 
				
			||||||
do { \
 | 
					do { \
 | 
				
			||||||
	if (currValue < minValue) \
 | 
						if ((currValue) < (minValue)) \
 | 
				
			||||||
		ereport(ERROR, \
 | 
							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 " \
 | 
											"%s = %d is a lower setting than on the master server " \
 | 
				
			||||||
						"(its value was %d)", \
 | 
											"(its value was %d)", \
 | 
				
			||||||
						param_name, \
 | 
											param_name, \
 | 
				
			||||||
@@ -5987,10 +5988,10 @@ CheckRequiredParameterValues(void)
 | 
				
			|||||||
		RecoveryRequiresIntParameter("max_connections",
 | 
							RecoveryRequiresIntParameter("max_connections",
 | 
				
			||||||
									 MaxConnections,
 | 
														 MaxConnections,
 | 
				
			||||||
									 ControlFile->MaxConnections);
 | 
														 ControlFile->MaxConnections);
 | 
				
			||||||
		RecoveryRequiresIntParameter("max_prepared_xacts",
 | 
							RecoveryRequiresIntParameter("max_prepared_transactions",
 | 
				
			||||||
									 max_prepared_xacts,
 | 
														 max_prepared_xacts,
 | 
				
			||||||
									 ControlFile->max_prepared_xacts);
 | 
														 ControlFile->max_prepared_xacts);
 | 
				
			||||||
		RecoveryRequiresIntParameter("max_locks_per_xact",
 | 
							RecoveryRequiresIntParameter("max_locks_per_transaction",
 | 
				
			||||||
									 max_locks_per_xact,
 | 
														 max_locks_per_xact,
 | 
				
			||||||
									 ControlFile->max_locks_per_xact);
 | 
														 ControlFile->max_locks_per_xact);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user