Commits

Anonymous committed cf63c64

Fix portability issue in ordered-set patch.

Overly compact coding in makeOrderedSetArgs() led to a platform dependency:
if the compiler chose to execute the subexpressions in the wrong order,
list_length() might get applied to an already-modified List, giving a
value we didn't want. Per buildfarm.

  • Participants
  • Parent commits 8d65da1
  • Branches jsonbuild, master

Comments (0)

Files changed (1)

File src/backend/parser/gram.y

 				   core_yyscan_t yyscanner)
 {
 	FunctionParameter *lastd = (FunctionParameter *) llast(directargs);
+	int			ndirectargs;
 
 	/* No restriction unless last direct arg is VARIADIC */
 	if (lastd->mode == FUNC_PARAM_VARIADIC)
 		orderedargs = NIL;
 	}
 
+	/* don't merge into the next line, as list_concat changes directargs */
+	ndirectargs = list_length(directargs);
+
 	return list_make2(list_concat(directargs, orderedargs),
-					  makeInteger(list_length(directargs)));
+					  makeInteger(ndirectargs));
 }
 
 /* insertSelectOptions()