mirror of
https://github.com/postgres/postgres.git
synced 2025-06-29 10:41:53 +03:00
Refactor parser's generation of Var nodes.
Instead of passing around a pointer to the RangeTblEntry that provides the desired column, pass a pointer to the associated ParseNamespaceItem. The RTE is trivially reachable from the nsitem, and having the ParseNamespaceItem allows access to additional information. As proof of concept for that, add the rangetable index to ParseNamespaceItem, and use that to get rid of RTERangeTablePosn searches. (I have in mind to teach the parser to generate some different representation for Vars that are nullable by outer joins, and keeping the necessary information in ParseNamespaceItems seems like a reasonable approach to that. But whether that ever happens or not, this seems like good cleanup.) Also refactor the code around scanRTEForColumn so that the "fuzzy match" stuff does not leak out of parse_relation.c. Discussion: https://postgr.es/m/26144.1576858373@sss.pgh.pa.us
This commit is contained in:
@ -180,27 +180,6 @@ pcb_error_callback(void *arg)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* make_var
|
||||
* Build a Var node for an attribute identified by RTE and attrno
|
||||
*/
|
||||
Var *
|
||||
make_var(ParseState *pstate, RangeTblEntry *rte, int attrno, int location)
|
||||
{
|
||||
Var *result;
|
||||
int vnum,
|
||||
sublevels_up;
|
||||
Oid vartypeid;
|
||||
int32 type_mod;
|
||||
Oid varcollid;
|
||||
|
||||
vnum = RTERangeTablePosn(pstate, rte, &sublevels_up);
|
||||
get_rte_attribute_type(rte, attrno, &vartypeid, &type_mod, &varcollid);
|
||||
result = makeVar(vnum, attrno, vartypeid, type_mod, varcollid, sublevels_up);
|
||||
result->location = location;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* transformContainerType()
|
||||
* Identify the types involved in a subscripting operation for container
|
||||
|
Reference in New Issue
Block a user