1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-25 13:17:41 +03:00

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
This commit is contained in:
Peter Eisentraut
2021-03-31 10:52:37 +02:00
parent 91c5a8caaa
commit 66392d3965
3 changed files with 28 additions and 17 deletions

View File

@@ -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? */