aboutsummaryrefslogtreecommitdiff
path: root/src/include/parser/parse_node.h
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2021-03-31 10:52:37 +0200
committerPeter Eisentraut <peter@eisentraut.org>2021-03-31 10:52:37 +0200
commit66392d396508c91c2ec07a61568bf96acb663ad8 (patch)
tree0917219968a431e0fa1700d6fdd1f005a91a914c /src/include/parser/parse_node.h
parent91c5a8caaa61055959aa5fb68a00e5f690e39a34 (diff)
downloadpostgresql-66392d396508c91c2ec07a61568bf96acb663ad8.tar.gz
postgresql-66392d396508c91c2ec07a61568bf96acb663ad8.zip
Add p_names field to ParseNamespaceItem
ParseNamespaceItem had a wired-in assumption that p_rte->eref describes the table and column aliases exposed by the nsitem. This relaxes this by creating a separate p_names field in an nsitem. This is mainly preparation for a patch for JOIN USING aliases, but it saves one indirection in common code paths, so it's possibly a win on its own. Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/785329.1616455091@sss.pgh.pa.us
Diffstat (limited to 'src/include/parser/parse_node.h')
-rw-r--r--src/include/parser/parse_node.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h
index a71d7e1f74f..70739bcd5b6 100644
--- a/src/include/parser/parse_node.h
+++ b/src/include/parser/parse_node.h
@@ -227,8 +227,13 @@ struct ParseState
/*
* An element of a namespace list.
*
+ * p_names contains the table name and column names exposed by this nsitem.
+ * (Currently, it's always equal to p_rte->eref.)
+ *
+ * p_rte and p_rtindex link to the underlying rangetable entry.
+ *
* The p_nscolumns array contains info showing how to construct Vars
- * referencing corresponding elements of the RTE's colnames list.
+ * referencing the names appearing in the p_names->colnames list.
*
* Namespace items with p_rel_visible set define which RTEs are accessible by
* qualified names, while those with p_cols_visible set define which RTEs are
@@ -256,9 +261,10 @@ struct ParseState
*/
struct ParseNamespaceItem
{
+ Alias *p_names; /* Table and column names */
RangeTblEntry *p_rte; /* The relation's rangetable entry */
int p_rtindex; /* The relation's index in the rangetable */
- /* array of same length as p_rte->eref->colnames: */
+ /* array of same length as p_names->colnames: */
ParseNamespaceColumn *p_nscolumns; /* per-column data */
bool p_rel_visible; /* Relation name is visible? */
bool p_cols_visible; /* Column names visible as unqualified refs? */