iffyio commented on code in PR #1751:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1751#discussion_r1974845227


##########
tests/sqlparser_mysql.rs:
##########
@@ -1047,6 +1047,174 @@ 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_without_equals() {
+    mysql_and_generic().one_statement_parses_to(
+        "CREATE TABLE foo (id INT) CHARSET utf8mb4",
+        "CREATE TABLE foo (id INT) DEFAULT CHARSET = utf8mb4",
+    );
+
+    mysql_and_generic().one_statement_parses_to(
+        "CREATE TABLE foo (id INT) COLLATE utf8mb4_unicode_ci",
+        "CREATE TABLE foo (id INT) COLLATE = utf8mb4_unicode_ci",
+    );
+
+    mysql_and_generic().one_statement_parses_to(
+        "CREATE TABLE foo (id INT) ENGINE InnoDB",
+        "CREATE TABLE foo (id INT) ENGINE = InnoDB",
+    );
+
+    mysql_and_generic().one_statement_parses_to(
+        "CREATE TABLE foo (id INT) DEFAULT CHARSET utf8mb4",
+        "CREATE TABLE foo (id INT) DEFAULT CHARSET = utf8mb4",
+    );
+
+    mysql_and_generic().one_statement_parses_to(
+        "CREATE TABLE foo (id INT) DEFAULT COLLATE utf8mb4_unicode_ci",
+        "CREATE TABLE foo (id INT) COLLATE = utf8mb4_unicode_ci",
+    );
+
+    mysql_and_generic().one_statement_parses_to(
+        "CREATE TABLE foo (id INT) AUTO_INCREMENT 123",
+        "CREATE TABLE foo (id INT) AUTO_INCREMENT = 123",
+    );
+
+    // Test multiple options
+    mysql_and_generic().one_statement_parses_to(
+            "CREATE TABLE foo (id INT) ENGINE InnoDB AUTO_INCREMENT 100 
CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci",
+            "CREATE TABLE foo (id INT) ENGINE = InnoDB AUTO_INCREMENT = 100 
DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci",
+        );
+
+    // Test mixing options with and without equals sign
+    mysql_and_generic().one_statement_parses_to(
+            "CREATE TABLE foo (id INT) ENGINE InnoDB AUTO_INCREMENT = 100 
CHARSET = utf8mb4 COLLATE utf8mb4_unicode_ci",
+            "CREATE TABLE foo (id INT) ENGINE = InnoDB AUTO_INCREMENT = 100 
DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci",
+        );
+}
+
+#[test]
+#[ignore = "not yet supported"]

Review Comment:
   Yeah I think we can remove and add it back when we have support for the 
syntax



##########
tests/sqlparser_mysql.rs:
##########
@@ -1047,6 +1047,174 @@ 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_without_equals() {
+    mysql_and_generic().one_statement_parses_to(
+        "CREATE TABLE foo (id INT) CHARSET utf8mb4",
+        "CREATE TABLE foo (id INT) DEFAULT CHARSET = utf8mb4",
+    );
+
+    mysql_and_generic().one_statement_parses_to(
+        "CREATE TABLE foo (id INT) COLLATE utf8mb4_unicode_ci",
+        "CREATE TABLE foo (id INT) COLLATE = utf8mb4_unicode_ci",

Review Comment:
   I'm thinking the mismatches aren't ideal if we would rather represent the 
input SQL faithfully?



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to