* Helper function to pop the next tuple from the reorder queue. */
| 493 | * Helper function to pop the next tuple from the reorder queue. |
| 494 | */ |
| 495 | static HeapTuple |
| 496 | reorderqueue_pop(IndexScanState *node) |
| 497 | { |
| 498 | HeapTuple result; |
| 499 | ReorderTuple *topmost; |
| 500 | int i; |
| 501 | |
| 502 | topmost = (ReorderTuple *) pairingheap_remove_first(node->iss_ReorderQueue); |
| 503 | |
| 504 | result = topmost->htup; |
| 505 | for (i = 0; i < node->iss_NumOrderByKeys; i++) |
| 506 | { |
| 507 | if (!node->iss_OrderByTypByVals[i] && !topmost->orderbynulls[i]) |
| 508 | pfree(DatumGetPointer(topmost->orderbyvals[i])); |
| 509 | } |
| 510 | pfree(topmost->orderbyvals); |
| 511 | pfree(topmost->orderbynulls); |
| 512 | pfree(topmost); |
| 513 | |
| 514 | return result; |
| 515 | } |
| 516 | |
| 517 | |
| 518 | /* ---------------------------------------------------------------- |
no test coverage detected