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

Function tts_virtual_getsysattr

src/backend/executor/execTuples.c:142–166  ·  view source on GitHub ↗

* VirtualTupleTableSlots never provide system attributes (except those * handled generically, such as tableoid). We generally shouldn't get * here, but provide a user-friendly message if we do. */

Source from the content-addressed store, hash-verified

140 * here, but provide a user-friendly message if we do.
141 */
142static Datum
143tts_virtual_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
144{
145 /*
146 * GPDB: AppendOptimized relations do need to get sysattrs AND use virtual
147 * tuples to pass around data. It is assumed that the caller knows what is
148 * doing, if the attribute is gp_segment_id. Otherwise, error out.
149 */
150 if (attnum == GpSegmentIdAttributeNumber)
151 {
152 *isnull = false;
153
154 return Int32GetDatum(GpIdentity.segindex);
155 }
156 else if (attnum == GpForeignServerAttributeNumber)
157 {
158 *isnull = false;
159
160 return ObjectIdGetDatum(GetForeignServerSegByRelid(slot->tts_tableOid));
161 }
162
163 elog(ERROR, "virtual tuple table slot does not have system attributes");
164
165 return 0; /* silence compiler warnings */
166}
167
168/*
169 * To materialize a virtual slot all the datums that aren't passed by value

Callers

nothing calls this directly

Calls 3

Int32GetDatumFunction · 0.85
ObjectIdGetDatumFunction · 0.85

Tested by

no test coverage detected