aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_target.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/parser/parse_target.c')
-rw-r--r--src/backend/parser/parse_target.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c
index 4953cc2a4c2..8476d3cb3f6 100644
--- a/src/backend/parser/parse_target.c
+++ b/src/backend/parser/parse_target.c
@@ -551,7 +551,7 @@ transformAssignedExpr(ParseState *pstate,
*/
Var *var;
- var = makeVar(pstate->p_target_rtindex, attrno,
+ var = makeVar(pstate->p_target_nsitem->p_rtindex, attrno,
attrtype, attrtypmod, attrcollation, 0);
var->location = location;
@@ -1359,8 +1359,7 @@ ExpandSingleTable(ParseState *pstate, ParseNamespaceItem *nsitem,
List *vars;
ListCell *l;
- expandRTE(rte, nsitem->p_rtindex, sublevels_up, location, false,
- NULL, &vars);
+ vars = expandNSItemVars(nsitem, sublevels_up, location, NULL);
/*
* Require read access to the table. This is normally redundant with
@@ -1496,6 +1495,12 @@ expandRecordVariable(ParseState *pstate, Var *var, int levelsup)
Assert(IsA(var, Var));
Assert(var->vartype == RECORDOID);
+ /*
+ * Note: it's tempting to use GetNSItemByRangeTablePosn here so that we
+ * can use expandNSItemVars instead of expandRTE; but that does not work
+ * for some of the recursion cases below, where we have consed up a
+ * ParseState that lacks p_namespace data.
+ */
netlevelsup = var->varlevelsup + levelsup;
rte = GetRTEByRangeTablePosn(pstate, var->varno, netlevelsup);
attnum = var->varattno;