diff --git a/src/common/backend/parser/parse_func.cpp b/src/common/backend/parser/parse_func.cpp index b2c595164..1e7e48f85 100644 --- a/src/common/backend/parser/parse_func.cpp +++ b/src/common/backend/parser/parse_func.cpp @@ -1454,7 +1454,14 @@ FuncCandidateList sort_candidate_func_list(FuncCandidateList oldCandidates) } candidates[smallestIndex] = NULL; } - + + for (int i = 0; i < size; i++) { + if (candidates[i] != NULL) { + lastCandidate->next = candidates[i]; + lastCandidate = lastCandidate->next; + } + } + lastCandidate->next = NULL; pfree(candidates); return sortedCandidates; }