diff options
Diffstat (limited to 'src/backend/executor/execExpr.c')
-rw-r--r-- | src/backend/executor/execExpr.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c index 74fcfbea566..77c9d785d99 100644 --- a/src/backend/executor/execExpr.c +++ b/src/backend/executor/execExpr.c @@ -1375,7 +1375,7 @@ ExecInitExprRec(Expr *node, ExprState *state, scratch.opcode = EEOP_FIELDSELECT; scratch.d.fieldselect.fieldnum = fselect->fieldnum; scratch.d.fieldselect.resulttype = fselect->resulttype; - scratch.d.fieldselect.argdesc = NULL; + scratch.d.fieldselect.rowcache.cacheptr = NULL; ExprEvalPushStep(state, &scratch); break; @@ -1385,7 +1385,7 @@ ExecInitExprRec(Expr *node, ExprState *state, { FieldStore *fstore = (FieldStore *) node; TupleDesc tupDesc; - TupleDesc *descp; + ExprEvalRowtypeCache *rowcachep; Datum *values; bool *nulls; int ncolumns; @@ -1401,9 +1401,9 @@ ExecInitExprRec(Expr *node, ExprState *state, values = (Datum *) palloc(sizeof(Datum) * ncolumns); nulls = (bool *) palloc(sizeof(bool) * ncolumns); - /* create workspace for runtime tupdesc cache */ - descp = (TupleDesc *) palloc(sizeof(TupleDesc)); - *descp = NULL; + /* create shared composite-type-lookup cache struct */ + rowcachep = palloc(sizeof(ExprEvalRowtypeCache)); + rowcachep->cacheptr = NULL; /* emit code to evaluate the composite input value */ ExecInitExprRec(fstore->arg, state, resv, resnull); @@ -1411,7 +1411,7 @@ ExecInitExprRec(Expr *node, ExprState *state, /* next, deform the input tuple into our workspace */ scratch.opcode = EEOP_FIELDSTORE_DEFORM; scratch.d.fieldstore.fstore = fstore; - scratch.d.fieldstore.argdesc = descp; + scratch.d.fieldstore.rowcache = rowcachep; scratch.d.fieldstore.values = values; scratch.d.fieldstore.nulls = nulls; scratch.d.fieldstore.ncolumns = ncolumns; @@ -1469,7 +1469,7 @@ ExecInitExprRec(Expr *node, ExprState *state, /* finally, form result tuple */ scratch.opcode = EEOP_FIELDSTORE_FORM; scratch.d.fieldstore.fstore = fstore; - scratch.d.fieldstore.argdesc = descp; + scratch.d.fieldstore.rowcache = rowcachep; scratch.d.fieldstore.values = values; scratch.d.fieldstore.nulls = nulls; scratch.d.fieldstore.ncolumns = ncolumns; @@ -1615,17 +1615,24 @@ ExecInitExprRec(Expr *node, ExprState *state, case T_ConvertRowtypeExpr: { ConvertRowtypeExpr *convert = (ConvertRowtypeExpr *) node; + ExprEvalRowtypeCache *rowcachep; + + /* cache structs must be out-of-line for space reasons */ + rowcachep = palloc(2 * sizeof(ExprEvalRowtypeCache)); + rowcachep[0].cacheptr = NULL; + rowcachep[1].cacheptr = NULL; /* evaluate argument into step's result area */ ExecInitExprRec(convert->arg, state, resv, resnull); /* and push conversion step */ scratch.opcode = EEOP_CONVERT_ROWTYPE; - scratch.d.convert_rowtype.convert = convert; - scratch.d.convert_rowtype.indesc = NULL; - scratch.d.convert_rowtype.outdesc = NULL; + scratch.d.convert_rowtype.inputtype = + exprType((Node *) convert->arg); + scratch.d.convert_rowtype.outputtype = convert->resulttype; + scratch.d.convert_rowtype.incache = &rowcachep[0]; + scratch.d.convert_rowtype.outcache = &rowcachep[1]; scratch.d.convert_rowtype.map = NULL; - scratch.d.convert_rowtype.initialized = false; ExprEvalPushStep(state, &scratch); break; @@ -2250,7 +2257,7 @@ ExecInitExprRec(Expr *node, ExprState *state, (int) ntest->nulltesttype); } /* initialize cache in case it's a row test */ - scratch.d.nulltest_row.argdesc = NULL; + scratch.d.nulltest_row.rowcache.cacheptr = NULL; /* first evaluate argument into result variable */ ExecInitExprRec(ntest->arg, state, |