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

Function boot_openrel

src/backend/bootstrap/bootstrap.c:631–670  ·  view source on GitHub ↗

---------------- * boot_openrel * * Execute BKI OPEN command. * ---------------- */

Source from the content-addressed store, hash-verified

629 * ----------------
630 */
631void
632boot_openrel(char *relname)
633{
634 int i;
635
636 if (strlen(relname) >= NAMEDATALEN)
637 relname[NAMEDATALEN - 1] = '\0';
638
639 /*
640 * pg_type must be filled before any OPEN command is executed, hence we
641 * can now populate Typ if we haven't yet.
642 */
643 if (Typ == NIL)
644 populate_typ_list();
645
646 if (boot_reldesc != NULL)
647 closerel(NULL);
648
649 elog(DEBUG4, "open relation %s, attrsize %d",
650 relname, (int) ATTRIBUTE_FIXED_PART_SIZE);
651
652 boot_reldesc = table_openrv(makeRangeVar(NULL, relname, -1), NoLock);
653 numattr = RelationGetNumberOfAttributes(boot_reldesc);
654 for (i = 0; i < numattr; i++)
655 {
656 if (attrtypes[i] == NULL)
657 attrtypes[i] = AllocateAttribute();
658 memmove((char *) attrtypes[i],
659 (char *) TupleDescAttr(boot_reldesc->rd_att, i),
660 ATTRIBUTE_FIXED_PART_SIZE);
661
662 {
663 Form_pg_attribute at = attrtypes[i];
664
665 elog(DEBUG4, "create attribute %d name %s len %d num %d type %u",
666 i, NameStr(at->attname), at->attlen, at->attnum,
667 at->atttypid);
668 }
669 }
670}
671
672/* ----------------
673 * closerel

Callers

nothing calls this directly

Calls 5

populate_typ_listFunction · 0.85
closerelFunction · 0.85
table_openrvFunction · 0.85
makeRangeVarFunction · 0.85
AllocateAttributeFunction · 0.85

Tested by

no test coverage detected