aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_relation.c
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
commitd01d97c25cf425acc097520bc1c6af57dff51c44 (patch)
treee12b0e8c5ddef53eff16a526df3e99a00223c055 /src/backend/parser/parse_relation.c
parent66104119e1fbcfd8c8d9fe0c016e0349ff977ba4 (diff)
downloadpostgresql-d01d97c25cf425acc097520bc1c6af57dff51c44.tar.gz
postgresql-d01d97c25cf425acc097520bc1c6af57dff51c44.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.
Diffstat (limited to 'src/backend/parser/parse_relation.c')
-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 ea62cbb41a6..ee0e0f81d89 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -1844,7 +1844,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)
@@ -1860,6 +1859,8 @@ expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
*colvars = lappend(*colvars, varnode);
}
+
+ aliasp_item = lnext(aliasp_item);
}
}
break;