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

Function RelationBuildLocalRelation

src/backend/utils/cache/relcache.c:3612–3878  ·  view source on GitHub ↗

* RelationBuildLocalRelation * Build a relcache entry for an about-to-be-created relation, * and enter it into the relcache. */

Source from the content-addressed store, hash-verified

3610 * and enter it into the relcache.
3611 */
3612Relation
3613RelationBuildLocalRelation(const char *relname,
3614 Oid relnamespace,
3615 TupleDesc tupDesc,
3616 Oid relid,
3617 Oid accessmtd,
3618 Oid relfilenode,
3619 Oid reltablespace,
3620 bool shared_relation,
3621 bool mapped_relation,
3622 char relpersistence,
3623 char relkind)
3624{
3625 Relation rel;
3626 MemoryContext oldcxt;
3627 int natts = tupDesc->natts;
3628 int i;
3629 bool has_not_null;
3630 bool nailit;
3631
3632 AssertArg(natts >= 0);
3633
3634 /*
3635 * check for creation of a rel that must be nailed in cache.
3636 *
3637 * XXX this list had better match the relations specially handled in
3638 * RelationCacheInitializePhase2/3.
3639 */
3640 switch (relid)
3641 {
3642 case DatabaseRelationId:
3643 case AuthIdRelationId:
3644 case AuthMemRelationId:
3645 case AuthTimeConstraintRelationId:
3646 case RelationRelationId:
3647 case AttributeRelationId:
3648 case ProcedureRelationId:
3649 case TypeRelationId:
3650 nailit = true;
3651 break;
3652 default:
3653 nailit = false;
3654 break;
3655 }
3656
3657 /*
3658 * check that hardwired list of shared rels matches what's in the
3659 * bootstrap .bki file. If you get a failure here during initdb, you
3660 * probably need to fix IsSharedRelation() to match whatever you've done
3661 * to the set of shared relations.
3662 */
3663 if (shared_relation != IsSharedRelation(relid))
3664 elog(ERROR, "shared_relation flag for \"%s\" does not match IsSharedRelation(%u)",
3665 relname, relid);
3666
3667 /* Shared relations had better be mapped, too */
3668 Assert(mapped_relation || !shared_relation);
3669

Callers 1

heap_createFunction · 0.85

Calls 15

IsSharedRelationFunction · 0.85
CreateCacheMemoryContextFunction · 0.85
MemoryContextSwitchToFunction · 0.85
CreateTupleDescCopyFunction · 0.85
namestrcpyFunction · 0.85
IsCatalogNamespaceFunction · 0.85
GetNewRelFileNodeFunction · 0.85
AdvanceObjectIdFunction · 0.85
RelationMapUpdateMapFunction · 0.85
RelationInitLockInfoFunction · 0.85

Tested by

no test coverage detected