mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-15 03:30:16 +00:00
MySQL: Support comma-separated CREATE TABLE
options (#1989)
Some checks are pending
license / Release Audit Tool (RAT) (push) Waiting to run
Rust / codestyle (push) Waiting to run
Rust / lint (push) Waiting to run
Rust / benchmark-lint (push) Waiting to run
Rust / compile (push) Waiting to run
Rust / docs (push) Waiting to run
Rust / compile-no-std (push) Waiting to run
Rust / test (beta) (push) Waiting to run
Rust / test (nightly) (push) Waiting to run
Rust / test (stable) (push) Waiting to run
Some checks are pending
license / Release Audit Tool (RAT) (push) Waiting to run
Rust / codestyle (push) Waiting to run
Rust / lint (push) Waiting to run
Rust / benchmark-lint (push) Waiting to run
Rust / compile (push) Waiting to run
Rust / docs (push) Waiting to run
Rust / compile-no-std (push) Waiting to run
Rust / test (beta) (push) Waiting to run
Rust / test (nightly) (push) Waiting to run
Rust / test (stable) (push) Waiting to run
This commit is contained in:
parent
c1648e79fe
commit
3583514602
3 changed files with 11 additions and 1 deletions
|
@ -590,7 +590,7 @@ pub trait Dialect: Debug + Any {
|
|||
false
|
||||
}
|
||||
|
||||
/// Returne true if the dialect supports specifying multiple options
|
||||
/// Return true if the dialect supports specifying multiple options
|
||||
/// in a `CREATE TABLE` statement for the structure of the new table. For example:
|
||||
/// `CREATE TABLE t (a INT, b INT) AS SELECT 1 AS b, 2 AS a`
|
||||
fn supports_create_table_multi_schema_info_sources(&self) -> bool {
|
||||
|
|
|
@ -7708,6 +7708,9 @@ impl<'a> Parser<'a> {
|
|||
|
||||
while let Some(option) = self.parse_plain_option()? {
|
||||
options.push(option);
|
||||
// Some dialects support comma-separated options; it shouldn't introduce ambiguity to
|
||||
// consume it for all dialects.
|
||||
let _ = self.consume_token(&Token::Comma);
|
||||
}
|
||||
|
||||
Ok(options)
|
||||
|
|
|
@ -1361,6 +1361,13 @@ fn parse_create_table_gencol() {
|
|||
mysql_and_generic().verified_stmt("CREATE TABLE t1 (a INT, b INT AS (a * 2) STORED)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_create_table_options_comma_separated() {
|
||||
let sql = "CREATE TABLE t (x INT) DEFAULT CHARSET = utf8mb4, ENGINE = InnoDB , AUTO_INCREMENT 1 DATA DIRECTORY '/var/lib/mysql/data'";
|
||||
let canonical = "CREATE TABLE t (x INT) DEFAULT CHARSET = utf8mb4 ENGINE = InnoDB AUTO_INCREMENT = 1 DATA DIRECTORY = '/var/lib/mysql/data'";
|
||||
mysql_and_generic().one_statement_parses_to(sql, canonical);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_quote_identifiers() {
|
||||
let sql = "CREATE TABLE `PRIMARY` (`BEGIN` INT PRIMARY KEY)";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue