Standardize CREATE TABLE options equals signs#1751
Standardize CREATE TABLE options equals signs#1751mvzink wants to merge 1 commit intoapache:mainfrom
Conversation
* Make spaces around equals signs canonical: `ENGINE = InnoDB` instead of `ENGINE=InnoDB` * Make equals signs canonical: `AUTO_INCREMENT = 100` instead of `AUTO_INCREMENT 100` * Make equals signs optional for charset, engine, and collation to match MySQl: `COLLATE utf8mb4_unicode_ci` works as well as `COLLATE = utf8mb4_unicode_ci` In some dialects, some options might require the equals signs, so will be more permissive in some situations. For example, [ClickHouse] requires the equals signs for `ENGINE`. It didn't seem worth special casing this to me. [ClickHouse]: https://clickhouse.com/docs/en/sql-reference/statements/create/table/#create-table-options
|
Note that a version of #1747 which standardizes all options a la |
| } | ||
|
|
||
| #[test] | ||
| #[ignore = "not yet supported"] |
There was a problem hiding this comment.
Happy to remove this, especially if it ends up being covered by #1747 or something.
There was a problem hiding this comment.
Yeah I think we can remove and add it back when we have support for the syntax
| "CREATE TABLE foo (id INT) COLLATE utf8mb4_unicode_ci", | ||
| "CREATE TABLE foo (id INT) COLLATE = utf8mb4_unicode_ci", |
There was a problem hiding this comment.
I'm thinking the mismatches aren't ideal if we would rather represent the input SQL faithfully?
There was a problem hiding this comment.
Well, I think ideally these options would all be in a vector similar to Vec<SqlOption>, but with a flag for the equals sign like I added for ALGORITHM and AUTO_INCREMENT, which would avoid these mismatches. Maybe I will see how #1747 shakes out and then revisit this, and mark this draft in the meantime.
| } | ||
|
|
||
| #[test] | ||
| #[ignore = "not yet supported"] |
There was a problem hiding this comment.
Yeah I think we can remove and add it back when we have support for the syntax
|
Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days. |
ENGINE = InnoDBinstead ofENGINE=InnoDBAUTO_INCREMENT = 100instead ofAUTO_INCREMENT 100COLLATE utf8mb4_unicode_ciworks as well asCOLLATE = utf8mb4_unicode_ciIn some dialects, some options might require the equals signs, so will be more permissive in some situations. For example, ClickHouse requires the equals signs for
ENGINE. It didn't seem worth special casing this to me.