iffyio commented on code in PR #2302:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2302#discussion_r3136517932
##########
tests/sqlparser_postgres.rs:
##########
@@ -3217,6 +3227,58 @@ fn parse_create_index_concurrently() {
}
}
+#[test]
+fn parse_create_index_async() {
+ let sql = "CREATE INDEX ASYNC my_index ON my_table(col1)";
+ match pg().verified_stmt(sql) {
+ Statement::CreateIndex(CreateIndex {
+ name: Some(ObjectName(name)),
+ table_name: ObjectName(table_name),
+ using,
+ columns,
+ unique,
+ concurrently,
+ r#async,
+ if_not_exists,
+ include,
+ nulls_distinct: None,
+ with,
+ predicate: None,
+ index_options,
+ alter_options,
+ }) => {
+ assert_eq_vec(&["my_index"], &name);
+ assert_eq_vec(&["my_table"], &table_name);
+ assert_eq!(None, using);
+ assert!(!unique);
+ assert!(!concurrently);
+ assert!(r#async);
+ assert!(!if_not_exists);
+ assert_eq_vec(&["col1"], &columns);
+ assert!(include.is_empty());
+ assert!(with.is_empty());
+ assert!(index_options.is_empty());
+ assert!(alter_options.is_empty());
+ }
+ _ => unreachable!(),
+ }
Review Comment:
```suggestion
pg().verified_stmt("CREATE INDEX ASYNC my_index ON my_table(col1)");
```
same for the unique one. Since the flag is already asserted in other tests,
a simple round trip test scenario should suffice.
Also can we move this test to common.rs - since its not guarded specifically
to postgres
##########
src/ast/ddl.rs:
##########
@@ -2818,6 +2818,8 @@ pub struct CreateIndex {
pub unique: bool,
/// whether the index is created concurrently
pub concurrently: bool,
+ /// whether the index is created asynchronously
+ pub r#async: bool,
Review Comment:
Can we add a link to the postgres docs describing the syntax?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]