Skip to content

Commit 2713ea4

Browse files
allow multiple index types in parsed result
1 parent bdbd173 commit 2713ea4

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

src/parser/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7123,15 +7123,6 @@ impl<'a> Parser<'a> {
71237123
// parse it anyway (as we do inside `ALTER TABLE` and `CREATE TABLE` parsing).
71247124
let index_options = self.parse_index_options()?;
71257125

7126-
// Only keep the latest USING, we don't take the IndexOption out of the vec and place the
7127-
// value in the `using` var because we try to keep the order of the options as they appear.
7128-
if index_options
7129-
.iter()
7130-
.any(|opt| matches!(opt, IndexOption::Using(_)))
7131-
{
7132-
using = None;
7133-
};
7134-
71357126
// MySQL allows `ALGORITHM` and `LOCK` options. Unlike in `ALTER TABLE`, they need not be comma separated.
71367127
let mut alter_options = Vec::new();
71377128
while self

tests/sqlparser_common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17270,7 +17270,7 @@ fn parse_create_index_different_using_positions() {
1727017270
}
1727117271

1727217272
let sql = "CREATE INDEX idx_name USING BTREE ON table_name (col1) USING HASH";
17273-
let expected = "CREATE INDEX idx_name ON table_name(col1) USING HASH";
17273+
let expected = "CREATE INDEX idx_name ON table_name USING BTREE (col1) USING HASH";
1727417274
match all_dialects().one_statement_parses_to(sql, expected) {
1727517275
Statement::CreateIndex(CreateIndex {
1727617276
name,

0 commit comments

Comments
 (0)