diff options
Diffstat (limited to 'src/include/nodes/primnodes.h')
-rw-r--r-- | src/include/nodes/primnodes.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 7b125904b4d..433437643e0 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -172,12 +172,12 @@ typedef struct Expr * in the planner and doesn't correspond to any simple relation column may * have varnosyn = varattnosyn = 0. */ -#define INNER_VAR 65000 /* reference to inner subplan */ -#define OUTER_VAR 65001 /* reference to outer subplan */ -#define INDEX_VAR 65002 /* reference to index column */ -#define ROWID_VAR 65003 /* row identity column during planning */ +#define INNER_VAR (-1) /* reference to inner subplan */ +#define OUTER_VAR (-2) /* reference to outer subplan */ +#define INDEX_VAR (-3) /* reference to index column */ +#define ROWID_VAR (-4) /* row identity column during planning */ -#define IS_SPECIAL_VARNO(varno) ((varno) >= INNER_VAR) +#define IS_SPECIAL_VARNO(varno) ((int) (varno) < 0) /* Symbols for the indexes of the special RTE entries in rules */ #define PRS2_OLD_VARNO 1 @@ -186,8 +186,8 @@ typedef struct Expr typedef struct Var { Expr xpr; - Index varno; /* index of this var's relation in the range - * table, or INNER_VAR/OUTER_VAR/INDEX_VAR */ + int varno; /* index of this var's relation in the range + * table, or INNER_VAR/OUTER_VAR/etc */ AttrNumber varattno; /* attribute number of this var, or zero for * all attrs ("whole-row Var") */ Oid vartype; /* pg_type OID for the type of this var */ @@ -1351,6 +1351,7 @@ typedef struct SetToDefault * of the target relation being constrained; this aids placing the expression * correctly during planning. We can assume however that its "levelsup" is * always zero, due to the syntactic constraints on where it can appear. + * Also, cvarno will always be a true RT index, never INNER_VAR etc. * * The referenced cursor can be represented either as a hardwired string * or as a reference to a run-time parameter of type REFCURSOR. The latter |