Skip to content

Commit 91bb744

Browse files
committed
Address review feedback for CREATE INDEX ASYNC
- Add DSQL docs link to the async field - Simplify async index tests to round-trip verified_stmt calls - Move async index tests from sqlparser_postgres.rs to sqlparser_common.rs
1 parent 204f047 commit 91bb744

3 files changed

Lines changed: 7 additions & 20 deletions

File tree

src/ast/ddl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2819,6 +2819,7 @@ pub struct CreateIndex {
28192819
/// whether the index is created concurrently
28202820
pub concurrently: bool,
28212821
/// whether the index is created asynchronously
2822+
/// [DSQL]: <https://docs.aws.amazon.com/aurora-dsql/latest/userguide/working-with-create-index-async.html>
28222823
pub r#async: bool,
28232824
/// IF NOT EXISTS clause
28242825
pub if_not_exists: bool,

tests/sqlparser_common.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9623,6 +9623,12 @@ fn test_create_index_with_with_clause() {
96239623
}
96249624
}
96259625

9626+
#[test]
9627+
fn parse_create_index_async() {
9628+
verified_stmt("CREATE INDEX ASYNC my_index ON my_table(col1)");
9629+
verified_stmt("CREATE UNIQUE INDEX ASYNC my_index ON my_table(col1)");
9630+
}
9631+
96269632
#[test]
96279633
fn parse_drop_index() {
96289634
let sql = "DROP INDEX idx_a";

tests/sqlparser_postgres.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3227,26 +3227,6 @@ fn parse_create_index_concurrently() {
32273227
}
32283228
}
32293229

3230-
#[test]
3231-
fn parse_create_index_async() {
3232-
pg().verified_stmt("CREATE INDEX ASYNC my_index ON my_table(col1)");
3233-
3234-
let sql = "CREATE UNIQUE INDEX ASYNC my_index ON my_table(col1)";
3235-
match pg().verified_stmt(sql) {
3236-
Statement::CreateIndex(CreateIndex {
3237-
unique,
3238-
concurrently,
3239-
r#async,
3240-
..
3241-
}) => {
3242-
assert!(unique);
3243-
assert!(!concurrently);
3244-
assert!(r#async);
3245-
}
3246-
_ => unreachable!(),
3247-
}
3248-
}
3249-
32503230
#[test]
32513231
fn parse_create_index_with_predicate() {
32523232
let sql = "CREATE INDEX IF NOT EXISTS my_index ON my_table(col1, col2) WHERE col3 IS NULL";

0 commit comments

Comments
 (0)