aboutsummaryrefslogtreecommitdiff
path: root/src/backend/rewrite/rewriteManip.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/rewrite/rewriteManip.c')
-rw-r--r--src/backend/rewrite/rewriteManip.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c
index d3985b2093e..5bd916862af 100644
--- a/src/backend/rewrite/rewriteManip.c
+++ b/src/backend/rewrite/rewriteManip.c
@@ -16,6 +16,7 @@
#include "catalog/pg_type.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
+#include "nodes/plannodes.h"
#include "optimizer/clauses.h"
#include "parser/parse_coerce.h"
#include "parser/parse_relation.h"
@@ -375,6 +376,7 @@ OffsetVarNodes_walker(Node *node, OffsetVarNodes_context *context)
/* fall through to examine children */
}
/* Shouldn't need to handle other planner auxiliary nodes here */
+ Assert(!IsA(node, PlanRowMark));
Assert(!IsA(node, SpecialJoinInfo));
Assert(!IsA(node, PlaceHolderInfo));
Assert(!IsA(node, MinMaxAggInfo));
@@ -529,6 +531,19 @@ ChangeVarNodes_walker(Node *node, ChangeVarNodes_context *context)
}
/* fall through to examine children */
}
+ if (IsA(node, PlanRowMark))
+ {
+ PlanRowMark *rowmark = (PlanRowMark *) node;
+
+ if (context->sublevels_up == 0)
+ {
+ if (rowmark->rti == context->rt_index)
+ rowmark->rti = context->new_index;
+ if (rowmark->prti == context->rt_index)
+ rowmark->prti = context->new_index;
+ }
+ return false;
+ }
if (IsA(node, AppendRelInfo))
{
AppendRelInfo *appinfo = (AppendRelInfo *) node;
@@ -810,6 +825,7 @@ rangeTableEntry_used_walker(Node *node,
}
/* Shouldn't need to handle planner auxiliary nodes here */
Assert(!IsA(node, PlaceHolderVar));
+ Assert(!IsA(node, PlanRowMark));
Assert(!IsA(node, SpecialJoinInfo));
Assert(!IsA(node, AppendRelInfo));
Assert(!IsA(node, PlaceHolderInfo));