Repository: tobymao/sqlglot
Issue category: Bug Report

"SERIAL" keyword is not supported in mysql dialect
"SERIAL" keyword is not supported using "mysql" read dialect, example within CREATE TABLE block:

## Reproduce
```python
sql = """
CREATE TABLE temp
(
    id SERIAL PRIMARY KEY
);
"""
sqlglot.transpile(sql, write='mysql',read='mysql',pretty=True,comments=False)
```

## Error:
```bash
Traceback (most recent call last):
  File "/Users/xxx/Library/Application Support/JetBrains/IntelliJIdea2024.3/plugins/python-ce/helpers/pydev/pydevconsole.py", line 364, in runcode
    coro = func()
           ^^^^^^
  File "<input>", line 1, in <module>
  File "/Users/xxx/workspace/venv/lib/python3.12/site-packages/sqlglot/__init__.py", line 177, in transpile
    for expression in parse(sql, read, error_level=error_level)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/workspace/venv/lib/python3.12/site-packages/sqlglot/__init__.py", line 102, in parse
    return Dialect.get_or_raise(read or dialect).parse(sql, **opts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/workspace/venv/lib/python3.12/site-packages/sqlglot/dialects/dialect.py", line 921, in parse
    return self.parser(**opts).parse(self.tokenize(sql), sql)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/workspace/venv/lib/python3.12/site-packages/sqlglot/parser.py", line 1417, in parse
    return self._parse(
           ^^^^^^^^^^^^
  File "/Users/xxx/workspace/venv/lib/python3.12/site-packages/sqlglot/parser.py", line 1486, in _parse
    expressions.append(parse_method(self))
                       ^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/workspace/venv/lib/python3.12/site-packages/sqlglot/parser.py", line 1719, in _parse_statement
    stmt = self.STATEMENT_PARSERS[self._prev.token_type](self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/workspace/venv/lib/python3.12/site-packages/sqlglot/parser.py", line 786, in <lambda>
    TokenType.CREATE: lambda self: self._parse_create(),
                                   ^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/workspace/venv/lib/python3.12/site-packages/sqlglot/parser.py", line 1878, in _parse_create
    this = self._parse_schema(this=table_parts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/workspace/venv/lib/python3.12/site-packages/sqlglot/parser.py", line 5436, in _parse_schema
    self._match_r_paren()
  File "/Users/xxx/workspace/venv/lib/python3.12/site-packages/sqlglot/parser.py", line 7255, in _match_r_paren
    self.raise_error("Expecting )")
  File "/Users/xxx/workspace/venv/lib/python3.12/site-packages/sqlglot/parser.py", line 1530, in raise_error
    raise error
sqlglot.errors.ParseError: Expecting ). Line 4, Col: 10.
  
CREATE TABLE temp
(
    id SERIAL PRIMARY KEY
);
```




Functions to edit:
sqlglot/dialects/mysql.py:MySQL

Patch:
diff --git a/sqlglot/dialects/mysql.py b/sqlglot/dialects/mysql.py
index f623f04387..fde34b0f0d 100644
--- a/sqlglot/dialects/mysql.py
+++ b/sqlglot/dialects/mysql.py
@@ -205,6 +205,7 @@ class Tokenizer(tokens.Tokenizer):
             "MEDIUMINT": TokenType.MEDIUMINT,
             "MEMBER OF": TokenType.MEMBER_OF,
             "SEPARATOR": TokenType.SEPARATOR,
+            "SERIAL": TokenType.SERIAL,
             "START": TokenType.BEGIN,
             "SIGNED": TokenType.BIGINT,
             "SIGNED INTEGER": TokenType.BIGINT,

Test patch: diff --git a/tests/dialects/test_mysql.py b/tests/dialects/test_mysql.py
index 465c23173c..5eb89f3beb 100644
--- a/tests/dialects/test_mysql.py
+++ b/tests/dialects/test_mysql.py
@@ -18,6 +18,7 @@ def test_ddl(self):
         self.validate_identity("CREATE TABLE foo (a BIGINT, UNIQUE (b) USING BTREE)")
         self.validate_identity("CREATE TABLE foo (id BIGINT)")
         self.validate_identity("CREATE TABLE 00f (1d BIGINT)")
+        self.validate_identity("CREATE TABLE temp (id SERIAL PRIMARY KEY)")
         self.validate_identity("UPDATE items SET items.price = 0 WHERE items.id >= 5 LIMIT 10")
         self.validate_identity("DELETE FROM t WHERE a <= 10 LIMIT 10")
         self.validate_identity("CREATE TABLE foo (a BIGINT, INDEX USING BTREE (b))")