diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
new file mode 100644
index 3c74873..e8c2a34
*** a/src/backend/commands/functioncmds.c
--- b/src/backend/commands/functioncmds.c
*************** interpret_func_parallel(DefElem *defel)
*** 610,616 ****
   * The input and result may be NULL to signify a null entry.
   */
  static ArrayType *
! update_proconfig_value(ArrayType *a, List *set_items)
  {
  	ListCell   *l;
  
--- 610,616 ----
   * The input and result may be NULL to signify a null entry.
   */
  static ArrayType *
! update_proconfig_value(ArrayType *a, List *set_items, bool allow_reset)
  {
  	ListCell   *l;
  
*************** update_proconfig_value(ArrayType *a, Lis
*** 626,633 ****
  
  			if (valuestr)
  				a = GUCArrayAdd(a, sstmt->name, valuestr);
! 			else				/* RESET */
! 				a = GUCArrayDelete(a, sstmt->name);
  		}
  	}
  
--- 626,640 ----
  
  			if (valuestr)
  				a = GUCArrayAdd(a, sstmt->name, valuestr);
! 			else
! 				if (allow_reset) /* RESET */
! 					a = GUCArrayDelete(a, sstmt->name);
! 				else {
! 					ereport(ERROR,
! 							(errcode(ERRCODE_SYNTAX_ERROR),
! 							 errmsg("Cannot RESET or SET to DEFAULT when creating a function or a procedure")));
! 					return NULL;				/* keep compiler quiet */
! 				}
  		}
  	}
  
*************** compute_function_attributes(ParseState *
*** 770,776 ****
  	if (leakproof_item)
  		*leakproof_p = intVal(leakproof_item->arg);
  	if (set_items)
! 		*proconfig = update_proconfig_value(NULL, set_items);
  	if (cost_item)
  	{
  		*procost = defGetNumeric(cost_item);
--- 777,783 ----
  	if (leakproof_item)
  		*leakproof_p = intVal(leakproof_item->arg);
  	if (set_items)
! 		*proconfig = update_proconfig_value(NULL, set_items, false);
  	if (cost_item)
  	{
  		*procost = defGetNumeric(cost_item);
*************** AlterFunction(ParseState *pstate, AlterF
*** 1279,1285 ****
  		a = isnull ? NULL : DatumGetArrayTypeP(datum);
  
  		/* update according to each SET or RESET item, left to right */
! 		a = update_proconfig_value(a, set_items);
  
  		/* update the tuple */
  		memset(repl_repl, false, sizeof(repl_repl));
--- 1286,1292 ----
  		a = isnull ? NULL : DatumGetArrayTypeP(datum);
  
  		/* update according to each SET or RESET item, left to right */
! 		a = update_proconfig_value(a, set_items, true);
  
  		/* update the tuple */
  		memset(repl_repl, false, sizeof(repl_repl));