Skip to content

Commit

Permalink
add mariadb table opts and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
James Cor committed Nov 26, 2024
1 parent 7d7ad4a commit 8a9c469
Show file tree
Hide file tree
Showing 4 changed files with 11,424 additions and 10,967 deletions.
9 changes: 9 additions & 0 deletions go/vt/sqlparser/keywords.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ var keywords = map[string]int{
"empty": EMPTY,
"enable": ENABLE,
"enclosed": ENCLOSED,
"encrypted": ENCRYPTED,
"encryption": ENCRYPTION,
"encryption_key_admin": ENCRYPTION_KEY_ADMIN,
"encryption_key_id": ENCRYPTION_KEY_ID,
"end": END,
"ends": ENDS,
"enforced": ENFORCED,
Expand Down Expand Up @@ -333,6 +335,7 @@ var keywords = map[string]int{
"is": IS,
"isolation": ISOLATION,
"issuer": ISSUER,
"itef_quotes": ITEF_QUOTES,
"iterate": ITERATE,
"join": JOIN,
"json": JSON,
Expand Down Expand Up @@ -447,6 +450,9 @@ var keywords = map[string]int{
"outfile": OUTFILE,
"over": OVER,
"pack_keys": PACK_KEYS,
"page_checksum": PAGE_CHECKSUM,
"page_compressed": PAGE_COMPRESSED,
"page_compression_level": PAGE_COMPRESSION_LEVEL,
"partition": PARTITION,
"partitioning": PARTITIONING,
"partitions": PARTITIONS,
Expand Down Expand Up @@ -629,6 +635,7 @@ var keywords = map[string]int{
"tp_connection_admin": TP_CONNECTION_ADMIN,
"trailing": TRAILING,
"transaction": TRANSACTION,
"transactional": TRANSACTIONAL,
"trigger": TRIGGER,
"triggers": TRIGGERS,
"trim": TRIM,
Expand Down Expand Up @@ -664,6 +671,7 @@ var keywords = map[string]int{
"varying": VARYING,
"vector": VECTOR,
"version": VERSION,
"versioning": VERSIONING,
"versions": VERSIONS,
"version_token_admin": VERSION_TOKEN_ADMIN,
"view": VIEW,
Expand All @@ -684,6 +692,7 @@ var keywords = map[string]int{
"xor": XOR,
"year": YEAR,
"year_month": YEAR_MONTH,
"yes": YES,
"zerofill": ZEROFILL,
}

Expand Down
88 changes: 87 additions & 1 deletion go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4163,10 +4163,42 @@ var (
output: "alter table t",
},
{
input: "alter table t union = (a, b, c)",
input: "alter table t itef_quotes=yes",
output: "alter table t",
},
{
input: "alter table t encrypted=yes",
output: "alter table t",
},
{
input: "alter table t encryption_key_id=123",
output: "alter table t",
},
{
input: "alter table t page_checksum=1",
output: "alter table t",
},
{
input: "alter table t page_compressed=1",
output: "alter table t",
},
{
input: "alter table t page_compression_level=9",
output: "alter table t",
},
{
input: "alter table t transactional=1",
output: "alter table t",
},
{
input: "alter table t with system versioning",
output: "alter table t",
},

{
input: "alter table t union = (a, b, c)",
output: "alter table t",
},
{
input: "alter table t modify col varchar(20) not null, algorithm = inplace, lock = none;",
output: "alter table t modify column col (\n" +
Expand Down Expand Up @@ -4229,6 +4261,60 @@ var (
"\ti int\n" +
") insert_method last",
},
{
input: "create table t (i int) itef_quotes=yes",
output: "create table t (\n" +
"\ti int\n" +
") itef_quotes yes",
},
{
input: "create table t (i int) encrypted=yes",
output: "create table t (\n" +
"\ti int\n" +
") encrypted yes",
},
{
input: "create table t (i int) encryption_key_id=123",
output: "create table t (\n" +
"\ti int\n" +
") encryption_key_id 123",
},
{
input: "create table t (i int) page_checksum=0",
output: "create table t (\n" +
"\ti int\n" +
") page_checksum 0",
},
{
input: "create table t (i int) page_compressed=0",
output: "create table t (\n" +
"\ti int\n" +
") page_compressed 0",
},
{
input: "create table t (i int) page_compression_level=0",
output: "create table t (\n" +
"\ti int\n" +
") page_compression_level 0",
},
{
input: "create table t (i int) sequence=0",
output: "create table t (\n" +
"\ti int\n" +
") sequence 0",
},
{
input: "create table t (i int) transactional=0",
output: "create table t (\n" +
"\ti int\n" +
") transactional 0",
},
{
input: "create table t (i int) with system versioning",
output: "create table t (\n" +
"\ti int\n" +
") with system versioning ",
},

// Date, Time, and Timestamp literals
{
Expand Down
Loading

0 comments on commit 8a9c469

Please sign in to comment.