diff --git a/dbcon/mysql/ha_calpont_impl.cpp b/dbcon/mysql/ha_calpont_impl.cpp index 5a71d6d48..12eadec42 100644 --- a/dbcon/mysql/ha_calpont_impl.cpp +++ b/dbcon/mysql/ha_calpont_impl.cpp @@ -5313,8 +5313,12 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE return 0; string query; - query.assign(thd->infinidb_vtable.original_query.ptr(), - thd->infinidb_vtable.original_query.length()); + // Set the query text only once if the server executes + // subqueries separately. + if(ci->queryState) + query.assign(""); + else + query.assign(thd->query_string.str(), thd->query_string.length()); csep->data(query); try