diff options
Diffstat (limited to '')
-rw-r--r-- | src/backend/parser/parse_relation.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c index 863c25f..e006683 100644 --- a/src/backend/parser/parse_relation.c +++ b/src/backend/parser/parse_relation.c @@ -2722,12 +2722,17 @@ expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, { RangeTblFunction *rtfunc = (RangeTblFunction *) lfirst(lc); TypeFuncClass functypclass; - Oid funcrettype; - TupleDesc tupdesc; + Oid funcrettype = InvalidOid; + TupleDesc tupdesc = NULL; + + /* If it has a coldeflist, it returns RECORD */ + if (rtfunc->funccolnames != NIL) + functypclass = TYPEFUNC_RECORD; + else + functypclass = get_expr_result_type(rtfunc->funcexpr, + &funcrettype, + &tupdesc); - functypclass = get_expr_result_type(rtfunc->funcexpr, - &funcrettype, - &tupdesc); if (functypclass == TYPEFUNC_COMPOSITE || functypclass == TYPEFUNC_COMPOSITE_DOMAIN) { @@ -3345,6 +3350,10 @@ get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum) { TupleDesc tupdesc; + /* If it has a coldeflist, it returns RECORD */ + if (rtfunc->funccolnames != NIL) + return false; /* can't have any dropped columns */ + tupdesc = get_expr_result_tupdesc(rtfunc->funcexpr, true); if (tupdesc) |