Start up execution of one execution_state node */
| 933 | |
| 934 | /* Start up execution of one execution_state node */ |
| 935 | static void |
| 936 | postquel_start(execution_state *es, SQLFunctionCachePtr fcache) |
| 937 | { |
| 938 | DestReceiver *dest; |
| 939 | |
| 940 | Assert(es->qd == NULL); |
| 941 | |
| 942 | /* Caller should have ensured a suitable snapshot is active */ |
| 943 | Assert(ActiveSnapshotSet()); |
| 944 | |
| 945 | /* |
| 946 | * If this query produces the function result, send its output to the |
| 947 | * tuplestore; else discard any output. |
| 948 | */ |
| 949 | if (es->setsResult) |
| 950 | { |
| 951 | DR_sqlfunction *myState; |
| 952 | |
| 953 | dest = CreateDestReceiver(DestSQLFunction); |
| 954 | /* pass down the needed info to the dest receiver routines */ |
| 955 | myState = (DR_sqlfunction *) dest; |
| 956 | Assert(myState->pub.mydest == DestSQLFunction); |
| 957 | myState->tstore = fcache->tstore; |
| 958 | myState->cxt = CurrentMemoryContext; |
| 959 | myState->filter = fcache->junkFilter; |
| 960 | } |
| 961 | else |
| 962 | dest = None_Receiver; |
| 963 | |
| 964 | es->qd = CreateQueryDesc(es->stmt, |
| 965 | fcache->src, |
| 966 | GetActiveSnapshot(), |
| 967 | InvalidSnapshot, |
| 968 | dest, |
| 969 | fcache->paramLI, |
| 970 | es->qd ? es->qd->queryEnv : NULL, |
| 971 | 0); |
| 972 | |
| 973 | /* GPDB hook for collecting query info */ |
| 974 | if (query_info_collect_hook) |
| 975 | (*query_info_collect_hook)(METRICS_QUERY_SUBMIT, es->qd); |
| 976 | |
| 977 | /* Utility commands don't need Executor. */ |
| 978 | if (es->qd->operation != CMD_UTILITY) |
| 979 | { |
| 980 | int eflags; |
| 981 | |
| 982 | if (!IsResManagerMemoryPolicyNone() |
| 983 | && SPI_IsMemoryReserved()) |
| 984 | { |
| 985 | es->qd->plannedstmt->query_mem = SPI_GetMemoryReservation(); |
| 986 | } |
| 987 | |
| 988 | /* |
| 989 | * In lazyEval mode, do not let the executor set up an AfterTrigger |
| 990 | * context. This is necessary not just an optimization, because we |
| 991 | * mustn't exit from the function execution with a stacked |
| 992 | * AfterTrigger level still active. We are careful not to select |
no test coverage detected