mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Repair some issues with column aliases and RowExpr construction in the
presence of dropped columns. Document the already-presumed fact that eref aliases in relation RTEs are supposed to have entries for dropped columns; cause the user alias structs to have such entries too, so that there's always a one-to-one mapping to the underlying physical attnums. Adjust expandRTE() and related code to handle the case where a column that is part of a JOIN has been dropped. Generalize expandRTE()'s API so that it can be used in a couple of places that formerly rolled their own implementation of the same logic. Fix ruleutils.c to suppress display of aliases for columns that were dropped since the rule was made.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.133 2004/06/16 01:26:44 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.134 2004/08/19 20:57:40 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -655,8 +655,8 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
|
||||
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(j->larg));
|
||||
leftrti = 0; /* keep compiler quiet */
|
||||
}
|
||||
rte = rt_fetch(leftrti, pstate->p_rtable);
|
||||
expandRTE(pstate, rte, &l_colnames, &l_colvars);
|
||||
expandRTE(pstate->p_rtable, leftrti, 0, false,
|
||||
&l_colnames, &l_colvars);
|
||||
|
||||
if (IsA(j->rarg, RangeTblRef))
|
||||
rightrti = ((RangeTblRef *) j->rarg)->rtindex;
|
||||
@ -667,8 +667,8 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
|
||||
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(j->rarg));
|
||||
rightrti = 0; /* keep compiler quiet */
|
||||
}
|
||||
rte = rt_fetch(rightrti, pstate->p_rtable);
|
||||
expandRTE(pstate, rte, &r_colnames, &r_colvars);
|
||||
expandRTE(pstate->p_rtable, rightrti, 0, false,
|
||||
&r_colnames, &r_colvars);
|
||||
|
||||
/*
|
||||
* Natural join does not explicitly specify columns; must generate
|
||||
|
Reference in New Issue
Block a user