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

Function GetOverrideSearchPath

src/backend/catalog/namespace.c:3520–3550  ·  view source on GitHub ↗

* GetOverrideSearchPath - fetch current search path definition in form * used by PushOverrideSearchPath. * * The result structure is allocated in the specified memory context * (which might or might not be equal to CurrentMemoryContext); but any * junk created by revalidation calculations will be in CurrentMemoryContext. */

Source from the content-addressed store, hash-verified

3518 * junk created by revalidation calculations will be in CurrentMemoryContext.
3519 */
3520OverrideSearchPath *
3521GetOverrideSearchPath(MemoryContext context)
3522{
3523 OverrideSearchPath *result;
3524 List *schemas;
3525 MemoryContext oldcxt;
3526
3527 recomputeNamespacePath();
3528
3529 oldcxt = MemoryContextSwitchTo(context);
3530
3531 result = (OverrideSearchPath *) palloc0(sizeof(OverrideSearchPath));
3532 schemas = list_copy(activeSearchPath);
3533 while (schemas && linitial_oid(schemas) != activeCreationNamespace)
3534 {
3535 if (linitial_oid(schemas) == myTempNamespace)
3536 result->addTemp = true;
3537 else
3538 {
3539 Assert(linitial_oid(schemas) == PG_CATALOG_NAMESPACE);
3540 result->addCatalog = true;
3541 }
3542 schemas = list_delete_first(schemas);
3543 }
3544 result->schemas = schemas;
3545 result->generation = activePathGeneration;
3546
3547 MemoryContextSwitchTo(oldcxt);
3548
3549 return result;
3550}
3551
3552/*
3553 * CopyOverrideSearchPath - copy the specified OverrideSearchPath.

Callers 3

CompleteCachedPlanFunction · 0.85
RevalidateCachedQueryFunction · 0.85

Calls 5

recomputeNamespacePathFunction · 0.85
MemoryContextSwitchToFunction · 0.85
list_copyFunction · 0.85
list_delete_firstFunction · 0.85
palloc0Function · 0.50

Tested by

no test coverage detected