mirror of
https://github.com/postgres/postgres.git
synced 2025-07-18 17:42:25 +03:00
Clean up a few failures to set collation fields in expression nodes.
I'm not sure these have any non-cosmetic implications, but I'm not sure they don't, either. In particular, ensure the CaseTestExpr generated by transformAssignmentIndirection to represent the base target column carries the correct collation, because parse_collate.c won't fix that. Tweak lsyscache.c API so that we can get the appropriate collation without an extra syscache lookup.
This commit is contained in:
@ -603,8 +603,7 @@ find_indexkey_var(PlannerInfo *root, RelOptInfo *rel, AttrNumber varattno)
|
||||
|
||||
relid = rel->relid;
|
||||
reloid = getrelid(relid, root->parse->rtable);
|
||||
get_atttypetypmod(reloid, varattno, &vartypeid, &type_mod);
|
||||
varcollid = get_attcollation(reloid, varattno);
|
||||
get_atttypetypmodcoll(reloid, varattno, &vartypeid, &type_mod, &varcollid);
|
||||
|
||||
return makeVar(relid, varattno, vartypeid, type_mod, varcollid, 0);
|
||||
}
|
||||
|
@ -2652,6 +2652,8 @@ get_switched_clauses(List *clauses, Relids outerrelids)
|
||||
temp->opfuncid = InvalidOid;
|
||||
temp->opresulttype = clause->opresulttype;
|
||||
temp->opretset = clause->opretset;
|
||||
temp->opcollid = clause->opcollid;
|
||||
temp->inputcollid = clause->inputcollid;
|
||||
temp->args = list_copy(clause->args);
|
||||
temp->location = clause->location;
|
||||
/* Commute it --- note this modifies the temp node in-place. */
|
||||
|
@ -1816,7 +1816,7 @@ CommuteOpExpr(OpExpr *clause)
|
||||
*/
|
||||
clause->opno = opoid;
|
||||
clause->opfuncid = InvalidOid;
|
||||
/* opresulttype and opretset are assumed not to change */
|
||||
/* opresulttype, opretset, opcollid, inputcollid need not change */
|
||||
|
||||
temp = linitial(clause->args);
|
||||
linitial(clause->args) = lsecond(clause->args);
|
||||
|
@ -906,6 +906,8 @@ arrayconst_startup_fn(Node *clause, PredIterInfo info)
|
||||
state->opexpr.opfuncid = saop->opfuncid;
|
||||
state->opexpr.opresulttype = BOOLOID;
|
||||
state->opexpr.opretset = false;
|
||||
state->opexpr.opcollid = InvalidOid;
|
||||
state->opexpr.inputcollid = saop->inputcollid;
|
||||
state->opexpr.args = list_copy(saop->args);
|
||||
|
||||
/* Set up a dummy Const node to hold the per-element values */
|
||||
@ -972,6 +974,8 @@ arrayexpr_startup_fn(Node *clause, PredIterInfo info)
|
||||
state->opexpr.opfuncid = saop->opfuncid;
|
||||
state->opexpr.opresulttype = BOOLOID;
|
||||
state->opexpr.opretset = false;
|
||||
state->opexpr.opcollid = InvalidOid;
|
||||
state->opexpr.inputcollid = saop->inputcollid;
|
||||
state->opexpr.args = list_copy(saop->args);
|
||||
|
||||
/* Initialize iteration variable to first member of ArrayExpr */
|
||||
|
Reference in New Issue
Block a user