diff options
Diffstat (limited to 'src/include/executor/execExpr.h')
-rw-r--r-- | src/include/executor/execExpr.h | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/include/executor/execExpr.h b/src/include/executor/execExpr.h index 2449cde7ad3..785600d04d0 100644 --- a/src/include/executor/execExpr.h +++ b/src/include/executor/execExpr.h @@ -38,6 +38,20 @@ typedef bool (*ExecEvalBoolSubroutine) (ExprState *state, struct ExprEvalStep *op, ExprContext *econtext); +/* ExprEvalSteps that cache a composite type's tupdesc need one of these */ +/* (it fits in-line in some step types, otherwise allocate out-of-line) */ +typedef struct ExprEvalRowtypeCache +{ + /* + * cacheptr points to composite type's TypeCacheEntry if tupdesc_id is not + * 0; or for an anonymous RECORD type, it points directly at the cached + * tupdesc for the type, and tupdesc_id is 0. (We'd use separate fields + * if space were not at a premium.) Initial state is cacheptr == NULL. + */ + void *cacheptr; + uint64 tupdesc_id; /* last-seen tupdesc identifier, or 0 */ +} ExprEvalRowtypeCache; + /* * Discriminator for ExprEvalSteps. * @@ -355,8 +369,8 @@ typedef struct ExprEvalStep /* for EEOP_NULLTEST_ROWIS[NOT]NULL */ struct { - /* cached tupdesc pointer - filled at runtime */ - TupleDesc argdesc; + /* cached descriptor for composite type - filled at runtime */ + ExprEvalRowtypeCache rowcache; } nulltest_row; /* for EEOP_PARAM_EXEC/EXTERN */ @@ -481,8 +495,8 @@ typedef struct ExprEvalStep { AttrNumber fieldnum; /* field number to extract */ Oid resulttype; /* field's type */ - /* cached tupdesc pointer - filled at runtime */ - TupleDesc argdesc; + /* cached descriptor for composite type - filled at runtime */ + ExprEvalRowtypeCache rowcache; } fieldselect; /* for EEOP_FIELDSTORE_DEFORM / FIELDSTORE_FORM */ @@ -491,9 +505,9 @@ typedef struct ExprEvalStep /* original expression node */ FieldStore *fstore; - /* cached tupdesc pointer - filled at runtime */ - /* note that a DEFORM and FORM pair share the same tupdesc */ - TupleDesc *argdesc; + /* cached descriptor for composite type - filled at runtime */ + /* note that a DEFORM and FORM pair share the same cache */ + ExprEvalRowtypeCache *rowcache; /* workspace for column values */ Datum *values; @@ -533,12 +547,12 @@ typedef struct ExprEvalStep /* for EEOP_CONVERT_ROWTYPE */ struct { - ConvertRowtypeExpr *convert; /* original expression */ + Oid inputtype; /* input composite type */ + Oid outputtype; /* output composite type */ /* these three fields are filled at runtime: */ - TupleDesc indesc; /* tupdesc for input type */ - TupleDesc outdesc; /* tupdesc for output type */ + ExprEvalRowtypeCache *incache; /* cache for input type */ + ExprEvalRowtypeCache *outcache; /* cache for output type */ TupleConversionMap *map; /* column mapping */ - bool initialized; /* initialized for current types? */ } convert_rowtype; /* for EEOP_SCALARARRAYOP */ |