github.com/matrixorigin/matrixone@v1.2.0/pkg/sql/parsers/dialect/mysql/mysql_sql_test.go (about)

     1  // Copyright 2021 Matrix Origin
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package mysql
    16  
    17  import (
    18  	"context"
    19  	"testing"
    20  
    21  	"github.com/matrixorigin/matrixone/pkg/sql/parsers/dialect"
    22  	"github.com/matrixorigin/matrixone/pkg/sql/parsers/tree"
    23  )
    24  
    25  var (
    26  	debugSQL = struct {
    27  		input  string
    28  		output string
    29  	}{
    30  		//input:  "upgrade account all with retry 10",
    31  		//output: "upgrade account all with retry 10",
    32  		//input:  "upgrade account all",
    33  		//output: "upgrade account all",
    34  		//input:  "upgrade account 'acc1' with retry 5",
    35  		//output: "upgrade account acc1 with retry 5",
    36  		//input:  "upgrade account 'acc1'",
    37  		//output: "upgrade account acc1",
    38  		input:  "show upgrade",
    39  		output: "show upgrade",
    40  	}
    41  )
    42  
    43  func TestDebug(t *testing.T) {
    44  	if debugSQL.output == "" {
    45  		debugSQL.output = debugSQL.input
    46  	}
    47  	ast, err := ParseOne(context.TODO(), debugSQL.input, 1, 0)
    48  	if err != nil {
    49  		t.Errorf("Parse(%q) err: %v", debugSQL.input, err)
    50  		return
    51  	}
    52  	out := tree.String(ast, dialect.MYSQL)
    53  	if debugSQL.output != out {
    54  		t.Errorf("Parsing failed. \nExpected/Got:\n%s\n%s", debugSQL.output, out)
    55  	}
    56  }
    57  
    58  var (
    59  	orginSQL = struct {
    60  		input  string
    61  		output string
    62  	}{
    63  		input:  "select A from t1",
    64  		output: "select A from t1",
    65  	}
    66  )
    67  
    68  // character set latin1 NOT NULL default
    69  func TestOriginSQL(t *testing.T) {
    70  	if orginSQL.output == "" {
    71  		orginSQL.output = orginSQL.input
    72  	}
    73  	ast, err := ParseOne(context.TODO(), orginSQL.input, 0, 1)
    74  	if err != nil {
    75  		t.Errorf("Parse(%q) err: %v", orginSQL.input, err)
    76  		return
    77  	}
    78  	out := tree.String(ast, dialect.MYSQL)
    79  	if orginSQL.output != out {
    80  		t.Errorf("Parsing failed. \nExpected/Got:\n%s\n%s", orginSQL.output, out)
    81  	}
    82  }
    83  
    84  var (
    85  	validSQL = []struct {
    86  		input  string
    87  		output string
    88  	}{{
    89  		input:  "create account 0b6d35cc_11ab_4da5_a5c5_c4c09917c11 admin_name='admin' identified by '123456';",
    90  		output: "create account 0b6d35cc_11ab_4da5_a5c5_c4c09917c11 admin_name 'admin' identified by '******'",
    91  	}, {
    92  		input:  "select enable from t1;",
    93  		output: "select enable from t1",
    94  	}, {
    95  		input:  "select _wstart(ts), _wend(ts), max(temperature), min(temperature) from sensor_data where ts > \"2023-08-01 00:00:00.000\" and ts < \"2023-08-01 00:50:00.000\" interval(ts, 10, minute) sliding(5, minute) fill(prev);",
    96  		output: "select _wstart(ts), _wend(ts), max(temperature), min(temperature) from sensor_data where ts > 2023-08-01 00:00:00.000 and ts < 2023-08-01 00:50:00.000 interval(ts, 10, minute) sliding(5, minute) fill(prev)",
    97  	}, {
    98  		input:  "select cluster_centers(a) from t1;",
    99  		output: "select cluster_centers(a, 1,vector_l2_ops,random,false) from t1",
   100  	}, {
   101  		input:  "select cluster_centers(a kmeans '5') from t1;",
   102  		output: "select cluster_centers(a, 5) from t1",
   103  	}, {
   104  		input:  "select cluster_centers(a kmeans '5,vector_l2_ops') from t1;",
   105  		output: "select cluster_centers(a, 5,vector_l2_ops) from t1",
   106  	}, {
   107  		input:  "select cluster_centers(a kmeans '5,vector_cosine_ops') from t1;",
   108  		output: "select cluster_centers(a, 5,vector_cosine_ops) from t1",
   109  	}, {
   110  		input:  "select cluster_centers(a kmeans '5,vector_cosine_ops,kmeansplusplus') from t1;",
   111  		output: "select cluster_centers(a, 5,vector_cosine_ops,kmeansplusplus) from t1",
   112  	}, {
   113  		input:  "select cluster_centers(a kmeans '5,vector_cosine_ops,random') from t1;",
   114  		output: "select cluster_centers(a, 5,vector_cosine_ops,random) from t1",
   115  	}, {
   116  		input:  "select cluster_centers(a kmeans '5,vector_cosine_ops,random,true') from t1;",
   117  		output: "select cluster_centers(a, 5,vector_cosine_ops,random,true) from t1",
   118  	}, {
   119  		input:  "alter table t1 alter reindex idx1 IVFFLAT lists = 5",
   120  		output: "alter table t1 alter reindex idx1 ivfflat lists = 5",
   121  	}, {
   122  		input:  "create connector for s with (\"type\"='kafka', \"topic\"= 'user', \"partition\" = '1', \"value\"= 'json', \"bootstrap.servers\" = '127.0.0.1:62610');",
   123  		output: "create connector for s with (type = kafka, topic = user, partition = 1, value = json, bootstrap.servers = 127.0.0.1:62610)",
   124  	}, {
   125  		input:  "select _wstart(ts), _wend(ts), max(temperature), min(temperature) from sensor_data where ts > \"2023-08-01 00:00:00.000\" and ts < \"2023-08-01 00:50:00.000\" interval(ts, 10, minute) sliding(5, minute) fill(prev);",
   126  		output: "select _wstart(ts), _wend(ts), max(temperature), min(temperature) from sensor_data where ts > 2023-08-01 00:00:00.000 and ts < 2023-08-01 00:50:00.000 interval(ts, 10, minute) sliding(5, minute) fill(prev)",
   127  	}, {
   128  		input:  "create connector for s with (\"type\"='kafkamo', \"topic\"= 'user', \"partion\" = '1', \"value\"= 'json', \"bootstrap.servers\" = '127.0.0.1:62610');",
   129  		output: "create connector for s with (type = kafkamo, topic = user, partion = 1, value = json, bootstrap.servers = 127.0.0.1:62610)",
   130  	}, {
   131  		input:  "create source s(a varchar, b varchar) with (\"type\"='kafka', \"topic\"= 'user', \"partion\" = '1', \"value\"= 'json', \"bootstrap.servers\" = '127.0.0.1:62610');",
   132  		output: "create source s (a varchar, b varchar) with (type = kafka, topic = user, partion = 1, value = json, bootstrap.servers = 127.0.0.1:62610)",
   133  	}, {
   134  		input:  "drop source if exists s",
   135  		output: "drop table if exists s",
   136  	}, {
   137  		input:  "CREATE source pageviews (\n    page_id BIGINT KEY\n  ) WITH (\n    KAFKA_TOPIC = 'keyed-pageviews-topic',\n    VALUE_FORMAT = 'JSON_SR',\n    VALUE_SCHEMA_ID = 2\n  );",
   138  		output: "create source pageviews (page_id bigint key) with (kafka_topic = keyed-pageviews-topic, value_format = JSON_SR, value_schema_id = 2)",
   139  	}, {
   140  		input:  "CREATE source pageviews (\n    viewtime BIGINT,\n    user_id VARCHAR\n  ) WITH (\n    KAFKA_TOPIC = 'keyless-pageviews-topic',\n    KEY_FORMAT = 'AVRO',\n    KEY_SCHEMA_ID = 1,\n    VALUE_FORMAT = 'JSON_SR'\n  );",
   141  		output: "create source pageviews (viewtime bigint, user_id varchar) with (kafka_topic = keyless-pageviews-topic, key_format = AVRO, key_schema_id = 1, value_format = JSON_SR)",
   142  	}, {
   143  		input:  "CREATE source pageviews (page_id BIGINT, viewtime BIGINT, user_id VARCHAR) WITH (\n    KAFKA_TOPIC = 'keyless-pageviews-topic',\n    VALUE_FORMAT = 'JSON'\n  )",
   144  		output: "create source pageviews (page_id bigint, viewtime bigint, user_id varchar) with (kafka_topic = keyless-pageviews-topic, value_format = JSON)",
   145  	}, {
   146  		input:  "select row_number() over (partition by col1, col2 order by col3 desc range unbounded preceding) from t1",
   147  		output: "select row_number() over (partition by col1, col2 order by col3 desc range unbounded preceding) from t1",
   148  	}, {
   149  		input:  "select dense_rank() over (partition by col1, col2 order by col3 desc range unbounded preceding) from t1",
   150  		output: "select dense_rank() over (partition by col1, col2 order by col3 desc range unbounded preceding) from t1",
   151  	}, {
   152  		input:  "select day_key,day_date,day,month,quarter,year,week,day_of_week from bi_date where 1=2;",
   153  		output: "select day_key, day_date, day, month, quarter, year, week, day_of_week from bi_date where 1 = 2",
   154  	}, {
   155  		input:  "select sum(a) over(partition by a range between interval 1 day preceding and interval 2 day following) from t1",
   156  		output: "select sum(a) over (partition by a range between interval(1, day) preceding and interval(2, day) following) from t1",
   157  	}, {
   158  		input:  "select rank() over(partition by a range between 1 preceding and current row) from t1",
   159  		output: "select rank() over (partition by a range between 1 preceding and current row) from t1",
   160  	}, {
   161  		input:  "select rank() over(partition by a) from t1",
   162  		output: "select rank() over (partition by a) from t1",
   163  	}, {
   164  		input:  "select rank() over(partition by a order by b desc) from t1",
   165  		output: "select rank() over (partition by a order by b desc) from t1",
   166  	}, {
   167  		input:  "load data url s3option {\"bucket\"='dan-test1', \"filepath\"='ex_table_dan_gzip.gz',\"role_arn\"='arn:aws:iam::468413122987:role/dev-cross-s3', \"external_id\"='5404f91c_4e59_4898_85b3', \"compression\"='auto'} into table hx3.t2 fields terminated by ',' enclosed by '\\\"' lines terminated by '\\n';\n",
   168  		output: "load data url s3option {'bucket'='dan-test1', 'filepath'='ex_table_dan_gzip.gz', 'role_arn'='arn:aws:iam::468413122987:role/dev-cross-s3', 'external_id'='5404f91c_4e59_4898_85b3', 'compression'='auto'} into table hx3.t2 fields terminated by , enclosed by \" lines terminated by \n",
   169  	}, {
   170  		input:  "load data url stageoption my_stage into table hx3.t2 fields terminated by ',' enclosed by '' lines terminated by '\\n';\n",
   171  		output: "load data url from stage my_stage into table hx3.t2 fields terminated by , lines terminated by \n",
   172  	}, {
   173  		input:  "SHOW CREATE TABLE information_schema.PROCESSLIST;",
   174  		output: "show create table information_schema.processlist",
   175  	}, {
   176  		input:  "create table t1 (a int comment '\"123123\\'')",
   177  		output: "create table t1 (a int comment \"123123'')",
   178  	}, {
   179  		input:  "select * from t1 where a not ilike '%a'",
   180  		output: "select * from t1 where a not ilike %a",
   181  	}, {
   182  		input:  "select * from t1 where a ilike '%a'",
   183  		output: "select * from t1 where a ilike %a",
   184  	}, {
   185  		input:  "select * from result_scan(query_id)",
   186  		output: "select * from result_scan(query_id)",
   187  	}, {
   188  		input:  "select * from meta_scan('query_id');",
   189  		output: "select * from meta_scan(query_id)",
   190  	}, {
   191  		input:  "show variables like 'sql_mode'",
   192  		output: "show variables like sql_mode",
   193  	}, {
   194  		input:  "show index from t1 from db",
   195  		output: "show index from t1 from db",
   196  	}, {
   197  		input:  "select * from (SELECT * FROM (SELECT 1, 2, 3)) AS t1",
   198  		output: "select * from (select * from (select 1, 2, 3)) as t1",
   199  	}, {
   200  		input:  "SELECT count(*) AS low_stock FROM (\nSELECT s_w_id, s_i_id, s_quantity\nFROM bmsql_stock\nWHERE s_w_id = 1 AND s_quantity < 1000 AND s_i_id IN (\nSELECT ol_i_id\nFROM bmsql_district\nJOIN bmsql_order_line ON ol_w_id = d_w_id\nAND ol_d_id = d_id\nAND ol_o_id >= d_next_o_id - 20\nAND ol_o_id < d_next_o_id\nWHERE d_w_id = 1 AND d_id = 1\n)\n);",
   201  		output: "select count(*) as low_stock from (select s_w_id, s_i_id, s_quantity from bmsql_stock where s_w_id = 1 and s_quantity < 1000 and s_i_id in (select ol_i_id from bmsql_district inner join bmsql_order_line on ol_w_id = d_w_id and ol_d_id = d_id and ol_o_id >= d_next_o_id - 20 and ol_o_id < d_next_o_id where d_w_id = 1 and d_id = 1))",
   202  	}, {
   203  		input:  "create account `abc@124` admin_name `abc@124` identified by '111'",
   204  		output: "create account abc@124 admin_name 'abc@124' identified by '******'",
   205  	}, {
   206  		input:  "create account account ADMIN_NAME 'root' IDENTIFIED BY '123456';",
   207  		output: "create account account admin_name 'root' identified by '******'",
   208  	}, {
   209  		input: "drop table if exists history",
   210  	}, {
   211  		input:  "create user daisy@192.168.1.10 identified by '123456'",
   212  		output: "create user daisy@192.168.1.10 identified by '******'",
   213  	}, {
   214  		input: "create table t0 (a float(255, 3))",
   215  	}, {
   216  		input:  "SELECT  id,name,view_type,attribute,attribute_filed,size,created_at,updated_at  FROM view_warehouse limit 0,10",
   217  		output: "select id, name, view_type, attribute, attribute_filed, size, created_at, updated_at from view_warehouse limit 10 offset 0",
   218  	}, {
   219  		input:  "select algo_alarm_record.* from algo_alarm_record inner join (SELECT id FROM algo_alarm_record use index(algo_alarm_record_algo_id_first_id_created_at_index) WHERE first_id = 0 AND created_at >= '2022-09-18 00:00:00' AND created_at <= '2022-10-18 00:00:00' and algo_id not in (9808,9809) order by id desc limit 0,10 ) e on e.id = algo_alarm_record.id order by algo_alarm_record.id desc;",
   220  		output: "select algo_alarm_record.* from algo_alarm_record inner join (select id from algo_alarm_record use index(algo_alarm_record_algo_id_first_id_created_at_index) where first_id = 0 and created_at >= 2022-09-18 00:00:00 and created_at <= 2022-10-18 00:00:00 and algo_id not in (9808, 9809) order by id desc limit 10 offset 0) as e on e.id = algo_alarm_record.id order by algo_alarm_record.id desc",
   221  	}, {
   222  		input:  "SELECT * FROM kv WHERE k = 1 FOR UPDATE",
   223  		output: "select * from kv where k = 1 for update",
   224  	}, {
   225  		input: "select a from t1 use index(b)",
   226  	}, {
   227  		input:  "SELECT   id,cid,status,ip,streams   FROM camera     WHERE (cid_type = ?)",
   228  		output: "select id, cid, status, ip, streams from camera where (cid_type = ?)",
   229  	}, {
   230  		input:  "CREATE  \nVIEW `xab0100` AS (\n  select `a`.`SYSUSERID` AS `sysuserid`,`a`.`USERID` AS `userid`,`a`.`USERNAME` AS `usernm`,`a`.`PWDHASH` AS `userpwd`,`a`.`USERTYPE` AS `usertype`,`a`.`EMPID` AS `empid`,`a`.`EMAIL` AS `email`,`a`.`TELO` AS `telo`,`a`.`TELH` AS `telh`,`a`.`MOBIL` AS `mobil`,(case `a`.`ACTIVED` when '1' then 'N' when '2' then 'Y' else 'Y' end) AS `useyn`,`a`.`ENABLEPWD` AS `enablepwd`,`a`.`ENABLEMMSG` AS `enablemmsg`,`a`.`FEECENTER` AS `feecenter`,left(concat(ifnull(`c`.`ORGID`,''),'|'),(char_length(concat(ifnull(`c`.`ORGID`,''),'|')) - 1)) AS `orgid`,left(concat(ifnull(`c`.`ORGNAME`,''),'|'),(char_length(concat(ifnull(`c`.`ORGNAME`,''),'|')) - 1)) AS `orgname`,ifnull(`a`.`ISPLANNER`,'') AS `isplanner`,ifnull(`a`.`ISWHEMPLOYEE`,'') AS `iswhemployee`,ifnull(`a`.`ISBUYER`,'') AS `isbuyer`,ifnull(`a`.`ISQCEMPLOYEE`,'') AS `isqceemployee`,ifnull(`a`.`ISSALEEMPLOYEE`,'') AS `issaleemployee`,`a`.`SEX` AS `sex`,ifnull(`c`.`ENTID`,'3') AS `ORGANIZATION_ID`,ifnull(`a`.`NOTICEUSER`,'') AS `NOTICEUSER` \n  from ((`kaf_cpcuser` `a` left join `kaf_cpcorguser` `b` on((`a`.`SYSUSERID` = `b`.`SYSUSERID`))) left join `kaf_cpcorg` `c` on((`b`.`ORGID` = `c`.`ORGID`))) \n  order by `a`.`SYSUSERID`,`a`.`USERID`,`a`.`USERNAME`,`a`.`USERPASS`,`a`.`USERTYPE`,`a`.`EMPID`,`a`.`EMAIL`,`a`.`TELO`,`a`.`TELH`,`a`.`MOBIL`,`a`.`ACTIVED`,`a`.`ENABLEPWD`,`a`.`ENABLEMMSG`,`a`.`FEECENTER`,`a`.`ISPLANNER`,`a`.`ISWHEMPLOYEE`,`a`.`ISBUYER`,`a`.`ISQCEMPLOYEE`,`a`.`ISSALEEMPLOYEE`,`a`.`SEX`,`c`.`ENTID`) ;\n",
   231  		output: "create view xab0100 as (select a.sysuserid as sysuserid, a.userid as userid, a.username as usernm, a.pwdhash as userpwd, a.usertype as usertype, a.empid as empid, a.email as email, a.telo as telo, a.telh as telh, a.mobil as mobil, (case a.actived when 1 then N when 2 then Y else Y end) as useyn, a.enablepwd as enablepwd, a.enablemmsg as enablemmsg, a.feecenter as feecenter, left(concat(ifnull(c.orgid, ), |), (char_length(concat(ifnull(c.orgid, ), |)) - 1)) as orgid, left(concat(ifnull(c.orgname, ), |), (char_length(concat(ifnull(c.orgname, ), |)) - 1)) as orgname, ifnull(a.isplanner, ) as isplanner, ifnull(a.iswhemployee, ) as iswhemployee, ifnull(a.isbuyer, ) as isbuyer, ifnull(a.isqcemployee, ) as isqceemployee, ifnull(a.issaleemployee, ) as issaleemployee, a.sex as sex, ifnull(c.entid, 3) as ORGANIZATION_ID, ifnull(a.noticeuser, ) as NOTICEUSER from kaf_cpcuser as a left join kaf_cpcorguser as b on ((a.sysuserid = b.sysuserid)) left join kaf_cpcorg as c on ((b.orgid = c.orgid)) order by a.sysuserid, a.userid, a.username, a.userpass, a.usertype, a.empid, a.email, a.telo, a.telh, a.mobil, a.actived, a.enablepwd, a.enablemmsg, a.feecenter, a.isplanner, a.iswhemployee, a.isbuyer, a.isqcemployee, a.issaleemployee, a.sex, c.entid)",
   232  	}, {
   233  		input:  "ALTER  \nVIEW `xab0100` AS (\n  select `a`.`SYSUSERID` AS `sysuserid`,`a`.`USERID` AS `userid`,`a`.`USERNAME` AS `usernm`,`a`.`PWDHASH` AS `userpwd`,`a`.`USERTYPE` AS `usertype`,`a`.`EMPID` AS `empid`,`a`.`EMAIL` AS `email`,`a`.`TELO` AS `telo`,`a`.`TELH` AS `telh`,`a`.`MOBIL` AS `mobil`,(case `a`.`ACTIVED` when '1' then 'N' when '2' then 'Y' else 'Y' end) AS `useyn`,`a`.`ENABLEPWD` AS `enablepwd`,`a`.`ENABLEMMSG` AS `enablemmsg`,`a`.`FEECENTER` AS `feecenter`,left(concat(ifnull(`c`.`ORGID`,''),'|'),(char_length(concat(ifnull(`c`.`ORGID`,''),'|')) - 1)) AS `orgid`,left(concat(ifnull(`c`.`ORGNAME`,''),'|'),(char_length(concat(ifnull(`c`.`ORGNAME`,''),'|')) - 1)) AS `orgname`,ifnull(`a`.`ISPLANNER`,'') AS `isplanner`,ifnull(`a`.`ISWHEMPLOYEE`,'') AS `iswhemployee`,ifnull(`a`.`ISBUYER`,'') AS `isbuyer`,ifnull(`a`.`ISQCEMPLOYEE`,'') AS `isqceemployee`,ifnull(`a`.`ISSALEEMPLOYEE`,'') AS `issaleemployee`,`a`.`SEX` AS `sex`,ifnull(`c`.`ENTID`,'3') AS `ORGANIZATION_ID`,ifnull(`a`.`NOTICEUSER`,'') AS `NOTICEUSER` \n  from ((`kaf_cpcuser` `a` left join `kaf_cpcorguser` `b` on((`a`.`SYSUSERID` = `b`.`SYSUSERID`))) left join `kaf_cpcorg` `c` on((`b`.`ORGID` = `c`.`ORGID`))) \n  order by `a`.`SYSUSERID`,`a`.`USERID`,`a`.`USERNAME`,`a`.`USERPASS`,`a`.`USERTYPE`,`a`.`EMPID`,`a`.`EMAIL`,`a`.`TELO`,`a`.`TELH`,`a`.`MOBIL`,`a`.`ACTIVED`,`a`.`ENABLEPWD`,`a`.`ENABLEMMSG`,`a`.`FEECENTER`,`a`.`ISPLANNER`,`a`.`ISWHEMPLOYEE`,`a`.`ISBUYER`,`a`.`ISQCEMPLOYEE`,`a`.`ISSALEEMPLOYEE`,`a`.`SEX`,`c`.`ENTID`) ;\n",
   234  		output: "alter view xab0100 as (select a.sysuserid as sysuserid, a.userid as userid, a.username as usernm, a.pwdhash as userpwd, a.usertype as usertype, a.empid as empid, a.email as email, a.telo as telo, a.telh as telh, a.mobil as mobil, (case a.actived when 1 then N when 2 then Y else Y end) as useyn, a.enablepwd as enablepwd, a.enablemmsg as enablemmsg, a.feecenter as feecenter, left(concat(ifnull(c.orgid, ), |), (char_length(concat(ifnull(c.orgid, ), |)) - 1)) as orgid, left(concat(ifnull(c.orgname, ), |), (char_length(concat(ifnull(c.orgname, ), |)) - 1)) as orgname, ifnull(a.isplanner, ) as isplanner, ifnull(a.iswhemployee, ) as iswhemployee, ifnull(a.isbuyer, ) as isbuyer, ifnull(a.isqcemployee, ) as isqceemployee, ifnull(a.issaleemployee, ) as issaleemployee, a.sex as sex, ifnull(c.entid, 3) as ORGANIZATION_ID, ifnull(a.noticeuser, ) as NOTICEUSER from kaf_cpcuser as a left join kaf_cpcorguser as b on ((a.sysuserid = b.sysuserid)) left join kaf_cpcorg as c on ((b.orgid = c.orgid)) order by a.sysuserid, a.userid, a.username, a.userpass, a.usertype, a.empid, a.email, a.telo, a.telh, a.mobil, a.actived, a.enablepwd, a.enablemmsg, a.feecenter, a.isplanner, a.iswhemployee, a.isbuyer, a.isqcemployee, a.issaleemployee, a.sex, c.entid)",
   235  	}, {
   236  		input: "select time from t1 as value",
   237  	}, {
   238  		input:  "alter database test set mysql_compatibility_mode = '{transaction_isolation: REPEATABLE-READ, lower_case_table_names: 0}'",
   239  		output: "alter database configuration for test as {transaction_isolation: REPEATABLE-READ, lower_case_table_names: 0} ",
   240  	}, {
   241  		input: "show profiles",
   242  	}, {
   243  		input:  "CREATE TABLE new_t1 LIKE t1",
   244  		output: "create table new_t1 like t1",
   245  	}, {
   246  		input:  "CREATE TABLE new_t1 LIKE test.t1",
   247  		output: "create table new_t1 like test.t1",
   248  	}, {
   249  		input: "show privileges",
   250  	}, {
   251  		input: "show events from db1",
   252  	}, {
   253  		input: "show collation",
   254  	}, {
   255  		input: "show plugins",
   256  	}, {
   257  		input: "show procedure status",
   258  	}, {
   259  		input: "show triggers from db1 where 1",
   260  	}, {
   261  		input: "show engines",
   262  	}, {
   263  		input: "show config",
   264  	}, {
   265  		input: "show grants",
   266  	}, {
   267  		input:  "show grants for 'test'@'localhost'",
   268  		output: "show grants for test@localhost",
   269  	}, {
   270  		input: "show table status from t1",
   271  	}, {
   272  		input: "show table status from t1",
   273  	}, {
   274  		input: "grant connect on account * to role_r1",
   275  	}, {
   276  		input: "select password from t1",
   277  	}, {
   278  		input:  "create table t1 (a datetime on update CURRENT_TIMESTAMP(1))",
   279  		output: "create table t1 (a datetime on update current_timestamp(1))",
   280  	}, {
   281  		input:  `create table table10 (a int primary key, b varchar(10)) checksum=0 COMMENT="asdf"`,
   282  		output: "create table table10 (a int primary key, b varchar(10)) checksum = 0 comment = 'asdf'",
   283  	}, {
   284  		input:  "commit work",
   285  		output: "commit",
   286  	}, {
   287  		input: "select * from tables",
   288  	}, {
   289  		input: "update t1 set a = default",
   290  	}, {
   291  		input:  "truncate t1",
   292  		output: "truncate table t1",
   293  	}, {
   294  		input:  "truncate table t1",
   295  		output: "truncate table t1",
   296  	}, {
   297  		input:  "truncate db1.t1",
   298  		output: "truncate table db1.t1",
   299  	}, {
   300  		input:  "truncate table db1.t1",
   301  		output: "truncate table db1.t1",
   302  	},
   303  		{
   304  			input:  "upgrade account all with retry 10",
   305  			output: "upgrade account all with retry 10",
   306  		}, {
   307  			input:  "upgrade account all",
   308  			output: "upgrade account all",
   309  		}, {
   310  			input:  "upgrade account 'acc1' with retry 5",
   311  			output: "upgrade account acc1 with retry 5",
   312  		}, {
   313  			input:  "upgrade account 'acc1'",
   314  			output: "upgrade account acc1",
   315  		}, {
   316  			input:  "explain select * from emp",
   317  			output: "explain select * from emp",
   318  		}, {
   319  			input:  "explain verbose select * from emp",
   320  			output: "explain (verbose) select * from emp",
   321  		}, {
   322  			input:  "explain analyze select * from emp",
   323  			output: "explain (analyze) select * from emp",
   324  		}, {
   325  			input:  "explain analyze verbose select * from emp",
   326  			output: "explain (analyze,verbose) select * from emp",
   327  		}, {
   328  			input:  "explain (analyze true,verbose false) select * from emp",
   329  			output: "explain (analyze true,verbose false) select * from emp",
   330  		}, {
   331  			input:  "explain (analyze true,verbose false,format json) select * from emp",
   332  			output: "explain (analyze true,verbose false,format json) select * from emp",
   333  		}, {
   334  			input:  "with t11 as (select * from t1) update t11 join t2 on t11.a = t2.b set t11.b = 1 where t2.a > 1",
   335  			output: "with t11 as (select * from t1) update t11 inner join t2 on t11.a = t2.b set t11.b = 1 where t2.a > 1",
   336  		}, {
   337  			input:  "UPDATE items,(SELECT id FROM items WHERE id IN (SELECT id FROM items WHERE retail / wholesale >= 1.3 AND quantity < 100)) AS discounted SET items.retail = items.retail * 0.9 WHERE items.id = discounted.id",
   338  			output: "update items cross join (select id from items where id in (select id from items where retail / wholesale >= 1.3 and quantity < 100)) as discounted set items.retail = items.retail * 0.9 where items.id = discounted.id",
   339  		}, {
   340  			input:  "with t2 as (select * from t1) DELETE FROM a1, a2 USING t1 AS a1 INNER JOIN t2 AS a2 WHERE a1.id=a2.id;",
   341  			output: "with t2 as (select * from t1) delete from a1, a2 using t1 as a1 inner join t2 as a2 where a1.id = a2.id",
   342  		}, {
   343  			input:  "DELETE FROM a1, a2 USING t1 AS a1 INNER JOIN t2 AS a2 WHERE a1.id=a2.id;",
   344  			output: "delete from a1, a2 using t1 as a1 inner join t2 as a2 where a1.id = a2.id",
   345  		}, {
   346  			input:  "DELETE a1, a2 FROM t1 AS a1 INNER JOIN t2 AS a2 WHERE a1.id=a2.id",
   347  			output: "delete from a1, a2 using t1 as a1 inner join t2 as a2 where a1.id = a2.id",
   348  		}, {
   349  			input:  "DELETE FROM t1, t2 USING t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.id=t2.id AND t2.id=t3.id",
   350  			output: "delete from t1, t2 using t1 inner join t2 inner join t3 where t1.id = t2.id and t2.id = t3.id",
   351  		}, {
   352  			input:  "DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.id=t2.id AND t2.id=t3.id",
   353  			output: "delete from t1, t2 using t1 inner join t2 inner join t3 where t1.id = t2.id and t2.id = t3.id",
   354  		}, {
   355  			input: "select cast(false as varchar)",
   356  		}, {
   357  			input: "select cast(a as timestamp)",
   358  		}, {
   359  			input:  "select cast(\"2022-01-30\" as varchar);",
   360  			output: "select cast(2022-01-30 as varchar)",
   361  		}, {
   362  			input: "select cast(b as timestamp) from t2",
   363  		}, {
   364  			input:  "select cast(\"2022-01-01 01:23:34\" as varchar)",
   365  			output: "select cast(2022-01-01 01:23:34 as varchar)",
   366  		}, {
   367  			input:  "select serial_extract(col, 1 as varchar(3)) from t1",
   368  			output: "select serial_extract(col, 1 as varchar(3)) from t1",
   369  		}, {
   370  			input:  "select binary('Geeksforgeeks')",
   371  			output: "select binary(Geeksforgeeks)",
   372  		}, {
   373  			input:  "show schemas where 1",
   374  			output: "show databases where 1",
   375  		}, {
   376  			input: "select role from t1",
   377  		}, {
   378  			input:  "select a || 'hello' || 'world' from t1;",
   379  			output: "select concat(concat(a, hello), world) from t1",
   380  		}, {
   381  			input:  "select col || 'bar'",
   382  			output: "select concat(col, bar)",
   383  		}, {
   384  			input:  "select 'foo' || 'bar'",
   385  			output: "select concat(foo, bar)",
   386  		}, {
   387  			input:  "select 'a\\'b'",
   388  			output: "select a'b",
   389  		}, {
   390  			input:  "select char_length('\\n\\t\\r\\b\\0\\_\\%\\\\');",
   391  			output: "select char_length(\\n\\t\\r\\b\\0\\_\\%\\\\)",
   392  		}, {
   393  			input:  "select CAST('10 ' as unsigned);",
   394  			output: "select cast(10  as unsigned)",
   395  		}, {
   396  			input:  "select CAST('10 ' as unsigned integer);",
   397  			output: "select cast(10  as integer unsigned)",
   398  		}, {
   399  			input:  "SELECT ((+0) IN ((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)), (32767.1)));",
   400  			output: "select ((+0) in ((0b111111111111111111111111111111111111111111111111111), (rpad(1.0, 2048, 1)), (32767.1)))",
   401  		}, {
   402  			input: "select 0b111111111111111111111111111111111111111111111111111",
   403  		}, {
   404  			input:  "select date,format,to_date(date, format) as to_date from t1;",
   405  			output: "select date, format, to_date(date, format) as to_date from t1",
   406  		}, {
   407  			input:  "select date,format,concat_ws(',',to_date(date, format)) as con from t1;",
   408  			output: "select date, format, concat_ws(,, to_date(date, format)) as con from t1",
   409  		}, {
   410  			input:  "select date,format,to_date(date, format) as to_date from t1;",
   411  			output: "select date, format, to_date(date, format) as to_date from t1",
   412  		}, {
   413  			input:  "select date,format,concat_ws(\" \",to_date(date, format),'') as con from t1;",
   414  			output: "select date, format, concat_ws( , to_date(date, format), ) as con from t1",
   415  		}, {
   416  			input: "select schema()",
   417  		}, {
   418  			input: "select last_insert_id()",
   419  		}, {
   420  			input:  "show char set where charset = 'utf8mb4'",
   421  			output: "show charset where charset = utf8mb4",
   422  		}, {
   423  			input:  "show charset where charset = 'utf8mb4'",
   424  			output: "show charset where charset = utf8mb4",
   425  		}, {
   426  			input:  "show character set where charset = 'utf8mb4'",
   427  			output: "show charset where charset = utf8mb4",
   428  		}, {
   429  			input: "show config where a > 1",
   430  		}, {
   431  			input:  "set @@a = b",
   432  			output: "set a = b",
   433  		}, {
   434  			input:  "set @a = b",
   435  			output: "set a = b",
   436  		}, {
   437  			input:  "CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date)",
   438  			output: "create table t1 (datetime datetime, timestamp timestamp, date date)",
   439  		}, {
   440  			input:  "SET timestamp=DEFAULT;",
   441  			output: "set timestamp = default",
   442  		}, {
   443  			input:  "SET timestamp=UNIX_TIMESTAMP('2011-07-31 10:00:00')",
   444  			output: "set timestamp = unix_timestamp(2011-07-31 10:00:00)",
   445  		}, {
   446  			input:  "select ltrim(\"a\"),rtrim(\"a\"),trim(BOTH \"\" from \"a\"),trim(BOTH \" \" from \"a\");",
   447  			output: "select ltrim(a), rtrim(a), trim(both  from a), trim(both   from a)",
   448  		}, {
   449  			input:  "select rpad('hello', -18446744073709551616, '1');",
   450  			output: "select rpad(hello, -18446744073709551616, 1)",
   451  		}, {
   452  			input:  "select rpad('hello', -18446744073709551616, '1');",
   453  			output: "select rpad(hello, -18446744073709551616, 1)",
   454  		}, {
   455  			input:  "SELECT CONCAT_WS(1471290948102948112341241204312904-23412412-4141, \"a\", \"b\")",
   456  			output: "select concat_ws(1471290948102948112341241204312904 - 23412412 - 4141, a, b)",
   457  		}, {
   458  			input:  "SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );",
   459  			output: "select * from t1 where a = any (select 1 union (select 1 union select 1))",
   460  		}, {
   461  			input:  "SELECT * FROM t1 WHERE a = ANY ( SELECT 1 except ( SELECT 1 except SELECT 1 ) );",
   462  			output: "select * from t1 where a = any (select 1 except (select 1 except select 1))",
   463  		}, {
   464  			input:  "SELECT * FROM t1 WHERE a = ANY ( SELECT 1 intersect ( SELECT 1 intersect SELECT 1 ) );",
   465  			output: "select * from t1 where a = any (select 1 intersect (select 1 intersect select 1))",
   466  		}, {
   467  			input:  "SELECT * FROM t1 WHERE a = ANY ( SELECT 1 minus ( SELECT 1 minus SELECT 1 ) );",
   468  			output: "select * from t1 where a = any (select 1 minus (select 1 minus select 1))",
   469  		}, {
   470  			input:  "SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);",
   471  			output: "select * from t1 where (a, b) = any (select a, max(b) from t1 group by a)",
   472  		}, {
   473  			input:  "select  (1,2) != ALL (select * from t1);",
   474  			output: "select (1, 2) != all (select * from t1)",
   475  		}, {
   476  			input:  "select s1, s1 = ANY (SELECT s1 FROM t2) from t1;",
   477  			output: "select s1, s1 = any (select s1 from t2) from t1",
   478  		}, {
   479  			input:  "select * from t3 where a >= some (select b from t2);",
   480  			output: "select * from t3 where a >= some (select b from t2)",
   481  		}, {
   482  			input:  "select 9999999999999999999;",
   483  			output: "select 9999999999999999999",
   484  		}, {
   485  			input:  "select substring('hello', -18446744073709551616, -18446744073709551616);",
   486  			output: "select substring(hello, -18446744073709551616, -18446744073709551616)",
   487  		}, {
   488  			input:  "select substring('hello', -18446744073709551616, 1);",
   489  			output: "select substring(hello, -18446744073709551616, 1)",
   490  		}, {
   491  			input:  "select space(18446744073709551616);",
   492  			output: "select space(18446744073709551616)",
   493  		}, {
   494  			input:  "select space(-18446744073709551616);",
   495  			output: "select space(-18446744073709551616)",
   496  		}, {
   497  			input:  "select ltrim(\"a\"),rtrim(\"a\"),trim(BOTH \"\" from \"a\"),trim(BOTH \" \" from \"a\");",
   498  			output: "select ltrim(a), rtrim(a), trim(both  from a), trim(both   from a)",
   499  		}, {
   500  			input:  "SELECT (rpad(1.0, 2048,1)) IS NOT FALSE;",
   501  			output: "select (rpad(1.0, 2048, 1)) is not false",
   502  		}, {
   503  			input:  "SELECT 1 is unknown;",
   504  			output: "select 1 is unknown",
   505  		}, {
   506  			input:  "SELECT false is not unknown;",
   507  			output: "select false is not unknown",
   508  		}, {
   509  			input:  "SELECT 1 is true;",
   510  			output: "select 1 is true",
   511  		}, {
   512  			input:  "SELECT false is not true;",
   513  			output: "select false is not true",
   514  		}, {
   515  			input:  "SELECT 1 is false;",
   516  			output: "select 1 is false",
   517  		}, {
   518  			input:  "SELECT false is not false;",
   519  			output: "select false is not false",
   520  		}, {
   521  			input:  "SELECT FROM_UNIXTIME(99999999999999999999999999999999999999999999999999999999999999999);",
   522  			output: "select from_unixtime(99999999999999999999999999999999999999999999999999999999999999999)",
   523  		}, {
   524  			input:  "SELECT FROM_UNIXTIME(2147483647) AS c1, FROM_UNIXTIME(2147483648) AS c2, FROM_UNIXTIME(2147483647.9999999) AS c3, FROM_UNIXTIME(32536771199) AS c4,FROM_UNIXTIME(32536771199.9999999) AS c5;",
   525  			output: "select from_unixtime(2147483647) as c1, from_unixtime(2147483648) as c2, from_unixtime(2147483647.9999999) as c3, from_unixtime(32536771199) as c4, from_unixtime(32536771199.9999999) as c5",
   526  		}, {
   527  			input:  "select date_add(\"1997-12-31 23:59:59\",INTERVAL -100000 YEAR);",
   528  			output: "select date_add(1997-12-31 23:59:59, interval(-100000, year))",
   529  		}, {
   530  			input:  "SELECT ADDDATE(DATE'2021-01-01', INTERVAL 1 DAY);",
   531  			output: "select adddate(date(2021-01-01), interval(1, day))",
   532  		}, {
   533  			input:  "select '2007-01-01' + interval a day from t1;",
   534  			output: "select 2007-01-01 + interval(a, day) from t1",
   535  		}, {
   536  			input:  "SELECT CAST(COALESCE(t0.c0, -1) AS UNSIGNED) IS TRUE FROM t0;",
   537  			output: "select cast(coalesce(t0.c0, -1) as unsigned) is true from t0",
   538  		}, {
   539  			input:  "select Fld1, variance(Fld2) as q from t1 group by Fld1 having q is not null;",
   540  			output: "select fld1, variance(fld2) as q from t1 group by fld1 having q is not null",
   541  		}, {
   542  			input:  "select variance(-99999999999999999.99999);",
   543  			output: "select variance(-99999999999999999.99999)",
   544  		}, {
   545  			input:  "select Fld1, std(Fld2) from t1 group by Fld1 having variance(Fld2) is not null",
   546  			output: "select fld1, std(fld2) from t1 group by fld1 having variance(fld2) is not null",
   547  		}, {
   548  			input:  "select a.f1 as a, a.f1 > b.f1 as gt, a.f1 < b.f1 as lt, a.f1<=>b.f1 as eq from t1 a, t1 b;",
   549  			output: "select a.f1 as a, a.f1 > b.f1 as gt, a.f1 < b.f1 as lt, a.f1 <=> b.f1 as eq from t1 as a cross join t1 as b",
   550  		}, {
   551  			input:  "select var_samp(s) as '0.5', var_pop(s) as '0.25' from bug22555;",
   552  			output: "select var_samp(s) as 0.5, var_pop(s) as 0.25 from bug22555",
   553  		}, {
   554  			input:  "select var_samp(s) as 'null', var_pop(s) as 'null' from bug22555;",
   555  			output: "select var_samp(s) as null, var_pop(s) as null from bug22555",
   556  		}, {
   557  			input: "select cast(variance(ff) as decimal(10, 3)) from t2",
   558  		}, {
   559  			input:  "SELECT GROUP_CONCAT(DISTINCT 2) from t1",
   560  			output: "select group_concat(distinct 2, ,) from t1",
   561  		}, {
   562  			input:  "SELECT GROUP_CONCAT(DISTINCT a order by a) from t1",
   563  			output: "select group_concat(distinct a, ,order by a) from t1",
   564  		}, {
   565  			input: "select variance(2) from t1",
   566  		}, {
   567  			input:  "select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;",
   568  			output: "select sql_big_result bit_and(col), bit_or(col) from t1 group by col",
   569  		}, {
   570  			input: "select sql_small_result t2.id, avg(rating + 0.0e0) from t2 group by t2.id",
   571  		}, {
   572  			input: "select sql_small_result t2.id, avg(rating) from t2 group by t2.id",
   573  		}, {
   574  			input:  "select any_value(name), avg(value1), std(value1), variance(value1) from t1, t2 where t1.id = t2.id group by t1.id",
   575  			output: "select any_value(name), avg(value1), std(value1), variance(value1) from t1 cross join t2 where t1.id = t2.id group by t1.id",
   576  		}, {
   577  			input: "select id, avg(value1), std(value1), variance(value1) from t1 group by id",
   578  		}, {
   579  			input: "select i, count(*), std(s1 / s2) from bug22555 group by i order by i",
   580  		}, {
   581  			input: "select i, count(*), variance(s1 / s2) from bug22555 group by i order by i",
   582  		}, {
   583  			input: "select i, count(*), variance(s1 / s2) from bug22555 group by i order by i",
   584  		}, {
   585  			input:  "select name, avg(value1), std(value1), variance(value1) from t1, t2 where t1.id = t2.id group by t1.id",
   586  			output: "select name, avg(value1), std(value1), variance(value1) from t1 cross join t2 where t1.id = t2.id group by t1.id",
   587  		}, {
   588  			input:  "select sum(all a),count(all a),avg(all a),std(all a),variance(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t",
   589  			output: "select sum(all a), count(all a), avg(all a), std(all a), variance(all a), bit_or(all a), bit_and(all a), min(all a), max(all a), min(all c), max(all c) from t",
   590  		}, {
   591  			input:  "insert into t1 values (date_add(NULL, INTERVAL 1 DAY));",
   592  			output: "insert into t1 values (date_add(null, interval(1, day)))",
   593  		}, {
   594  			input:  "replace into t1 values (date_add(NULL, INTERVAL 1 DAY));",
   595  			output: "replace into t1 values (date_add(null, interval(1, day)))",
   596  		}, {
   597  			input:  "SELECT DATE_ADD('2022-02-28 23:59:59.9999', INTERVAL 1 SECOND) '1 second later';",
   598  			output: "select date_add(2022-02-28 23:59:59.9999, interval(1, second)) as 1 second later",
   599  		}, {
   600  			input:  "SELECT sum(a) as 'hello' from t1;",
   601  			output: "select sum(a) as hello from t1",
   602  		}, {
   603  			input:  "select stream from t1;",
   604  			output: "select stream from t1",
   605  		}, {
   606  			input:  "SELECT DATE_ADD(\"2017-06-15\", INTERVAL -10 MONTH);",
   607  			output: "select date_add(2017-06-15, interval(-10, month))",
   608  		}, {
   609  			input:  "create table t1 (a varchar)",
   610  			output: "create table t1 (a varchar)",
   611  		}, {
   612  			input:  "SELECT (CAST(0x7FFFFFFFFFFFFFFF AS char));",
   613  			output: "select (cast(0x7fffffffffffffff as varchar))",
   614  		}, {
   615  			input:  "select cast(-19999999999999999999 as signed);",
   616  			output: "select cast(-19999999999999999999 as signed)",
   617  		}, {
   618  			input:  "select cast(19999999999999999999 as signed);",
   619  			output: "select cast(19999999999999999999 as signed)",
   620  		}, {
   621  			input:  "select date_sub(now(), interval 1 day) from t1;",
   622  			output: "select date_sub(now(), interval(1, day)) from t1",
   623  		}, {
   624  			input:  "select date_sub(now(), interval '1' day) from t1;",
   625  			output: "select date_sub(now(), interval(1, day)) from t1",
   626  		}, {
   627  			input:  "select date_add(now(), interval '1' day) from t1;",
   628  			output: "select date_add(now(), interval(1, day)) from t1",
   629  		}, {
   630  			input:  "SELECT md.datname as `Database` FROM TT md",
   631  			output: "select md.datname as Database from tt as md",
   632  		}, {
   633  			input:  "select * from t where a = `Hello`",
   634  			output: "select * from t where a = hello",
   635  		}, {
   636  			input:  "CREATE VIEW v AS SELECT * FROM t WHERE t.id = f(t.name);",
   637  			output: "create view v as select * from t where t.id = f(t.name)",
   638  		}, {
   639  			input:  "ALTER VIEW v AS SELECT * FROM t WHERE t.id = f(t.name);",
   640  			output: "alter view v as select * from t where t.id = f(t.name)",
   641  		}, {
   642  			input:  "CREATE VIEW v AS SELECT qty, price, qty*price AS value FROM t;",
   643  			output: "create view v as select qty, price, qty * price as value from t",
   644  		}, {
   645  			input:  "ALTER VIEW v AS SELECT qty, price, qty*price AS value FROM t;",
   646  			output: "alter view v as select qty, price, qty * price as value from t",
   647  		}, {
   648  			input: "create view v_today (today) as select current_day from t",
   649  		}, {
   650  			input: "alter view v_today (today) as select current_day from t",
   651  		}, {
   652  			input: "explain (analyze true,verbose false) select * from emp",
   653  		}, {
   654  			input: "select quarter from ontime limit 1",
   655  		}, {
   656  			input: "select month from ontime limit 1",
   657  		}, {
   658  			input: "with tw as (select * from t2), tf as (select * from t3) select * from tw where a > 1",
   659  		}, {
   660  			input: "with tw as (select * from t2) select * from tw where a > 1",
   661  		}, {
   662  			input:  "create table t (a double(13))  // comment",
   663  			output: "create table t (a double(13))",
   664  		}, {
   665  			input:  "create table t (a double(13))  -- comment",
   666  			output: "create table t (a double(13))",
   667  		}, {
   668  			input: "select a as promo_revenue from (select * from r) as c_orders(c_custkey, c_count)",
   669  		}, {
   670  			input:  "select extract(year from l_shipdate) as l_year from t",
   671  			output: "select extract(year, l_shipdate) as l_year from t",
   672  		}, {
   673  			input:  "select * from R join S on R.uid = S.uid where l_shipdate <= date '1998-12-01' - interval '112' day",
   674  			output: "select * from r inner join s on r.uid = s.uid where l_shipdate <= date(1998-12-01) - interval(112, day)",
   675  		}, {
   676  			input: "create table deci_table (a decimal(10, 5))",
   677  		}, {
   678  			input: "create table deci_table (a decimal(20, 5))",
   679  		}, {
   680  			input:  "create table deci_table (a decimal)",
   681  			output: "create table deci_table (a decimal(38))",
   682  		}, {
   683  			input: "create table deci_table (a decimal(20))",
   684  		}, {
   685  			input: "select substr(name, 5) from t1",
   686  		}, {
   687  			input: "select substring(name, 5) from t1",
   688  		}, {
   689  			input: "select substr(name, 5, 3) from t1",
   690  		}, {
   691  			input: "select substring(name, 5, 3) from t1",
   692  		}, {
   693  			input:  "select * from R join S on R.uid = S.uid",
   694  			output: "select * from r inner join s on r.uid = s.uid",
   695  		}, {
   696  			input:  "create table t (a int, b char, key idx1 type zonemap (a, b))",
   697  			output: "create table t (a int, b char, index idx1 using zonemap (a, b))",
   698  		}, {
   699  			input: "create table t (a int, index idx1 using zonemap (a))",
   700  		}, {
   701  			input: "create table t (a int, index idx1 using bsi (a))",
   702  		}, {
   703  			input:  "set @@sql_mode ='TRADITIONAL'",
   704  			output: "set sql_mode = TRADITIONAL",
   705  		}, {
   706  			input:  "set @@session.sql_mode ='TRADITIONAL'",
   707  			output: "set sql_mode = TRADITIONAL",
   708  		}, {
   709  			input:  "set session sql_mode ='TRADITIONAL'",
   710  			output: "set sql_mode = TRADITIONAL",
   711  		}, {
   712  			input:  "select @session.tx_isolation",
   713  			output: "select @session.tx_isolation",
   714  		}, {
   715  			input:  "select @@session.tx_isolation",
   716  			output: "select @@tx_isolation",
   717  		}, {
   718  			input:  "/* mysql-connector-java-8.0.27 (Revision: e920b979015ae7117d60d72bcc8f077a839cd791) */SHOW VARIABLES;",
   719  			output: "show variables",
   720  		}, {
   721  			input: "create index idx1 using bsi on a (a)",
   722  		}, {
   723  			input:  "INSERT INTO pet VALUES row('Sunsweet05','Dsant05','otter','f',30.11,2), row('Sunsweet06','Dsant06','otter','m',30.11,3);",
   724  			output: "insert into pet values (Sunsweet05, Dsant05, otter, f, 30.11, 2), (Sunsweet06, Dsant06, otter, m, 30.11, 3)",
   725  		}, {
   726  			input:  "INSERT INTO t1 SET f1 = -1.0e+30, f2 = 'exore', f3 = 123",
   727  			output: "insert into t1 (f1, f2, f3) values (-1.0e+30, exore, 123)",
   728  		}, {
   729  			input:  "INSERT INTO t1 SET f1 = -1;",
   730  			output: "insert into t1 (f1) values (-1)",
   731  		}, {
   732  			input:  "INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6) ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b), b=VALUES(a)+VALUES(c);",
   733  			output: "insert into t1 (a, b, c) values (1, 2, 3), (4, 5, 6) on duplicate key update c = values(a) + values(b), b = values(a) + values(c)",
   734  		}, {
   735  			input:  "INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6) ON DUPLICATE KEY UPDATE c=2, b=3;",
   736  			output: "insert into t1 (a, b, c) values (1, 2, 3), (4, 5, 6) on duplicate key update c = 2, b = 3",
   737  		}, {
   738  			input:  "INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6) ON DUPLICATE KEY UPDATE c=2/2, b=3;",
   739  			output: "insert into t1 (a, b, c) values (1, 2, 3), (4, 5, 6) on duplicate key update c = 2 / 2, b = 3",
   740  		}, {
   741  			input:  "insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612)",
   742  			output: "insert into t1 values (18446744073709551615), (0xfffffffffffffffe), (18446744073709551613), (18446744073709551612)",
   743  		}, {
   744  			input:  "REPLACE INTO pet VALUES row('Sunsweet05','Dsant05','otter','f',30.11,2), row('Sunsweet06','Dsant06','otter','m',30.11,3);",
   745  			output: "replace into pet values (Sunsweet05, Dsant05, otter, f, 30.11, 2), (Sunsweet06, Dsant06, otter, m, 30.11, 3)",
   746  		}, {
   747  			input:  "REPLACE INTO t1 SET f1 = -1.0e+30, f2 = 'exore', f3 = 123",
   748  			output: "replace into t1 (f1, f2, f3) values (-1.0e+30, exore, 123)",
   749  		}, {
   750  			input:  "REPLACE INTO t1 SET f1 = -1;",
   751  			output: "replace into t1 (f1) values (-1)",
   752  		}, {
   753  			input:  "replace into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612)",
   754  			output: "replace into t1 values (18446744073709551615), (0xfffffffffffffffe), (18446744073709551613), (18446744073709551612)",
   755  		}, {
   756  			input:  "create table t (a int) properties(\"host\" = \"127.0.0.1\", \"port\" = \"8239\", \"user\" = \"mysql_user\", \"password\" = \"mysql_passwd\")",
   757  			output: "create table t (a int) properties(host = 127.0.0.1, port = 8239, user = mysql_user, password = mysql_passwd)",
   758  		}, {
   759  			input:  "create table t (a int) properties('a' = 'b')",
   760  			output: "create table t (a int) properties(a = b)",
   761  		}, {
   762  			input: "create table t (a int, b char, check (1 + 1) enforced)",
   763  		}, {
   764  			input: "create table t (a int, b char, foreign key sdf (a, b) references b(a asc, b desc))",
   765  		}, {
   766  			input:  "create table t (a int, b char, constraint sdf foreign key (a, b) references b(a asc, b desc))",
   767  			output: "create table t (a int, b char, constraint sdf foreign key (a, b) references b(a asc, b desc))",
   768  		}, {
   769  			input:  "create table t (a int, b char, constraint sdf foreign key dddd (a, b) references b(a asc, b desc))",
   770  			output: "create table t (a int, b char, constraint sdf foreign key dddd (a, b) references b(a asc, b desc))",
   771  		}, {
   772  			input: "create table t (a int, b char, unique key idx (a, b))",
   773  		}, {
   774  			input: "create table t (a int, b char, index if not exists idx (a, b))",
   775  		}, {
   776  			input: "create table t (a int, b char, fulltext idx (a, b))",
   777  		}, {
   778  			input:  "create table t (a int, b char, constraint p1 primary key idx using hash (a, b))",
   779  			output: "create table t (a int, b char, constraint p1 primary key idx using none (a, b))",
   780  		}, {
   781  			input: "create table t (a int, b char, primary key idx (a, b))",
   782  		}, {
   783  			input:  "create dynamic table t as select a from t1",
   784  			output: "create dynamic table t as select a from t1",
   785  		}, {
   786  			input:  "create dynamic table t as select a from t1 with (\"type\"='kafka')",
   787  			output: "create dynamic table t as select a from t1 with (type = kafka)",
   788  		}, {
   789  			input:  "create external table t (a int) infile 'data.txt'",
   790  			output: "create external table t (a int) infile 'data.txt'",
   791  		}, {
   792  			input: "create external table t (a int) infile {'filepath'='data.txt', 'compression'='none'}",
   793  		}, {
   794  			input: "create external table t (a int) infile {'filepath'='data.txt', 'compression'='auto'}",
   795  		}, {
   796  			input: "create external table t (a int) infile {'filepath'='data.txt', 'compression'='lz4'}",
   797  		}, {
   798  			input:  "create external table t (a int) infile 'data.txt' FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY ''",
   799  			output: "create external table t (a int) infile 'data.txt' fields terminated by '' optionally enclosed by '' lines terminated by ''",
   800  		}, {
   801  			input:  "SET NAMES 'utf8mb4' COLLATE 'utf8mb4_general_ci'",
   802  			output: "set names = utf8mb4 utf8mb4_general_ci",
   803  		}, {
   804  			input: "insert into cms values (null, default)",
   805  		}, {
   806  			input: "replace into cms values (null, default)",
   807  		}, {
   808  			input:  "create database `show`",
   809  			output: "create database show",
   810  		}, {
   811  			input: "create table table16 (1a20 int, 1e int)",
   812  		}, {
   813  			input: "insert into t2 values (-3, 2)",
   814  		}, {
   815  			input: "replace into t2 values (-3, 2)",
   816  		}, {
   817  			input:  "select spID,userID,score from t1 where spID>(userID-1);",
   818  			output: "select spid, userid, score from t1 where spid > (userid - 1)",
   819  		}, {
   820  			input:  "CREATE TABLE t2(product VARCHAR(32),country_id INTEGER NOT NULL,year INTEGER,profit INTEGER)",
   821  			output: "create table t2 (product varchar(32), country_id integer not null, year integer, profit integer)",
   822  		}, {
   823  			input: "insert into numtable values (255, 65535, 4294967295, 18446744073709551615)",
   824  		}, {
   825  			input: "replace into numtable values (255, 65535, 4294967295, 18446744073709551615)",
   826  		}, {
   827  			input: "create table numtable (a tinyint unsigned, b smallint unsigned, c int unsigned, d bigint unsigned)",
   828  		}, {
   829  			input:  "SELECT userID as user, MAX(score) as max FROM t1 GROUP BY userID order by user",
   830  			output: "select userid as user, max(score) as max from t1 group by userid order by user",
   831  		}, {
   832  			input:  "load data infile 'test/loadfile5' ignore INTO TABLE T.A FIELDS TERMINATED BY  ',' (@,@,c,d,e,f)",
   833  			output: "load data infile test/loadfile5 ignore into table t.a fields terminated by , (, , c, d, e, f)",
   834  		}, {
   835  			input:  "load data infile '/root/lineorder_flat_10.tbl' into table lineorder_flat FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '';",
   836  			output: "load data infile /root/lineorder_flat_10.tbl into table lineorder_flat fields terminated by '' optionally enclosed by '' lines terminated by ''",
   837  		}, {
   838  			input:  "load data local infile 'data' replace into table db.a (a, b, @vc, @vd) set a = @vc != 0, d = @vd != 1",
   839  			output: "load data local infile data replace into table db.a (a, b, @vc, @vd) set a = @vc != 0, d = @vd != 1",
   840  		}, {
   841  			input:  "load data local infile 'data' replace into table db.a lines starting by '#' terminated by '\t' ignore 2 lines",
   842  			output: "load data local infile data replace into table db.a lines starting by # terminated by 	 ignore 2 lines",
   843  		}, {
   844  			input:  "load data local infile 'data' replace into table db.a lines starting by '#' terminated by '\t' ignore 2 rows",
   845  			output: "load data local infile data replace into table db.a lines starting by # terminated by 	 ignore 2 lines",
   846  		}, {
   847  			input:  "load data local infile 'data' replace into table db.a lines terminated by '\t' starting by '#' ignore 2 lines",
   848  			output: "load data local infile data replace into table db.a lines starting by # terminated by 	 ignore 2 lines",
   849  		}, {
   850  			input:  "load data local infile 'data' replace into table db.a lines terminated by '\t' starting by '#' ignore 2 rows",
   851  			output: "load data local infile data replace into table db.a lines starting by # terminated by 	 ignore 2 lines",
   852  		}, {
   853  			input:  "load data infile 'data.txt' into table db.a fields terminated by '\t' escaped by '\t'",
   854  			output: "load data infile data.txt into table db.a fields terminated by \t escaped by \t",
   855  		}, {
   856  			input:  "load data infile 'data.txt' into table db.a fields terminated by '\t' enclosed by '\t' escaped by '\t'",
   857  			output: "load data infile data.txt into table db.a fields terminated by \t enclosed by \t escaped by \t",
   858  		}, {
   859  			input:  "load data infile 'data.txt' into table db.a",
   860  			output: "load data infile data.txt into table db.a",
   861  		}, {
   862  			input: "load data infile {'filepath'='data.txt', 'compression'='auto'} into table db.a",
   863  		}, {
   864  			input: "load data infile {'filepath'='data.txt', 'compression'='none'} into table db.a",
   865  		}, {
   866  			input:  "create external table t (a int) infile 'data.txt'",
   867  			output: "create external table t (a int) infile 'data.txt'",
   868  		}, {
   869  			input: "create external table t (a int) infile {'filepath'='data.txt', 'compression'='none'}",
   870  		}, {
   871  			input: "create external table t (a int) infile {'filepath'='data.txt', 'compression'='auto'}",
   872  		}, {
   873  			input: "create external table t (a int) infile {'filepath'='data.txt', 'compression'='lz4'}",
   874  		}, {
   875  			input:  "create external table t (a int) infile 'data.txt' FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY ''",
   876  			output: "create external table t (a int) infile 'data.txt' fields terminated by '' optionally enclosed by '' lines terminated by ''",
   877  		}, {
   878  			input:  "create external table t (a int) URL s3option{'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='XXX', 'secret_access_key'='XXX', 'bucket'='test', 'filepath'='*.txt', 'region'='us-west-2'}",
   879  			output: "create external table t (a int) url s3option {'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='******', 'secret_access_key'='******', 'bucket'='test', 'filepath'='*.txt', 'region'='us-west-2'}",
   880  		}, {
   881  			input:  "load data infile 'test/loadfile5' ignore INTO TABLE T.A FIELDS TERMINATED BY  ',' (@,@,c,d,e,f)",
   882  			output: "load data infile test/loadfile5 ignore into table t.a fields terminated by , (, , c, d, e, f)",
   883  		}, {
   884  			input:  "load data infile '/root/lineorder_flat_10.tbl' into table lineorder_flat FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '';",
   885  			output: "load data infile /root/lineorder_flat_10.tbl into table lineorder_flat fields terminated by '' optionally enclosed by '' lines terminated by ''",
   886  		}, {
   887  			input:  "load data infile '/root/lineorder_flat_10.tbl' into table lineorder_flat FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '' parallel 'true';",
   888  			output: "load data infile /root/lineorder_flat_10.tbl into table lineorder_flat fields terminated by '' optionally enclosed by '' lines terminated by '' parallel true ",
   889  		}, {
   890  			input:  "load data infile '/root/lineorder_flat_10.tbl' into table lineorder_flat FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '' parallel 'true' strict 'true';",
   891  			output: "load data infile /root/lineorder_flat_10.tbl into table lineorder_flat fields terminated by '' optionally enclosed by '' lines terminated by '' parallel true strict true ",
   892  		}, {
   893  			input: "load data infile {'filepath'='data.txt', 'compression'='auto'} into table db.a",
   894  		}, {
   895  			input: "load data infile {'filepath'='data.txt', 'compression'='none'} into table db.a",
   896  		}, {
   897  			input: "load data infile {'filepath'='data.txt', 'compression'='GZIP'} into table db.a",
   898  		}, {
   899  			input: "load data infile {'filepath'='data.txt', 'compression'='BZIP2'} into table db.a",
   900  		}, {
   901  			input: "load data infile {'filepath'='data.txt', 'compression'='FLATE'} into table db.a",
   902  		}, {
   903  			input: "load data infile {'filepath'='data.txt', 'compression'='LZW'} into table db.a",
   904  		}, {
   905  			input: "load data infile {'filepath'='data.txt', 'compression'='ZLIB'} into table db.a",
   906  		}, {
   907  			input: "load data infile {'filepath'='data.txt', 'compression'='LZ4'} into table db.a",
   908  		}, {
   909  			input:  "LOAD DATA URL s3option{'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='XXX', 'secret_access_key'='XXX', 'bucket'='test', 'filepath'='*.txt', 'region'='us-west-2'} into table db.a",
   910  			output: "load data url s3option {'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='******', 'secret_access_key'='******', 'bucket'='test', 'filepath'='*.txt', 'region'='us-west-2'} into table db.a",
   911  		},
   912  		{
   913  			input: `load data url s3option {'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='******', 'secret_access_key'='******', 'bucket'='test', 'filepath'='jsonline/jsonline_object.jl', 'region'='us-west-2', 'compression'='none', 'format'='jsonline', 'jsondata'='object'} into table t1`,
   914  		}, {
   915  			input: "load data infile {'filepath'='data.txt', 'compression'='GZIP'} into table db.a",
   916  		}, {
   917  			input: "load data infile {'filepath'='data.txt', 'compression'='BZIP2'} into table db.a",
   918  		}, {
   919  			input: "load data infile {'filepath'='data.txt', 'compression'='FLATE'} into table db.a",
   920  		}, {
   921  			input: "load data infile {'filepath'='data.txt', 'compression'='LZW'} into table db.a",
   922  		}, {
   923  			input: "load data infile {'filepath'='data.txt', 'compression'='ZLIB'} into table db.a",
   924  		}, {
   925  			input: "load data infile {'filepath'='data.txt', 'compression'='LZ4'} into table db.a",
   926  		}, {
   927  			input: "load data infile {'filepath'='data.txt', 'format'='jsonline', 'jsondata'='array'} into table db.a",
   928  		},
   929  		{
   930  			input: "load data infile {'filepath'='data.txt', 'format'='jsonline', 'jsondata'='object'} into table db.a",
   931  		},
   932  		{
   933  			input: "load data infile {'filepath'='data.txt', 'compression'='BZIP2', 'format'='jsonline', 'jsondata'='object'} into table db.a",
   934  		},
   935  		{
   936  			input: "load data inline format='jsonline', data='[1,2,3,4]', jsontype='array' into table t1",
   937  		},
   938  		{
   939  			input:  "show tables from test01 where tables_in_test01 like '%t2%'",
   940  			output: "show tables from test01 where tables_in_test01 like %t2%",
   941  		}, {
   942  			input:  "select userID,MAX(score) max_score from t1 where userID <2 || userID > 3 group by userID order by max_score",
   943  			output: "select userid, max(score) as max_score from t1 where concat(userid < 2, userid > 3) group by userid order by max_score",
   944  		}, {
   945  			input: "select c1, -c2 from t2 order by -c1 desc",
   946  		}, {
   947  			input:  "select * from t1 where spID>2 AND userID <2 || userID >=2 OR userID < 2 limit 3",
   948  			output: "select * from t1 where concat(spid > 2 and userid < 2, userid >= 2) or userid < 2 limit 3",
   949  		}, {
   950  			input:  "select * from t10 where (b='ba' or b='cb') and (c='dc' or c='ed');",
   951  			output: "select * from t10 where (b = ba or b = cb) and (c = dc or c = ed)",
   952  		}, {
   953  			input:  "select CAST(userID AS DOUBLE) cast_double, CAST(userID AS FLOAT(3)) cast_float , CAST(userID AS REAL) cast_real, CAST(userID AS SIGNED) cast_signed, CAST(userID AS UNSIGNED) cast_unsigned from t1 limit 2",
   954  			output: "select cast(userid as double) as cast_double, cast(userid as float(3)) as cast_float, cast(userid as real) as cast_real, cast(userid as signed) as cast_signed, cast(userid as unsigned) as cast_unsigned from t1 limit 2",
   955  		}, {
   956  			input: "select distinct name as name1 from t1",
   957  		}, {
   958  			input:  "select userID, userID DIV 2 as user_dir, userID%2 as user_percent, userID MOD 2 as user_mod from t1",
   959  			output: "select userid, userid div 2 as user_dir, userid % 2 as user_percent, userid % 2 as user_mod from t1",
   960  		}, {
   961  			input:  "select sum(score) as sum from t1 where spID=6 group by score order by sum desc",
   962  			output: "select sum(score) as sum from t1 where spid = 6 group by score order by sum desc",
   963  		}, {
   964  			input:  "select userID,count(score) from t1 where userID>2 group by userID having count(score)>1",
   965  			output: "select userid, count(score) from t1 where userid > 2 group by userid having count(score) > 1",
   966  		}, {
   967  			input:  "SELECT product, SUM(profit),AVG(profit) FROM t2 where product<>'TV' GROUP BY product order by product asc",
   968  			output: "select product, sum(profit), avg(profit) from t2 where product != TV group by product order by product asc",
   969  		}, {
   970  			input:  "SELECT product, SUM(profit),AVG(profit) FROM t2 where product='Phone' GROUP BY product order by product asc",
   971  			output: "select product, sum(profit), avg(profit) from t2 where product = Phone group by product order by product asc",
   972  		}, {
   973  			input:  "select sum(col_1d),count(col_1d),avg(col_1d),min(col_1d),max(col_1d) from tbl1 group by col_1e",
   974  			output: "select sum(col_1d), count(col_1d), avg(col_1d), min(col_1d), max(col_1d) from tbl1 group by col_1e",
   975  		}, {
   976  			input:  "select u.a, (select t.a from sa.t, u) from u, (select t.a, u.a from sa.t, u where t.a = u.a) as t where (u.a, u.b, u.c) in (select t.a, u.a, t.b * u.b tubb from t)",
   977  			output: "select u.a, (select t.a from sa.t cross join u) from u cross join (select t.a, u.a from sa.t cross join u where t.a = u.a) as t where (u.a, u.b, u.c) in (select t.a, u.a, t.b * u.b as tubb from t)",
   978  		}, {
   979  			input:  "select u.a, (select t.a from sa.t, u) from u",
   980  			output: "select u.a, (select t.a from sa.t cross join u) from u",
   981  		}, {
   982  			input:  "select t.a, u.a, t.b * u.b from sa.t join u on t.c = u.c or t.d != u.d where t.a = u.a and t.b > u.b group by t.a, u.a, (t.a + u.b + v.b) having t.a = 11 and v.c > 1000 order by t.a desc, u.a asc, v.d asc, tubb limit 200 offset 100",
   983  			output: "select t.a, u.a, t.b * u.b from sa.t inner join u on t.c = u.c or t.d != u.d where t.a = u.a and t.b > u.b group by t.a, u.a, (t.a + u.b + v.b) having t.a = 11 and v.c > 1000 order by t.a desc, u.a asc, v.d asc, tubb limit 200 offset 100",
   984  		}, {
   985  			input:  "select t.a, u.a, t.b * u.b from sa.t join u on t.c = u.c or t.d != u.d where t.a = u.a and t.b > u.b group by t.a, u.a, (t.a + u.b + v.b) having t.a = 11 and v.c > 1000",
   986  			output: "select t.a, u.a, t.b * u.b from sa.t inner join u on t.c = u.c or t.d != u.d where t.a = u.a and t.b > u.b group by t.a, u.a, (t.a + u.b + v.b) having t.a = 11 and v.c > 1000",
   987  		}, {
   988  			input:  "select t.a, u.a, t.b * u.b from sa.t join u on t.c = u.c or t.d != u.d where t.a = u.a and t.b > u.b group by t.a, u.a, (t.a + u.b + v.b)",
   989  			output: "select t.a, u.a, t.b * u.b from sa.t inner join u on t.c = u.c or t.d != u.d where t.a = u.a and t.b > u.b group by t.a, u.a, (t.a + u.b + v.b)",
   990  		}, {
   991  			input:  "SELECT t.a,u.a,t.b * u.b FROM sa.t join u on t.c = u.c or t.d != u.d where t.a = u.a and t.b > u.b",
   992  			output: "select t.a, u.a, t.b * u.b from sa.t inner join u on t.c = u.c or t.d != u.d where t.a = u.a and t.b > u.b",
   993  		}, {
   994  			input: "select avg(u.a), count(u.b), cast(u.c as varchar) from u",
   995  		}, {
   996  			input: "select avg(u.a), count(*) from u",
   997  		}, {
   998  			input: "select approx_count(*) from u",
   999  		}, {
  1000  			input: "select avg(u.a), count(u.b) from u",
  1001  		}, {
  1002  			input: "select sum(col_1d) from tbl1 where col_1d < 13 group by col_1e",
  1003  		}, {
  1004  			input:  "select sum(col_1a),count(col_1b),avg(col_1c),min(col_1d),max(col_1d) from tbl1",
  1005  			output: "select sum(col_1a), count(col_1b), avg(col_1c), min(col_1d), max(col_1d) from tbl1",
  1006  		}, {
  1007  			input:  "insert into tbl1 values (0,1,5,11, \"a\")",
  1008  			output: "insert into tbl1 values (0, 1, 5, 11, a)",
  1009  		}, {
  1010  			input:  "replace into tbl1 values (0,1,5,11, \"a\")",
  1011  			output: "replace into tbl1 values (0, 1, 5, 11, a)",
  1012  		}, {
  1013  			input: "create table tbl1 (col_1a tinyint, col_1b smallint, col_1c int, col_1d bigint, col_1e char(10) not null)",
  1014  		}, {
  1015  			input: "insert into numtable values (4, 1.234567891, 1.234567891)",
  1016  		}, {
  1017  			input: "insert into numtable values (3, 1.234567, 1.234567)",
  1018  		}, {
  1019  			input: "replace into numtable values (4, 1.234567891, 1.234567891)",
  1020  		}, {
  1021  			input: "replace into numtable values (3, 1.234567, 1.234567)",
  1022  		}, {
  1023  			input: "create table numtable (id int, fl float, dl double)",
  1024  		}, {
  1025  			input: "drop table if exists numtable",
  1026  		}, {
  1027  			input:  "create table table17 (`index` int)",
  1028  			output: "create table table17 (index int)",
  1029  		}, {
  1030  			input: "create table table19$ (a int)",
  1031  		}, {
  1032  			input:  "create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);",
  1033  			output: "create table aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int)",
  1034  		}, {
  1035  			input:  "create table table12 (`a ` int)",
  1036  			output: "create table table12 (a  int)",
  1037  		}, {
  1038  			input:  "create table `table11 ` (a int)",
  1039  			output: "create table table11  (a int)",
  1040  		}, {
  1041  			input:  "create table table10 (a int primary key, b varchar(10)) checksum=0 COMMENT=\"asdf\"",
  1042  			output: "create table table10 (a int primary key, b varchar(10)) checksum = 0 comment = 'asdf'",
  1043  		}, {
  1044  			input:  "create temporary table table05 ( a int, b char(10));",
  1045  			output: "create temporary table table05 (a int, b char(10))",
  1046  		}, {
  1047  			input:  "create table table15 (a varchar(5) default 'abcde')",
  1048  			output: "create table table15 (a varchar(5) default abcde)",
  1049  		}, {
  1050  			input:  "create table table01 (a TINYINT primary key, b SMALLINT SIGNED, c INT UNSIGNED, d BIGINT not null , e FLOAT unique,f DOUBLE, g CHAR(10), h VARCHAR(20))",
  1051  			output: "create table table01 (a tinyint primary key, b smallint, c int unsigned, d bigint not null, e float unique, f double, g char(10), h varchar(20))",
  1052  		}, {
  1053  			input:  "create database test04 CHARACTER SET=utf8 collate=utf8_general_ci ENCRYPTION='N'",
  1054  			output: "create database test04 character set utf8 collate utf8_general_ci encryption N",
  1055  		}, {
  1056  			input:  "create database test03 DEFAULT CHARACTER SET utf8 collate utf8_general_ci ENCRYPTION 'Y'",
  1057  			output: "create database test03 default character set utf8 collate utf8_general_ci encryption Y",
  1058  		}, {
  1059  			input: "drop database if exists t01234567890123456789012345678901234567890123456789012345678901234567890123456789",
  1060  		}, {
  1061  			input: "select distinct a from t",
  1062  		}, {
  1063  			input:  "select * from t where a like 'a%'",
  1064  			output: "select * from t where a like a%",
  1065  		}, {
  1066  			input: "select sysdate(), curtime(22) from t",
  1067  		}, {
  1068  			input: "select sysdate(), curtime from t",
  1069  		}, {
  1070  			input:  "select current_time(), current_timestamp, lacalTIMe(89), utc_time() from t",
  1071  			output: "select current_time(), current_timestamp(), lacaltime(89), utc_time() from t",
  1072  		}, {
  1073  			input:  "select current_user(), current_role(), current_date, utc_date from t",
  1074  			output: "select current_user(), current_role(), current_date(), utc_date() from t",
  1075  		}, {
  1076  			input: "select ascii(a), collation(b), hour(c), microsecond(d) from t",
  1077  		}, {
  1078  			input:  "select dayofmonth('2001-11-00'), month('2005-00-00') from t",
  1079  			output: "select dayofmonth(2001-11-00), month(2005-00-00) from t",
  1080  		}, {
  1081  			input: "select sum(distinct s) from tbl where 1",
  1082  		}, {
  1083  			input:  "select u.a, interval 1 second from t",
  1084  			output: "select u.a, interval(1, second) from t",
  1085  		}, {
  1086  			input:  "select u.a, (select t.a from sa.t, u) from t where (u.a, u.b, u.c) in (select * from t)",
  1087  			output: "select u.a, (select t.a from sa.t cross join u) from t where (u.a, u.b, u.c) in (select * from t)",
  1088  		}, {
  1089  			input:  "select u.a, (select t.a from sa.t, u) from t where (u.a, u.b, u.c)",
  1090  			output: "select u.a, (select t.a from sa.t cross join u) from t where (u.a, u.b, u.c)",
  1091  		}, {
  1092  			input:  "select u.a, (select t.a from sa.t, u) from u",
  1093  			output: "select u.a, (select t.a from sa.t cross join u) from u",
  1094  		}, {
  1095  			input:  "select t.a from sa.t, u",
  1096  			output: "select t.a from sa.t cross join u",
  1097  		}, {
  1098  			input: "select t.a from sa.t",
  1099  		}, {
  1100  			input:  "create table k1 (id int not null primary key,name varchar(20)) partition by key() partitions 2",
  1101  			output: "create table k1 (id int not null primary key, name varchar(20)) partition by key algorithm = 2 partitions 2",
  1102  		}, {
  1103  			input:  "create table k1 (id int not null,name varchar(20),unique key (id))partition by key() partitions 2",
  1104  			output: "create table k1 (id int not null, name varchar(20), unique key (id)) partition by key algorithm = 2 partitions 2",
  1105  		}, {
  1106  			input:  "create table a (a int) partition by key (a, b, db.t.c) (partition xx (subpartition s1, subpartition s3 max_rows = 1000 min_rows = 100))",
  1107  			output: "create table a (a int) partition by key algorithm = 2 (a, b, db.t.c) (partition xx (subpartition s1, subpartition s3 max_rows = 1000 min_rows = 100))",
  1108  		}, {
  1109  			input:  "create table a (a int) partition by key (a, b, db.t.c) (partition xx row_format = dynamic max_rows = 1000 min_rows = 100)",
  1110  			output: "create table a (a int) partition by key algorithm = 2 (a, b, db.t.c) (partition xx row_format = dynamic max_rows = 1000 min_rows = 100)",
  1111  		}, {
  1112  			input:  "create table a (a int) engine = 'innodb' row_format = dynamic comment = 'table A' compression = 'lz4' data directory = '/data' index directory = '/index' max_rows = 1000 min_rows = 100",
  1113  			output: "create table a (a int) engine = innodb row_format = dynamic comment = 'table A' compression = lz4 data directory = /data index directory = /index max_rows = 1000 min_rows = 100",
  1114  		}, {
  1115  			input:  "create table a (a int) partition by linear key algorithm = 3221 (a, b, db.t.c) (partition xx values less than (1, 2, 323), partition yy)",
  1116  			output: "create table a (a int) partition by linear key algorithm = 3221 (a, b, db.t.c) (partition xx values less than (1, 2, 323), partition yy)",
  1117  		}, {
  1118  			input:  "create table a (a int) partition by linear key algorithm = 3221 (a, b, db.t.c) partitions 10 subpartition by key (a, b, db.t.c) subpartitions 10",
  1119  			output: "create table a (a int) partition by linear key algorithm = 3221 (a, b, db.t.c) partitions 10 subpartition by key algorithm = 2 (a, b, db.t.c) subpartitions 10",
  1120  		}, {
  1121  			input: "create table a (a int) partition by linear key algorithm = 3221 (a, b, db.t.c) partitions 10",
  1122  		}, {
  1123  			input: "create table a (a int) partition by linear hash (1 + 1234 / 32)",
  1124  		}, {
  1125  			input: "create table a (a int) partition by linear key algorithm = 31 (a, b, db.t.c)",
  1126  		}, {
  1127  			input:  "create table a (a int) partition by linear key (a, b, db.t.c)",
  1128  			output: "create table a (a int) partition by linear key algorithm = 2 (a, b, db.t.c)",
  1129  		}, {
  1130  			input: "create table a (a int) partition by list columns (a, b, db.t.c)",
  1131  		}, {
  1132  			input: "create table a (a int) partition by list columns (a, b, db.t.c)",
  1133  		}, {
  1134  			input: "create table a (a int) partition by range columns (a, b, db.t.c)",
  1135  		}, {
  1136  			input: "create table a (a int) partition by range(1 + 21)",
  1137  		}, {
  1138  			input: "create table a (a int storage disk constraint cx check (b + c) enforced)",
  1139  		}, {
  1140  			input: "create table a (a int storage disk, b int references b(a asc, b desc) match full on delete cascade on update restrict)",
  1141  		}, {
  1142  			input: "create table a (a int storage disk, b int)",
  1143  		}, {
  1144  			input: "create table a (a int not null default 1 auto_increment unique primary key collate utf8_bin storage disk)",
  1145  		},
  1146  		{
  1147  			input:  `CREATE TABLE tp1 (col1 INT, col2 CHAR(5), col3 DATE) PARTITION BY KEY(col3) PARTITIONS 4`,
  1148  			output: `create table tp1 (col1 int, col2 char(5), col3 date) partition by key algorithm = 2 (col3) partitions 4`,
  1149  		},
  1150  		{
  1151  			input:  `CREATE TABLE tp2 (col1 INT, col2 CHAR(5), col3 DATE) PARTITION BY KEY(col3)`,
  1152  			output: `create table tp2 (col1 int, col2 char(5), col3 date) partition by key algorithm = 2 (col3)`,
  1153  		},
  1154  		{
  1155  			input:  `CREATE TABLE tp3 (col1 INT, col2 CHAR(5), col3 DATE) PARTITION BY LINEAR KEY(col3) PARTITIONS 5`,
  1156  			output: `create table tp3 (col1 int, col2 char(5), col3 date) partition by linear key algorithm = 2 (col3) partitions 5`,
  1157  		},
  1158  		{
  1159  			input:  `CREATE TABLE tp4 (col1 INT, col2 CHAR(5), col3 DATE) PARTITION BY KEY ALGORITHM = 1 (col3)`,
  1160  			output: `create table tp4 (col1 int, col2 char(5), col3 date) partition by key algorithm = 1 (col3)`,
  1161  		},
  1162  		{
  1163  			input:  `CREATE TABLE tp5 (col1 INT, col2 CHAR(5), col3 DATE) PARTITION BY LINEAR KEY ALGORITHM = 1 (col3) PARTITIONS 5;`,
  1164  			output: `create table tp5 (col1 int, col2 char(5), col3 date) partition by linear key algorithm = 1 (col3) partitions 5`,
  1165  		},
  1166  		{
  1167  			input:  `CREATE TABLE tp6 (col1 INT, col2 CHAR(5), col3 DATE) PARTITION BY KEY(col1, col2) PARTITIONS 4`,
  1168  			output: `create table tp6 (col1 int, col2 char(5), col3 date) partition by key algorithm = 2 (col1, col2) partitions 4`,
  1169  		},
  1170  		{
  1171  			input:  `CREATE TABLE tp7 (col1 INT NOT NULL, col2 DATE NOT NULL, col3 INT NOT NULL, col4 INT NOT NULL, PRIMARY KEY (col1, col2)) PARTITION BY KEY(col1) PARTITIONS 4`,
  1172  			output: `create table tp7 (col1 int not null, col2 date not null, col3 int not null, col4 int not null, primary key (col1, col2)) partition by key algorithm = 2 (col1) partitions 4`,
  1173  		},
  1174  		{
  1175  			input:  `CREATE TABLE tp9 (col1 INT, col2 CHAR(5)) PARTITION BY HASH(col1) PARTITIONS 4`,
  1176  			output: `create table tp9 (col1 int, col2 char(5)) partition by hash (col1) partitions 4`,
  1177  		},
  1178  		{
  1179  			input:  `CREATE TABLE tp10 (col1 INT, col2 CHAR(5), col3 DATETIME) PARTITION BY HASH (YEAR(col3));`,
  1180  			output: `create table tp10 (col1 int, col2 char(5), col3 datetime) partition by hash (year(col3))`,
  1181  		},
  1182  		{
  1183  			input:  `CREATE TABLE tp11 (col1 INT, col2 CHAR(5), col3 DATE) PARTITION BY LINEAR HASH( YEAR(col3)) PARTITIONS 6`,
  1184  			output: `create table tp11 (col1 int, col2 char(5), col3 date) partition by linear hash (year(col3)) partitions 6`,
  1185  		},
  1186  		{
  1187  			input:  `CREATE TABLE tp12 (col1 INT NOT NULL, col2 DATE NOT NULL, col3 INT NOT NULL, col4 INT NOT NULL, PRIMARY KEY (col1, col2)) PARTITION BY HASH(col1) PARTITIONS 4`,
  1188  			output: `create table tp12 (col1 int not null, col2 date not null, col3 int not null, col4 int not null, primary key (col1, col2)) partition by hash (col1) partitions 4`,
  1189  		},
  1190  		{
  1191  			input: `CREATE TABLE tp13 (
  1192  					id INT NOT NULL,
  1193  					fname VARCHAR(30),
  1194  					lname VARCHAR(30),
  1195  					hired DATE NOT NULL DEFAULT '1970-01-01',
  1196  					separated DATE NOT NULL DEFAULT '9999-12-31',
  1197  					job_code INT,
  1198  					store_id INT
  1199  				)
  1200  				PARTITION BY RANGE ( YEAR(separated) ) (
  1201  					PARTITION p0 VALUES LESS THAN (1991),
  1202  					PARTITION p1 VALUES LESS THAN (1996),
  1203  					PARTITION p2 VALUES LESS THAN (2001),
  1204  					PARTITION p3 VALUES LESS THAN MAXVALUE
  1205  				);`,
  1206  			output: `create table tp13 (id int not null, fname varchar(30), lname varchar(30), hired date not null default 1970-01-01, separated date not null default 9999-12-31, job_code int, store_id int) partition by range(year(separated)) (partition p0 values less than (1991), partition p1 values less than (1996), partition p2 values less than (2001), partition p3 values less than (MAXVALUE))`,
  1207  		},
  1208  		{
  1209  			input: `CREATE TABLE tp14 (
  1210  					a INT NOT NULL,
  1211  					b INT NOT NULL
  1212  				)
  1213  				PARTITION BY RANGE COLUMNS(a,b) PARTITIONS 4 (
  1214  					PARTITION p0 VALUES LESS THAN (10,5),
  1215  					PARTITION p1 VALUES LESS THAN (20,10),
  1216  					PARTITION p2 VALUES LESS THAN (50,20),
  1217  					PARTITION p3 VALUES LESS THAN (65,30)
  1218  				)`,
  1219  			output: `create table tp14 (a int not null, b int not null) partition by range columns (a, b) partitions 4 (partition p0 values less than (10, 5), partition p1 values less than (20, 10), partition p2 values less than (50, 20), partition p3 values less than (65, 30))`,
  1220  		},
  1221  		{
  1222  			input: `CREATE TABLE tp15 (
  1223  					id   INT PRIMARY KEY,
  1224  					name VARCHAR(35),
  1225  					age INT unsigned
  1226  				)
  1227  				PARTITION BY LIST (id) (
  1228  					PARTITION r0 VALUES IN (1, 5, 9, 13, 17, 21),
  1229  					PARTITION r1 VALUES IN (2, 6, 10, 14, 18, 22),
  1230  					PARTITION r2 VALUES IN (3, 7, 11, 15, 19, 23),
  1231  					PARTITION r3 VALUES IN (4, 8, 12, 16, 20, 24)
  1232  				);`,
  1233  			output: `create table tp15 (id int primary key, name varchar(35), age int unsigned) partition by list(id) (partition r0 values in (1, 5, 9, 13, 17, 21), partition r1 values in (2, 6, 10, 14, 18, 22), partition r2 values in (3, 7, 11, 15, 19, 23), partition r3 values in (4, 8, 12, 16, 20, 24))`,
  1234  		},
  1235  		{
  1236  			input: `CREATE TABLE tp16 (
  1237  					a INT NULL,
  1238  					b INT NULL
  1239  				)
  1240  				PARTITION BY LIST COLUMNS(a,b) (
  1241  					PARTITION p0 VALUES IN( (0,0), (NULL,NULL) ),
  1242  					PARTITION p1 VALUES IN( (0,1), (0,2), (0,3), (1,1), (1,2) ),
  1243  					PARTITION p2 VALUES IN( (1,0), (2,0), (2,1), (3,0), (3,1) ),
  1244  					PARTITION p3 VALUES IN( (1,3), (2,2), (2,3), (3,2), (3,3) )
  1245  				)`,
  1246  			output: `create table tp16 (a int null, b int null) partition by list columns (a, b) (partition p0 values in ((0, 0), (null, null)), partition p1 values in ((0, 1), (0, 2), (0, 3), (1, 1), (1, 2)), partition p2 values in ((1, 0), (2, 0), (2, 1), (3, 0), (3, 1)), partition p3 values in ((1, 3), (2, 2), (2, 3), (3, 2), (3, 3)))`,
  1247  		},
  1248  		{
  1249  			input: `CREATE TABLE tp17 (
  1250  					id INT NOT NULL PRIMARY KEY,
  1251  					fname VARCHAR(30),
  1252  					lname VARCHAR(30)
  1253  				)
  1254  				PARTITION BY RANGE (id) (
  1255  					PARTITION p0 VALUES LESS THAN (6),
  1256  					PARTITION p1 VALUES LESS THAN (11),
  1257  					PARTITION p2 VALUES LESS THAN (16),
  1258  					PARTITION p3 VALUES LESS THAN (21)
  1259  				);`,
  1260  			output: `create table tp17 (id int not null primary key, fname varchar(30), lname varchar(30)) partition by range(id) (partition p0 values less than (6), partition p1 values less than (11), partition p2 values less than (16), partition p3 values less than (21))`,
  1261  		},
  1262  		{
  1263  			input: "grant all, all(a, b), create(a, b), select(a, b), super(a, b, c) on table db.a to u1, u2 with grant option",
  1264  		}, {
  1265  			input: "grant proxy on u1 to u2, u3, u4 with grant option",
  1266  		}, {
  1267  			input: "grant proxy on u1 to u2, u3, u4",
  1268  		},
  1269  		{
  1270  			input: "grant r1, r2, r3 to u1, u1, u3",
  1271  		}, {
  1272  			input:  "grant super(a, b, c) on procedure db.func to 'h3'",
  1273  			output: "grant super(a, b, c) on procedure db.func to h3",
  1274  		},
  1275  		{
  1276  			input:  "revoke all, all(a, b), create(a, b), select(a, b), super(a, b, c) on table db.A from u1, u2",
  1277  			output: "revoke all, all(a, b), create(a, b), select(a, b), super(a, b, c) on table db.a from u1, u2",
  1278  		}, {
  1279  			input: "revoke r1, r2, r3 from u1, u2, u3",
  1280  		}, {
  1281  			input: "revoke super(a, b, c) on procedure db.func from h3",
  1282  		}, {
  1283  			input:  "revoke all on table db.A from u1, u2",
  1284  			output: "revoke all on table db.a from u1, u2",
  1285  		}, {
  1286  			input: "revoke all on table db.a from u1",
  1287  		}, {
  1288  			input: "set default role r1, r2, r3 to u1, u2, u3",
  1289  		}, {
  1290  			input: "set default role all to u1, u2, u3",
  1291  		}, {
  1292  			input: "set default role none to u1, u2, u3",
  1293  		}, {
  1294  			input:  "set password = password('ppp')",
  1295  			output: "set password = ppp",
  1296  		}, {
  1297  			input:  "set password for u1@h1 = password('ppp')",
  1298  			output: "set password for u1@h1 = ppp",
  1299  		}, {
  1300  			input:  "set password for u1@h1 = 'ppp'",
  1301  			output: "set password for u1@h1 = ppp",
  1302  		}, {
  1303  			input:  "set @a = 0, @b = 1",
  1304  			output: "set a = 0, b = 1",
  1305  		}, {
  1306  			input:  "set a = 0, session b = 1, @@session.c = 1, global d = 1, @@global.e = 1",
  1307  			output: "set a = 0, b = 1, c = 1, global d = 1, global e = 1",
  1308  		}, {
  1309  			input:  "set @@session.a = 1",
  1310  			output: "set a = 1",
  1311  		}, {
  1312  			input:  "set @@global.a = 1",
  1313  			output: "set global a = 1",
  1314  		}, {
  1315  			input: "set global a = 1",
  1316  		}, {
  1317  			input:  "set persist a = 1",
  1318  			output: "set global a = 1",
  1319  		}, {
  1320  			input:  "alter account config set MYSQL_COMPATIBILITY_MODE a = 1",
  1321  			output: "set global a = 1",
  1322  		}, {
  1323  			input: "set a = 1",
  1324  		}, {
  1325  			input: "rollback",
  1326  		}, {
  1327  			input:  "rollback and chain no release",
  1328  			output: "rollback",
  1329  		}, {
  1330  			input:  "commit and chain no release",
  1331  			output: "commit",
  1332  		}, {
  1333  			input: "commit",
  1334  		}, {
  1335  			input: "start transaction read only",
  1336  		}, {
  1337  			input: "start transaction read write",
  1338  		}, {
  1339  			input: "start transaction",
  1340  		}, {
  1341  			input: "use db1",
  1342  		}, {
  1343  			input: "use",
  1344  		}, {
  1345  			input: "update a as aa set a = 3, b = 4 where a != 0 order by b limit 1",
  1346  		}, {
  1347  			input: "update a as aa set a = 3, b = 4",
  1348  		}, {
  1349  			input: "explain insert into u (a, b, c, d) values (1, 2, 3, 4), (5, 6, 7, 8)",
  1350  		}, {
  1351  			input: "explain replace into u (a, b, c, d) values (1, 2, 3, 4), (5, 6, 7, 8)",
  1352  		}, {
  1353  			input: "explain delete from a where a != 0 order by b limit 1",
  1354  		}, {
  1355  			input: "explain select a from a union select b from b",
  1356  		}, {
  1357  			input: "explain select a from a intersect select b from b",
  1358  		}, {
  1359  			input: "explain select a from a except select b from b",
  1360  		}, {
  1361  			input: "explain select a from a minus select b from b",
  1362  		}, {
  1363  			input: "explain select a from a",
  1364  		}, {
  1365  			input:  "explain (format text) select a from A",
  1366  			output: "explain (format text) select a from a",
  1367  		}, {
  1368  			input:  "explain analyze select * from t",
  1369  			output: "explain (analyze) select * from t",
  1370  		}, {
  1371  			input:  "explain format = 'tree' for connection 10",
  1372  			output: "explain format = tree for connection 10",
  1373  		}, {
  1374  			input:  "explain db.a",
  1375  			output: "show columns from db.a",
  1376  		}, {
  1377  			input:  "explain a",
  1378  			output: "show columns from a",
  1379  		}, {
  1380  			input: "show index from t where true",
  1381  		}, {
  1382  			input:  "show databases like 'a%'",
  1383  			output: "show databases like a%",
  1384  		}, {
  1385  			input: "show global status where 1 + 21 > 21",
  1386  		}, {
  1387  			input: "show global variables",
  1388  		}, {
  1389  			input: "show warnings",
  1390  		}, {
  1391  			input: "show errors",
  1392  		}, {
  1393  			input: "show full processlist",
  1394  		}, {
  1395  			input: "show processlist",
  1396  		}, {
  1397  			input:  "show full tables from db1 like 'a%' where a != 0",
  1398  			output: "show full tables from db1 like a% where a != 0",
  1399  		}, {
  1400  			input:  "show open tables from db1 like 'a%' where a != 0",
  1401  			output: "show open tables from db1 like a% where a != 0",
  1402  		}, {
  1403  			input:  "show tables from db1 like 'a%' where a != 0",
  1404  			output: "show tables from db1 like a% where a != 0",
  1405  		}, {
  1406  			input:  "show databases like 'a%' where a != 0",
  1407  			output: "show databases like a% where a != 0",
  1408  		}, {
  1409  			input: "show databases",
  1410  		}, {
  1411  			input:  "show extended full columns from t from db like 'a%'",
  1412  			output: "show extended full columns from t from db like a%",
  1413  		}, {
  1414  			input: "show extended full columns from t from db where a != 0",
  1415  		}, {
  1416  			input: "show columns from t from db where a != 0",
  1417  		}, {
  1418  			input: "show columns from t from db",
  1419  		}, {
  1420  			input: "show create database if not exists db",
  1421  		}, {
  1422  			input: "show create database db",
  1423  		}, {
  1424  			input: "show create table db.t1",
  1425  		}, {
  1426  			input: "show create table t1",
  1427  		}, {
  1428  			input: "drop user if exists u1, u2, u3",
  1429  		}, {
  1430  			input: "drop user u1",
  1431  		}, {
  1432  			input: "drop role r1",
  1433  		}, {
  1434  			input: "drop role if exists r1, r2, r3",
  1435  		}, {
  1436  			input: "drop index if exists idx1 on db.t",
  1437  		}, {
  1438  			input: "drop index idx1 on db.t",
  1439  		}, {
  1440  			input: "drop table if exists t1, t2, db.t",
  1441  		}, {
  1442  			input: "drop table db.t",
  1443  		}, {
  1444  			input: "drop table if exists t",
  1445  		}, {
  1446  			input: "drop database if exists t",
  1447  		}, {
  1448  			input: "drop database t",
  1449  		}, {
  1450  			input:  "create role if not exists 'a', 'b'",
  1451  			output: "create role if not exists a, b",
  1452  		}, {
  1453  			input:  "create role if not exists 'webapp'",
  1454  			output: "create role if not exists webapp",
  1455  		}, {
  1456  			input:  "create role 'admin', 'developer'",
  1457  			output: "create role admin, developer",
  1458  		}, {
  1459  			input:  "create index idx1 on a (a) KEY_BLOCK_SIZE 10 with parser x comment 'x' invisible",
  1460  			output: "create index idx1 on a (a) KEY_BLOCK_SIZE 10 with parser x comment x invisible",
  1461  		}, {
  1462  			input:  "create index idx1 using btree on A (a) KEY_BLOCK_SIZE 10 with parser x comment 'x' invisible",
  1463  			output: "create index idx1 using btree on a (a) KEY_BLOCK_SIZE 10 with parser x comment x invisible",
  1464  		}, {
  1465  			input:  "create index idx using ivfflat on A (a) LISTS 10",
  1466  			output: "create index idx using ivfflat on a (a) LISTS 10 ",
  1467  		}, {
  1468  			input:  "create index idx using ivfflat on A (a) LISTS 10 op_type 'vector_l2_ops'",
  1469  			output: "create index idx using ivfflat on a (a) LISTS 10 OP_TYPE vector_l2_ops ",
  1470  		}, {
  1471  			input: "create index idx1 on a (a)",
  1472  		}, {
  1473  			input:  "create index idx using master on A (a,b,c)",
  1474  			output: "create index idx using master on a (a, b, c)",
  1475  		}, {
  1476  			input: "create unique index idx1 using btree on a (a, b(10), (a + b), (a - b)) visible",
  1477  		}, {
  1478  			input:  "create database test_db default collate 'utf8mb4_general_ci' collate utf8mb4_general_ci",
  1479  			output: "create database test_db default collate utf8mb4_general_ci collate utf8mb4_general_ci",
  1480  		}, {
  1481  			input: "create database if not exists test_db character set geostd8",
  1482  		}, {
  1483  			input: "create database test_db default collate utf8mb4_general_ci",
  1484  		}, {
  1485  			input: "create database if not exists db",
  1486  		}, {
  1487  			input: "create database db",
  1488  		}, {
  1489  			input: "delete from a as aa",
  1490  		}, {
  1491  			input: "delete from t where a > 1 order by b limit 1 offset 2",
  1492  		}, {
  1493  			input: "delete from t where a = 1",
  1494  		}, {
  1495  			input: "insert into u partition(p1, p2) (a, b, c, d) values (1, 2, 3, 4), (5, 6, 1, 0)",
  1496  		}, {
  1497  			input:  "insert into t values ('aa', 'bb', 'cc')",
  1498  			output: "insert into t values (aa, bb, cc)",
  1499  		}, {
  1500  			input:  "insert into t() values (1, 2, 3)",
  1501  			output: "insert into t values (1, 2, 3)",
  1502  		}, {
  1503  			input: "insert into t (c1, c2, c3) values (1, 2, 3)",
  1504  		}, {
  1505  			input: "insert into t (c1, c2, c3) select c1, c2, c3 from t1",
  1506  		}, {
  1507  			input: "insert into t select c1, c2, c3 from t1",
  1508  		}, {
  1509  			input: "insert into t values (1, 3, 4)",
  1510  		}, {
  1511  			input: "replace into u partition(p1, p2) (a, b, c, d) values (1, 2, 3, 4), (5, 6, 1, 0)",
  1512  		}, {
  1513  			input:  "replace into t values ('aa', 'bb', 'cc')",
  1514  			output: "replace into t values (aa, bb, cc)",
  1515  		}, {
  1516  			input:  "replace into t() values (1, 2, 3)",
  1517  			output: "replace into t values (1, 2, 3)",
  1518  		}, {
  1519  			input: "replace into t (c1, c2, c3) values (1, 2, 3)",
  1520  		}, {
  1521  			input: "replace into t (c1, c2, c3) select c1, c2, c3 from t1",
  1522  		}, {
  1523  			input: "replace into t select c1, c2, c3 from t1",
  1524  		}, {
  1525  			input: "replace into t values (1, 3, 4)",
  1526  		}, {
  1527  			input:  "create table t1 (`show` bool(0));",
  1528  			output: "create table t1 (show bool(0))",
  1529  		}, {
  1530  			input:  "create table t1 (t bool(0));",
  1531  			output: "create table t1 (t bool(0))",
  1532  		}, {
  1533  			input: "create table t1 (t char(0))",
  1534  		}, {
  1535  			input: "create table t1 (t bool(20), b int, c char(20), d varchar(20))",
  1536  		}, {
  1537  			input: "create table t (a int(20) not null)",
  1538  		}, {
  1539  			input: "create table db.t (db.t.a int(20) null)",
  1540  		}, {
  1541  			input: "create table t (a float(20, 20) not null, b int(20) null, c int(30) null)",
  1542  		}, {
  1543  			input:  "create table t1 (t time(3) null, dt datetime(6) null, ts timestamp(1) null)",
  1544  			output: "create table t1 (t time(3, 3) null, dt datetime(6, 6) null, ts timestamp(1, 1) null)",
  1545  		}, {
  1546  			input:  "create table t1 (a int default 1 + 1 - 2 * 3 / 4 div 7 ^ 8 << 9 >> 10 % 11)",
  1547  			output: "create table t1 (a int default 1 + 1 - 2 * 3 / 4 div 7 ^ 8 << 9 >> 10 % 11)",
  1548  		}, {
  1549  			input: "create table t1 (t bool default -1 + +1)",
  1550  		}, {
  1551  			input: "create table t (id int unique key)",
  1552  		}, {
  1553  			input: "select * from t",
  1554  		}, {
  1555  			input:  "select c1, c2, c3 from t1, t as t2 where t1.c1 = 1 group by c2 having c2 > 10",
  1556  			output: "select c1, c2, c3 from t1 cross join t as t2 where t1.c1 = 1 group by c2 having c2 > 10",
  1557  		}, {
  1558  			input: "select a from t order by a desc limit 1 offset 2",
  1559  		}, {
  1560  			input:  "select a from t order by a desc limit 1, 2",
  1561  			output: "select a from t order by a desc limit 2 offset 1",
  1562  		}, {
  1563  			input: "select * from t union select c from t1",
  1564  		}, {
  1565  			input: "select * from t union all select c from t1",
  1566  		}, {
  1567  			input: "select * from t union distinct select c from t1",
  1568  		}, {
  1569  			input: "select * from t except select c from t1",
  1570  		}, {
  1571  			input: "select * from t except all select c from t1",
  1572  		}, {
  1573  			input: "select * from t except distinct select c from t1",
  1574  		}, {
  1575  			input: "select * from t intersect select c from t1",
  1576  		}, {
  1577  			input: "select * from t intersect all select c from t1",
  1578  		}, {
  1579  			input: "select * from t intersect distinct select c from t1",
  1580  		}, {
  1581  			input: "select * from t minus all select c from t1",
  1582  		}, {
  1583  			input: "select * from t minus distinct select c from t1",
  1584  		}, {
  1585  			input: "select * from t minus select c from t1",
  1586  		}, {
  1587  			input: "select * from (select a from t) as t1",
  1588  		}, {
  1589  			input:  "select * from (select a from t) as t1 join t2 on 1",
  1590  			output: "select * from (select a from t) as t1 inner join t2 on 1",
  1591  		}, {
  1592  			input: "select * from (select a from t) as t1 inner join t2 using (a)",
  1593  		}, {
  1594  			input: "select * from (select a from t) as t1 cross join t2",
  1595  		}, {
  1596  			input:  "select * from t1 join t2 using (a, b, c)",
  1597  			output: "select * from t1 inner join t2 using (a, b, c)",
  1598  		}, {
  1599  			input: "select * from t1 straight_join t2 on 1 + 213",
  1600  		}, {
  1601  			input: "select * from t1 straight_join t2 on col",
  1602  		}, {
  1603  			input:  "select * from t1 right outer join t2 on 123",
  1604  			output: "select * from t1 right join t2 on 123",
  1605  		}, {
  1606  			input: "select * from t1 natural left join t2",
  1607  		}, {
  1608  			input: "select 1",
  1609  		}, {
  1610  			input: "select $ from t",
  1611  		}, {
  1612  			input:  "analyze table part (a,b )",
  1613  			output: "analyze table part(a, b)",
  1614  		}, {
  1615  			input:  "select $ from t into outfile '/Users/tmp/test'",
  1616  			output: "select $ from t into outfile /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header true",
  1617  		}, {
  1618  			input:  "select $ from t into outfile '/Users/tmp/test' FIELDS TERMINATED BY ','",
  1619  			output: "select $ from t into outfile /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header true",
  1620  		}, {
  1621  			input:  "select $ from t into outfile '/Users/tmp/test' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'",
  1622  			output: "select $ from t into outfile /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header true",
  1623  		}, {
  1624  			input:  "select $ from t into outfile '/Users/tmp/test' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' header 'TRUE'",
  1625  			output: "select $ from t into outfile /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header true",
  1626  		}, {
  1627  			input:  "select $ from t into outfile '/Users/tmp/test' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' header 'FALSE'",
  1628  			output: "select $ from t into outfile /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header false",
  1629  		}, {
  1630  			input:  "select $ from t into outfile '/Users/tmp/test' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' header 'FALSE' MAX_FILE_SIZE 100",
  1631  			output: "select $ from t into outfile /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header false max_file_size 102400",
  1632  		}, {
  1633  			input:  "select $ from t into outfile '/Users/tmp/test' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' header 'FALSE' MAX_FILE_SIZE 100 FORCE_QUOTE (a, b)",
  1634  			output: "select $ from t into outfile /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header false max_file_size 102400 force_quote a, b",
  1635  		}, {
  1636  			input: "drop prepare stmt_name1",
  1637  		}, {
  1638  			input: "deallocate prepare stmt_name1",
  1639  		}, {
  1640  			input: "execute stmt_name1",
  1641  		}, {
  1642  			input: "execute stmt_name1 using @var_name,@@sys_name",
  1643  		}, {
  1644  			input: "prepare stmt_name1 from select * from t1",
  1645  		}, {
  1646  			input:  "prepare stmt_name1 from 'select * from t1'",
  1647  			output: "prepare stmt_name1 from select * from t1",
  1648  		}, {
  1649  			input: "prepare stmt_name1 from select * from t1 where a > ? or abs(b) < ?",
  1650  		}, {
  1651  			input:  "create account if not exists nihao admin_name 'admin' identified by '123' open comment 'new account'",
  1652  			output: "create account if not exists nihao admin_name 'admin' identified by '******' open comment 'new account'",
  1653  		}, {
  1654  			input: "create account if not exists nihao admin_name 'admin' identified by random password",
  1655  		}, {
  1656  			input:  "create account if not exists nihao admin_name 'admin' identified with '123'",
  1657  			output: "create account if not exists nihao admin_name 'admin' identified with '******'",
  1658  		}, {
  1659  			input:  "create account nihao admin_name 'admin' identified by '123' open comment 'new account'",
  1660  			output: "create account nihao admin_name 'admin' identified by '******' open comment 'new account'",
  1661  		}, {
  1662  			input: "create account nihao admin_name 'admin' identified by random password",
  1663  		}, {
  1664  			input:  "create account nihao admin_name 'admin' identified with '123'",
  1665  			output: "create account nihao admin_name 'admin' identified with '******'",
  1666  		}, {
  1667  			input:  "create account ? admin_name 'admin' identified with '123'",
  1668  			output: "create account ? admin_name 'admin' identified with '******'",
  1669  		}, {
  1670  			input: "create account nihao admin_name ? identified by ?",
  1671  		}, {
  1672  			input: "drop account if exists abc",
  1673  		}, {
  1674  			input: "drop account ?",
  1675  		}, {
  1676  			input:  "alter account if exists nihao admin_name 'admin' identified by '123' open comment 'new account'",
  1677  			output: "alter account if exists nihao admin_name 'admin' identified by '******' open comment 'new account'",
  1678  		}, {
  1679  			input: "alter account if exists nihao admin_name 'admin' identified by random password",
  1680  		}, {
  1681  			input:  "alter account if exists nihao admin_name 'admin' identified with '123'",
  1682  			output: "alter account if exists nihao admin_name 'admin' identified with '******'",
  1683  		}, {
  1684  			input:  "alter account nihao admin_name 'admin' identified by '123' open comment 'new account'",
  1685  			output: "alter account nihao admin_name 'admin' identified by '******' open comment 'new account'",
  1686  		}, {
  1687  			input: "alter account nihao admin_name 'admin' identified by random password",
  1688  		}, {
  1689  			input:  "alter account nihao admin_name 'admin' identified with '123'",
  1690  			output: "alter account nihao admin_name 'admin' identified with '******'",
  1691  		}, {
  1692  			input: "alter account ? admin_name ? identified with ?",
  1693  		}, {
  1694  			input: "create user if not exists abc1 identified by '123', abc2 identified by '234', abc3 identified by '111' default role def_role " +
  1695  				"password expire " +
  1696  				"comment 'new comment'",
  1697  			output: "create user if not exists abc1 identified by '******', abc2 identified by '******', abc3 identified by '******' default role def_role " +
  1698  				"password expire " +
  1699  				"comment 'new comment'",
  1700  		}, {
  1701  			input: "create user if not exists abc1 identified by '123', abc2 identified by '234', abc3 identified by '111' default role de_role " +
  1702  				"lock " +
  1703  				"attribute 'new attribute'",
  1704  			output: "create user if not exists abc1 identified by '******', abc2 identified by '******', abc3 identified by '******' default role de_role " +
  1705  				"lock " +
  1706  				"attribute 'new attribute'",
  1707  		}, {
  1708  			input: "create user if not exists abc1 identified by '123', abc2 identified by '234', abc3 identified by '111', " +
  1709  				"abc4 identified by random password, " +
  1710  				"abc5 identified with '345' " +
  1711  				"default role de_role " +
  1712  				"attribute 'new attribute'",
  1713  			output: "create user if not exists abc1 identified by '******', abc2 identified by '******', abc3 identified by '******', " +
  1714  				"abc4 identified by random password, " +
  1715  				"abc5 identified with '******' " +
  1716  				"default role de_role " +
  1717  				"attribute 'new attribute'",
  1718  		}, {
  1719  			input: "create user if not exists abc1 identified by '111' " +
  1720  				"default role de_role " +
  1721  				"comment 'new comment'",
  1722  			output: "create user if not exists abc1 identified by '******' " +
  1723  				"default role de_role " +
  1724  				"comment 'new comment'",
  1725  		}, {
  1726  			input: "create user if not exists abc1 identified by '111' " +
  1727  				"default role de_role",
  1728  			output: "create user if not exists abc1 identified by '******' " +
  1729  				"default role de_role",
  1730  		}, {
  1731  			input: "create user if not exists abc1 identified by '123' " +
  1732  				"default role de_role",
  1733  			output: "create user if not exists abc1 identified by '******' " +
  1734  				"default role de_role",
  1735  		}, {
  1736  			input: "create user if not exists abc1 identified by '123' " +
  1737  				"default role de_role",
  1738  			output: "create user if not exists abc1 identified by '******' " +
  1739  				"default role de_role",
  1740  		}, {
  1741  			input: "create user abc1 identified by '123' " +
  1742  				"default role de_role",
  1743  			output: "create user abc1 identified by '******' " +
  1744  				"default role de_role",
  1745  		}, {
  1746  			input: "create user abc1 identified by '111' " +
  1747  				"default role de_role",
  1748  			output: "create user abc1 identified by '******' " +
  1749  				"default role de_role",
  1750  		}, {
  1751  			input:  "create user abc1 identified by 'a111'",
  1752  			output: "create user abc1 identified by '******'",
  1753  		}, {
  1754  			input: "drop user if exists abc1, abc2, abc3",
  1755  		}, {
  1756  			input: "drop user abc1, abc2, abc3",
  1757  		}, {
  1758  			input: "drop user abc1",
  1759  		}, {
  1760  			input: "alter user if exists abc1 identified by '123', abc2 identified by '234', abc3 identified by '123' " +
  1761  				"default role de_role " +
  1762  				"lock " +
  1763  				"comment 'new comment'",
  1764  			output: "alter user if exists abc1 identified by '******', abc2 identified by '******', abc3 identified by '******' " +
  1765  				"default role de_role " +
  1766  				"lock " +
  1767  				"comment 'new comment'",
  1768  		}, {
  1769  			input: "alter user if exists abc1 identified by '123', abc2 identified by '234', abc3 identified by '123' " +
  1770  				"default role de_role " +
  1771  				"unlock " +
  1772  				"comment 'new comment'",
  1773  			output: "alter user if exists abc1 identified by '******', abc2 identified by '******', abc3 identified by '******' " +
  1774  				"default role de_role " +
  1775  				"unlock " +
  1776  				"comment 'new comment'",
  1777  		}, {
  1778  			input: "alter user if exists abc1 identified by '123', abc2 identified by '234', abc3 identified by '123' " +
  1779  				"default role de_role " +
  1780  				"password expire " +
  1781  				"attribute 'new attribute'",
  1782  			output: "alter user if exists abc1 identified by '******', abc2 identified by '******', abc3 identified by '******' " +
  1783  				"default role de_role " +
  1784  				"password expire " +
  1785  				"attribute 'new attribute'",
  1786  		}, {
  1787  			input: "alter user if exists abc1 identified by '123', abc2 identified by '234', abc3 identified by '123' " +
  1788  				"attribute 'new attribute'",
  1789  			output: "alter user if exists abc1 identified by '******', abc2 identified by '******', abc3 identified by '******' " +
  1790  				"attribute 'new attribute'",
  1791  		}, {
  1792  			input:  "alter user if exists abc1 identified by '123', abc2 identified by '234', abc3 identified by '123'",
  1793  			output: "alter user if exists abc1 identified by '******', abc2 identified by '******', abc3 identified by '******'",
  1794  		}, {
  1795  			input:  "alter user if exists abc1 identified by '123', abc2 identified with '234', abc3 identified with 'SSL'",
  1796  			output: "alter user if exists abc1 identified by '******', abc2 identified with '******', abc3 identified with '******'",
  1797  		}, {
  1798  			input:  "alter user if exists abc1 identified by '123'",
  1799  			output: "alter user if exists abc1 identified by '******'",
  1800  		}, {
  1801  			input:  "alter user if exists abc1 identified by '123'",
  1802  			output: "alter user if exists abc1 identified by '******'",
  1803  		}, {
  1804  			input:  "alter user abc1 identified by '123'",
  1805  			output: "alter user abc1 identified by '******'",
  1806  		}, {
  1807  			input: "create role if not exists role1, role2, role2",
  1808  		}, {
  1809  			input: "create role role1",
  1810  		}, {
  1811  			input: "drop role if exists role1, role2, role2",
  1812  		}, {
  1813  			input: "drop role if exists role1",
  1814  		}, {
  1815  			input: "drop role role1",
  1816  		}, {
  1817  			input: "grant all, all(a, b), create(a, b), select(a, b), super(a, b, c) on table db.a to u1, u2 with grant option",
  1818  		}, {
  1819  			input: "grant all, all(a, b) on table *.* to u1, u2 with grant option",
  1820  		}, {
  1821  			input: "grant all, all(a, b) on table db.a to u1, u2 with grant option",
  1822  		}, {
  1823  			input: "grant all, all(a, b) on table db.* to u1, u2 with grant option",
  1824  		}, {
  1825  			input: "grant all, all(a, b) on database * to u1, u2 with grant option",
  1826  		}, {
  1827  			input: "grant all, all(a, b) on table *.* to u1, u2 with grant option",
  1828  		}, {
  1829  			input: "grant all, all(a, b) on table db1.* to u1, u2 with grant option",
  1830  		}, {
  1831  			input: "grant all, all(a, b) on table db1.tb1 to u1, u2 with grant option",
  1832  		}, {
  1833  			input: "grant all, all(a, b) on table tb1 to u1, u2 with grant option",
  1834  		}, {
  1835  			input: "grant r1, r2 to u1, u2, r3 with grant option",
  1836  		}, {
  1837  			input: "grant r1, r2 to u1, u2, r3",
  1838  		}, {
  1839  			input: "grant r1, r2 to u1@h1, u2@h2, r3",
  1840  		}, {
  1841  			input:  "revoke if exists all, all(a, b), create(a, b), select(a, b), super(a, b, c) on table db.A from u1, u2",
  1842  			output: "revoke if exists all, all(a, b), create(a, b), select(a, b), super(a, b, c) on table db.a from u1, u2",
  1843  		}, {
  1844  			input: "revoke if exists r1, r2, r3 from u1, u2, u3",
  1845  		}, {
  1846  			input: "revoke if exists super(a, b, c) on procedure db.func from h3",
  1847  		}, {
  1848  			input:  "revoke if exists all on table db.A from u1, u2",
  1849  			output: "revoke if exists all on table db.a from u1, u2",
  1850  		}, {
  1851  			input: "revoke if exists all on table db.a from u1",
  1852  		}, {
  1853  			input: "use db1",
  1854  		}, {
  1855  			input: "set role r1",
  1856  		}, {
  1857  			input: "set secondary role all",
  1858  		}, {
  1859  			input: "set secondary role none",
  1860  		}, {
  1861  			input:  `select json_extract('{"a":1,"b":2}', '$.b')`,
  1862  			output: `select json_extract({"a":1,"b":2}, $.b)`,
  1863  		}, {
  1864  			input:  `select json_extract(a, '$.b') from t`,
  1865  			output: `select json_extract(a, $.b) from t`,
  1866  		}, {
  1867  			input: `create table t1 (a int, b uuid)`,
  1868  		}, {
  1869  			input: `create table t2 (a uuid primary key, b varchar(10))`,
  1870  		}, {
  1871  			input: `create table t3 (a int, b uuid, primary key idx (a, b))`,
  1872  		}, {
  1873  			input:  `DO SLEEP(5)`,
  1874  			output: `do sleep(5)`,
  1875  		}, {
  1876  			input:  `DECLARE a, b INT`,
  1877  			output: `declare a b int default null`,
  1878  		}, {
  1879  			input:  `DECLARE a, b INT DEFAULT 1`,
  1880  			output: `declare a b int default 1`,
  1881  		}, {
  1882  			input: "grant truncate on table *.* to r1",
  1883  		}, {
  1884  			input: "grant reference on table *.* to r1",
  1885  		},
  1886  		{
  1887  			input:  `VALUES ROW(1,-2,3), ROW(5,7,9), ROW(4,6,8)`,
  1888  			output: `values row(1, -2, 3), row(5, 7, 9), row(4, 6, 8)`,
  1889  		}, {
  1890  			input:  `VALUES ROW(5,7,9), ROW(1,2,3), ROW(9,10,11) ORDER BY column_1`,
  1891  			output: `values row(5, 7, 9), row(1, 2, 3), row(9, 10, 11) order by column_1`,
  1892  		},
  1893  		{
  1894  			input:  `VALUES ROW(5,7,9), ROW(1,2,3), ROW(9,10,11) ORDER BY column_1 LIMIT 2`,
  1895  			output: `values row(5, 7, 9), row(1, 2, 3), row(9, 10, 11) order by column_1 limit 2`,
  1896  		},
  1897  		{
  1898  			input:  `select * from unnest("a") as f`,
  1899  			output: `select * from unnest(a) as f`,
  1900  		},
  1901  		{
  1902  			input:  `select * from unnest("a", "b") as f`,
  1903  			output: `select * from unnest(a, b) as f`,
  1904  		},
  1905  		{
  1906  			input:  `select * from unnest("a", "b", true) as f`,
  1907  			output: `select * from unnest(a, b, true) as f`,
  1908  		},
  1909  		{
  1910  			input:  `select * from unnest("a")`,
  1911  			output: `select * from unnest(a)`,
  1912  		},
  1913  		{
  1914  			input:  `select * from unnest("a", "b")`,
  1915  			output: `select * from unnest(a, b)`,
  1916  		},
  1917  		{
  1918  			input:  `select * from unnest("a", "b", true)`,
  1919  			output: `select * from unnest(a, b, true)`,
  1920  		},
  1921  		{
  1922  			input:  `select * from unnest(t.a)`,
  1923  			output: `select * from unnest(t.a)`,
  1924  		},
  1925  		{
  1926  			input:  `select * from unnest(t.a, "$.b")`,
  1927  			output: `select * from unnest(t.a, $.b)`,
  1928  		},
  1929  		{
  1930  			input:  `select * from unnest(t.a, "$.b", true)`,
  1931  			output: `select * from unnest(t.a, $.b, true)`,
  1932  		},
  1933  		{
  1934  			input:  `select * from unnest(t.a) as f`,
  1935  			output: `select * from unnest(t.a) as f`,
  1936  		},
  1937  		{
  1938  			input:  `select * from unnest(t.a, "$.b") as f`,
  1939  			output: `select * from unnest(t.a, $.b) as f`,
  1940  		},
  1941  		{
  1942  			input:  `select * from unnest(t.a, "$.b", true) as f`,
  1943  			output: `select * from unnest(t.a, $.b, true) as f`,
  1944  		},
  1945  		{
  1946  			input:  `select * from generate_series('1', '10', '1')`,
  1947  			output: `select * from generate_series(1, 10, 1)`,
  1948  		},
  1949  		{
  1950  			input:  `select * from generate_series('1', '10', '1') g`,
  1951  			output: `select * from generate_series(1, 10, 1) as g`,
  1952  		},
  1953  		{
  1954  			input:  `select * from generate_series(1, 10, 1)`,
  1955  			output: `select * from generate_series(1, 10, 1)`,
  1956  		},
  1957  		{
  1958  			input:  `select * from generate_series(1, 10, 1) as g`,
  1959  			output: `select * from generate_series(1, 10, 1) as g`,
  1960  		},
  1961  		{
  1962  			input:  `create table t1 (a int low_cardinality, b int not null low_cardinality)`,
  1963  			output: `create table t1 (a int low_cardinality, b int not null low_cardinality)`,
  1964  		},
  1965  		{
  1966  			input:  `select mo_show_visible_bin('a',0) as m`,
  1967  			output: `select mo_show_visible_bin(a, 0) as m`,
  1968  		},
  1969  		//https://dev.mysql.com/doc/refman/8.0/en/window-functions-usage.html
  1970  		{
  1971  			input:  `select avg(a) over () from t1`,
  1972  			output: "select avg(a) over () from t1",
  1973  		},
  1974  		{
  1975  			input:  `select avg(a) over (partition by col1, col2) from t1`,
  1976  			output: "select avg(a) over (partition by col1, col2) from t1",
  1977  		},
  1978  		{
  1979  			input:  `select avg(a) over (partition by col1, col2 order by col3 desc) from t1`,
  1980  			output: "select avg(a) over (partition by col1, col2 order by col3 desc) from t1",
  1981  		},
  1982  		//https://dev.mysql.com/doc/refman/8.0/en/window-functions-frames.html
  1983  		{
  1984  			input:  `select count(a) over (partition by col1, col2 order by col3 desc rows 1 preceding) from t1`,
  1985  			output: "select count(a) over (partition by col1, col2 order by col3 desc rows 1 preceding) from t1",
  1986  		},
  1987  		{
  1988  			input: `select sum(a) over (partition by col1, col2 order by col3 desc rows between 1 preceding and 20 following) from t1`,
  1989  		},
  1990  		{
  1991  			input:  `select count(a) over (partition by col1, col2 order by col3 desc range unbounded preceding) from t1`,
  1992  			output: "select count(a) over (partition by col1, col2 order by col3 desc range unbounded preceding) from t1",
  1993  		},
  1994  		{
  1995  			input: "alter account if exists abc",
  1996  		},
  1997  		{
  1998  			input:  "alter account if exists abc admin_name 'root' identified by '111' open comment 'str'",
  1999  			output: "alter account if exists abc admin_name 'root' identified by '******' open comment 'str'",
  2000  		},
  2001  		{
  2002  			input: "alter account if exists abc open comment 'str'",
  2003  		},
  2004  		{
  2005  			input: "alter account if exists abc comment 'str'",
  2006  		},
  2007  		{
  2008  			input: "alter account if exists abc open",
  2009  		},
  2010  		{
  2011  			input:  "alter account if exists abc restricted",
  2012  			output: "alter account if exists abc restricted",
  2013  		},
  2014  		{
  2015  			input:  "alter account if exists abc admin_name 'root' identified by '111' open",
  2016  			output: "alter account if exists abc admin_name 'root' identified by '******' open",
  2017  		},
  2018  		{
  2019  			input:  "alter account if exists abc admin_name 'root' identified by '111' comment 'str'",
  2020  			output: "alter account if exists abc admin_name 'root' identified by '******' comment 'str'",
  2021  		},
  2022  		{
  2023  			input: `create cluster table a (a int)`,
  2024  		},
  2025  		{
  2026  			input: `insert into a values (1, 2), (1, 2)`,
  2027  		},
  2028  		{
  2029  			input: `insert into a select a, b from a`,
  2030  		},
  2031  		{
  2032  			input: `insert into a (a, b) values (1, 2), (1, 2)`,
  2033  		},
  2034  		{
  2035  			input:  `insert into a () values (1, 2), (1, 2)`,
  2036  			output: `insert into a values (1, 2), (1, 2)`,
  2037  		},
  2038  		{
  2039  			input: `insert into a (a, b) select a, b from a`,
  2040  		},
  2041  		{
  2042  			input:  `insert into a set a = b, b = b + 1`,
  2043  			output: `insert into a (a, b) values (b, b + 1)`,
  2044  		},
  2045  		{
  2046  			input:  "load data infile 'test/loadfile5' ignore INTO TABLE T.A FIELDS TERMINATED BY  ',' (@,@,c,d,e,f)",
  2047  			output: "load data infile test/loadfile5 ignore into table t.a fields terminated by , (, , c, d, e, f)",
  2048  		},
  2049  		{
  2050  			input:  "load data infile 'data.txt' into table db.a fields terminated by '\t' escaped by '\t'",
  2051  			output: "load data infile data.txt into table db.a fields terminated by \t escaped by \t",
  2052  		},
  2053  		{
  2054  			input:  `create function helloworld () returns int language sql as 'select id from test_table limit 1'`,
  2055  			output: `create function helloworld () returns int language sql as 'select id from test_table limit 1'`,
  2056  		},
  2057  		{
  2058  			input:  `create function twosum (x int, y int) returns int language sql as 'select $1 + $2'`,
  2059  			output: `create function twosum (x int, y int) returns int language sql as 'select $1 + $2'`,
  2060  		},
  2061  		{
  2062  			input:  `create function charat (x int) returns char language sql as 'select $1'`,
  2063  			output: `create function charat (x int) returns char language sql as 'select $1'`,
  2064  		},
  2065  		{
  2066  			input:  `create function charat (x int default 15) returns char language sql as 'select $1'`,
  2067  			output: `create function charat (x int default 15) returns char language sql as 'select $1'`,
  2068  		},
  2069  		{
  2070  			input:  `create function t.increment (x float) returns float language sql as 'select $1 + 1'`,
  2071  			output: `create function t.increment (x float) returns float language sql as 'select $1 + 1'`,
  2072  		},
  2073  		{
  2074  			input:  `drop function helloworld ()`,
  2075  			output: `drop function helloworld ()`,
  2076  		},
  2077  		{
  2078  			input:  `drop function charat (int)`,
  2079  			output: `drop function charat (int)`,
  2080  		},
  2081  		{
  2082  			input:  `drop function twosum (int, int)`,
  2083  			output: `drop function twosum (int, int)`,
  2084  		},
  2085  		{
  2086  			input:  `drop function t.increment (float)`,
  2087  			output: `drop function t.increment (float)`,
  2088  		},
  2089  		{
  2090  			input:  `create extension python as strutil file 'stringutils.whl'`,
  2091  			output: `create extension python as strutil file stringutils.whl`,
  2092  		},
  2093  		{
  2094  			input:  `load strutil`,
  2095  			output: `load strutil`,
  2096  		},
  2097  		{
  2098  			input: `select * from (values row(1, 2), row(3, 3)) as a`,
  2099  		},
  2100  		{
  2101  			input: `select t1.* from (values row(1, 1), row(3, 3)) as a(c1, c2) inner join t1 on a.c1 = t1.b`,
  2102  		},
  2103  		{
  2104  			input:  "modump query_result '0adaxg' into '/Users/tmp/test'",
  2105  			output: "modump query_result 0adaxg into /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header true",
  2106  		},
  2107  		{
  2108  			input:  `modump query_result "queryId" into '/Users/tmp/test' FIELDS TERMINATED BY ','`,
  2109  			output: "modump query_result queryId into /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header true",
  2110  		},
  2111  		{
  2112  			input:  "modump query_result 'abcx' into '/Users/tmp/test' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'",
  2113  			output: "modump query_result abcx into /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header true",
  2114  		},
  2115  		{
  2116  			input:  "modump query_result '098e32' into '/Users/tmp/test' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' header 'TRUE'",
  2117  			output: "modump query_result 098e32 into /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header true",
  2118  		},
  2119  		{
  2120  			input:  "modump query_result '09eqr' into '/Users/tmp/test' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' header 'FALSE'",
  2121  			output: "modump query_result 09eqr into /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header false",
  2122  		},
  2123  		{
  2124  			input:  "modump query_result 'd097i7' into '/Users/tmp/test' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' header 'FALSE' MAX_FILE_SIZE 100",
  2125  			output: "modump query_result d097i7 into /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header false max_file_size 102400",
  2126  		},
  2127  		{
  2128  			input:  "modump query_result '09eqrteq' into '/Users/tmp/test' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' header 'FALSE' MAX_FILE_SIZE 100 FORCE_QUOTE (a, b)",
  2129  			output: "modump query_result 09eqrteq into /Users/tmp/test fields terminated by , enclosed by \" lines terminated by \n header false max_file_size 102400 force_quote a, b",
  2130  		},
  2131  		{
  2132  			input: "show accounts",
  2133  		},
  2134  		{
  2135  			input:  "show accounts like '%dafgda_'",
  2136  			output: "show accounts like %dafgda_",
  2137  		},
  2138  		{
  2139  			input:  "create table test (`col` varchar(255) DEFAULT b'0')",
  2140  			output: "create table test (col varchar(255) default 0b0)",
  2141  		},
  2142  		{
  2143  			input:  "select trim(a)",
  2144  			output: "select trim(a)",
  2145  		},
  2146  		{
  2147  			input: "select trim(a from a)",
  2148  		},
  2149  		{
  2150  			input: "select trim(leading a from b)",
  2151  		},
  2152  		{
  2153  			input: "select trim(trailing b from a)",
  2154  		},
  2155  		{
  2156  			input: "select trim(both a from b) from t",
  2157  		},
  2158  		{
  2159  			input:  "LOCK TABLES t READ",
  2160  			output: "Lock Tables t READ",
  2161  		},
  2162  		{
  2163  			input:  "LOCK TABLES t READ LOCAL",
  2164  			output: "Lock Tables t READ LOCAL",
  2165  		},
  2166  		{
  2167  			input:  "LOCK TABLES t WRITE",
  2168  			output: "Lock Tables t WRITE",
  2169  		},
  2170  		{
  2171  			input:  "LOCK TABLES t LOW_PRIORITY WRITE",
  2172  			output: "Lock Tables t LOW_PRIORITY WRITE",
  2173  		},
  2174  		{
  2175  			input:  "LOCK TABLES t LOW_PRIORITY WRITE, t1 READ, t2 WRITE",
  2176  			output: "Lock Tables t LOW_PRIORITY WRITE, t1 READ, t2 WRITE",
  2177  		},
  2178  		{
  2179  			input:  "UNLOCK TABLES",
  2180  			output: "UnLock Tables",
  2181  		},
  2182  		{
  2183  			input:  "create sequence s as smallint unsigned increment by 1 minvalue -100 maxvalue 100 start with -90 cycle",
  2184  			output: "create sequence s as smallint unsigned increment by 1 minvalue -100 maxvalue 100 start with -90 cycle",
  2185  		},
  2186  		{
  2187  			input:  "ALTER SEQUENCE my_sequence START WITH 100;",
  2188  			output: "alter sequence my_sequence start with 100 ",
  2189  		},
  2190  		{
  2191  			input:  "ALTER SEQUENCE my_sequence INCREMENT BY 5;",
  2192  			output: "alter sequence my_sequence increment by 5 ",
  2193  		},
  2194  		{
  2195  			input:  "ALTER SEQUENCE my_sequence MINVALUE 1 MAXVALUE 1000;",
  2196  			output: "alter sequence my_sequence minvalue 1 maxvalue 1000 ",
  2197  		},
  2198  		{
  2199  			input:  "ALTER SEQUENCE my_sequence CYCLE;",
  2200  			output: "alter sequence my_sequence cycle",
  2201  		},
  2202  		{
  2203  			input:  "alter table t1 modify column b int",
  2204  			output: "alter table t1 modify column b int",
  2205  		},
  2206  		{
  2207  			input:  "alter table t1 modify column b VARCHAR(20) first",
  2208  			output: "alter table t1 modify column b varchar(20) first",
  2209  		},
  2210  		{
  2211  			input:  "alter table t1 modify column b VARCHAR(20) after a",
  2212  			output: "alter table t1 modify column b varchar(20) after a",
  2213  		},
  2214  		{
  2215  			input:  "alter table t1 modify b VARCHAR(20) after a",
  2216  			output: "alter table t1 modify column b varchar(20) after a",
  2217  		},
  2218  		{
  2219  			input:  "alter table t1 change column a b int",
  2220  			output: "alter table t1 change column a b int",
  2221  		},
  2222  		{
  2223  			input:  "alter table t1 change column a b int first",
  2224  			output: "alter table t1 change column a b int first",
  2225  		},
  2226  		{
  2227  			input:  "alter table t1 change a x varchar(20) after b",
  2228  			output: "alter table t1 change column a x varchar(20) after b",
  2229  		},
  2230  		{
  2231  			input:  "alter table t1 change column a x varchar(20) after b",
  2232  			output: "alter table t1 change column a x varchar(20) after b",
  2233  		},
  2234  		{
  2235  			input:  "alter table emp rename column deptno to deptid",
  2236  			output: "alter table emp rename column deptno to deptid",
  2237  		},
  2238  		{
  2239  			input:  "alter table t1 alter a set default 100",
  2240  			output: "alter table t1 alter column a set default 100",
  2241  		},
  2242  		{
  2243  			input:  "alter table t1 alter column a drop default",
  2244  			output: "alter table t1 alter column a drop default",
  2245  		},
  2246  		{
  2247  			input:  "alter table t1 alter column b set visible",
  2248  			output: "alter table t1 alter column b set visible",
  2249  		},
  2250  		{
  2251  			input:  "alter table t1 order by a ASC, b DESC",
  2252  			output: "alter table t1 order by a asc, b desc",
  2253  		},
  2254  		{
  2255  			input:  "alter table t1 order by a, b DESC",
  2256  			output: "alter table t1 order by a, b desc",
  2257  		},
  2258  		{
  2259  			input: "alter table tbl1 drop column col1",
  2260  		},
  2261  		{
  2262  			input: "alter table tbl1 drop column col1, drop column col2",
  2263  		},
  2264  		{
  2265  			input: "alter table tbl1 drop index idx_name",
  2266  		},
  2267  		{
  2268  			input:  "alter table tbl1 drop index idx_name, drop key idx_name, drop column col1, drop primary key, comment = 'aa'",
  2269  			output: "alter table tbl1 drop index idx_name, drop key idx_name, drop column col1, drop primary key, comment = 'aa'",
  2270  		},
  2271  		{
  2272  			input: "alter table tbl1 drop key idx_name",
  2273  		},
  2274  		{
  2275  			input: "alter table tbl1 drop primary key",
  2276  		},
  2277  		{
  2278  			input: "alter table tbl1 drop foreign key fk_name",
  2279  		},
  2280  		{
  2281  			input: "alter table tbl1 add foreign key sdf (a, b) references b(a asc, b desc)",
  2282  		},
  2283  		{
  2284  			input:  "alter table tbl1 checksum = 0, COMMENT = 'asdf'",
  2285  			output: "alter table tbl1 checksum = 0, comment = 'asdf'",
  2286  		},
  2287  		{
  2288  			input:  "alter table t1 alter index c visible",
  2289  			output: "alter table t1 alter index c visible",
  2290  		},
  2291  		{
  2292  			input:  "alter table t1 alter index c invisible",
  2293  			output: "alter table t1 alter index c invisible",
  2294  		},
  2295  		{
  2296  			input:  "alter table t1 add constraint uk_6dotkott2kjsp8vw4d0m25fb7 unique key (col3)",
  2297  			output: "alter table t1 add constraint uk_6dotkott2kjsp8vw4d0m25fb7 unique key (col3)",
  2298  		},
  2299  		{
  2300  			input:  "alter table t1 add constraint unique key (col3, col4)",
  2301  			output: "alter table t1 add unique key (col3, col4)",
  2302  		},
  2303  		{
  2304  			input:  "alter table t1 add constraint unique key zxxxxxx (col3, col4)",
  2305  			output: "alter table t1 add unique key zxxxxxx (col3, col4)",
  2306  		},
  2307  		{
  2308  			input:  "alter table t1 add constraint uk_6dotkott2kjsp8vw4d0m25fb7 unique key zxxxxx (col3)",
  2309  			output: "alter table t1 add constraint uk_6dotkott2kjsp8vw4d0m25fb7 unique key zxxxxx (col3)",
  2310  		},
  2311  		{
  2312  			input:  "alter table t1 add constraint uk_6dotkott2kjsp8vw4d0m25fb7 unique key (col3)",
  2313  			output: "alter table t1 add constraint uk_6dotkott2kjsp8vw4d0m25fb7 unique key (col3)",
  2314  		},
  2315  		{
  2316  			input:  "alter table t1 add constraint fk_6dotkott2kjsp8vw4d0m25fb7 foreign key fk1 (col4) references dept(deptno)",
  2317  			output: "alter table t1 add constraint fk_6dotkott2kjsp8vw4d0m25fb7 foreign key fk1 (col4) references dept(deptno)",
  2318  		},
  2319  		{
  2320  			input:  "alter table t1 add constraint fk_6dotkott2kjsp8vw4d0m25fb7 foreign key (col4) references dept(deptno)",
  2321  			output: "alter table t1 add constraint fk_6dotkott2kjsp8vw4d0m25fb7 foreign key (col4) references dept(deptno)",
  2322  		},
  2323  		{
  2324  			input:  "alter table t1 add constraint foreign key fk1 (col4) references dept(deptno)",
  2325  			output: "alter table t1 add foreign key fk1 (col4) references dept(deptno)",
  2326  		},
  2327  		{
  2328  			input:  "alter table t1 add constraint foreign key (col4) references dept(deptno)",
  2329  			output: "alter table t1 add foreign key (col4) references dept(deptno)",
  2330  		},
  2331  		{
  2332  			input:  "alter table t1 add constraint pk primary key pk1 (col1, col4)",
  2333  			output: "alter table t1 add constraint pk primary key pk1 (col1, col4)",
  2334  		},
  2335  		{
  2336  			input:  "alter table t1 add constraint pk primary key (col4)",
  2337  			output: "alter table t1 add constraint pk primary key (col4)",
  2338  		},
  2339  		{
  2340  			input:  "alter table t1 add constraint pk primary key (col1, col4)",
  2341  			output: "alter table t1 add constraint pk primary key (col1, col4)",
  2342  		},
  2343  		{
  2344  			input:  "alter table t1 add primary key (col1, col4)",
  2345  			output: "alter table t1 add primary key (col1, col4)",
  2346  		},
  2347  		{
  2348  			input:  "alter table t1 add primary key pk1 (col1, col4)",
  2349  			output: "alter table t1 add primary key pk1 (col1, col4)",
  2350  		},
  2351  		{
  2352  			input:  "alter table t1 comment 'abc'",
  2353  			output: "alter table t1 comment = 'abc'",
  2354  		},
  2355  		{
  2356  			input: "alter table t1 rename to t2",
  2357  		},
  2358  		{
  2359  			input: "alter table t1 add column a int, add column b int",
  2360  		},
  2361  		{
  2362  			input: "alter table t1 drop column a, drop column b",
  2363  		},
  2364  		{
  2365  			input:  "ALTER TABLE employees ADD PARTITION (PARTITION p05 VALUES LESS THAN (500001))",
  2366  			output: "alter table employees add partition (partition p05 values less than (500001))",
  2367  		},
  2368  		{
  2369  			input:  "alter table t add partition (partition p4 values in (7), partition p5 values in (8, 9))",
  2370  			output: "alter table t add partition (partition p4 values in (7), partition p5 values in (8, 9))",
  2371  		},
  2372  		{
  2373  			input:  "ALTER TABLE t1 DROP PARTITION p1",
  2374  			output: "alter table t1 drop partition p1",
  2375  		},
  2376  		{
  2377  			input:  "ALTER TABLE t1 DROP PARTITION p0, p1",
  2378  			output: "alter table t1 drop partition p0, p1",
  2379  		},
  2380  		{
  2381  			input:  "ALTER TABLE t1 TRUNCATE PARTITION p0",
  2382  			output: "alter table t1 truncate partition p0",
  2383  		},
  2384  		{
  2385  			input:  "ALTER TABLE t1 TRUNCATE PARTITION p0, p3",
  2386  			output: "alter table t1 truncate partition p0, p3",
  2387  		},
  2388  		{
  2389  			input:  "ALTER TABLE t1 TRUNCATE PARTITION ALL",
  2390  			output: "alter table t1 truncate partition all",
  2391  		},
  2392  		{
  2393  			input:  "ALTER TABLE titles partition by range(to_days(from_date)) (partition p01 values less than (to_days('1985-12-31')), partition p02 values less than (to_days('1986-12-31')), partition p03 values less than (to_days('1987-12-31')))",
  2394  			output: "alter table titles partition by range(to_days(from_date)) (partition p01 values less than (to_days(1985-12-31)), partition p02 values less than (to_days(1986-12-31)), partition p03 values less than (to_days(1987-12-31)))",
  2395  		},
  2396  		{
  2397  			input:  "create table pt2 (id int, date_column date) partition by range(year(date_column)) (partition p1 values less than (2010) comment 'p1 comment', partition p2 values less than maxvalue comment 'p3 comment')",
  2398  			output: "create table pt2 (id int, date_column date) partition by range(year(date_column)) (partition p1 values less than (2010) comment = 'p1 comment', partition p2 values less than (MAXVALUE) comment = 'p3 comment')",
  2399  		},
  2400  		{
  2401  			input: "create publication pub1 database db1",
  2402  		},
  2403  		{
  2404  			input: "create publication pub1 database db1 account acc0",
  2405  		},
  2406  		{
  2407  			input: "create publication pub1 database db1 account acc0, acc1",
  2408  		},
  2409  		{
  2410  			input: "create publication pub1 database db1 account acc0, acc1, acc2 comment 'test'",
  2411  		},
  2412  		{
  2413  			input: "create publication pub1 database db1 comment 'test'",
  2414  		},
  2415  		{
  2416  			input: "create publication pub1 table t1",
  2417  		},
  2418  		{
  2419  			input: "create publication pub1 table t1 account acc0",
  2420  		},
  2421  		{
  2422  			input: "create publication pub1 table t1 account acc0, acc1",
  2423  		},
  2424  		{
  2425  			input: "create publication pub1 table t1 account acc0, acc1, acc2 comment 'test'",
  2426  		},
  2427  		{
  2428  			input: "create publication pub1 table t1 comment 'test'",
  2429  		},
  2430  		{
  2431  			input:  "CREATE STAGE my_ext_stage URL='s3://load/files/'",
  2432  			output: "create stage my_ext_stage url='s3://load/files/'",
  2433  		},
  2434  		{
  2435  			input:  "CREATE STAGE my_ext_stage1 URL='s3://load/files/' CREDENTIALS={'AWS_KEY_ID'='1a2b3c' ,'AWS_SECRET_KEY'='4x5y6z'};",
  2436  			output: "create stage my_ext_stage1 url='s3://load/files/' crentiasl={'AWS_KEY_ID'='1a2b3c','AWS_SECRET_KEY'='4x5y6z'}",
  2437  		},
  2438  		{
  2439  			input:  "CREATE STAGE my_ext_stage1 URL='s3://load/files/' CREDENTIALS={'AWS_KEY_ID'='1a2b3c', 'AWS_SECRET_KEY'='4x5y6z'} ENABLE = TRUE;",
  2440  			output: "create stage my_ext_stage1 url='s3://load/files/' crentiasl={'AWS_KEY_ID'='1a2b3c','AWS_SECRET_KEY'='4x5y6z'} enabled",
  2441  		},
  2442  		{
  2443  			input:  "DROP STAGE my_ext_stage1",
  2444  			output: "drop stage my_ext_stage1",
  2445  		},
  2446  		{
  2447  			input:  "DROP STAGE if exists my_ext_stage1",
  2448  			output: "drop stage if not exists my_ext_stage1",
  2449  		},
  2450  		{
  2451  			input:  "ALTER STAGE my_ext_stage SET URL='s3://loading/files/new/'",
  2452  			output: "alter stage my_ext_stage set  url='s3://loading/files/new/'",
  2453  		},
  2454  		{
  2455  			input:  "ALTER STAGE my_ext_stage SET CREDENTIALS={'AWS_KEY_ID'='1a2b3c' ,'AWS_SECRET_KEY'='4x5y6z'};",
  2456  			output: "alter stage my_ext_stage set  crentiasl={'AWS_KEY_ID'='1a2b3c','AWS_SECRET_KEY'='4x5y6z'}",
  2457  		},
  2458  		{
  2459  			input:  "SHOW STAGES LIKE 'my_stage'",
  2460  			output: "show stages like my_stage",
  2461  		},
  2462  		{
  2463  			input: "create database db1 from acc0 publication pub1",
  2464  		},
  2465  		{
  2466  			input: "create table t1 from acc0 publication pub1",
  2467  		},
  2468  		{
  2469  			input: "create temporary table t1 from acc0 publication pub1",
  2470  		},
  2471  		{
  2472  			input: "create table if not exists t1 from acc0 publication pub1",
  2473  		},
  2474  		{
  2475  			input: "create temporary table if not exists t1 from acc0 publication pub1",
  2476  		},
  2477  		{
  2478  			input: "drop publication pub1",
  2479  		},
  2480  		{
  2481  			input: "drop publication if exists pub1",
  2482  		},
  2483  		{
  2484  			input: "alter publication pub1 account all",
  2485  		},
  2486  		{
  2487  			input: "alter publication pub1 account acc0",
  2488  		},
  2489  		{
  2490  			input: "alter publication pub1 account acc0, acc1",
  2491  		},
  2492  		{
  2493  			input: "alter publication pub1 account add acc0",
  2494  		},
  2495  		{
  2496  			input: "restore cluster from snapshot snapshot_01",
  2497  		},
  2498  		{
  2499  			input: "restore account account_01 from snapshot snapshot_01",
  2500  		},
  2501  		{
  2502  			input: "restore account account_01 database db1 from snapshot snapshot_01",
  2503  		},
  2504  		{
  2505  			input: "restore account account_01 database db1 table t1 from snapshot snapshot_01",
  2506  		},
  2507  		{
  2508  			input:  "restore account account_01 from snapshot snapshot_01 to account account_02",
  2509  			output: "restore account account_01 from snapshot snapshot_01 to account account_02",
  2510  		},
  2511  		{
  2512  			input: "alter publication pub1 account add acc0, acc1",
  2513  		},
  2514  		{
  2515  			input: "alter publication pub1 account drop acc0",
  2516  		},
  2517  		{
  2518  			input: "alter publication if exists pub1 account drop acc0, acc1",
  2519  		},
  2520  		{
  2521  			input: "alter publication pub1 account drop acc1 comment 'test'",
  2522  		},
  2523  		{
  2524  			input: "alter publication if exists pub1 account acc1 comment 'test'",
  2525  		},
  2526  		{
  2527  			input: "show create publication pub1",
  2528  		},
  2529  		{
  2530  			input: "show publications",
  2531  		},
  2532  		{
  2533  			input: "show subscriptions",
  2534  		},
  2535  		{
  2536  			input: "show subscriptions all",
  2537  		},
  2538  		{
  2539  			input:  "show subscriptions all like '%pub'",
  2540  			output: "show subscriptions all like %pub",
  2541  		},
  2542  		{
  2543  			input:  "insert into tbl values ($$this is a dollar-quoted string$$)",
  2544  			output: "insert into tbl values (this is a dollar-quoted string)",
  2545  		},
  2546  		{
  2547  			input:  "select $tag$this is a dollar-quoted string$tag$",
  2548  			output: "select this is a dollar-quoted string",
  2549  		},
  2550  		{
  2551  			input:  "select $1 + $q$\\n\\t\\r\\b\\0\\_\\%\\\\$q$",
  2552  			output: "select $1 + \\n\\t\\r\\b\\0\\_\\%\\\\",
  2553  		},
  2554  		{
  2555  			input:  "show table_size from test",
  2556  			output: "show table size from test",
  2557  		},
  2558  		{
  2559  			input:  "show table_size from mo_role from mo_catalog",
  2560  			output: "show table size from mo_role from mo_catalog",
  2561  		},
  2562  		{
  2563  			input:  "show roles",
  2564  			output: "show roles",
  2565  		},
  2566  		{
  2567  			input:  "show roles like '%dafgda_'",
  2568  			output: "show roles like %dafgda_",
  2569  		},
  2570  		{
  2571  			input:  "create procedure test1 (in param1 int) 'test test'",
  2572  			output: "create procedure test1 (in param1 int) 'test test'",
  2573  		},
  2574  		{
  2575  			input:  "create procedure test2 (param1 int, inout param2 char(5)) 'test test'",
  2576  			output: "create procedure test2 (in param1 int, inout param2 char(5)) 'test test'",
  2577  		},
  2578  		{
  2579  			input:  "drop procedure test1",
  2580  			output: "drop procedure test1",
  2581  		},
  2582  		{
  2583  			input:  "call test1()",
  2584  			output: "call test1()",
  2585  		},
  2586  		{
  2587  			input:  "call test1(@session, @increment)",
  2588  			output: "call test1(@session, @increment)",
  2589  		},
  2590  		{
  2591  			input:  "select cast(123 as binary)",
  2592  			output: "select cast(123 as binary)",
  2593  		},
  2594  		{
  2595  			input:  "select BINARY 124",
  2596  			output: "select binary(124)",
  2597  		},
  2598  		{
  2599  			input:  "set transaction isolation level read committed;",
  2600  			output: "set transaction isolation level read committed",
  2601  		},
  2602  		{
  2603  			input:  "set global transaction isolation level read committed , read write , isolation level read committed , read only;",
  2604  			output: "set global transaction isolation level read committed , read write , isolation level read committed , read only",
  2605  		},
  2606  		{
  2607  			input:  "set session transaction isolation level read committed , read write , isolation level read committed , read only;",
  2608  			output: "set transaction isolation level read committed , read write , isolation level read committed , read only",
  2609  		},
  2610  		{
  2611  			input:  "set session transaction isolation level read committed , isolation level read uncommitted , isolation level repeatable read , isolation level serializable;",
  2612  			output: "set transaction isolation level read committed , isolation level read uncommitted , isolation level repeatable read , isolation level serializable",
  2613  		},
  2614  		{
  2615  			input:  "create table t1(a int) STORAGE DISK;",
  2616  			output: "create table t1 (a int) tablespace =  STORAGE DISK",
  2617  		}, {
  2618  			input:  "create table t1 (a int) STORAGE DISK;",
  2619  			output: "create table t1 (a int) tablespace =  STORAGE DISK",
  2620  		}, {
  2621  			input: "create table t1 (a numeric(10, 2))",
  2622  		}, {
  2623  			input: "create table t1 (a mediumint)",
  2624  		}, {
  2625  			input:  "drop schema if exists ssb",
  2626  			output: "drop database if exists ssb",
  2627  		}, {
  2628  			input:  "drop table if exists ssb RESTRICT",
  2629  			output: "drop table if exists ssb",
  2630  		}, {
  2631  			input:  "drop table if exists ssb CASCADE",
  2632  			output: "drop table if exists ssb",
  2633  		}, {
  2634  			input: "create table t1 (a int) AUTOEXTEND_SIZE = 10",
  2635  		}, {
  2636  			input:  "create table t1 (a int) ENGINE_ATTRIBUTE = 'abc'",
  2637  			output: "create table t1 (a int) ENGINE_ATTRIBUTE = abc",
  2638  		}, {
  2639  			input: "create table t1 (a int) INSERT_METHOD = NO",
  2640  		}, {
  2641  			input: "create table t1 (a int) INSERT_METHOD = FIRST",
  2642  		}, {
  2643  			input: "create table t1 (a int) INSERT_METHOD = LAST",
  2644  		}, {
  2645  			input: "create table t1 (a int) START TRANSACTION",
  2646  		}, {
  2647  			input:  "create table t1 (a int) SECONDARY_ENGINE_ATTRIBUTE = 'abc'",
  2648  			output: "create table t1 (a int) SECONDARY_ENGINE_ATTRIBUTE = abc",
  2649  		}, {
  2650  			input:  "create table /*! if not exists */ t1 (a int)",
  2651  			output: "create table if not exists t1 (a int)",
  2652  		}, {
  2653  			input:  "create table /*!50100 if not exists */ t1 (a int)",
  2654  			output: "create table if not exists t1 (a int)",
  2655  		}, {
  2656  			input:  "create table /*!50100 if not exists */ t1 (a int) /*!AUTOEXTEND_SIZE = 10*/",
  2657  			output: "create table if not exists t1 (a int) AUTOEXTEND_SIZE = 10",
  2658  		}, {
  2659  			input:  "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */",
  2660  			output: "set OLD_CHARACTER_SET_CLIENT = @@CHARACTER_SET_CLIENT",
  2661  		}, {
  2662  			input:  "SET @@GLOBAL.GTID_PURGED=/*!80000 '+'*/ '65c4c218-d343-11eb-8106-525400f4f901:1-769275'",
  2663  			output: "set global GTID_PURGED = 65c4c218-d343-11eb-8106-525400f4f901:1-769275",
  2664  		}, {
  2665  			input:  " /*!40103 SET TIME_ZONE='+00:00' */",
  2666  			output: "set time_zone = +00:00",
  2667  		}, {
  2668  			input:  "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */",
  2669  			output: "set OLD_CHARACTER_SET_CLIENT = @@CHARACTER_SET_CLIENT",
  2670  		}, {
  2671  			input:  "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */",
  2672  			output: "set OLD_TIME_ZONE = @@TIME_ZONE",
  2673  		}, {
  2674  			input:  "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */",
  2675  			output: "set OLD_SQL_MODE = @@SQL_MODE, sql_mode = NO_AUTO_VALUE_ON_ZERO",
  2676  		}, {
  2677  			input:  "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;",
  2678  			output: "set OLD_SQL_NOTES = @@SQL_NOTES, sql_notes = 0",
  2679  		}, {
  2680  			input:  "SELECT /*+ RESOURCE_GROUP(resouce_group_name) */ * from table_name;",
  2681  			output: "select * from table_name",
  2682  		}, {
  2683  			input:  "SELECT /*+ qb_name(viewSub, v@sel_1 . @sel_2) use_index(e3@viewSub, idx) hash_agg(viewSub) */ * FROM v;",
  2684  			output: "select * from v",
  2685  		}, {
  2686  			input:  "SELECT * FROM t1 dt WHERE EXISTS( WITH RECURSIVE qn AS (SELECT a AS b UNION ALL SELECT b+1 FROM qn WHERE b=0 or b = 1) SELECT * FROM qn dtqn1 where exists (select /*+ NO_DECORRELATE() */ b from qn where dtqn1.b+1))",
  2687  			output: "select * from t1 as dt where exists (with recursive qn as (select a as b union all select b + 1 from qn where b = 0 or b = 1) select * from qn as dtqn1 where exists (select b from qn where dtqn1.b + 1))",
  2688  		}, {
  2689  			input:  "select /*+use_index(tmp1, code)*/ * from tmp1 where code > 1",
  2690  			output: "select * from tmp1 where code > 1",
  2691  		}, {
  2692  			input:  "explain analyze select /*+ HASH_JOIN(t1, t2) */ t1.k from t t1, t t2 where t1.v = t2.v+1",
  2693  			output: "explain (analyze) select t1.k from t as t1 cross join t as t2 where t1.v = t2.v + 1",
  2694  		}, {
  2695  			input:  "prepare stmt from 'select /*+ inl_join(t2) */ * from t t1 join t t2 on t1.a = t2.a and t1.c = t2.c where t2.a = 1 or t2.b = 1;';",
  2696  			output: "prepare stmt from select /*+ inl_join(t2) */ * from t t1 join t t2 on t1.a = t2.a and t1.c = t2.c where t2.a = 1 or t2.b = 1;",
  2697  		}, {
  2698  			input:  "CREATE DATABASE /*!32312 IF NOT EXISTS*/ `ucl360_demo_v3` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;",
  2699  			output: "create database if not exists ucl360_demo_v3 default character set utf8mb4 collate utf8mb4_0900_ai_ci encryption N",
  2700  		}, {
  2701  			input:  "alter table t1 algorithm = DEFAULT",
  2702  			output: "alter table t1 alter algorithm not enforce",
  2703  		}, {
  2704  			input:  "alter table t1 algorithm = INSTANT",
  2705  			output: "alter table t1 alter algorithm not enforce",
  2706  		}, {
  2707  			input:  "alter table t1 algorithm = INPLACE",
  2708  			output: "alter table t1 alter algorithm not enforce",
  2709  		}, {
  2710  			input:  "alter table t1 algorithm = COPY",
  2711  			output: "alter table t1 alter algorithm not enforce",
  2712  		}, {
  2713  			input:  "alter table t1 default CHARACTER SET = a COLLATE = b",
  2714  			output: "alter table t1 charset = a",
  2715  		}, {
  2716  			input:  "alter table t1 CONVERT TO CHARACTER SET a COLLATE b",
  2717  			output: "alter table t1 charset = a",
  2718  		}, {
  2719  			input:  "alter table t1 DISABLE KEYS",
  2720  			output: "alter table t1 charset = DISABLE",
  2721  		}, {
  2722  			input:  "alter table t1 ENABLE KEYS",
  2723  			output: "alter table t1 charset = ENABLE",
  2724  		}, {
  2725  			input:  "alter table t1 DISCARD TABLESPACE",
  2726  			output: "alter table t1 charset = DISCARD",
  2727  		}, {
  2728  			input:  "alter table t1 IMPORT TABLESPACE",
  2729  			output: "alter table t1 charset = IMPORT",
  2730  		}, {
  2731  			input:  "alter table t1 FORCE",
  2732  			output: "alter table t1 charset = FORCE",
  2733  		}, {
  2734  			input:  "alter table t1 LOCK = DEFAULT",
  2735  			output: "alter table t1 charset = LOCK",
  2736  		}, {
  2737  			input:  "alter table t1 LOCK = NONE",
  2738  			output: "alter table t1 charset = LOCK",
  2739  		}, {
  2740  			input:  "alter table t1 LOCK = SHARED",
  2741  			output: "alter table t1 charset = LOCK",
  2742  		}, {
  2743  			input:  "alter table t1 LOCK = EXCLUSIVE",
  2744  			output: "alter table t1 charset = LOCK",
  2745  		}, {
  2746  			input:  "alter table t1 WITHOUT VALIDATION",
  2747  			output: "alter table t1 charset = WITHOUT",
  2748  		}, {
  2749  			input:  "alter table t1 WITH VALIDATION",
  2750  			output: "alter table t1 charset = WITH",
  2751  		}, {
  2752  			input:  "alter table t1 alter CHECK a ENFORCED",
  2753  			output: "alter table t1 alter CHECK enforce",
  2754  		}, {
  2755  			input:  "alter table t1 alter CONSTRAINT a NOT ENFORCED",
  2756  			output: "alter table t1 alter CONSTRAINT not enforce",
  2757  		}, {
  2758  			input:  "create SQL SECURITY DEFINER VIEW t2 as select * from t1",
  2759  			output: "create view t2 as select * from t1",
  2760  		}, {
  2761  			input:  "create SQL SECURITY INVOKER VIEW t2 as select * from t1",
  2762  			output: "create view t2 as select * from t1",
  2763  		}, {
  2764  			input:  "create VIEW t2 as select * from t1 WITH CASCADED CHECK OPTION",
  2765  			output: "create view t2 as select * from t1",
  2766  		}, {
  2767  			input:  "create VIEW t2 as select * from t1 WITH LOCAL CHECK OPTION",
  2768  			output: "create view t2 as select * from t1",
  2769  		}, {
  2770  			input:  "insert into t1 values(_binary 0x123)",
  2771  			output: "insert into t1 values (123)",
  2772  		}, {
  2773  			input:  "backup '123' filesystem '/home/abc' parallelism '1'",
  2774  			output: "backup 123 filesystem /home/abc parallelism 1",
  2775  		}, {
  2776  			input:  "backup '125' filesystem '/tmp/backup' parallelism '1';",
  2777  			output: "backup 125 filesystem /tmp/backup parallelism 1",
  2778  		}, {
  2779  			input:  "backup '123' s3option {\"bucket\"='dan-test1', \"filepath\"='ex_table_dan_gzip.gz',\"role_arn\"='arn:aws:iam::468413122987:role/dev-cross-s3', \"external_id\"='5404f91c_4e59_4898_85b3', \"compression\"='auto'}",
  2780  			output: "backup 123 s3option {'bucket'='dan-test1', 'filepath'='ex_table_dan_gzip.gz', 'role_arn'='arn:aws:iam::468413122987:role/dev-cross-s3', 'external_id'='5404f91c_4e59_4898_85b3', 'compression'='auto'}",
  2781  		}, {
  2782  			input:  "backup '123' s3option{'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='XXX', 'secret_access_key'='XXX', 'bucket'='test', 'filepath'='*.txt', 'region'='us-west-2'}",
  2783  			output: "backup 123 s3option {'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='******', 'secret_access_key'='******', 'bucket'='test', 'filepath'='*.txt', 'region'='us-west-2'}",
  2784  		}, {
  2785  			input:  "backup '123' s3option{'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='XXX', 'secret_access_key'='XXX', 'bucket'='test', 'filepath'='*.txt', 'region'='us-west-2'}",
  2786  			output: "backup 123 s3option {'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='******', 'secret_access_key'='******', 'bucket'='test', 'filepath'='*.txt', 'region'='us-west-2'}",
  2787  		}, {
  2788  			input:  `backup '123' s3option {'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='******', 'secret_access_key'='******', 'bucket'='test', 'filepath'='jsonline/jsonline_object.jl', 'region'='us-west-2', 'compression'='none', 'format'='jsonline', 'jsondata'='object'}`,
  2789  			output: `backup 123 s3option {'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='******', 'secret_access_key'='******', 'bucket'='test', 'filepath'='jsonline/jsonline_object.jl', 'region'='us-west-2', 'compression'='none', 'format'='jsonline', 'jsondata'='object'}`,
  2790  		},
  2791  		{
  2792  			input:  "backup '123' filesystem '/home/abc' parallelism '1' type 'incremental' timestamp 'xxxxx-xxxxx'",
  2793  			output: "backup 123 filesystem /home/abc parallelism 1 backuptype incremental backupts xxxxx-xxxxx",
  2794  		}, {
  2795  			input:  "backup '125' filesystem '/tmp/backup' parallelism '1' type 'incremental' timestamp 'xxxxx-xxxxx';",
  2796  			output: "backup 125 filesystem /tmp/backup parallelism 1 backuptype incremental backupts xxxxx-xxxxx",
  2797  		}, {
  2798  			input:  "backup '123' s3option {\"bucket\"='dan-test1', \"filepath\"='ex_table_dan_gzip.gz',\"role_arn\"='arn:aws:iam::468413122987:role/dev-cross-s3', \"external_id\"='5404f91c_4e59_4898_85b3', \"compression\"='auto'} type 'incremental' timestamp 'xxxxx-xxxxx'",
  2799  			output: "backup 123 s3option {'bucket'='dan-test1', 'filepath'='ex_table_dan_gzip.gz', 'role_arn'='arn:aws:iam::468413122987:role/dev-cross-s3', 'external_id'='5404f91c_4e59_4898_85b3', 'compression'='auto'} backuptype incremental backupts xxxxx-xxxxx",
  2800  		}, {
  2801  			input:  "backup '123' s3option{'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='XXX', 'secret_access_key'='XXX', 'bucket'='test', 'filepath'='*.txt', 'region'='us-west-2'} type 'incremental' timestamp 'xxxxx-xxxxx'",
  2802  			output: "backup 123 s3option {'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='******', 'secret_access_key'='******', 'bucket'='test', 'filepath'='*.txt', 'region'='us-west-2'} backuptype incremental backupts xxxxx-xxxxx",
  2803  		}, {
  2804  			input:  "backup '123' s3option{'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='XXX', 'secret_access_key'='XXX', 'bucket'='test', 'filepath'='*.txt', 'region'='us-west-2'} type 'incremental' timestamp 'xxxxx-xxxxx'",
  2805  			output: "backup 123 s3option {'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='******', 'secret_access_key'='******', 'bucket'='test', 'filepath'='*.txt', 'region'='us-west-2'} backuptype incremental backupts xxxxx-xxxxx",
  2806  		}, {
  2807  			input:  `backup '123' s3option {'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='******', 'secret_access_key'='******', 'bucket'='test', 'filepath'='jsonline/jsonline_object.jl', 'region'='us-west-2', 'compression'='none', 'format'='jsonline', 'jsondata'='object'} type 'incremental' timestamp 'xxxxx-xxxxx'`,
  2808  			output: `backup 123 s3option {'endpoint'='s3.us-west-2.amazonaws.com', 'access_key_id'='******', 'secret_access_key'='******', 'bucket'='test', 'filepath'='jsonline/jsonline_object.jl', 'region'='us-west-2', 'compression'='none', 'format'='jsonline', 'jsondata'='object'} backuptype incremental backupts xxxxx-xxxxx`,
  2809  		}, {
  2810  			input:  "/*!50001 CREATE ALGORITHM=UNDEFINED *//*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER *//*!50001 VIEW `pga0010` AS select distinct `a`.`FACDIV` AS `FACDIV`,`a`.`BLDCD` AS `BLDCD`,`a`.`PRDCD` AS `PRDCD`,`a`.`PRDNAM` AS `PRDNAM`,`a`.`PRDLNG` AS `PRDLNG`,`a`.`PRDWID` AS `PRDWID`,`a`.`PRDGAG` AS `PRDGAG`,`a`.`AREA` AS `AREA`,`a`.`GLZTYP` AS `GLZTYP`,`a`.`TECTYP` AS `TECTYP`,`a`.`PRDCATE` AS `PRDCATE`,`a`.`PRCCD` AS `PRCCD`,`a`.`PRCDSC` AS `PRCDSC`,`a`.`GLSSTR` AS `GLSSTR`,`a`.`REMARK` AS `REMARK`,`a`.`USEYN` AS `USEYN`,`a`.`ISMES` AS `ISMES` from (select 'N' AS `ISMES`,`skim`.`bga0010`.`USEYN` AS `USEYN`,`skim`.`bga0010`.`FACDIV` AS `FACDIV`,`skim`.`bga0010`.`BLDCDFATHER` AS `BLDCD`,substring_index(`skim`.`bga0010`.`PRDCD`,'-',1) AS `PRDCD`,`skim`.`bga0010`.`PRDNAM` AS `PRDNAM`,`skim`.`bga0010`.`PRDLNG` AS `PRDLNG`,`skim`.`bga0010`.`PRDWID` AS `PRDWID`,`skim`.`bga0010`.`PRDGAG` AS `PRDGAG`,`skim`.`bga0010`.`AREA` AS `AREA`,`skim`.`bga0010`.`GLZTYP` AS `GLZTYP`,`skim`.`bga0010`.`TECTYP` AS `TECTYP`,`skim`.`bga0010`.`PRDCATE` AS `PRDCATE`,`skim`.`bga0010`.`MATCST` AS `MATCST`,`skim`.`bga0010`.`PRCCD` AS `PRCCD`,`skim`.`bga0010`.`PRCDSC` AS `PRCDSC`,`skim`.`bga0010`.`GLSSTR` AS `GLSSTR`,`skim`.`bga0010`.`REMARK` AS `REMARK` from `skim`.`bga0010` where ((`skim`.`bga0010`.`ISMES` = 'Y') and (`skim`.`bga0010`.`USEYN` = 'Y') and (not(substring_index(`skim`.`bga0010`.`PRDCD`,'-',1) in (select `skim`.`bga0010`.`PRDCD` from `skim`.`bga0010` where ((`skim`.`bga0010`.`ISMES` = 'N') and (`skim`.`bga0010`.`USEYN` = 'Y')))))) union all select `skim`.`bga0010`.`ISMES` AS `ISMES`,`skim`.`bga0010`.`USEYN` AS `USEYN`,`skim`.`bga0010`.`FACDIV` AS `FACDIV`,`skim`.`bga0010`.`BLDCD` AS `BLDCD`,`skim`.`bga0010`.`PRDCD` AS `PRDCD`,`skim`.`bga0010`.`PRDNAM` AS `PRDNAM`,`skim`.`bga0010`.`PRDLNG` AS `PRDLNG`,`skim`.`bga0010`.`PRDWID` AS `PRDWID`,`skim`.`bga0010`.`PRDGAG` AS `PRDGAG`,`skim`.`bga0010`.`AREA` AS `AREA`,`skim`.`bga0010`.`GLZTYP` AS `GLZTYP`,`skim`.`bga0010`.`TECTYP` AS `TECTYP`,`skim`.`bga0010`.`PRDCATE` AS `PRDCATE`,`skim`.`bga0010`.`MATCST` AS `MATCST`,`skim`.`bga0010`.`PRCCD` AS `PRCCD`,`skim`.`bga0010`.`PRCDSC` AS `PRCDSC`,`skim`.`bga0010`.`GLSSTR` AS `GLSSTR`,`skim`.`bga0010`.`REMARK` AS `REMARK` from `skim`.`bga0010` where ((`skim`.`bga0010`.`ISMES` = 'N') and (`skim`.`bga0010`.`USEYN` = 'Y'))) `a` order by `a`.`BLDCD` */;",
  2811  			output: "create view pga0010 as select distinct a.facdiv as FACDIV, a.bldcd as BLDCD, a.prdcd as PRDCD, a.prdnam as PRDNAM, a.prdlng as PRDLNG, a.prdwid as PRDWID, a.prdgag as PRDGAG, a.area as AREA, a.glztyp as GLZTYP, a.tectyp as TECTYP, a.prdcate as PRDCATE, a.prccd as PRCCD, a.prcdsc as PRCDSC, a.glsstr as GLSSTR, a.remark as REMARK, a.useyn as USEYN, a.ismes as ISMES from (select N as ISMES, skim.bga0010.useyn as USEYN, skim.bga0010.facdiv as FACDIV, skim.bga0010.bldcdfather as BLDCD, substring_index(skim.bga0010.prdcd, -, 1) as PRDCD, skim.bga0010.prdnam as PRDNAM, skim.bga0010.prdlng as PRDLNG, skim.bga0010.prdwid as PRDWID, skim.bga0010.prdgag as PRDGAG, skim.bga0010.area as AREA, skim.bga0010.glztyp as GLZTYP, skim.bga0010.tectyp as TECTYP, skim.bga0010.prdcate as PRDCATE, skim.bga0010.matcst as MATCST, skim.bga0010.prccd as PRCCD, skim.bga0010.prcdsc as PRCDSC, skim.bga0010.glsstr as GLSSTR, skim.bga0010.remark as REMARK from skim.bga0010 where ((skim.bga0010.ismes = Y) and (skim.bga0010.useyn = Y) and (not (substring_index(skim.bga0010.prdcd, -, 1) in (select skim.bga0010.prdcd from skim.bga0010 where ((skim.bga0010.ismes = N) and (skim.bga0010.useyn = Y)))))) union all select skim.bga0010.ismes as ISMES, skim.bga0010.useyn as USEYN, skim.bga0010.facdiv as FACDIV, skim.bga0010.bldcd as BLDCD, skim.bga0010.prdcd as PRDCD, skim.bga0010.prdnam as PRDNAM, skim.bga0010.prdlng as PRDLNG, skim.bga0010.prdwid as PRDWID, skim.bga0010.prdgag as PRDGAG, skim.bga0010.area as AREA, skim.bga0010.glztyp as GLZTYP, skim.bga0010.tectyp as TECTYP, skim.bga0010.prdcate as PRDCATE, skim.bga0010.matcst as MATCST, skim.bga0010.prccd as PRCCD, skim.bga0010.prcdsc as PRCDSC, skim.bga0010.glsstr as GLSSTR, skim.bga0010.remark as REMARK from skim.bga0010 where ((skim.bga0010.ismes = N) and (skim.bga0010.useyn = Y))) as a order by a.bldcd",
  2812  		}, {
  2813  			input:  "/*!50001 CREATE ALGORITHM=UNDEFINED *//*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER *//*!50001 VIEW `sale_employee` AS select `ct`.`ENTID` AS `ORGANIZATION_ID`,`cu`.`SYSUSERID` AS `SALE_EMPLOYEE_ID`,`cu`.`SYSUSERID` AS `EMPLOYEE_ID`,`cu`.`ACTIVED` AS `ISUSEABLE`,`cu`.`CREATOR` AS `CREATED_BY`,`cu`.`CREATETIME` AS `CREATION_DATE`,`cu`.`UPDATOR` AS `LAST_UPDATED_BY`,`cu`.`UPDATETIME` AS `LAST_UPDATE_DATE`,'' AS `ATTRIBUTE11`,'' AS `ATTRIBUTE21`,'' AS `ATTRIBUTE31`,0 AS `ATTRIBUTE41`,0 AS `ATTRIBUTE51`,0 AS `AREA_ID` from (`kaf_cpcuser` `cu` join `kaf_cpcent` `ct`) where (`cu`.`ISSALEEMPLOYEE` = 2) */;",
  2814  			output: "create view sale_employee as select ct.entid as ORGANIZATION_ID, cu.sysuserid as SALE_EMPLOYEE_ID, cu.sysuserid as EMPLOYEE_ID, cu.actived as ISUSEABLE, cu.creator as CREATED_BY, cu.createtime as CREATION_DATE, cu.updator as LAST_UPDATED_BY, cu.updatetime as LAST_UPDATE_DATE,  as ATTRIBUTE11,  as ATTRIBUTE21,  as ATTRIBUTE31, 0 as ATTRIBUTE41, 0 as ATTRIBUTE51, 0 as AREA_ID from kaf_cpcuser as cu inner join kaf_cpcent as ct where (cu.issaleemployee = 2)",
  2815  		}, {
  2816  			input:  "/*!50001 CREATE ALGORITHM=UNDEFINED *//*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER *//*!50001 VIEW `xab0100` AS (select `a`.`SYSUSERID` AS `sysuserid`,`a`.`USERID` AS `userid`,`a`.`USERNAME` AS `usernm`,`a`.`PWDHASH` AS `userpwd`,`a`.`USERTYPE` AS `usertype`,`a`.`EMPID` AS `empid`,`a`.`EMAIL` AS `email`,`a`.`TELO` AS `telo`,`a`.`TELH` AS `telh`,`a`.`MOBIL` AS `mobil`,(case `a`.`ACTIVED` when '1' then 'N' when '2' then 'Y' else 'Y' end) AS `useyn`,`a`.`ENABLEPWD` AS `enablepwd`,`a`.`ENABLEMMSG` AS `enablemmsg`,`a`.`FEECENTER` AS `feecenter`,left(concat(ifnull(`c`.`ORGID`,''),'|'),(char_length(concat(ifnull(`c`.`ORGID`,''),'|')) - 1)) AS `orgid`,left(concat(ifnull(`c`.`ORGNAME`,''),'|'),(char_length(concat(ifnull(`c`.`ORGNAME`,''),'|')) - 1)) AS `orgname`,ifnull(`a`.`ISPLANNER`,'') AS `isplanner`,ifnull(`a`.`ISWHEMPLOYEE`,'') AS `iswhemployee`,ifnull(`a`.`ISBUYER`,'') AS `isbuyer`,ifnull(`a`.`ISQCEMPLOYEE`,'') AS `isqceemployee`,ifnull(`a`.`ISSALEEMPLOYEE`,'') AS `issaleemployee`,`a`.`SEX` AS `sex`,ifnull(`c`.`ENTID`,'3') AS `ORGANIZATION_ID`,ifnull(`a`.`NOTICEUSER`,'') AS `NOTICEUSER` from ((`kaf_cpcuser` `a` left join `kaf_cpcorguser` `b` on((`a`.`SYSUSERID` = `b`.`SYSUSERID`))) left join `kaf_cpcorg` `c` on((`b`.`ORGID` = `c`.`ORGID`))) order by `a`.`SYSUSERID`,`a`.`USERID`,`a`.`USERNAME`,`a`.`USERPASS`,`a`.`USERTYPE`,`a`.`EMPID`,`a`.`EMAIL`,`a`.`TELO`,`a`.`TELH`,`a`.`MOBIL`,`a`.`ACTIVED`,`a`.`ENABLEPWD`,`a`.`ENABLEMMSG`,`a`.`FEECENTER`,`a`.`ISPLANNER`,`a`.`ISWHEMPLOYEE`,`a`.`ISBUYER`,`a`.`ISQCEMPLOYEE`,`a`.`ISSALEEMPLOYEE`,`a`.`SEX`,`c`.`ENTID`) */;",
  2817  			output: "create view xab0100 as (select a.sysuserid as sysuserid, a.userid as userid, a.username as usernm, a.pwdhash as userpwd, a.usertype as usertype, a.empid as empid, a.email as email, a.telo as telo, a.telh as telh, a.mobil as mobil, (case a.actived when 1 then N when 2 then Y else Y end) as useyn, a.enablepwd as enablepwd, a.enablemmsg as enablemmsg, a.feecenter as feecenter, left(concat(ifnull(c.orgid, ), |), (char_length(concat(ifnull(c.orgid, ), |)) - 1)) as orgid, left(concat(ifnull(c.orgname, ), |), (char_length(concat(ifnull(c.orgname, ), |)) - 1)) as orgname, ifnull(a.isplanner, ) as isplanner, ifnull(a.iswhemployee, ) as iswhemployee, ifnull(a.isbuyer, ) as isbuyer, ifnull(a.isqcemployee, ) as isqceemployee, ifnull(a.issaleemployee, ) as issaleemployee, a.sex as sex, ifnull(c.entid, 3) as ORGANIZATION_ID, ifnull(a.noticeuser, ) as NOTICEUSER from kaf_cpcuser as a left join kaf_cpcorguser as b on ((a.sysuserid = b.sysuserid)) left join kaf_cpcorg as c on ((b.orgid = c.orgid)) order by a.sysuserid, a.userid, a.username, a.userpass, a.usertype, a.empid, a.email, a.telo, a.telh, a.mobil, a.actived, a.enablepwd, a.enablemmsg, a.feecenter, a.isplanner, a.iswhemployee, a.isbuyer, a.isqcemployee, a.issaleemployee, a.sex, c.entid)",
  2818  		},
  2819  		{
  2820  			input:  "CREATE TABLE `ecbase_push_log` (`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间') ENGINE=InnoDB AUTO_INCREMENT=654 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='推送记录表'/*!50500 PARTITION BY RANGE  COLUMNS(create_time)(PARTITION p20240115 VALUES LESS THAN ('2024-01-15 00:00:00') ENGINE = InnoDB,PARTITION p20240116 VALUES LESS THAN ('2024-01-16 00:00:00') ENGINE = InnoDB,PARTITION p20240117 VALUES LESS THAN ('2024-01-17 00:00:00') ENGINE = InnoDB,PARTITION p20240118 VALUES LESS THAN ('2024-01-18 00:00:00') ENGINE = InnoDB,PARTITION p20240119 VALUES LESS THAN ('2024-01-19 00:00:00') ENGINE = InnoDB,PARTITION p20240120 VALUES LESS THAN ('2024-01-20 00:00:00') ENGINE = InnoDB,PARTITION p20240121 VALUES LESS THAN ('2024-01-21 00:00:00') ENGINE = InnoDB,PARTITION p20240122 VALUES LESS THAN ('2024-01-22 00:00:00') ENGINE = InnoDB,PARTITION p20240123 VALUES LESS THAN ('2024-01-23 00:00:00') ENGINE = InnoDB,PARTITION p20240124 VALUES LESS THAN ('2024-01-24 00:00:00') ENGINE = InnoDB,PARTITION p20240125 VALUES LESS THAN ('2024-01-25 00:00:00') ENGINE = InnoDB) */;",
  2821  			output: "create table ecbase_push_log (id bigint not null auto_increment comment 主键, create_time datetime not null default current_timestamp() comment 创建时间) engine = innodb auto_increment = 654 charset = utf8mb4 Collate = utf8mb4_general_ci comment = '推送记录表' partition by range columns (create_time) (partition p20240115 values less than (2024-01-15 00:00:00) engine = innodb, partition p20240116 values less than (2024-01-16 00:00:00) engine = innodb, partition p20240117 values less than (2024-01-17 00:00:00) engine = innodb, partition p20240118 values less than (2024-01-18 00:00:00) engine = innodb, partition p20240119 values less than (2024-01-19 00:00:00) engine = innodb, partition p20240120 values less than (2024-01-20 00:00:00) engine = innodb, partition p20240121 values less than (2024-01-21 00:00:00) engine = innodb, partition p20240122 values less than (2024-01-22 00:00:00) engine = innodb, partition p20240123 values less than (2024-01-23 00:00:00) engine = innodb, partition p20240124 values less than (2024-01-24 00:00:00) engine = innodb, partition p20240125 values less than (2024-01-25 00:00:00) engine = innodb)",
  2822  		},
  2823  		{
  2824  			input:  "show connectors",
  2825  			output: "show connectors",
  2826  		},
  2827  		{
  2828  			input:  "show index from t1 from db",
  2829  			output: "show index from t1 from db",
  2830  		},
  2831  		{
  2832  			input:  "show index from t1",
  2833  			output: "show index from t1",
  2834  		},
  2835  		{
  2836  			input:  "show index from db.t1",
  2837  			output: "show index from db.t1",
  2838  		},
  2839  		{
  2840  			input:  "show index from db.t1 from db",
  2841  			output: "show index from db.t1 from db",
  2842  		},
  2843  		{
  2844  			input:  "create table t1(a vecf32(3), b vecf64(3), c int)",
  2845  			output: "create table t1 (a vecf32(3), b vecf64(3), c int)",
  2846  		},
  2847  		{
  2848  			input:  "alter table tbl1 drop constraint fk_name",
  2849  			output: "alter table tbl1 drop foreign key fk_name",
  2850  		},
  2851  		{
  2852  			input:  "explain force execute st using @a",
  2853  			output: "explain execute st using @a",
  2854  		},
  2855  		{
  2856  			input:  "explain analyze force execute st using @a",
  2857  			output: "explain (analyze) execute st using @a",
  2858  		},
  2859  		{
  2860  			input:  "explain verbose force execute st using @a",
  2861  			output: "explain (verbose) execute st using @a",
  2862  		},
  2863  		{
  2864  			input:  "explain analyze verbose force execute st using @a",
  2865  			output: "explain (analyze,verbose) execute st using @a",
  2866  		},
  2867  		{
  2868  			input:  "explain force execute st",
  2869  			output: "explain execute st",
  2870  		},
  2871  		{
  2872  			input:  "explain analyze force execute st",
  2873  			output: "explain (analyze) execute st",
  2874  		},
  2875  		{
  2876  			input:  "explain verbose force execute st",
  2877  			output: "explain (verbose) execute st",
  2878  		},
  2879  		{
  2880  			input:  "explain analyze verbose force execute st",
  2881  			output: "explain (analyze,verbose) execute st",
  2882  		},
  2883  		{
  2884  			input:  "explain analyze verbose force execute st",
  2885  			output: "explain (analyze,verbose) execute st",
  2886  		},
  2887  	}
  2888  )
  2889  
  2890  func TestValid(t *testing.T) {
  2891  	ctx := context.TODO()
  2892  	for _, tcase := range validSQL {
  2893  		if tcase.output == "" {
  2894  			tcase.output = tcase.input
  2895  		}
  2896  		ast, err := ParseOne(ctx, tcase.input, 1, 0)
  2897  		if err != nil {
  2898  			t.Errorf("Parse(%q) err: %v", tcase.input, err)
  2899  			continue
  2900  		}
  2901  		out := tree.String(ast, dialect.MYSQL)
  2902  		if tcase.output != out {
  2903  			t.Errorf("Parsing failed. \nExpected/Got:\n%s\n%s", tcase.output, out)
  2904  		}
  2905  		ast.StmtKind()
  2906  	}
  2907  }
  2908  
  2909  var (
  2910  	validStrSQL = []struct {
  2911  		input  string
  2912  		output string
  2913  	}{
  2914  		{
  2915  			input:  "create table pt1 (id int, category varchar(50)) partition by list columns(category) (partition p1 values in ('A', 'B') comment 'Category A and B', partition p2 values in ('C', 'D') comment 'Category C and D')",
  2916  			output: "create table pt1 (id int, category varchar(50)) partition by list columns (category) (partition p1 values in ('A', 'B') comment = 'Category A and B', partition p2 values in ('C', 'D') comment = 'Category C and D')",
  2917  		},
  2918  		{
  2919  			input:  "create table titles (emp_no int not null, title varchar(50) not null, from_date date not null, to_date date, primary key (emp_no, title, from_date)) partition by range(to_days(from_date)) (partition p01 values less than (to_days('1985-12-31')), partition p02 values less than (to_days('1986-12-31')))",
  2920  			output: "create table titles (emp_no int not null, title varchar(50) not null, from_date date not null, to_date date, primary key (emp_no, title, from_date)) partition by range(to_days(from_date)) (partition p01 values less than (to_days('1985-12-31')), partition p02 values less than (to_days('1986-12-31')))",
  2921  		},
  2922  		{
  2923  			input:  "create table pt2 (id int, date_column date, value int) partition by range(year(date_column)) (partition p1 values less than (2010) comment 'Before 2010', partition p2 values less than (2020) comment '2010 - 2019', partition p3 values less than (MAXVALUE) comment '2020 and Beyond')",
  2924  			output: "create table pt2 (id int, date_column date, value int) partition by range(year(date_column)) (partition p1 values less than (2010) comment = 'Before 2010', partition p2 values less than (2020) comment = '2010 - 2019', partition p3 values less than (MAXVALUE) comment = '2020 and Beyond')",
  2925  		},
  2926  	}
  2927  )
  2928  
  2929  // Test whether strings in SQL can be restored in string format
  2930  func TestSQLStringFmt(t *testing.T) {
  2931  	ctx := context.TODO()
  2932  	for _, tcase := range validStrSQL {
  2933  		if tcase.output == "" {
  2934  			tcase.output = tcase.input
  2935  		}
  2936  		ast, err := ParseOne(ctx, tcase.input, 1, 0)
  2937  		if err != nil {
  2938  			t.Errorf("Parse(%q) err: %v", tcase.input, err)
  2939  			continue
  2940  		}
  2941  		out := tree.StringWithOpts(ast, dialect.MYSQL, tree.WithSingleQuoteString())
  2942  		if tcase.output != out {
  2943  			t.Errorf("Parsing failed. \nExpected/Got:\n%s\n%s", tcase.output, out)
  2944  		}
  2945  	}
  2946  }
  2947  
  2948  var (
  2949  	multiSQL = []struct {
  2950  		input  string
  2951  		output string
  2952  	}{{
  2953  		input:  "use db1; select * from t;",
  2954  		output: "use db1; select * from t",
  2955  	}, {
  2956  		input: "use db1; select * from t",
  2957  	}, {
  2958  		input: "use db1; select * from t; use db2; select * from t2",
  2959  	}, {
  2960  		input: `BEGIN
  2961  					DECLARE x,y VARCHAR(10);
  2962  					DECLARE z INT;
  2963  					DECLARE fl FLOAT DEFAULT 1.0;
  2964  				END`,
  2965  		output: `begin declare x y varchar(10) default null; declare z int default null; declare fl float default 1.0; end`,
  2966  	}, {
  2967  		input: `BEGIN
  2968  					CASE v
  2969  						WHEN 2 THEN SELECT v;
  2970  						WHEN 3 THEN SELECT 0;
  2971  					ELSE
  2972  						BEGIN
  2973  							CASE v
  2974  								WHEN 4 THEN SELECT v;
  2975  								WHEN 5 THEN SELECT 0;
  2976  							ELSE
  2977  								BEGIN
  2978  								END
  2979  							END CASE;
  2980  						END
  2981  					END CASE; 
  2982  				END`,
  2983  		output: "begin case v when 2 then select v; when 3 then select 0; else begin case v when 4 then select v; when 5 then select 0; else begin end; end case; end; end case; end",
  2984  	}, {
  2985  		input: `BEGIN
  2986  					IF n > m THEN SET s = '>';
  2987  					ELSEIF n = m THEN SET s = '=';
  2988  					ELSE SET s = '<';
  2989  					END IF;
  2990  				END`,
  2991  		output: "begin if n > m then set s = >; elseif n = m then set s = =; else set s = <; end if; end",
  2992  	}, {
  2993  		input: `BEGIN					
  2994  					IF n = m THEN SET s = 'equals';
  2995  					ELSE
  2996  						IF n > m THEN SET s = 'greater';
  2997  						ELSE SET s = 'less';
  2998  						END IF;
  2999  						SET s = CONCAT('is ', s, ' than');
  3000  					END IF;
  3001  					SET s = CONCAT(n, ' ', s, ' ', m, '.');
  3002  				END`,
  3003  		output: "begin if n = m then set s = equals; else if n > m then set s = greater; else set s = less; end if; set s = concat(is , s,  than); end if; set s = concat(n,  , s,  , m, .); end",
  3004  	}, {
  3005  		input: `BEGIN					
  3006  					label1: LOOP
  3007  						SET p1 = p1 + 1;
  3008  						IF p1 < 10 THEN
  3009  							ITERATE label1;
  3010  						END IF;
  3011  						LEAVE label1;
  3012  					END LOOP label1;
  3013  					SET @x = p1;
  3014  				END`,
  3015  		output: "begin label1: loop set p1 = p1 + 1; if p1 < 10 then iterate label1; end if; leave label1; end loop label1; set x = p1; end",
  3016  	}, {
  3017  		input: `BEGIN
  3018  					SET @x = 0;
  3019  					REPEAT
  3020  						SET @x = @x + 1;
  3021  					UNTIL @x > p1 END REPEAT;
  3022  				END`,
  3023  		output: "begin set x = 0; repeat set x = @x + 1; until @x > p1 end repeat; end",
  3024  	}, {
  3025  		input: `BEGIN
  3026  					DECLARE v1 INT DEFAULT 5;
  3027  					WHILE v1 > 0 DO
  3028  						SET v1 = v1 - 1;
  3029  					END WHILE;
  3030  				END`,
  3031  		output: "begin declare v1 int default 5; while v1 > 0 do set v1 = v1 - 1; end while; end",
  3032  	}}
  3033  )
  3034  
  3035  func TestMulti(t *testing.T) {
  3036  	ctx := context.TODO()
  3037  	for _, tcase := range multiSQL {
  3038  		if tcase.output == "" {
  3039  			tcase.output = tcase.input
  3040  		}
  3041  		asts, err := Parse(ctx, tcase.input, 1, 0)
  3042  		if err != nil {
  3043  			t.Errorf("Parse(%q) err: %v", tcase.input, err)
  3044  			continue
  3045  		}
  3046  		var res string
  3047  		prefix := ""
  3048  		for _, ast := range asts {
  3049  			res += prefix
  3050  			out := tree.String(ast, dialect.MYSQL)
  3051  			res += out
  3052  			prefix = "; "
  3053  		}
  3054  		if tcase.output != res {
  3055  			t.Errorf("Parsing failed. \nExpected/Got:\n%s\n%s", tcase.output, res)
  3056  		}
  3057  	}
  3058  }
  3059  
  3060  // Fault tolerant use cases
  3061  var (
  3062  	invalidSQL = []struct {
  3063  		input string
  3064  	}{
  3065  		{
  3066  			input: "alter table t1 add constraint index (col3, col4)",
  3067  		},
  3068  		{
  3069  			input: "alter table t1 add constraint uk_6dotkott2kjsp8vw4d0m25fb7 index (col3)",
  3070  		},
  3071  		{
  3072  			input: "alter table t1 add constraint uk_6dotkott2kjsp8vw4d0m25fb7 index zxxx (col3)",
  3073  		},
  3074  		{
  3075  			input: "create table t (a int, b char, constraint sdf index (a, b) )",
  3076  		},
  3077  		{
  3078  			input: "create table t (a int, b char, constraint sdf index idx(a, b) )",
  3079  		},
  3080  		{
  3081  			input: "create table t (a int, b char, constraint index idx(a, b) )",
  3082  		},
  3083  		{
  3084  			input: "ALTER TABLE t1 TRUNCATE PARTITION ALL, p0",
  3085  		},
  3086  		{
  3087  			input: "ALTER TABLE pt5 add column a INT NOT NULL, ADD PARTITION (PARTITION p4 VALUES LESS THAN (2022))",
  3088  		},
  3089  		{
  3090  			input: "ALTER TABLE pt5 ADD PARTITION (PARTITION p4 VALUES LESS THAN (2022)),add column a INT NOT NULL",
  3091  		},
  3092  		{
  3093  			input: "ALTER TABLE t1 ADD PARTITION (PARTITION p5 VALUES IN (15, 17)",
  3094  		},
  3095  	}
  3096  )
  3097  
  3098  func TestFaultTolerance(t *testing.T) {
  3099  	ctx := context.TODO()
  3100  	for _, tcase := range invalidSQL {
  3101  		_, err := ParseOne(ctx, tcase.input, 1, 0)
  3102  		if err == nil {
  3103  			t.Errorf("Fault tolerant ases (%q) should parse errors", tcase.input)
  3104  			continue
  3105  		}
  3106  	}
  3107  }