diff --git a/core/translate/expr.rs b/core/translate/expr.rs index 37c25c401..ed52c1675 100644 --- a/core/translate/expr.rs +++ b/core/translate/expr.rs @@ -2159,7 +2159,7 @@ pub fn translate_expr( // this value into the proper order. let index = program.parameters.push(name); if let Some(ref mut indicies) = &mut program.param_positions { - // index of the parameter in the inserted values + index of the parameter relative + // (value_index, parameter_index) indicies.push((program.current_col_idx.unwrap_or(index.get()), index)); } program.emit_insn(Insn::Variable { diff --git a/core/translate/insert.rs b/core/translate/insert.rs index e05030cb3..c9ed37005 100644 --- a/core/translate/insert.rs +++ b/core/translate/insert.rs @@ -648,6 +648,7 @@ fn populate_column_registers( // if there are any parameter positions, we sort them by the value_index position // to ensure we are binding the parameters to the proper index later on if let Some(ref mut params) = program.param_positions.as_mut() { + // sort the tuples by the value_index position, leaving the param_index in right order. params.sort_by_key(|(val_pos, _)| *val_pos); let remap = params .iter()