forked from src-d/go-mysql-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: add support for intervals, DATE_SUB and DATE_ADD
Fixes src-d#663 This PR introduces a few new features: - Correctly parsing interval expressions. - Allow using the + and - operators to subtract from and add to dates. e.g. `'2019-04-10' - INTERVAL 1 DAY`. - New `DATE_ADD` function, which is essentially the same as `DATE + INTERVAL`. - New `DATE_SUB` function, which is essentially the same as `DATE - INTERVAL`. - Validation rule to ensure intervals are only used in certain specific places, such as DATE_SUB, DATE_ADD, + and -. Using it anywhere else is not valid SQL, but vitess does not catch those errors. Plus, even if it's an expression for convenience, its `Eval` method is a stub and panics, so it should not be used unless it's in an expression that knows how to deal with intervals. Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
- Loading branch information
1 parent
d03de5f
commit 69d26d9
Showing
14 changed files
with
1,206 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.