Display CREATE INDEX column list separated by commas with spaces

The column list in `CREATE INDEX` now matches the style used elsewhere,
e.g. in `TableConstraint`, which is to use spaces after commas.

```sql
-- before:
CREATE INDEX idx_name ON table_name (column1,column2,column3);
-- after:
CREATE INDEX idx_name ON table_name (column1, column2, column3);
```

When `CreateIndex` was added, there was no explanation for the lack of
spaces, so I assume it was just author preference. But standard style in
all documentation I've seen is to use spaces after commas (including
[MSSQL]'s documentation of `INCLUDE`, which copied the no-spaces style
when added).

[MSSQL]: https://learn.microsoft.com/en-us/sql/t-sql/statements/create-index-transact-sql?view=sql-server-ver17#i-create-an-index-with-included-non-key-columns
This commit is contained in:
Michael Victor Zink 2025-07-07 11:03:35 -07:00
parent 3583514602
commit 00662c03fb
3 changed files with 14 additions and 14 deletions

View file

@ -9175,7 +9175,7 @@ fn ensure_multiple_dialects_are_tested() {
#[test]
fn parse_create_index() {
let sql = "CREATE UNIQUE INDEX IF NOT EXISTS idx_name ON test(name,age DESC)";
let sql = "CREATE UNIQUE INDEX IF NOT EXISTS idx_name ON test(name, age DESC)";
let indexed_columns: Vec<IndexColumn> = vec![
IndexColumn {
operator_class: None,
@ -9221,7 +9221,7 @@ fn parse_create_index() {
#[test]
fn test_create_index_with_using_function() {
let sql = "CREATE UNIQUE INDEX IF NOT EXISTS idx_name ON test USING BTREE (name,age DESC)";
let sql = "CREATE UNIQUE INDEX IF NOT EXISTS idx_name ON test USING BTREE (name, age DESC)";
let indexed_columns: Vec<IndexColumn> = vec![
IndexColumn {
operator_class: None,