diff --git a/src/common/backend/pgxc_single/pool/execRemote.cpp b/src/common/backend/pgxc_single/pool/execRemote.cpp index 221a0a4e0..b518da2f8 100755 --- a/src/common/backend/pgxc_single/pool/execRemote.cpp +++ b/src/common/backend/pgxc_single/pool/execRemote.cpp @@ -1600,7 +1600,9 @@ void spq_do_query(RemoteQueryState* node) need_stream_sync = step->num_stream > 0 ? true : false; } #endif - + if (node->rqs_num_params) { + step->sql_statement = node->serializedPlan; + } /* * Send begin statement to all datanodes for RW transaction parallel. * Current it should be RO transaction diff --git a/src/gausskernel/process/tcop/postgres.cpp b/src/gausskernel/process/tcop/postgres.cpp index 316a20259..1a3494a8a 100755 --- a/src/gausskernel/process/tcop/postgres.cpp +++ b/src/gausskernel/process/tcop/postgres.cpp @@ -3214,7 +3214,7 @@ static void exec_plan_with_params(StringInfo input_message) } if (paramTypeNames != NULL) { - if (IsConnFromCoord() || (IS_PGXC_COORDINATOR && planstmt->in_compute_pool)) { + if (IS_SPQ_EXECUTOR || IsConnFromCoord() || (IS_PGXC_COORDINATOR && planstmt->in_compute_pool)) { int cnt_param; for (cnt_param = 0; cnt_param < numParams; cnt_param++) parseTypeString(paramTypeNames[cnt_param], ¶mTypes[cnt_param], NULL); @@ -3460,6 +3460,9 @@ static void exec_plan_with_params(StringInfo input_message) } finish_xact_command(); + if (planstmt->enable_adaptive_scan) { + disconnect_qc_conn(planstmt); + } } #endif @@ -8988,7 +8991,8 @@ int PostgresMain(int argc, char* argv[], const char* dbname, const char* usernam case 'Y': /* plan with params */ { - if (IS_PGXC_COORDINATOR || IS_SINGLE_NODE) + t_thrd.spq_ctx.spq_role = ROLE_QUERY_EXECUTOR; + if ((IS_PGXC_COORDINATOR || IS_SINGLE_NODE) && (!IS_SPQ_EXECUTOR)) ereport(ERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), errmsg("invalid frontend message type '%c'.", firstchar)));