mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-17 01:07:19 +00:00
MySQL: CREATE INDEX
: allow USING
clause before ON
(#2029)
Some checks failed
license / Release Audit Tool (RAT) (push) Has been cancelled
Rust / codestyle (push) Has been cancelled
Rust / lint (push) Has been cancelled
Rust / benchmark-lint (push) Has been cancelled
Rust / compile (push) Has been cancelled
Rust / docs (push) Has been cancelled
Rust / compile-no-std (push) Has been cancelled
Rust / test (beta) (push) Has been cancelled
Rust / test (nightly) (push) Has been cancelled
Rust / test (stable) (push) Has been cancelled
Some checks failed
license / Release Audit Tool (RAT) (push) Has been cancelled
Rust / codestyle (push) Has been cancelled
Rust / lint (push) Has been cancelled
Rust / benchmark-lint (push) Has been cancelled
Rust / compile (push) Has been cancelled
Rust / docs (push) Has been cancelled
Rust / compile-no-std (push) Has been cancelled
Rust / test (beta) (push) Has been cancelled
Rust / test (nightly) (push) Has been cancelled
Rust / test (stable) (push) Has been cancelled
This commit is contained in:
parent
c0998832a2
commit
7461d8bd02
3 changed files with 55 additions and 5 deletions
|
@ -17252,6 +17252,49 @@ fn parse_invisible_column() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_create_index_different_using_positions() {
|
||||
let sql = "CREATE INDEX idx_name USING BTREE ON table_name (col1)";
|
||||
let expected = "CREATE INDEX idx_name ON table_name USING BTREE (col1)";
|
||||
match all_dialects().one_statement_parses_to(sql, expected) {
|
||||
Statement::CreateIndex(CreateIndex {
|
||||
name,
|
||||
table_name,
|
||||
using,
|
||||
columns,
|
||||
unique,
|
||||
..
|
||||
}) => {
|
||||
assert_eq!(name.unwrap().to_string(), "idx_name");
|
||||
assert_eq!(table_name.to_string(), "table_name");
|
||||
assert_eq!(using, Some(IndexType::BTree));
|
||||
assert_eq!(columns.len(), 1);
|
||||
assert!(!unique);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
let sql = "CREATE INDEX idx_name USING BTREE ON table_name (col1) USING HASH";
|
||||
let expected = "CREATE INDEX idx_name ON table_name USING BTREE (col1) USING HASH";
|
||||
match all_dialects().one_statement_parses_to(sql, expected) {
|
||||
Statement::CreateIndex(CreateIndex {
|
||||
name,
|
||||
table_name,
|
||||
columns,
|
||||
index_options,
|
||||
..
|
||||
}) => {
|
||||
assert_eq!(name.unwrap().to_string(), "idx_name");
|
||||
assert_eq!(table_name.to_string(), "table_name");
|
||||
assert_eq!(columns.len(), 1);
|
||||
assert!(index_options
|
||||
.iter()
|
||||
.any(|o| o == &IndexOption::Using(IndexType::Hash)));
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_alter_user() {
|
||||
verified_stmt("ALTER USER u1");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue