Fix a *different* problem with whole-row Vars afflicting 8.0 branch.
authorTom Lane <[email protected]>
Wed, 14 Dec 2005 16:30:20 +0000 (16:30 +0000)
committerTom Lane <[email protected]>
Wed, 14 Dec 2005 16:30:20 +0000 (16:30 +0000)
This is a back-port of a fix made to markTargetListOrigin() on 2005-04-25.

src/backend/parser/parse_target.c

index a5996d09bb2ee64c8d8b3f8a02aceaaae4699b05..fa72a9bdeb07c24ea8b92693867496e277e3846b 100644 (file)
@@ -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));