* Compute additional information for EEOP_*_FETCHSOME ops. * * The goal is to determine whether a slot is 'fixed', that is, every * evaluation of the expression will have the same type of slot, with an * equivalent descriptor. * * Returns true if the deforming step is required, false otherwise. */
| 2766 | * Returns true if the deforming step is required, false otherwise. |
| 2767 | */ |
| 2768 | static bool |
| 2769 | ExecComputeSlotInfo(ExprState *state, ExprEvalStep *op) |
| 2770 | { |
| 2771 | PlanState *parent = state->parent; |
| 2772 | TupleDesc desc = NULL; |
| 2773 | const TupleTableSlotOps *tts_ops = NULL; |
| 2774 | bool isfixed = false; |
| 2775 | ExprEvalOp opcode = op->opcode; |
| 2776 | |
| 2777 | Assert(opcode == EEOP_INNER_FETCHSOME || |
| 2778 | opcode == EEOP_OUTER_FETCHSOME || |
| 2779 | opcode == EEOP_SCAN_FETCHSOME); |
| 2780 | |
| 2781 | if (op->d.fetch.known_desc != NULL) |
| 2782 | { |
| 2783 | desc = op->d.fetch.known_desc; |
| 2784 | tts_ops = op->d.fetch.kind; |
| 2785 | isfixed = op->d.fetch.kind != NULL; |
| 2786 | } |
| 2787 | else if (!parent) |
| 2788 | { |
| 2789 | isfixed = false; |
| 2790 | } |
| 2791 | else if (opcode == EEOP_INNER_FETCHSOME) |
| 2792 | { |
| 2793 | PlanState *is = innerPlanState(parent); |
| 2794 | |
| 2795 | if (parent->inneropsset && !parent->inneropsfixed) |
| 2796 | { |
| 2797 | isfixed = false; |
| 2798 | } |
| 2799 | else if (parent->inneropsset && parent->innerops) |
| 2800 | { |
| 2801 | isfixed = true; |
| 2802 | tts_ops = parent->innerops; |
| 2803 | desc = ExecGetResultType(is); |
| 2804 | } |
| 2805 | else if (is) |
| 2806 | { |
| 2807 | tts_ops = ExecGetResultSlotOps(is, &isfixed); |
| 2808 | desc = ExecGetResultType(is); |
| 2809 | } |
| 2810 | } |
| 2811 | else if (opcode == EEOP_OUTER_FETCHSOME) |
| 2812 | { |
| 2813 | PlanState *os = outerPlanState(parent); |
| 2814 | |
| 2815 | if (parent->outeropsset && !parent->outeropsfixed) |
| 2816 | { |
| 2817 | isfixed = false; |
| 2818 | } |
| 2819 | else if (parent->outeropsset && parent->outerops) |
| 2820 | { |
| 2821 | isfixed = true; |
| 2822 | tts_ops = parent->outerops; |
| 2823 | desc = ExecGetResultType(os); |
| 2824 | } |
| 2825 | else if (os) |
no test coverage detected