aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/executor/nodeTidrangescan.c9
-rw-r--r--src/backend/executor/nodeTidscan.c9
2 files changed, 14 insertions, 4 deletions
diff --git a/src/backend/executor/nodeTidrangescan.c b/src/backend/executor/nodeTidrangescan.c
index d5bf1be787f..0455819e73c 100644
--- a/src/backend/executor/nodeTidrangescan.c
+++ b/src/backend/executor/nodeTidrangescan.c
@@ -25,11 +25,16 @@
#include "utils/rel.h"
+/*
+ * It's sufficient to check varattno to identify the CTID variable, as any
+ * Var in the relation scan qual must be for our table. (Even if it's a
+ * parameterized scan referencing some other table's CTID, the other table's
+ * Var would have become a Param by the time it gets here.)
+ */
#define IsCTIDVar(node) \
((node) != NULL && \
IsA((node), Var) && \
- ((Var *) (node))->varattno == SelfItemPointerAttributeNumber && \
- ((Var *) (node))->varlevelsup == 0)
+ ((Var *) (node))->varattno == SelfItemPointerAttributeNumber)
typedef enum
{
diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c
index a1c6325d649..ee4c0d1ea01 100644
--- a/src/backend/executor/nodeTidscan.c
+++ b/src/backend/executor/nodeTidscan.c
@@ -35,11 +35,16 @@
#include "utils/rel.h"
+/*
+ * It's sufficient to check varattno to identify the CTID variable, as any
+ * Var in the relation scan qual must be for our table. (Even if it's a
+ * parameterized scan referencing some other table's CTID, the other table's
+ * Var would have become a Param by the time it gets here.)
+ */
#define IsCTIDVar(node) \
((node) != NULL && \
IsA((node), Var) && \
- ((Var *) (node))->varattno == SelfItemPointerAttributeNumber && \
- ((Var *) (node))->varlevelsup == 0)
+ ((Var *) (node))->varattno == SelfItemPointerAttributeNumber)
/* one element in tss_tidexprs */
typedef struct TidExpr