• Tom Lane's avatar
    Refactor parser's generation of Var nodes. · b541e9ac
    Tom Lane authored
    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
    b541e9ac
parse_relation.h 4.57 KB