* exec_execute_message * * Process an "Execute" message for a portal */
| 2850 | * Process an "Execute" message for a portal |
| 2851 | */ |
| 2852 | static void |
| 2853 | exec_execute_message(const char *portal_name, int64 max_rows) |
| 2854 | { |
| 2855 | CommandDest dest; |
| 2856 | DestReceiver *receiver; |
| 2857 | Portal portal; |
| 2858 | bool completed; |
| 2859 | QueryCompletion qc; |
| 2860 | const char *sourceText; |
| 2861 | const char *prepStmtName; |
| 2862 | ParamListInfo portalParams; |
| 2863 | bool save_log_statement_stats = log_statement_stats; |
| 2864 | bool is_xact_command; |
| 2865 | bool execute_is_fetch; |
| 2866 | bool was_logged = false; |
| 2867 | char msec_str[32]; |
| 2868 | ParamsErrorCbData params_data; |
| 2869 | ErrorContextCallback params_errcxt; |
| 2870 | |
| 2871 | /* Adjust destination to tell printtup.c what to do */ |
| 2872 | dest = whereToSendOutput; |
| 2873 | if (dest == DestRemote) |
| 2874 | dest = DestRemoteExecute; |
| 2875 | |
| 2876 | portal = GetPortalByName(portal_name); |
| 2877 | if (!PortalIsValid(portal)) |
| 2878 | ereport(ERROR, |
| 2879 | (errcode(ERRCODE_UNDEFINED_CURSOR), |
| 2880 | errmsg("portal \"%s\" does not exist", portal_name))); |
| 2881 | |
| 2882 | /* |
| 2883 | * If the original query was a null string, just return |
| 2884 | * EmptyQueryResponse. |
| 2885 | */ |
| 2886 | if (portal->commandTag == CMDTAG_UNKNOWN) |
| 2887 | { |
| 2888 | Assert(portal->stmts == NIL); |
| 2889 | NullCommand(dest); |
| 2890 | return; |
| 2891 | } |
| 2892 | |
| 2893 | if (Gp_role != GP_ROLE_EXECUTE) |
| 2894 | { |
| 2895 | |
| 2896 | /* |
| 2897 | * MPP-20924 |
| 2898 | * Increment command_count only if we're executing utility statements |
| 2899 | * In all other cases, we already incremented it in CreateQueryDescr |
| 2900 | */ |
| 2901 | bool is_utility_stmt = true; |
| 2902 | ListCell *stmtlist_item = NULL; |
| 2903 | foreach(stmtlist_item, portal->stmts) |
| 2904 | { |
| 2905 | Node *stmt = lfirst(stmtlist_item); |
| 2906 | if (IsA(stmt, PlannedStmt)) |
| 2907 | { |
| 2908 | is_utility_stmt = false; |
| 2909 | break; |
no test coverage detected