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

Function TupleDescGetAttInMetadata

src/backend/executor/execTuples.c:2102–2144  ·  view source on GitHub ↗

* TupleDescGetAttInMetadata - Build an AttInMetadata structure based on the * supplied TupleDesc. AttInMetadata can be used in conjunction with C strings * to produce a properly formed tuple. */

Source from the content-addressed store, hash-verified

2100 * to produce a properly formed tuple.
2101 */
2102AttInMetadata *
2103TupleDescGetAttInMetadata(TupleDesc tupdesc)
2104{
2105 int natts = tupdesc->natts;
2106 int i;
2107 Oid atttypeid;
2108 Oid attinfuncid;
2109 FmgrInfo *attinfuncinfo;
2110 Oid *attioparams;
2111 int32 *atttypmods;
2112 AttInMetadata *attinmeta;
2113
2114 attinmeta = (AttInMetadata *) palloc(sizeof(AttInMetadata));
2115
2116 /* "Bless" the tupledesc so that we can make rowtype datums with it */
2117 attinmeta->tupdesc = BlessTupleDesc(tupdesc);
2118
2119 /*
2120 * Gather info needed later to call the "in" function for each attribute
2121 */
2122 attinfuncinfo = (FmgrInfo *) palloc0(natts * sizeof(FmgrInfo));
2123 attioparams = (Oid *) palloc0(natts * sizeof(Oid));
2124 atttypmods = (int32 *) palloc0(natts * sizeof(int32));
2125
2126 for (i = 0; i < natts; i++)
2127 {
2128 Form_pg_attribute att = TupleDescAttr(tupdesc, i);
2129
2130 /* Ignore dropped attributes */
2131 if (!att->attisdropped)
2132 {
2133 atttypeid = att->atttypid;
2134 getTypeInputInfo(atttypeid, &attinfuncid, &attioparams[i]);
2135 fmgr_info(attinfuncid, &attinfuncinfo[i]);
2136 atttypmods[i] = att->atttypmod;
2137 }
2138 }
2139 attinmeta->attinfuncs = attinfuncinfo;
2140 attinmeta->attioparams = attioparams;
2141 attinmeta->atttypmods = atttypmods;
2142
2143 return attinmeta;
2144}
2145
2146/*
2147 * BuildTupleFromCStrings - build a HeapTuple given user data in C string form.

Callers 15

postgresBeginForeignScanFunction · 0.85
create_foreign_modifyFunction · 0.85
bt_page_stats_internalFunction · 0.85
bt_metapFunction · 0.85
hash_page_itemsFunction · 0.85
bm_metapFunction · 0.85
bm_lov_page_itemsFunction · 0.85
bm_bitmap_page_headerFunction · 0.85
bm_bitmap_page_itemsFunction · 0.85

Calls 5

BlessTupleDescFunction · 0.85
getTypeInputInfoFunction · 0.85
fmgr_infoFunction · 0.85
pallocFunction · 0.50
palloc0Function · 0.50

Tested by 1

retcompositeFunction · 0.68