mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Remove unnecessary local variables to work around an icc optimization bug.
Buildfarm member dunlin has been crashing since commit 8b49a60
, but other
machines seem fine with that code. It turns out that removing the local
variables in ordered_set_startup() that are copies of fields in "qstate"
dodges the problem. This might cost a few cycles on register-rich
machines, but it's probably a wash on others, and in any case this code
isn't performance-critical. Thanks to Jeremy Drake for off-list
investigation.
This commit is contained in:
parent
192b4aacad
commit
faab7a957d
@ -159,27 +159,17 @@ ordered_set_startup(FunctionCallInfo fcinfo, bool use_tuples)
|
||||
if (use_tuples)
|
||||
{
|
||||
bool ishypothetical = (aggref->aggkind == AGGKIND_HYPOTHETICAL);
|
||||
AttrNumber *sortColIdx;
|
||||
Oid *sortOperators;
|
||||
Oid *eqOperators;
|
||||
Oid *sortCollations;
|
||||
bool *sortNullsFirsts;
|
||||
ListCell *lc;
|
||||
int i;
|
||||
|
||||
if (ishypothetical)
|
||||
numSortCols++; /* make space for flag column */
|
||||
qstate->numSortCols = numSortCols;
|
||||
qstate->sortColIdx = sortColIdx =
|
||||
(AttrNumber *) palloc(numSortCols * sizeof(AttrNumber));
|
||||
qstate->sortOperators = sortOperators =
|
||||
(Oid *) palloc(numSortCols * sizeof(Oid));
|
||||
qstate->eqOperators = eqOperators =
|
||||
(Oid *) palloc(numSortCols * sizeof(Oid));
|
||||
qstate->sortCollations = sortCollations =
|
||||
(Oid *) palloc(numSortCols * sizeof(Oid));
|
||||
qstate->sortNullsFirsts = sortNullsFirsts =
|
||||
(bool *) palloc(numSortCols * sizeof(bool));
|
||||
qstate->sortColIdx = (AttrNumber *) palloc(numSortCols * sizeof(AttrNumber));
|
||||
qstate->sortOperators = (Oid *) palloc(numSortCols * sizeof(Oid));
|
||||
qstate->eqOperators = (Oid *) palloc(numSortCols * sizeof(Oid));
|
||||
qstate->sortCollations = (Oid *) palloc(numSortCols * sizeof(Oid));
|
||||
qstate->sortNullsFirsts = (bool *) palloc(numSortCols * sizeof(bool));
|
||||
|
||||
i = 0;
|
||||
foreach(lc, sortlist)
|
||||
@ -191,22 +181,22 @@ ordered_set_startup(FunctionCallInfo fcinfo, bool use_tuples)
|
||||
/* the parser should have made sure of this */
|
||||
Assert(OidIsValid(sortcl->sortop));
|
||||
|
||||
sortColIdx[i] = tle->resno;
|
||||
sortOperators[i] = sortcl->sortop;
|
||||
eqOperators[i] = sortcl->eqop;
|
||||
sortCollations[i] = exprCollation((Node *) tle->expr);
|
||||
sortNullsFirsts[i] = sortcl->nulls_first;
|
||||
qstate->sortColIdx[i] = tle->resno;
|
||||
qstate->sortOperators[i] = sortcl->sortop;
|
||||
qstate->eqOperators[i] = sortcl->eqop;
|
||||
qstate->sortCollations[i] = exprCollation((Node *) tle->expr);
|
||||
qstate->sortNullsFirsts[i] = sortcl->nulls_first;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (ishypothetical)
|
||||
{
|
||||
/* Add an integer flag column as the last sort column */
|
||||
sortColIdx[i] = list_length(aggref->args) + 1;
|
||||
sortOperators[i] = Int4LessOperator;
|
||||
eqOperators[i] = Int4EqualOperator;
|
||||
sortCollations[i] = InvalidOid;
|
||||
sortNullsFirsts[i] = false;
|
||||
qstate->sortColIdx[i] = list_length(aggref->args) + 1;
|
||||
qstate->sortOperators[i] = Int4LessOperator;
|
||||
qstate->eqOperators[i] = Int4EqualOperator;
|
||||
qstate->sortCollations[i] = InvalidOid;
|
||||
qstate->sortNullsFirsts[i] = false;
|
||||
i++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user