diff --git a/core/translate/display.rs b/core/translate/display.rs index e62aac9fd..9895aafbd 100644 --- a/core/translate/display.rs +++ b/core/translate/display.rs @@ -37,8 +37,8 @@ impl Display for Plan { order_by, } => { for (plan, operator) in left { - writeln!(f, "{}", operator)?; plan.fmt(f)?; + writeln!(f, "{}", operator)?; } right_most.fmt(f)?; if let Some(limit) = limit { @@ -283,7 +283,7 @@ impl ToSqlString for Plan { let mut ret = Vec::new(); for (plan, operator) in left { - ret.push(format!("{} {}", operator, plan.to_sql_string(context))); + ret.push(format!("{} {}", plan.to_sql_string(context), operator)); } ret.push(right_most.to_sql_string(context)); if let Some(order_by) = &order_by { diff --git a/core/translate/select.rs b/core/translate/select.rs index d06271ca7..85469be64 100644 --- a/core/translate/select.rs +++ b/core/translate/select.rs @@ -149,10 +149,10 @@ pub fn prepare_select_plan<'a>( )?; } - // Ensure all subplans have same number of result columns - let first_num_result_columns = last.result_columns.len(); + // Ensure all subplans have the same number of result columns + let right_most_num_result_columns = last.result_columns.len(); for (plan, operator) in left.iter() { - if plan.result_columns.len() != first_num_result_columns { + if plan.result_columns.len() != right_most_num_result_columns { crate::bail_parse_error!("SELECTs to the left and right of {} do not have the same number of result columns", operator); } } diff --git a/testing/testing_user_version_10.db b/testing/testing_user_version_10.db index d81609441..d51d013f1 100644 Binary files a/testing/testing_user_version_10.db and b/testing/testing_user_version_10.db differ