aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-10-27 18:16:25 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-10-27 18:16:25 -0400
commit291a31c42c893574e9676e00121e6c6915a59de5 (patch)
treeeeed0defd0249eef0e44b4db9ef66281c0c03022
parentddde3b4f3e888c06f7b866575be242357d9d72be (diff)
downloadpostgresql-291a31c42c893574e9676e00121e6c6915a59de5.tar.gz
postgresql-291a31c42c893574e9676e00121e6c6915a59de5.zip
Dept of second thoughts: keep aliasp_item in sync with tlistitem.
Commit d5b760ecb wasn't quite right, on second thought: if the caller didn't ask for column names then it would happily emit more Vars than if the caller did ask for column names. This is surely not a good idea. Advance the aliasp_item whether or not we're preparing a colnames list.
-rw-r--r--src/backend/parser/parse_relation.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index 225137a6574..bbbb0b618ab 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -2220,7 +2220,6 @@ expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
char *label = strVal(lfirst(aliasp_item));
*colnames = lappend(*colnames, makeString(pstrdup(label)));
- aliasp_item = lnext(aliasp_item);
}
if (colvars)
@@ -2236,6 +2235,8 @@ expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
*colvars = lappend(*colvars, varnode);
}
+
+ aliasp_item = lnext(aliasp_item);
}
}
break;