123456789101112131415161718 |
- package xsql
- import "fmt"
- // Validate validate select statement without context.
- // This is the pre-validation. In planner, there will be a more comprehensive validation after binding
- func Validate(stmt *SelectStatement) error {
- if HasAggFuncs(stmt.Condition) {
- return fmt.Errorf("Not allowed to call aggregate functions in WHERE clause.")
- }
- for _, d := range stmt.Dimensions {
- if HasAggFuncs(d.Expr) {
- return fmt.Errorf("Not allowed to call aggregate functions in GROUP BY clause.")
- }
- }
- return nil
- }
|