From d4c9057e5d5b6893ef3346a434ac487fb7119497 Mon Sep 17 00:00:00 2001 From: vaggelisd Date: Wed, 18 Dec 2024 12:40:43 +0200 Subject: [PATCH] feat(mysql): Support SERIAL data type --- sqlglot/dialects/mysql.py | 1 + tests/dialects/test_mysql.py | 1 + 2 files changed, 2 insertions(+) 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, 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))")