*** a/src/backend/utils/misc/guc.c
--- b/src/backend/utils/misc/guc.c
***************
*** 6859,6864 **** GetConfigOptionResetString(const char *name)
--- 6859,6891 ----
  	return NULL;
  }
  
+ /*
+  * quote_list_identifiers
+  *		quote each element in the given list string
+  */
+ static const char *
+ quote_list_identifiers(char *str)
+ {
+ 	StringInfoData buf;
+ 	List		   *namelist;
+ 	ListCell	   *lc;
+ 
+ 	/* Just quote the whole if this is not a list */
+ 	if (!SplitIdentifierString(str, ',', &namelist))
+ 		return quote_identifier(str);
+ 
+ 	initStringInfo(&buf);
+ 	foreach (lc, namelist)
+ 	{
+ 		char *elmstr = (char *) lfirst(lc);
+ 
+ 		if (lc != list_head(namelist))
+ 			appendStringInfoString(&buf, ", ");
+ 		appendStringInfoString(&buf, quote_identifier(elmstr));
+ 	}
+ 
+ 	return buf.data;
+ }
  
  /*
   * flatten_set_variable_args
***************
*** 6973,6979 **** flatten_set_variable_args(const char *name, List *args)
  					 * quote it if it's not a vanilla identifier.
  					 */
  					if (flags & GUC_LIST_QUOTE)
! 						appendStringInfoString(&buf, quote_identifier(val));
  					else
  						appendStringInfoString(&buf, val);
  				}
--- 7000,7018 ----
  					 * quote it if it's not a vanilla identifier.
  					 */
  					if (flags & GUC_LIST_QUOTE)
! 					{
! 						if (list_length(args) > 1)
! 							appendStringInfoString(&buf, quote_identifier(val));
! 						else
! 						{
! 							/*
! 							 * If we have only one elment, it may be a list
! 							 * that is quoted as a whole.
! 							 */
! 							appendStringInfoString(&buf,
! 												   quote_list_identifiers(val));
! 						}
! 					}
  					else
  						appendStringInfoString(&buf, val);
  				}
