* Does the work of LookupTupleHashEntry and LookupTupleHashEntryHash. Useful * so that we can avoid switching the memory context multiple times for * LookupTupleHashEntry. * * NB: This function may or may not change the memory context. Caller is * expected to change it back. */
| 504 | * expected to change it back. |
| 505 | */ |
| 506 | static inline TupleHashEntry |
| 507 | LookupTupleHashEntry_internal(TupleHashTable hashtable, TupleTableSlot *slot, |
| 508 | bool *isnew, uint32 hash) |
| 509 | { |
| 510 | TupleHashEntryData *entry; |
| 511 | bool found; |
| 512 | MinimalTuple key; |
| 513 | |
| 514 | key = NULL; /* flag to reference inputslot */ |
| 515 | |
| 516 | if (isnew) |
| 517 | { |
| 518 | entry = tuplehash_insert_hash(hashtable->hashtab, key, hash, &found); |
| 519 | |
| 520 | if (found) |
| 521 | { |
| 522 | /* found pre-existing entry */ |
| 523 | *isnew = false; |
| 524 | } |
| 525 | else |
| 526 | { |
| 527 | /* created new entry */ |
| 528 | *isnew = true; |
| 529 | /* zero caller data */ |
| 530 | entry->additional = NULL; |
| 531 | MemoryContextSwitchTo(hashtable->tablecxt); |
| 532 | /* Copy the first tuple into the table context */ |
| 533 | entry->firstTuple = ExecCopySlotMinimalTuple(slot); |
| 534 | } |
| 535 | } |
| 536 | else |
| 537 | { |
| 538 | entry = tuplehash_lookup_hash(hashtable->hashtab, key, hash); |
| 539 | } |
| 540 | |
| 541 | return entry; |
| 542 | } |
| 543 | |
| 544 | /* |
| 545 | * See whether two tuples (presumably of the same hash value) match |
no test coverage detected