diff --git a/ddl/util/util.go b/ddl/util/util.go index b4e22b8f80034..57e307735d6b7 100644 --- a/ddl/util/util.go +++ b/ddl/util/util.go @@ -36,7 +36,7 @@ const ( completeDeleteMultiRangesSQL = `DELETE FROM mysql.gc_delete_range WHERE job_id = %? AND element_id in (` // + idList + ")" updateDeleteRangeSQL = `UPDATE mysql.gc_delete_range SET start_key = %? WHERE job_id = %? AND element_id = %? AND start_key = %?` deleteDoneRecordSQL = `DELETE FROM mysql.gc_delete_range_done WHERE job_id = %? AND element_id = %?` - loadGlobalVars = `SELECT HIGH_PRIORITY variable_name, variable_value from mysql.global_variables where variable_name in (` // + nameList + ")" + loadGlobalVars = `SELECT HIGH_PRIORITY variable_name, variable_value from mysql.global_variables where variable_name in (%?)` ) // DelRangeTask is for run delete-range command in gc_worker. @@ -162,18 +162,7 @@ func LoadDDLVars(ctx sessionctx.Context) error { // LoadGlobalVars loads global variable from mysql.global_variables. func LoadGlobalVars(ctx sessionctx.Context, varNames []string) error { if sctx, ok := ctx.(sqlexec.RestrictedSQLExecutor); ok { - var buf strings.Builder - buf.WriteString(loadGlobalVars) - paramNames := make([]interface{}, 0, len(varNames)) - for i, name := range varNames { - if i > 0 { - buf.WriteString(", ") - } - buf.WriteString("%?") - paramNames = append(paramNames, name) - } - buf.WriteString(")") - stmt, err := sctx.ParseWithParams(context.Background(), buf.String(), paramNames...) + stmt, err := sctx.ParseWithParams(context.Background(), loadGlobalVars, varNames) if err != nil { return errors.Trace(err) }