* Store a HeapTuple into any kind of slot, performing conversion if * necessary. */
| 1483 | * necessary. |
| 1484 | */ |
| 1485 | void |
| 1486 | ExecForceStoreHeapTuple(HeapTuple tuple, |
| 1487 | TupleTableSlot *slot, |
| 1488 | bool shouldFree) |
| 1489 | { |
| 1490 | if (TTS_IS_HEAPTUPLE(slot)) |
| 1491 | { |
| 1492 | ExecStoreHeapTuple(tuple, slot, shouldFree); |
| 1493 | } |
| 1494 | else if (TTS_IS_BUFFERTUPLE(slot)) |
| 1495 | { |
| 1496 | MemoryContext oldContext; |
| 1497 | BufferHeapTupleTableSlot *bslot = (BufferHeapTupleTableSlot *) slot; |
| 1498 | |
| 1499 | ExecClearTuple(slot); |
| 1500 | slot->tts_flags &= ~TTS_FLAG_EMPTY; |
| 1501 | oldContext = MemoryContextSwitchTo(slot->tts_mcxt); |
| 1502 | bslot->base.tuple = heap_copytuple(tuple); |
| 1503 | slot->tts_flags |= TTS_FLAG_SHOULDFREE; |
| 1504 | MemoryContextSwitchTo(oldContext); |
| 1505 | |
| 1506 | if (shouldFree) |
| 1507 | pfree(tuple); |
| 1508 | } |
| 1509 | else |
| 1510 | { |
| 1511 | ExecClearTuple(slot); |
| 1512 | heap_deform_tuple(tuple, slot->tts_tupleDescriptor, |
| 1513 | slot->tts_values, slot->tts_isnull); |
| 1514 | ExecStoreVirtualTuple(slot); |
| 1515 | |
| 1516 | if (shouldFree) |
| 1517 | { |
| 1518 | ExecMaterializeSlot(slot); |
| 1519 | pfree(tuple); |
| 1520 | } |
| 1521 | } |
| 1522 | } |
| 1523 | |
| 1524 | /* |
| 1525 | * Store a MinimalTuple into any kind of slot, performing conversion if |
no test coverage detected