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
commit1f81c2cd524e0c65a621d280255be559ab630e4a (patch)
tree0638160447b6b3c23260f93e6696fdac44caf612 /src/backend/parser/parse_relation.c
parentacd3287e437eea6df51d7b0aaa2909efc7c9219e (diff)
downloadpostgresql-1f81c2cd524e0c65a621d280255be559ab630e4a.tar.gz
postgresql-1f81c2cd524e0c65a621d280255be559ab630e4a.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 17a0f9f5ce2..837078c57df 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -2028,7 +2028,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)
@@ -2044,6 +2043,8 @@ expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
*colvars = lappend(*colvars, varnode);
}
+
+ aliasp_item = lnext(aliasp_item);
}
}
break;