Skip to content

Commit

Permalink
fix data trunc supported types
Browse files Browse the repository at this point in the history
  • Loading branch information
ariesdevil committed Jul 13, 2022
1 parent b6b2fb0 commit 6973593
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion common/ast/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ pub fn expr_element(i: Input) -> IResult<WithSpan<ExprElement>> {
| #cast : "`CAST(... AS ...)`"
| #date_add: "`DATE_ADD(..., ..., (YEAR| MONTH | DAY | HOUR | MINUTE | SECOND | DOY | DOW))`"
| #date_sub: "`DATE_SUB(..., ..., (YEAR| MONTH | DAY | HOUR | MINUTE | SECOND | DOY | DOW))`"
| #date_trunc: "`DATE_TRUNC((YEAR | MONTH | DAY | HOUR | MINUTE | SECOND | DOY | DOW), ...)`"
| #date_trunc: "`DATE_TRUNC((YEAR | MONTH | DAY | HOUR | MINUTE | SECOND), ...)`"
| #interval: "`INTERVAL ... (YEAR| MONTH | DAY | HOUR | MINUTE | SECOND | DOY | DOW)`"
| #pg_cast : "`::<type_name>`"
| #extract : "`EXTRACT((YEAR | MONTH | DAY | HOUR | MINUTE | SECOND) FROM ...)`"
Expand Down
1 change: 0 additions & 1 deletion common/exception/src/exception_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ build_exceptions! {
IllegalUDFFormat(2601),
UnknownUDF(2602),
UdfAlreadyExists(2603),
UnsupportedIntervalKind(2604),

// Database error codes.
UnknownDatabaseEngine(2701),
Expand Down
2 changes: 1 addition & 1 deletion query/src/sql/planner/semantic/type_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ impl<'a> TypeChecker<'a> {
)
.await
}
_ => Err(ErrorCode::UnsupportedIntervalKind("Only these interval types are currently supported: year, month, day, hour, minute, second")),
_ => Err(ErrorCode::SemanticError(span.display_error("Only these interval types are currently supported: [year, month, day, hour, minute, second]".to_string()))),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ ERROR 1105 (HY000) at line 8: Code: 1065, displayText = error:
1 | select a as b from t1 intersect select a as b from t2 order by a
| ^ column doesn't exist

.
.

0 comments on commit 6973593

Please sign in to comment.