*** a/src/backend/utils/adt/pg_locale.c
--- b/src/backend/utils/adt/pg_locale.c
***************
*** 229,234 **** check_locale(int category, const char *value)
--- 229,241 ----
  	char	   *save;
  	bool		ret;
  
+ 	/*
+ 	 * The empty string is not a valid locale; it causes the locale to be set
+ 	 * from the environment, which is not what we want.
+ 	 */
+ 	if (strcmp(value, "") == 0)
+ 		return false;
+ 
  	save = setlocale(category, NULL);
  	if (!save)
  		return false;			/* won't happen, we hope */
