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

Function SPI_returntuple

src/backend/executor/spi.c:1101–1131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1099}
1100
1101HeapTupleHeader
1102SPI_returntuple(HeapTuple tuple, TupleDesc tupdesc)
1103{
1104 MemoryContext oldcxt;
1105 HeapTupleHeader dtup;
1106
1107 if (tuple == NULL || tupdesc == NULL)
1108 {
1109 SPI_result = SPI_ERROR_ARGUMENT;
1110 return NULL;
1111 }
1112
1113 if (_SPI_current == NULL)
1114 {
1115 SPI_result = SPI_ERROR_UNCONNECTED;
1116 return NULL;
1117 }
1118
1119 /* For RECORD results, make sure a typmod has been assigned */
1120 if (tupdesc->tdtypeid == RECORDOID &&
1121 tupdesc->tdtypmod < 0)
1122 assign_record_type_typmod(tupdesc);
1123
1124 oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
1125
1126 dtup = DatumGetHeapTupleHeader(heap_copy_tuple_as_datum(tuple, tupdesc));
1127
1128 MemoryContextSwitchTo(oldcxt);
1129
1130 return dtup;
1131}
1132
1133HeapTuple
1134SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,

Callers 2

dbms_sql_column_valueFunction · 0.85

Calls 3

MemoryContextSwitchToFunction · 0.85
heap_copy_tuple_as_datumFunction · 0.85

Tested by

no test coverage detected