1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +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

@ -1217,9 +1217,9 @@ transformFromClauseItem(ParseState *pstate, Node *n,
* input column numbers more easily.
*/
l_nscolumns = l_nsitem->p_nscolumns;
l_colnames = l_nsitem->p_rte->eref->colnames;
l_colnames = l_nsitem->p_names->colnames;
r_nscolumns = r_nsitem->p_nscolumns;
r_colnames = r_nsitem->p_rte->eref->colnames;
r_colnames = r_nsitem->p_names->colnames;
/*
* Natural join does not explicitly specify columns; must generate
@ -1469,7 +1469,7 @@ transformFromClauseItem(ParseState *pstate, Node *n,
* Now that we know the join RTE's rangetable index, we can fix up the
* res_nscolumns data in places where it should contain that.
*/
Assert(res_colindex == list_length(nsitem->p_rte->eref->colnames));
Assert(res_colindex == list_length(nsitem->p_names->colnames));
for (k = 0; k < res_colindex; k++)
{
ParseNamespaceColumn *nscol = res_nscolumns + k;