mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-31 03:07:20 +00:00
Add support for MySQL auto_increment offset (#950)
This commit is contained in:
parent
41e47cc013
commit
9500649c35
4 changed files with 52 additions and 0 deletions
|
@ -312,6 +312,31 @@ fn parse_create_table_comment() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_create_table_auto_increment_offset() {
|
||||
let canonical =
|
||||
"CREATE TABLE foo (bar INT NOT NULL AUTO_INCREMENT) ENGINE=InnoDB AUTO_INCREMENT 123";
|
||||
let with_equal =
|
||||
"CREATE TABLE foo (bar INT NOT NULL AUTO_INCREMENT) ENGINE=InnoDB AUTO_INCREMENT=123";
|
||||
|
||||
for sql in [canonical, with_equal] {
|
||||
match mysql().one_statement_parses_to(sql, canonical) {
|
||||
Statement::CreateTable {
|
||||
name,
|
||||
auto_increment_offset,
|
||||
..
|
||||
} => {
|
||||
assert_eq!(name.to_string(), "foo");
|
||||
assert_eq!(
|
||||
auto_increment_offset.expect("Should exist").to_string(),
|
||||
"123"
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_create_table_set_enum() {
|
||||
let sql = "CREATE TABLE foo (bar SET('a', 'b'), baz ENUM('a', 'b'))";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue