summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/prep
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/prep')
-rw-r--r--src/backend/optimizer/prep/preptlist.c6
-rw-r--r--src/backend/optimizer/prep/prepunion.c1
2 files changed, 4 insertions, 3 deletions
diff --git a/src/backend/optimizer/prep/preptlist.c b/src/backend/optimizer/prep/preptlist.c
index 34b38eb329..63447aa536 100644
--- a/src/backend/optimizer/prep/preptlist.c
+++ b/src/backend/optimizer/prep/preptlist.c
@@ -102,7 +102,7 @@ preprocess_targetlist(PlannerInfo *root, List *tlist)
-1,
InvalidOid,
0);
- snprintf(resname, sizeof(resname), "ctid%u", rc->rti);
+ snprintf(resname, sizeof(resname), "ctid%u", rc->rowmarkId);
tle = makeTargetEntry((Expr *) var,
list_length(tlist) + 1,
pstrdup(resname),
@@ -118,7 +118,7 @@ preprocess_targetlist(PlannerInfo *root, List *tlist)
-1,
InvalidOid,
0);
- snprintf(resname, sizeof(resname), "tableoid%u", rc->rti);
+ snprintf(resname, sizeof(resname), "tableoid%u", rc->rowmarkId);
tle = makeTargetEntry((Expr *) var,
list_length(tlist) + 1,
pstrdup(resname),
@@ -132,7 +132,7 @@ preprocess_targetlist(PlannerInfo *root, List *tlist)
var = makeWholeRowVar(rt_fetch(rc->rti, range_table),
rc->rti,
0);
- snprintf(resname, sizeof(resname), "wholerow%u", rc->rti);
+ snprintf(resname, sizeof(resname), "wholerow%u", rc->rowmarkId);
tle = makeTargetEntry((Expr *) var,
list_length(tlist) + 1,
pstrdup(resname),
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index f62af6c37d..606e5fe60a 100644
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -1294,6 +1294,7 @@ expand_inherited_rtentry(PlannerInfo *root, RangeTblEntry *rte, Index rti)
newrc->rti = childRTindex;
newrc->prti = rti;
+ newrc->rowmarkId = oldrc->rowmarkId;
newrc->markType = oldrc->markType;
newrc->noWait = oldrc->noWait;
newrc->isParent = false;