Handle FunctionCallStar in analyze_expr

This commit is contained in:
Vegard Stikbakke
2024-08-11 13:49:16 +02:00
parent f75b43f28e
commit e54fd83f49
2 changed files with 21 additions and 1 deletions

View File

@@ -1,3 +1,5 @@
use core::panic;
use crate::{function::JsonFunc, Result};
use sqlite3_parser::ast::{self, Expr, UnaryOperator};
@@ -582,7 +584,21 @@ pub fn analyze_expr<'a>(expr: &'a Expr, column_info_out: &mut ColumnInfo<'a>) {
column_info_out.args = args;
}
}
ast::Expr::FunctionCallStar { .. } => todo!(),
ast::Expr::FunctionCallStar {
name,
filter_over: _,
} => {
let func_type =
match Func::resolve_function(normalize_ident(name.0.as_str()).as_str(), 1) {
Ok(func) => Some(func),
Err(_) => None,
};
if func_type.is_none() {
panic!("Function not found");
} else {
column_info_out.func = func_type;
}
}
_ => {}
}
}

View File

@@ -35,6 +35,10 @@ do_execsql_test select-count {
SELECT count(id) FROM users;
} {10000}
do_execsql_test select-count {
SELECT count(*) FROM users;
} {10000}
do_execsql_test select-max {
SELECT max(age) FROM users;
} {100}