postgresql/src/include/parser
Tom Lane 5815696bc6 Make parser rely more heavily on the ParseNamespaceItem data structure.
When I added the ParseNamespaceItem data structure (in commit 5ebaaa494),
it wasn't very tightly integrated into the parser's APIs.  In the wake of
adding p_rtindex to that struct (commit b541e9acc), there is a good reason
to make more use of it: by passing around ParseNamespaceItem pointers
instead of bare RTE pointers, we can get rid of various messy methods for
passing back or deducing the rangetable index of an RTE during parsing.
Hence, refactor the addRangeTableEntryXXX functions to build and return
a ParseNamespaceItem struct, not just the RTE proper; and replace
addRTEtoQuery with addNSItemToQuery, which is passed a ParseNamespaceItem
rather than building one internally.

Also, add per-column data (a ParseNamespaceColumn array) to each
ParseNamespaceItem.  These arrays are built during addRangeTableEntryXXX,
where we have column type data at hand so that it's nearly free to fill
the data structure.  Later, when we need to build Vars referencing RTEs,
we can use the ParseNamespaceColumn info to avoid the rather expensive
operations done in get_rte_attribute_type() or expandRTE().
get_rte_attribute_type() is indeed dead code now, so I've removed it.
This makes for a useful improvement in parse analysis speed, around 20%
in one moderately-complex test query.

The ParseNamespaceColumn structs also include Var identity information
(varno/varattno).  That info isn't actually being used in this patch,
except that p_varno == 0 is a handy test for a dropped column.
A follow-on patch will make more use of it.

Discussion: https://postgr.es/m/2461.1577764221@sss.pgh.pa.us
2020-01-02 11:29:01 -05:00
..
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
analyze.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
gramparse.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
kwlist.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parse_agg.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parse_clause.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parse_coerce.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parse_collate.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parse_cte.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parse_enr.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parse_expr.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parse_func.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parse_node.h Make parser rely more heavily on the ParseNamespaceItem data structure. 2020-01-02 11:29:01 -05:00
parse_oper.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parse_param.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parse_relation.h Make parser rely more heavily on the ParseNamespaceItem data structure. 2020-01-02 11:29:01 -05:00
parse_target.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parse_type.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parse_utilcmd.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parser.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parsetree.h Make parser rely more heavily on the ParseNamespaceItem data structure. 2020-01-02 11:29:01 -05:00
scanner.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
scansup.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00