From: Tom Lane Date: Wed, 14 Dec 2005 16:30:20 +0000 (+0000) Subject: Fix a *different* problem with whole-row Vars afflicting 8.0 branch. X-Git-Tag: REL8_0_6~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ec8c876bdee1375d44a86c35df6124acecf42d4d;p=thirdparty%2Fpostgresql.git Fix a *different* problem with whole-row Vars afflicting 8.0 branch. This is a back-port of a fix made to markTargetListOrigin() on 2005-04-25. --- diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c index ebba3e868f1..a6b1edbe48d 100644 --- a/src/backend/parser/parse_target.c +++ b/src/backend/parser/parse_target.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.129 2005/01/13 17:19:09 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.129.4.1 2005/12/14 16:30:20 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -209,8 +209,9 @@ markTargetListOrigin(ParseState *pstate, Resdom *res, Var *var, int levelsup) res->resorigcol = attnum; break; case RTE_SUBQUERY: + /* Subselect-in-FROM: copy up from the subselect */ + if (attnum != InvalidAttrNumber) { - /* Subselect-in-FROM: copy up from the subselect */ TargetEntry *te = get_tle_by_resno(rte->subquery->targetList, attnum); @@ -222,8 +223,9 @@ markTargetListOrigin(ParseState *pstate, Resdom *res, Var *var, int levelsup) } break; case RTE_JOIN: + /* Join RTE --- recursively inspect the alias variable */ + if (attnum != InvalidAttrNumber) { - /* Join RTE --- recursively inspect the alias variable */ Var *aliasvar; Assert(attnum > 0 && attnum <= list_length(rte->joinaliasvars));