summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/util/appendinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/util/appendinfo.c')
-rw-r--r--src/backend/optimizer/util/appendinfo.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/backend/optimizer/util/appendinfo.c b/src/backend/optimizer/util/appendinfo.c
index ad50865f04a..d722063cf3b 100644
--- a/src/backend/optimizer/util/appendinfo.c
+++ b/src/backend/optimizer/util/appendinfo.c
@@ -255,6 +255,9 @@ adjust_appendrel_attrs_mutator(Node *node,
Var *var = (Var *) copyObject(node);
AppendRelInfo *appinfo = NULL;
+ if (var->varlevelsup != 0)
+ return (Node *) var; /* no changes needed */
+
for (cnt = 0; cnt < nappinfos; cnt++)
{
if (var->varno == appinfos[cnt]->parent_relid)
@@ -264,10 +267,12 @@ adjust_appendrel_attrs_mutator(Node *node,
}
}
- if (var->varlevelsup == 0 && appinfo)
+ if (appinfo)
{
var->varno = appinfo->child_relid;
- var->varnoold = appinfo->child_relid;
+ /* it's now a generated Var, so drop any syntactic labeling */
+ var->varnosyn = 0;
+ var->varattnosyn = 0;
if (var->varattno > 0)
{
Node *newnode;