* Receive a tuple from a query, and send it to the designated shm_mq. * * Returns true if successful, false if shm_mq has been detached. */
| 51 | * Returns true if successful, false if shm_mq has been detached. |
| 52 | */ |
| 53 | static bool |
| 54 | tqueueReceiveSlot(TupleTableSlot *slot, DestReceiver *self) |
| 55 | { |
| 56 | TQueueDestReceiver *tqueue = (TQueueDestReceiver *) self; |
| 57 | MinimalTuple tuple; |
| 58 | shm_mq_result result; |
| 59 | bool should_free; |
| 60 | |
| 61 | /* Send the tuple itself. */ |
| 62 | tuple = ExecFetchSlotMinimalTuple(slot, &should_free); |
| 63 | result = shm_mq_send(tqueue->queue, tuple->t_len, tuple, false); |
| 64 | |
| 65 | if (should_free) |
| 66 | pfree(tuple); |
| 67 | |
| 68 | /* Check for failure. */ |
| 69 | if (result == SHM_MQ_DETACHED) |
| 70 | return false; |
| 71 | else if (result != SHM_MQ_SUCCESS && result != SHM_MQ_QUERY_FINISH) |
| 72 | ereport(ERROR, |
| 73 | (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), |
| 74 | errmsg("could not send tuple to shared-memory queue"))); |
| 75 | |
| 76 | return true; |
| 77 | } |
| 78 | |
| 79 | /* |
| 80 | * Prepare to receive tuples from executor. |
nothing calls this directly
no test coverage detected