mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +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/optimizer/util/var.c,v 1.59 2004/06/01 04:47:46 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.60 2004/08/19 20:57:40 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -515,11 +515,19 @@ flatten_join_alias_vars_mutator(Node *node,
|
||||
/* Must expand whole-row reference */
|
||||
RowExpr *rowexpr;
|
||||
List *fields = NIL;
|
||||
AttrNumber attnum;
|
||||
ListCell *l;
|
||||
|
||||
attnum = 0;
|
||||
foreach(l, rte->joinaliasvars)
|
||||
{
|
||||
newvar = (Node *) lfirst(l);
|
||||
attnum++;
|
||||
/* Ignore dropped columns */
|
||||
if (get_rte_attribute_is_dropped(context->root->rtable,
|
||||
var->varno,
|
||||
attnum))
|
||||
continue;
|
||||
/*
|
||||
* If we are expanding an alias carried down from an upper
|
||||
* query, must adjust its varlevelsup fields.
|
||||
|
Reference in New Issue
Block a user