MCPcopy Create free account
hub / github.com/apache/cloudberry / array_subscript_fetch_old

Function array_subscript_fetch_old

src/backend/utils/adt/arraysubs.c:398–421  ·  view source on GitHub ↗

* Compute old array element value for a SubscriptingRef assignment * expression. Will only be called if the new-value subexpression * contains SubscriptingRef or FieldStore. This is the same as the * regular fetch case, except that we have to handle a null array, * and the value should be stored into the SubscriptingRefState's * prevvalue/prevnull fields. */

Source from the content-addressed store, hash-verified

396 * prevvalue/prevnull fields.
397 */
398static void
399array_subscript_fetch_old(ExprState *state,
400 ExprEvalStep *op,
401 ExprContext *econtext)
402{
403 SubscriptingRefState *sbsrefstate = op->d.sbsref.state;
404 ArraySubWorkspace *workspace = (ArraySubWorkspace *) sbsrefstate->workspace;
405
406 if (*op->resnull)
407 {
408 /* whole array is null, so any element is too */
409 sbsrefstate->prevvalue = (Datum) 0;
410 sbsrefstate->prevnull = true;
411 }
412 else
413 sbsrefstate->prevvalue = array_get_element(*op->resvalue,
414 sbsrefstate->numupper,
415 workspace->upperindex,
416 workspace->refattrlength,
417 workspace->refelemlength,
418 workspace->refelembyval,
419 workspace->refelemalign,
420 &sbsrefstate->prevnull);
421}
422
423/*
424 * Compute old array slice value for a SubscriptingRef assignment

Callers

nothing calls this directly

Calls 1

array_get_elementFunction · 0.85

Tested by

no test coverage detected