From bbd6eb5b958ef38f786089fd4a03d650d4b7220e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 19 Aug 2004 20:57:41 +0000 Subject: 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. --- src/backend/rewrite/rewriteHandler.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/backend/rewrite/rewriteHandler.c') diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c index fadc7416ad9..7358d745f78 100644 --- a/src/backend/rewrite/rewriteHandler.c +++ b/src/backend/rewrite/rewriteHandler.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.141 2004/08/07 17:40:49 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.142 2004/08/19 20:57:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -214,8 +214,7 @@ rewriteRuleAction(Query *parsetree, sub_action = (Query *) ResolveNew((Node *) sub_action, new_varno, 0, - rt_fetch(new_varno, - sub_action->rtable), + sub_action->rtable, parsetree->targetList, event, current_varno); @@ -1040,7 +1039,7 @@ CopyAndAddInvertedQual(Query *parsetree, new_qual = ResolveNew(new_qual, PRS2_NEW_VARNO, 0, - rt_fetch(rt_index, parsetree->rtable), + parsetree->rtable, parsetree->targetList, event, rt_index); -- cgit v1.2.3