Skip to content

Commit

Permalink
add mariadb table opts and tests (#384)
Browse files Browse the repository at this point in the history
Co-authored-by: James Cor <[email protected]>
  • Loading branch information
jycor and James Cor authored Nov 26, 2024
1 parent 88972ec commit cd8f828
Show file tree
Hide file tree
Showing 4 changed files with 10,984 additions and 10,627 deletions.
9 changes: 9 additions & 0 deletions go/vt/sqlparser/keywords.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,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 @@ -334,6 +336,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 @@ -448,6 +451,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 @@ -631,6 +637,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 @@ -666,6 +673,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 @@ -686,6 +694,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 @@ -4166,10 +4166,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 @@ -4232,6 +4264,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 cd8f828

Please sign in to comment.