| 962 | } ArrayConstIterState; |
| 963 | |
| 964 | static void |
| 965 | arrayconst_startup_fn(Node *clause, PredIterInfo info) |
| 966 | { |
| 967 | ScalarArrayOpExpr *saop = (ScalarArrayOpExpr *) clause; |
| 968 | ArrayConstIterState *state; |
| 969 | Const *arrayconst; |
| 970 | ArrayType *arrayval; |
| 971 | int16 elmlen; |
| 972 | bool elmbyval; |
| 973 | char elmalign; |
| 974 | |
| 975 | /* Create working state struct */ |
| 976 | state = (ArrayConstIterState *) palloc(sizeof(ArrayConstIterState)); |
| 977 | info->state = (void *) state; |
| 978 | |
| 979 | /* Deconstruct the array literal */ |
| 980 | arrayconst = (Const *) lsecond(saop->args); |
| 981 | arrayval = DatumGetArrayTypeP(arrayconst->constvalue); |
| 982 | get_typlenbyvalalign(ARR_ELEMTYPE(arrayval), |
| 983 | &elmlen, &elmbyval, &elmalign); |
| 984 | deconstruct_array(arrayval, |
| 985 | ARR_ELEMTYPE(arrayval), |
| 986 | elmlen, elmbyval, elmalign, |
| 987 | &state->elem_values, &state->elem_nulls, |
| 988 | &state->num_elems); |
| 989 | |
| 990 | /* Set up a dummy OpExpr to return as the per-item node */ |
| 991 | state->opexpr.xpr.type = T_OpExpr; |
| 992 | state->opexpr.opno = saop->opno; |
| 993 | state->opexpr.opfuncid = saop->opfuncid; |
| 994 | state->opexpr.opresulttype = BOOLOID; |
| 995 | state->opexpr.opretset = false; |
| 996 | state->opexpr.opcollid = InvalidOid; |
| 997 | state->opexpr.inputcollid = saop->inputcollid; |
| 998 | state->opexpr.args = list_copy(saop->args); |
| 999 | |
| 1000 | /* Set up a dummy Const node to hold the per-element values */ |
| 1001 | state->constexpr.xpr.type = T_Const; |
| 1002 | state->constexpr.consttype = ARR_ELEMTYPE(arrayval); |
| 1003 | state->constexpr.consttypmod = -1; |
| 1004 | state->constexpr.constcollid = arrayconst->constcollid; |
| 1005 | state->constexpr.constlen = elmlen; |
| 1006 | state->constexpr.constbyval = elmbyval; |
| 1007 | lsecond(state->opexpr.args) = &state->constexpr; |
| 1008 | |
| 1009 | /* Initialize iteration state */ |
| 1010 | state->next_elem = 0; |
| 1011 | } |
| 1012 | |
| 1013 | static Node * |
| 1014 | arrayconst_next_fn(PredIterInfo info) |
nothing calls this directly
no test coverage detected