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

Function SPI_keepplan

src/backend/executor/spi.c:1003–1028  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1001}
1002
1003int
1004SPI_keepplan(SPIPlanPtr plan)
1005{
1006 ListCell *lc;
1007
1008 if (plan == NULL || plan->magic != _SPI_PLAN_MAGIC ||
1009 plan->saved || plan->oneshot)
1010 return SPI_ERROR_ARGUMENT;
1011
1012 /*
1013 * Mark it saved, reparent it under CacheMemoryContext, and mark all the
1014 * component CachedPlanSources as saved. This sequence cannot fail
1015 * partway through, so there's no risk of long-term memory leakage.
1016 */
1017 plan->saved = true;
1018 MemoryContextSetParent(plan->plancxt, CacheMemoryContext);
1019
1020 foreach(lc, plan->plancache_list)
1021 {
1022 CachedPlanSource *plansource = (CachedPlanSource *) lfirst(lc);
1023
1024 SaveCachedPlan(plansource);
1025 }
1026
1027 return 0;
1028}
1029
1030SPIPlanPtr
1031SPI_saveplan(SPIPlanPtr plan)

Callers 11

check_primary_keyFunction · 0.85
check_foreign_keyFunction · 0.85
pltcl_SPI_prepareFunction · 0.85
exec_prepare_planFunction · 0.85
plperl_spi_prepareFunction · 0.85
PLy_spi_prepareFunction · 0.85
pg_get_ruledef_workerFunction · 0.85
pg_get_viewdef_workerFunction · 0.85
ri_PlanCheckFunction · 0.85
ttdummyFunction · 0.85
executeFunction · 0.85

Calls 3

MemoryContextSetParentFunction · 0.85
SaveCachedPlanFunction · 0.85
foreachFunction · 0.50

Tested by 1

ttdummyFunction · 0.68