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

Function ExecBuildAuxRowMark

src/backend/executor/execMain.c:3551–3590  ·  view source on GitHub ↗

* ExecBuildAuxRowMark -- create an ExecAuxRowMark struct * * Inputs are the underlying ExecRowMark struct and the targetlist of the * input plan node (not planstate node!). We need the latter to find out * the column numbers of the resjunk columns. */

Source from the content-addressed store, hash-verified

3549 * the column numbers of the resjunk columns.
3550 */
3551ExecAuxRowMark *
3552ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist)
3553{
3554 ExecAuxRowMark *aerm = (ExecAuxRowMark *) palloc0(sizeof(ExecAuxRowMark));
3555 char resname[32];
3556
3557 aerm->rowmark = erm;
3558
3559 /* Look up the resjunk columns associated with this rowmark */
3560 if (erm->markType != ROW_MARK_COPY)
3561 {
3562 /* need ctid for all methods other than COPY */
3563 snprintf(resname, sizeof(resname), "ctid%u", erm->rowmarkId);
3564 aerm->ctidAttNo = ExecFindJunkAttributeInTlist(targetlist,
3565 resname);
3566 if (!AttributeNumberIsValid(aerm->ctidAttNo))
3567 elog(ERROR, "could not find junk %s column", resname);
3568 }
3569 else
3570 {
3571 /* need wholerow if COPY */
3572 snprintf(resname, sizeof(resname), "wholerow%u", erm->rowmarkId);
3573 aerm->wholeAttNo = ExecFindJunkAttributeInTlist(targetlist,
3574 resname);
3575 if (!AttributeNumberIsValid(aerm->wholeAttNo))
3576 elog(ERROR, "could not find junk %s column", resname);
3577 }
3578
3579 /* if child rel, need tableoid */
3580 if (erm->rti != erm->prti)
3581 {
3582 snprintf(resname, sizeof(resname), "tableoid%u", erm->rowmarkId);
3583 aerm->toidAttNo = ExecFindJunkAttributeInTlist(targetlist,
3584 resname);
3585 if (!AttributeNumberIsValid(aerm->toidAttNo))
3586 elog(ERROR, "could not find junk %s column", resname);
3587 }
3588
3589 return aerm;
3590}
3591
3592
3593/*

Callers 2

ExecInitModifyTableFunction · 0.85
ExecInitLockRowsFunction · 0.85

Calls 2

palloc0Function · 0.50

Tested by

no test coverage detected