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

Function lookupProcCallback

src/backend/catalog/pg_proc_callback.c:127–172  ·  view source on GitHub ↗

--------------------- * lookupProcCallback() - Find a specified callback for a specified function * * Parameters: * profnoid - oid of the function that has a callback * promethod - which callback to find * --------------------- */

Source from the content-addressed store, hash-verified

125 * ---------------------
126 */
127Oid
128lookupProcCallback(Oid profnoid, char promethod)
129{
130 Relation rel;
131 ScanKeyData skey[2];
132 SysScanDesc scan;
133 HeapTuple tup;
134 Oid result;
135
136 Assert(OidIsValid(profnoid));
137
138 /* open pg_proc_callback */
139 rel = heap_open(ProcCallbackRelationId, AccessShareLock);
140
141 /* Lookup (profnoid, promethod) from index */
142 /* (profnoid, promethod) is guaranteed unique by the index */
143 ScanKeyInit(&skey[0],
144 Anum_pg_proc_callback_profnoid,
145 BTEqualStrategyNumber, F_OIDEQ,
146 ObjectIdGetDatum(profnoid));
147 ScanKeyInit(&skey[1],
148 Anum_pg_proc_callback_promethod,
149 BTEqualStrategyNumber, F_CHAREQ,
150 CharGetDatum(promethod));
151 scan = systable_beginscan(rel, ProcCallbackProfnoidPromethodIndexId, true,
152 NULL, 2, skey);
153 tup = systable_getnext(scan);
154 if (HeapTupleIsValid(tup))
155 {
156 Datum d;
157 bool isnull;
158
159 d = heap_getattr(tup, Anum_pg_proc_callback_procallback,
160 RelationGetDescr(rel), &isnull);
161 Assert(!isnull);
162
163 result = DatumGetObjectId(d);
164 }
165 else
166 result = InvalidOid;
167
168 systable_endscan(scan);
169 heap_close(rel, AccessShareLock);
170
171 return result;
172}

Callers 2

ParseFuncOrColumnFunction · 0.85

Calls 8

ScanKeyInitFunction · 0.85
ObjectIdGetDatumFunction · 0.85
CharGetDatumFunction · 0.85
systable_beginscanFunction · 0.85
systable_getnextFunction · 0.85
heap_getattrFunction · 0.85
DatumGetObjectIdFunction · 0.85
systable_endscanFunction · 0.85

Tested by

no test coverage detected