From 22ea260083fa6ef2242d5b7b4d7578043a9fd431 Mon Sep 17 00:00:00 2001 From: ani-sha Date: Thu, 9 Jan 2025 17:43:36 +0530 Subject: [PATCH 1/2] [MySql] Synchronize grammar and tests; remove Mariadb grammars --- sql/mysql/Positive-Technologies/MySqlLexer.g4 | 9 +- .../Positive-Technologies/MySqlParser.g4 | 82 +++++++++++-------- .../examples/ddl_alter.sql | 38 ++++++++- .../examples/ddl_create.sql | 78 ++++++++++++++---- .../examples/ddl_flush.sql | 3 + .../examples/dml_select.sql | 31 ++++++- .../examples/dml_table.sql | 3 - .../Positive-Technologies/examples/grant.sql | 72 +++++++++++++++- 8 files changed, 253 insertions(+), 63 deletions(-) diff --git a/sql/mysql/Positive-Technologies/MySqlLexer.g4 b/sql/mysql/Positive-Technologies/MySqlLexer.g4 index 72da513647..cc91df8ddb 100644 --- a/sql/mysql/Positive-Technologies/MySqlLexer.g4 +++ b/sql/mysql/Positive-Technologies/MySqlLexer.g4 @@ -437,7 +437,7 @@ COMMIT : 'COMMIT'; COMPACT : 'COMPACT'; COMPLETION : 'COMPLETION'; COMPRESSED : 'COMPRESSED'; -COMPRESSION : 'COMPRESSION'; +COMPRESSION : 'COMPRESSION' | QUOTE_SYMB? 'COMPRESSION' QUOTE_SYMB?; CONCURRENT : 'CONCURRENT'; CONNECT : 'CONNECT'; CONNECTION : 'CONNECTION'; @@ -1169,6 +1169,7 @@ SUBSTRING_INDEX : 'SUBSTRING_INDEX'; SUBTIME : 'SUBTIME'; SYSTEM_USER : 'SYSTEM_USER'; TAN : 'TAN'; +TELEMETRY_LOG_ADMIN : 'TELEMETRY_LOG_ADMIN'; TIMEDIFF : 'TIMEDIFF'; TIMESTAMPADD : 'TIMESTAMPADD'; TIMESTAMPDIFF : 'TIMESTAMPDIFF'; @@ -1272,9 +1273,9 @@ DECIMAL_LITERAL : DEC_DIGIT+; HEXADECIMAL_LITERAL : 'X' '\'' (HEX_DIGIT HEX_DIGIT)+ '\'' | '0X' HEX_DIGIT+; REAL_LITERAL: - DEC_DIGIT* '.' DEC_DIGIT+ + (DEC_DIGIT+)? '.' DEC_DIGIT* | DEC_DIGIT+ '.' EXPONENT_NUM_PART - | DEC_DIGIT* '.' (DEC_DIGIT+ EXPONENT_NUM_PART) + | (DEC_DIGIT+)? '.' (DEC_DIGIT+ EXPONENT_NUM_PART) | DEC_DIGIT+ EXPONENT_NUM_PART ; NULL_SPEC_LITERAL : '\\' 'N'; @@ -1354,4 +1355,4 @@ fragment IP_ADDRESS : [0-9]+ '.' [0-9.]+ | [0-9A-F]* ':' [0-9A-F]* ':' [0 // Last tokens must generate Errors -ERROR_RECONGNIGION: . -> channel(ERRORCHANNEL); +ERROR_RECONGNIGION: . -> channel(ERRORCHANNEL); \ No newline at end of file diff --git a/sql/mysql/Positive-Technologies/MySqlParser.g4 b/sql/mysql/Positive-Technologies/MySqlParser.g4 index 65ec8eeea4..99e6e5976c 100644 --- a/sql/mysql/Positive-Technologies/MySqlParser.g4 +++ b/sql/mysql/Positive-Technologies/MySqlParser.g4 @@ -237,7 +237,7 @@ createLogfileGroup ; createProcedure - : CREATE ownerStatement? PROCEDURE fullId '(' procedureParameter? (',' procedureParameter)* ')' routineOption* routineBody + : CREATE ownerStatement? PROCEDURE ifNotExists? fullId '(' procedureParameter? (',' procedureParameter)* ')' routineOption* routineBody ; createFunction @@ -286,11 +286,12 @@ createTablespaceNdb ; createTrigger - : CREATE ownerStatement? TRIGGER ifNotExists? thisTrigger = fullId triggerTime = (BEFORE | AFTER) triggerEvent = ( - INSERT - | UPDATE - | DELETE - ) ON tableName FOR EACH ROW (triggerPlace = (FOLLOWS | PRECEDES) otherTrigger = fullId)? routineBody + : CREATE ownerStatement? TRIGGER ifNotExists? thisTrigger = fullId triggerTime = ( + BEFORE + | AFTER + ) triggerEvent = (INSERT | UPDATE | DELETE) ON tableName FOR EACH ROW ( + triggerPlace = (FOLLOWS | PRECEDES) otherTrigger = fullId + )? routineBody ; withClause @@ -632,7 +633,7 @@ alterServer ; alterTable - : ALTER intimeAction = (ONLINE | OFFLINE)? IGNORE? TABLE tableName waitNowaitClause? ( + : ALTER intimeAction = (ONLINE | OFFLINE)? IGNORE? TABLE tableName ( alterSpecification (',' alterSpecification)* )? partitionDefinitions? ; @@ -685,7 +686,7 @@ alterSpecification | DROP DEFAULT ) # alterByAlterColumnDefault | ALTER INDEX uid (VISIBLE | INVISIBLE) # alterByAlterIndexVisibility - | DROP FOREIGN KEY uid # alterByDropForeignKey + | DROP FOREIGN KEY uid dottedId? # alterByDropForeignKey | DISABLE KEYS # alterByDisableKeys | ENABLE KEYS # alterByEnableKeys | RENAME renameFormat = (TO | AS)? (uid | fullId) # alterByRename @@ -939,7 +940,7 @@ handlerCloseStatement ; singleUpdateStatement - : UPDATE priority = LOW_PRIORITY? IGNORE? tableName (AS? uid)? SET updatedElement ( + : UPDATE priority = LOW_PRIORITY? IGNORE? tableSources (AS? uid)? SET updatedElement ( ',' updatedElement )* (WHERE expression)? orderByClause? limitClause? ; @@ -1011,12 +1012,12 @@ queryExpressionNointo ; querySpecification - : SELECT selectSpec* selectElements selectIntoExpression? fromClause groupByClause? havingClause? windowClause? orderByClause? limitClause? - | SELECT selectSpec* selectElements fromClause groupByClause? havingClause? windowClause? orderByClause? limitClause? selectIntoExpression? + : SELECT selectSpec* selectElements selectIntoExpression? fromClause? groupByClause? havingClause? windowClause? orderByClause? limitClause? + | SELECT selectSpec* selectElements fromClause? groupByClause? havingClause? windowClause? orderByClause? limitClause? selectIntoExpression? ; querySpecificationNointo - : SELECT selectSpec* selectElements fromClause groupByClause? havingClause? windowClause? orderByClause? limitClause? unionStatement? + : SELECT selectSpec* selectElements fromClause? groupByClause? havingClause? windowClause? orderByClause? limitClause? unionStatement? ; unionParenthesis @@ -1039,7 +1040,7 @@ lateralStatement // https://dev.mysql.com/doc/refman/8.0/en/json-table-functions.html jsonTable - : JSON_TABLE '(' STRING_LITERAL ',' STRING_LITERAL COLUMNS '(' jsonColumnList ')' ')' (AS? uid)? + : JSON_TABLE '(' expression ',' STRING_LITERAL COLUMNS '(' jsonColumnList ')' ')' (AS? uid)? ; jsonColumnList @@ -1171,7 +1172,7 @@ releaseStatement ; lockTables - : LOCK (TABLE | TABLES) lockTableElement (',' lockTableElement)* waitNowaitClause? + : LOCK (TABLE | TABLES) lockTableElement (',' lockTableElement)* ; unlockTables @@ -1541,16 +1542,17 @@ renameUser ; revokeStatement - : REVOKE ifExists? (privelegeClause | uid) (',' privelegeClause | uid)* - ON - privilegeObject=(TABLE | FUNCTION | PROCEDURE)? - privilegeLevel - FROM userName (',' userName)* (IGNORE UNKNOWN USER)? #detailRevoke - | REVOKE ifExists? ALL PRIVILEGES? ',' GRANT OPTION - FROM userName (',' userName)* (IGNORE UNKNOWN USER)? #shortRevoke - | REVOKE ifExists? (userName | uid) (',' (userName | uid))* - FROM (userName | uid) (',' (userName | uid))* - (IGNORE UNKNOWN USER)? #roleRevoke + : REVOKE ifExists? (privelegeClause | uid) (',' privelegeClause | uid)* ON privilegeObject = ( + TABLE + | FUNCTION + | PROCEDURE + )? privilegeLevel FROM userName (',' userName)* (IGNORE UNKNOWN USER)? # detailRevoke + | REVOKE ifExists? ALL PRIVILEGES? ',' GRANT OPTION FROM userName (',' userName)* ( + IGNORE UNKNOWN USER + )? # shortRevoke + | REVOKE ifExists? (userName | uid) (',' (userName | uid))* FROM (userName | uid) ( + ',' (userName | uid) + )* (IGNORE UNKNOWN USER)? # roleRevoke ; revokeProxy @@ -1681,6 +1683,7 @@ privilege | SYSTEM_USER | SYSTEM_VARIABLES_ADMIN | TABLE_ENCRYPTION_ADMIN + | TELEMETRY_LOG_ADMIN | TP_CONNECTION_ADMIN | VERSION_TOKEN_ADMIN | XA_RECOVER_ADMIN @@ -2222,10 +2225,10 @@ dataType SIGNED | UNSIGNED | ZEROFILL - )* # dimensionDataType - | typeName = (DATE | TINYBLOB | MEDIUMBLOB | LONGBLOB | BOOL | BOOLEAN | SERIAL) # simpleDataType + )* # dimensionDataType + | typeName = (DATE | TINYBLOB | MEDIUMBLOB | LONGBLOB | BOOL | BOOLEAN | SERIAL) # simpleDataType | typeName = (BIT | TIME | TIMESTAMP | DATETIME | BINARY | VARBINARY | BLOB | YEAR | VECTOR) lengthOneDimension? # dimensionDataType - | typeName = (ENUM | SET) collectionOptions BINARY? (charSet charsetName)? # collectionDataType + | typeName = (ENUM | SET) collectionOptions BINARY? (charSet charsetName)? # collectionDataType | typeName = ( GEOMETRYCOLLECTION | GEOMCOLLECTION @@ -2243,7 +2246,11 @@ dataType ; collectionOptions - : '(' STRING_LITERAL (',' STRING_LITERAL)* ')' + : '(' collectionOption (',' collectionOption)* ')' + ; + +collectionOption + : STRING_LITERAL ; convertedDataType @@ -2341,11 +2348,6 @@ orReplace : OR REPLACE ; -waitNowaitClause - : WAIT decimalLiteral - | NOWAIT - ; - // Functions functionCall @@ -2439,7 +2441,7 @@ nonAggregateWindowedFunction ; overClause - : OVER ('(' windowSpec ')' | windowName) + : OVER ('(' windowSpec? ')' | windowName) ; windowSpec @@ -2715,6 +2717,7 @@ keywordsCanBeId | AGGREGATE | ALGORITHM | ANY + | APPLICATION_PASSWORD_ADMIN | ARRAY | AT | AUDIT_ADMIN @@ -2838,11 +2841,16 @@ keywordsCanBeId | FIRST | FIXED | FLUSH + | FLUSH_OPTIMIZER_COSTS + | FLUSH_STATUS + | FLUSH_TABLES + | FLUSH_USER_RESOURCES | FOLLOWS | FOUND | FULL | FUNCTION | GENERAL + | GEOMETRY | GLOBAL | GRANTS | GROUP @@ -2862,6 +2870,7 @@ keywordsCanBeId | INDEXES | INITIAL_SIZE | INNODB_REDO_LOG_ARCHIVE + | INNODB_REDO_LOG_ENABLE | INPLACE | INSERT_METHOD | INSTALL @@ -2934,6 +2943,7 @@ keywordsCanBeId | MYSQL_ERRNO | NAME | NAMES + | NATIONAL | NCHAR | NDB_STORED_USER | NESTED @@ -3082,10 +3092,12 @@ keywordsCanBeId | SWAPS | SWITCHES | SYSTEM_VARIABLES_ADMIN + | SYSTEM_USER | TABLE_NAME | TABLESPACE | TABLE_ENCRYPTION_ADMIN | TABLE_TYPE + | TELEMETRY_LOG_ADMIN | TEMPORARY | TEMPTABLE | THAN @@ -3497,4 +3509,4 @@ functionNameBase | JSON_ARRAYAGG | JSON_OBJECTAGG | STATEMENT - ; + ; \ No newline at end of file diff --git a/sql/mysql/Positive-Technologies/examples/ddl_alter.sql b/sql/mysql/Positive-Technologies/examples/ddl_alter.sql index 63cb46de6a..26de8296d3 100644 --- a/sql/mysql/Positive-Technologies/examples/ddl_alter.sql +++ b/sql/mysql/Positive-Technologies/examples/ddl_alter.sql @@ -1,7 +1,8 @@ #begin -- Alter Table -alter table ship_class add column ship_spec varchar(150) first, add somecol int after start_build; +alter table ship_class add column ship_spec varchar(150) first, add somecol int after start_build, algorithm=instant; alter table t3 add column (c2 decimal(10, 2) comment 'comment`' null, c3 enum('abc', 'cba', 'aaa')), add index t3_i1 using btree (c2) comment 'some index'; +alter table t3 add column (c4 decimal(10, 2) comment 'comment`' null), add index t3_i2 using btree (c4) comment 'some index'; alter table t3 add column (c2 decimal(10, 2), c3 int); ALTER TABLE `deals` ADD INDEX `idx_custom_field_30c4f4a7c529ccf0825b2fac732bebfd843ed764` ((cast(json_unquote(json_extract(`custom_fields`,_utf8mb4'$."30c4f4a7c529ccf0825b2fac732bebfd843ed764".value')) as DOUBLE))); ALTER TABLE `deals` ADD INDEX `idx_custom_field_30c4f4a7c529ccf0825b2fac732bebfd843ed764` ((cast(json_unquote(json_extract(`custom_fields`,_utf8mb4'$."30c4f4a7c529ccf0825b2fac732bebfd843ed764".value')) as FLOAT))); @@ -30,7 +31,7 @@ alter table with_check add check (c1 in (1, 2, 3, 4)); alter table with_partition add partition (partition p201901 values less than (737425) engine = InnoDB); alter table with_partition add partition (partition p1 values less than (837425) engine = InnoDB, partition p2 values less than (MAXVALUE) engine = InnoDB); alter table t1 stats_auto_recalc=default stats_sample_pages=50; -alter table t1 stats_auto_recalc=default, stats_sample_pages=50; +alter table t1 stats_auto_recalc=default, stats_sample_pages=50.0; alter table t1 stats_auto_recalc=default, stats_sample_pages=default; alter table t1 modify column c1 enum('abc','cba','aaa') character set 'utf8' collate 'utf8_unicode_ci' not null default 'abc'; alter table table1 add primary key (id); @@ -43,6 +44,10 @@ alter table table1 add column yes varchar(255) default '' null; alter table add_test add column col1 int not null; alter table `some_table` add (primary key `id` (`id`),`k_id` int unsigned not null,`another_field` smallint not null,index `k_id` (`k_id`)); alter table `some_table` add column (unique key `another_field` (`another_field`)); +alter table add_test add column optional bool default 0 null; +alter table add_test add column empty varchar(255); +alter table add_test add column geometry int; +alter table add_test drop foreign key fk; alter table default.task add column xxxx varchar(200) comment 'cdc test'; ALTER TABLE `hcore`.comments COLLATE='utf8mb4_general_ci', CONVERT TO CHARSET UTF8MB4; ALTER TABLE T1 ADD FOREIGN KEY ( I ) REFERENCES TT ( I ) ON DELETE SET DEFAULT; @@ -101,9 +106,34 @@ alter tablespace tblsp_2 drop datafile 'deletedfilename' wait engine ndb; alter view my_view1 as select 1 union select 2 limit 0,5; alter algorithm = merge view my_view2(col1, col2) as select * from t2 with check option; alter definer = 'ivan'@'%' view my_view3 as select count(*) from t3; -alter definer = current_user sql security invoker view my_view4(c1, 1c, _, c1_2) +alter definer = current_user sql security invoker view my_view4(c1, 1c, _, c1_2) as select * from (t1 as tt1, t2 as tt2) inner join t1 on t1.col1 = tt1.col1; +#end +#begin -- Alter user +alter user 'user'@'%' identified with 'mysql_native_password' as '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' + require none password expire default account unlock password history default; +alter user 'user'@'%' identified with 'mysql_native_password' as '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' + require none password expire default account unlock password history 90; +alter user 'user'@'%' identified with 'mysql_native_password' as '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' + require none password expire default account unlock password reuse interval default; +alter user 'user'@'%' identified with 'mysql_native_password' as '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' + require none password expire default account unlock password reuse interval 360 DAY; +alter user 'user'@'%' identified with 'mysql_native_password' as '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' + require none password expire default account unlock password require current; +alter user 'user'@'%' identified with 'mysql_native_password' as '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' + require none password expire default account unlock password require current optional; +alter user 'user'@'%' identified with 'mysql_native_password' as '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' + require none password expire default account unlock password require current default; +alter user 'user'@'%' identified with 'mysql_native_password' as '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' + require none password expire default account unlock failed_login_attempts 5; +alter user 'user'@'%' identified with 'mysql_native_password' as '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' + require none password expire default account unlock password_lock_time 2; +alter user 'user'@'%' identified with 'mysql_native_password' as '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' + require none password expire default account unlock password_lock_time unbounded; +alter user 'user'@'%' identified by 'newpassword' retain current password; +alter user if exists 'user'@'%' identified with 'mysql_native_password' as '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' + require none password expire default account unlock password history default; ALTER USER 'mattias.hultman' DEFAULT ROLE `prod-spain-mysql-read-only`@`%`; rename user user1@100.200.1.1 to user2@100.200.1.2; rename user user1@100.200.1.1 to user2@2001:0db8:85a3:0000:0000:8a2e:0370:7334; @@ -116,4 +146,4 @@ ALTER USER 'test_dual_pass'@'%' IDENTIFIED WITH 'mysql_native_password' AS '*247 ALTER USER 'test_dual_pass'@'%' IDENTIFIED WITH 'mysql_native_password' AS 'REDACTED' RETAIN CURRENT PASSWORD; ALTER USER 'test_dual_pass'@'%' IDENTIFIED WITH 'mysql_native_password' BY '2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' REPLACE 'current_auth_string' RETAIN CURRENT PASSWORD; ALTER USER 'test_dual_pass'@'%' IDENTIFIED WITH 'mysql_native_password' BY RANDOM PASSWORD REPLACE 'current_auth_string' RETAIN CURRENT PASSWORD; -#end +#end \ No newline at end of file diff --git a/sql/mysql/Positive-Technologies/examples/ddl_create.sql b/sql/mysql/Positive-Technologies/examples/ddl_create.sql index 31a4f485a5..551e8c8415 100644 --- a/sql/mysql/Positive-Technologies/examples/ddl_create.sql +++ b/sql/mysql/Positive-Technologies/examples/ddl_create.sql @@ -1,4 +1,15 @@ #begin +GET DIAGNOSTICS @p1 = NUMBER, @p2 = ROW_COUNT; +GET DIAGNOSTICS CONDITION 1 @p1 = MYSQL_ERRNO; +GET DIAGNOSTICS CONDITION 1 @p1 = RETURNED_SQLSTATE, @p2 = MESSAGE_TEXT; +GET DIAGNOSTICS CONDITION 1 @p3 = RETURNED_SQLSTATE, @p4 = MESSAGE_TEXT; +GET DIAGNOSTICS CONDITION 1 @p5 = SCHEMA_NAME, @p6 = TABLE_NAME; +GET DIAGNOSTICS CONDITION 1 @errno = MYSQL_ERRNO; +GET DIAGNOSTICS @cno = NUMBER; +GET DIAGNOSTICS CONDITION @cno @errno = MYSQL_ERRNO; +GET CURRENT DIAGNOSTICS CONDITION 1 errno = MYSQL_ERRNO, msg = MESSAGE_TEXT; +GET STACKED DIAGNOSTICS CONDITION 1 errno = MYSQL_ERRNO, msg = MESSAGE_TEXT; +GET CURRENT DIAGNOSTICS errcount = NUMBER; -- Create User CREATE USER 'test_crm_debezium'@'%' IDENTIFIED WITH 'mysql_native_password' AS '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9' PASSWORD EXPIRE NEVER COMMENT '-'; CREATE USER 'jim'@'localhost' ATTRIBUTE '{"fname": "James", "lname": "Scott", "phone": "123-456-7890"}'; @@ -69,8 +80,13 @@ create table table_with_character_set_eq (id int, data varchar(50)) character se create table table_with_character_set (id int, data varchar(50)) character set default; create table table_with_visible_index (id int, data varchar(50), UNIQUE INDEX `data_UNIQUE` (`data` ASC) INVISIBLE VISIBLE); create table table_with_index (id int, data varchar(50), UNIQUE INDEX `data_UNIQUE` (`data` ASC)); +create table table_with_keyword_as_column_name (geometry int, national int); +create table transactional_table(name varchar(255), class_id int, id int) transactional=1; +create table transactional(name varchar(255), class_id int, id int); +create table add_test(col1 varchar(255), col2 int, col3 int); create table blob_test(id int, col1 blob(45)); create table žluťoučký (kůň int); +CREATE TABLE staff (PRIMARY KEY (staff_num), staff_num INT(5) NOT NULL, first_name VARCHAR(100) NOT NULL, pens_in_drawer INT(2) NOT NULL, CONSTRAINT pens_in_drawer_range CHECK(pens_in_drawer BETWEEN 1 AND 99)); create table column_names_as_aggr_funcs(min varchar(100), max varchar(100), sum varchar(100), count varchar(100)); CREATE TABLE char_table (c1 CHAR VARYING(10), c2 CHARACTER VARYING(10), c3 NCHAR VARYING(10)); create table rack_shelf_bin ( id int unsigned not null auto_increment unique primary key, bin_volume decimal(20, 4) default (bin_len * bin_width * bin_height)); @@ -79,6 +95,7 @@ create table invisible_column_test(id int, col1 int INVISIBLE); create table visible_column_test(id int, col1 int VISIBLE); create table table_with_buckets(id int(11) auto_increment NOT NULL COMMENT 'ID', buckets int(11) NOT NULL COMMENT '分桶数'); CREATE TABLE foo (c1 decimal(19), c2 decimal(19.5), c3 decimal(0.0), c4 decimal(0.2), c5 decimal(19,2)); +create table statement(id int); CREATE TABLE table_items (id INT, purchased DATE) PARTITION BY RANGE( YEAR(purchased) ) SUBPARTITION BY HASH( TO_DAYS(purchased) ) @@ -209,6 +226,14 @@ CREATE TABLE `daily_intelligences`( PRIMARY KEY (`id`) ) ENGINE=innodb DEFAULT CHAR SET=utf8 COMMENT ''; +CREATE TABLE IF NOT EXISTS `contract_center`.`ent_folder_letter_relationship` ( +`id` BIGINT(19) UNSIGNED NOT NULL COMMENT '唯一标识', +`layer` TINYINT(4) UNSIGNED DEFAULT _UTF8MB4'0' COMMENT '文档所属层级,0-主关联文档, 1-次关联文档', +`deleted` TINYINT(1) NOT NULL DEFAULT _UTF8MB4'0' COMMENT '0-有效记录, 1-删除', +`data_create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP() COMMENT '创建时间', +`data_update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP() COMMENT '更新时间', +PRIMARY KEY(`id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = UTF8MB4; + CREATE TABLE `auth_realm_clients` ( `pk_realm` int unsigned NOT NULL DEFAULT '0', `fk_realm` int unsigned DEFAULT NULL, @@ -288,6 +313,7 @@ create index index5 on antlr_tokens(token(30) asc) algorithm default; create index index6 on antlr_tokens(token(30) asc) algorithm default lock default; create index index7 on antlr_tokens(token(30) asc) lock default algorithm default; create index index8 on t1(col1) comment 'test index' using btree; +create index myindex on t1(col1) comment 'test index' comment 'some test' using btree; CREATE INDEX `idx_custom_field_30c4f4a7c529ccf0825b2fac732bebfd843ed764` ON `deals` ((cast(json_unquote(json_extract(`custom_fields`,_utf8mb4'$."30c4f4a7c529ccf0825b2fac732bebfd843ed764".value')) as double))); CREATE INDEX `idx_custom_field_d3bb7ad91ba729aaa20df0af037cb7ed8ce3ffc8` ON `deals` ((cast(json_unquote(json_extract(`custom_fields`,_utf8mb4'$."d3bb7ad91ba729aaa20df0af037cb7ed8ce3ffc8".value')) as float))); #end @@ -363,6 +389,9 @@ END create trigger trg_my1 before delete on test.t1 for each row begin insert into log_table values ("delete row from test.t1"); insert into t4 values (old.col1, old.col1 + 5, old.col1 + 7); end; -- //-- delimiter ; #end #begin +-- Create trigger 7 +-- delimiter // +CREATE TRIGGER IF NOT EXISTS `my_trigger` BEFORE INSERT ON `my_table` FOR EACH ROW BEGIN SET NEW.my_col = CONCAT(NEW.mycol, NEW.id); END; -- //-- delimiter ; -- Create view create or replace view my_view1 as select 1 union select 2 limit 0,5; create algorithm = merge view my_view2(col1, col2) as select * from t2 with check option; @@ -394,14 +423,13 @@ RETURN SUBSTR(_uuid, 25) )) #end #begin --- From MariaDB 10.4.3, the JSON_VALID function is automatically used as a CHECK constraint for the JSON data type alias in order to ensure that a valid json document is inserted. --- src: https://mariadb.com/kb/en/json_valid/ -CREATE TABLE `global_priv` ( - `Host` CHAR(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `User` CHAR(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `Privilege` LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Privilege`)), - PRIMARY KEY (`Host`,`User`) -) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 COMMENT='Users and global privileges'; +-- Use UTC_TIMESTAMP without parenthesis +CREATE FUNCTION IF NOT EXISTS myfunc(a INT) RETURNS INT +BEGIN + DECLARE result INT; + SET result = UTC_TIMESTAMP; + RETURN result; +END; #end #begin -- https://dev.mysql.com/doc/refman/8.0/en/json-validation-functions.html#json-validation-functions-constraints @@ -476,6 +504,17 @@ BEGIN insert into order_config(order_id, attribute, value, performer) END #end #begin +-- Create procedure +-- delimiter // +CREATE PROCEDURE makesignal(p1 INT) +BEGIN + DECLARE error_text VARCHAR(255); + IF (error_text != 'OK') THEN + SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = error_text; + END IF; +END -- //-- delimiter ; +#end +#begin CREATE DEFINER=`bettingservice`@`stage-us-nj-app%` PROCEDURE `AggregatePlayerFactDaily`() BEGIN DECLARE CID_min BIGINT; @@ -536,6 +575,7 @@ END -- //-- delimiter ; -- delimiter // CREATE PROCEDURE set_unique_check() BEGIN + SET unique_checks=off; SET unique_checks=on; END; -- //-- delimiter ; #end @@ -742,10 +782,15 @@ WITH RECURSIVE cte (n) AS ) SELECT * FROM cte; #end - +#begin +CREATE VIEW `invoice_payments_stats` AS +SELECT + `i`.`id` AS `id` +FROM (`invoices` `i` JOIN lateral (SELECT MAX(`ip`.`date`) AS `latest_payment` FROM `invoice_payments` `ip`) `ps`); +#end #begin lock tables t1 read; -lock table t1 read local wait 100; +lock table t1 read local; #end #begin @@ -824,8 +869,13 @@ ORDER BY 1 ; END #end + #begin --- Create trigger 7 --- delimiter // -CREATE TRIGGER IF NOT EXISTS `my_trigger` BEFORE INSERT ON `my_table` FOR EACH ROW BEGIN SET NEW.my_col = CONCAT(NEW.mycol, NEW.id); END; -- //-- delimiter ; -#end +CREATE PROCEDURE TEST_UPDATE() +BEGIN + UPDATE TEST_AUTO_INC AI + JOIN TEST_JOIN_LIMIT JL ON JL.ID = AI.ID + SET AI.COL_1 = NULL + LIMIT 500; +END +#end \ No newline at end of file diff --git a/sql/mysql/Positive-Technologies/examples/ddl_flush.sql b/sql/mysql/Positive-Technologies/examples/ddl_flush.sql index 15e72ba36a..d001574ab1 100644 --- a/sql/mysql/Positive-Technologies/examples/ddl_flush.sql +++ b/sql/mysql/Positive-Technologies/examples/ddl_flush.sql @@ -1,4 +1,6 @@ #begin +flush no_write_to_binlog hosts; +flush local hosts; flush hosts, status; #end #begin @@ -15,4 +17,5 @@ flush table; flush local table Foo; flush TABLE Foo, Bar; flush table Foo, Bar for export; +flush table Foo, Bar with read lock; #end diff --git a/sql/mysql/Positive-Technologies/examples/dml_select.sql b/sql/mysql/Positive-Technologies/examples/dml_select.sql index b3d95af395..3c19320451 100644 --- a/sql/mysql/Positive-Technologies/examples/dml_select.sql +++ b/sql/mysql/Positive-Technologies/examples/dml_select.sql @@ -23,6 +23,7 @@ select * from `select` where `varchar` = 'abc \' ' and `varchar2` = '\'bca'; #begin -- -- -- Number literal SELECT 1; +SELECT 1.; select 1.e-3 as 123e; select del1.e123 as c from del1; select -1, 3e-2, 2.34E0; @@ -31,6 +32,7 @@ SELECT .1e10; SELECT -.1e10; select 15e3, .2e5 as col1; select .2e3 c1, .2e-4 as c5; +select * from tab where `field` = 1.; #end #begin -- -- -- Number float collision test @@ -189,13 +191,25 @@ SELECT * FROM test LIMIT LIMIT1,LIMIT2; SELECT SCHEMA(); -- Functions SELECT REPEAT('X',2); -SELECT mod(3,2);SELECT * FROM TEST WHERE TB_SCHEMA = SCHEMA(); +SELECT mod(3,2); +SELECT * FROM TEST WHERE TB_SCHEMA = SCHEMA(); -- Group By with computed column SELECT 1 AS col1, t1.Id FROM t1 GROUP BY col1; -- Non Aggregate Functions SELECT pk, LEAD(pk) OVER (ORDER BY pk) AS l; SELECT COALESCE(LAG(last_eq.end_variation) OVER (PARTITION BY eq.account_id, eq.execution_name_id, eq.currency ORDER BY eq.start_date), 0) AS start_variation FROM t1; -- Window Functions +SELECT + year, country, product, profit, + SUM(profit) OVER() AS total_profit, + SUM(profit) OVER(PARTITION BY country) AS country_profit +FROM sales + ORDER BY country, year, product, profit; +SELECT + year, country, product, profit, + ROW_NUMBER() OVER(PARTITION BY country) AS row_num1, + ROW_NUMBER() OVER(PARTITION BY country ORDER BY year, product) AS row_num2 +FROM sales; SELECT e.id, SUM(e.bin_volume) AS bin_volume, @@ -218,6 +232,21 @@ SELECT FROM table2 WINDOW w AS (PARTITION BY id, bin_volume ORDER BY id ROWS UNBOUNDED PRECEDING), w2 AS (PARTITION BY id, bin_volume ORDER BY id DESC ROWS 10 PRECEDING); +#begin +-- https://dev.mysql.com/doc/refman/8.0/en/lateral-derived-tables.html +SELECT + salesperson.name, + max_sale.amount, + max_sale.customer_name +FROM + salesperson, + LATERAL + (SELECT amount, customer_name + FROM all_sales + WHERE all_sales.salesperson_id = salesperson.id + ORDER BY amount DESC LIMIT 1) + AS max_sale; +#end -- Index hints: https://dev.mysql.com/doc/refman/5.7/en/index-hints.html SELECT * FROM table1 USE INDEX (col1_index,col2_index) WHERE col1=1 AND col2=2 AND col3=3; SELECT * FROM table1 FORCE INDEX (col1_index,col2_index) WHERE col1=1 AND col2=2 AND col3=3; diff --git a/sql/mysql/Positive-Technologies/examples/dml_table.sql b/sql/mysql/Positive-Technologies/examples/dml_table.sql index 9e931dd23a..f427601d88 100644 --- a/sql/mysql/Positive-Technologies/examples/dml_table.sql +++ b/sql/mysql/Positive-Technologies/examples/dml_table.sql @@ -10,6 +10,3 @@ TABLE t LIMIT 3; #begin TABLE t ORDER BY b LIMIT 3; #end - - - diff --git a/sql/mysql/Positive-Technologies/examples/grant.sql b/sql/mysql/Positive-Technologies/examples/grant.sql index 24cb1bc1c8..e77e920abb 100644 --- a/sql/mysql/Positive-Technologies/examples/grant.sql +++ b/sql/mysql/Positive-Technologies/examples/grant.sql @@ -12,6 +12,8 @@ GRANT ALL on db.tbl to 'admin'; GRANT ALL on `db`.`tbl` to 'admin'; GRANT ALL on `db`.tbl to 'admin'; GRANT ALL on db.`tbl` to 'admin'; +GRANT ALL ON *.* TO `foo2` @`%`; +GRANT ALL ON *.* TO `foo2` @test; GRANT SESSION_VARIABLES_ADMIN on *.* to 'u2'; GRANT 'SESSION_VARIABLES_ADMIN' on *.* to 'u2'; GRANT `SESSION_VARIABLES_ADMIN` on *.* to 'u2'; @@ -22,7 +24,7 @@ GRANT AUDIT_ADMIN, BACKUP_ADMIN, BINLOG_ADMIN, BINLOG_ENCRYPTION_ADMIN, CLONE_AD ENCRYPTION_KEY_ADMIN, FIREWALL_ADMIN, FIREWALL_USER, GROUP_REPLICATION_ADMIN, INNODB_REDO_LOG_ARCHIVE, NDB_STORED_USER, PERSIST_RO_VARIABLES_ADMIN, REPLICATION_APPLIER, REPLICATION_SLAVE_ADMIN, RESOURCE_GROUP_ADMIN, RESOURCE_GROUP_USER, ROLE_ADMIN, SESSION_VARIABLES_ADMIN, SET_USER_ID, SHOW_ROUTINE, SYSTEM_VARIABLES_ADMIN, AUTHENTICATION_POLICY_ADMIN, -TABLE_ENCRYPTION_ADMIN, VERSION_TOKEN_ADMIN, XA_RECOVER_ADMIN, AUDIT_ABORT_EXEMPT, FIREWALL_EXEMPT, SKIP_QUERY_REWRITE, TP_CONNECTION_ADMIN ON *.* TO `admin`@`localhost`; +TABLE_ENCRYPTION_ADMIN, VERSION_TOKEN_ADMIN, XA_RECOVER_ADMIN, AUDIT_ABORT_EXEMPT, FIREWALL_EXEMPT, SKIP_QUERY_REWRITE, TELEMETRY_LOG_ADMIN, TP_CONNECTION_ADMIN ON *.* TO `admin`@`localhost`; GRANT SELECT, INSERT, UPDATE ON *.* TO u4 AS u1 WITH ROLE r1; GRANT SELECT, RELOAD, REPLICATION SLAVE, REPLICATION CLIENT, SHOW VIEW, EVENT, TRIGGER ON *.* TO 'xuser1'@'%', 'xuser2'@'%' AS 'root'@'%' WITH ROLE 'cloudsqlsuperuser'@'%'; @@ -92,6 +94,72 @@ GRANT SYSTEM_VARIABLES_ADMIN ON *.* TO 'admin'@'localhost' GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO 'admin'@'localhost' GRANT VERSION_TOKEN_ADMIN ON *.* TO 'admin'@'localhost' GRANT XA_RECOVER_ADMIN ON *.* TO 'admin'@'localhost' +GRANT ALTER ON *.* TO 'mysqluser'@'localhost' +GRANT ALTER ROUTINE ON *.* TO 'mysqluser'@'localhost' +GRANT CREATE ON *.* TO 'mysqluser'@'localhost' +GRANT CREATE TEMPORARY TABLES ON *.* TO 'mysqluser'@'localhost' +GRANT CREATE ROUTINE ON *.* TO 'mysqluser'@'localhost' +GRANT CREATE VIEW ON *.* TO 'mysqluser'@'localhost' +GRANT CREATE USER ON *.* TO 'mysqluser'@'localhost' +GRANT CREATE TABLESPACE ON *.* TO 'mysqluser'@'localhost' +GRANT CREATE ROLE ON *.* TO 'mysqluser'@'localhost' +GRANT DELETE ON *.* TO 'mysqluser'@'localhost' +GRANT DROP ON *.* TO 'mysqluser'@'localhost' +GRANT DROP ROLE ON *.* TO 'mysqluser'@'localhost' +GRANT EVENT ON *.* TO 'mysqluser'@'localhost' +GRANT EXECUTE ON *.* TO 'mysqluser'@'localhost' +GRANT FILE ON *.* TO 'mysqluser'@'localhost' +GRANT GRANT OPTION ON *.* TO 'mysqluser'@'localhost' +GRANT INDEX ON *.* TO 'mysqluser'@'localhost' +GRANT INSERT ON *.* TO 'mysqluser'@'localhost' +GRANT LOCK TABLES ON *.* TO 'mysqluser'@'localhost' +GRANT PROCESS ON *.* TO 'mysqluser'@'localhost' +GRANT PROXY ON *.* TO 'mysqluser'@'localhost' +GRANT REFERENCES ON *.* TO 'mysqluser'@'localhost' +GRANT RELOAD ON *.* TO 'mysqluser'@'localhost' +GRANT REPLICATION CLIENT ON *.* TO 'mysqluser'@'localhost' +GRANT REPLICATION SLAVE ON *.* TO 'mysqluser'@'localhost' +GRANT SELECT ON *.* TO 'mysqluser'@'localhost' +GRANT SHOW VIEW ON *.* TO 'mysqluser'@'localhost' +GRANT SHOW DATABASES ON *.* TO 'mysqluser'@'localhost' +GRANT SHUTDOWN ON *.* TO 'mysqluser'@'localhost' +GRANT SUPER ON *.* TO 'mysqluser'@'localhost' +GRANT TRIGGER ON *.* TO 'mysqluser'@'localhost' +GRANT UPDATE ON *.* TO 'mysqluser'@'localhost' +GRANT USAGE ON *.* TO 'mysqluser'@'localhost' +GRANT APPLICATION_PASSWORD_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT AUDIT_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT BACKUP_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT BINLOG_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT BINLOG_ENCRYPTION_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT CLONE_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT CONNECTION_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT ENCRYPTION_KEY_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT FIREWALL_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT FIREWALL_USER ON *.* TO 'mysqluser'@'localhost' +GRANT FLUSH_OPTIMIZER_COSTS ON *.* TO 'mysqluser'@'localhost' +GRANT FLUSH_STATUS ON *.* TO 'mysqluser'@'localhost' +GRANT FLUSH_TABLES ON *.* TO 'mysqluser'@'localhost' +GRANT FLUSH_USER_RESOURCES ON *.* TO 'mysqluser'@'localhost' +GRANT GROUP_REPLICATION_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT INNODB_REDO_LOG_ARCHIVE ON *.* TO 'mysqluser'@'localhost' +GRANT INNODB_REDO_LOG_ENABLE ON *.* TO 'mysqluser'@'localhost' +GRANT NDB_STORED_USER ON *.* TO 'mysqluser'@'localhost' +GRANT PERSIST_RO_VARIABLES_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT REPLICATION_APPLIER ON *.* TO 'mysqluser'@'localhost' +GRANT REPLICATION_SLAVE_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT RESOURCE_GROUP_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT RESOURCE_GROUP_USER ON *.* TO 'mysqluser'@'localhost' +GRANT ROLE_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT SERVICE_CONNECTION_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT SESSION_VARIABLES_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT SET_USER_ID ON *.* TO 'mysqluser'@'localhost' +GRANT SHOW_ROUTINE ON *.* TO 'mysqluser'@'localhost' +GRANT SYSTEM_USER ON *.* TO 'mysqluser'@'localhost' +GRANT SYSTEM_VARIABLES_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT VERSION_TOKEN_ADMIN ON *.* TO 'mysqluser'@'localhost' +GRANT XA_RECOVER_ADMIN ON *.* TO 'mysqluser'@'localhost' GRANT reader TO 'mysqluser'@'localhost' GRANT reader TO topreader GRANT reader TO topreader WITH ADMIN OPTION; @@ -102,7 +170,7 @@ REVOKE reader FROM topreader REVOKE `cloudsqlsuperuser`@`%` FROM `sarmonitoring`@`10.90.29.%` REVOKE IF EXISTS SELECT ON test.t1 FROM jerry@localhost; REVOKE IF EXISTS Bogus ON test FROM jerry@localhost IGNORE UNKNOWN USER; - +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'retool'@ -- Set Role SET ROLE DEFAULT; SET ROLE 'role1', 'role2'; From 9d09cd93b1bb16a7ef5111a2ab30533d41ff3ce9 Mon Sep 17 00:00:00 2001 From: ani-sha Date: Thu, 16 Jan 2025 13:09:30 +0530 Subject: [PATCH 2/2] [MariaDB] Add mariadb specific extensions --- sql/mariadb/MariaDBLexer.g4 | 4 ++++ sql/mariadb/MariaDBParser.g4 | 27 ++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/sql/mariadb/MariaDBLexer.g4 b/sql/mariadb/MariaDBLexer.g4 index 1b4c38c24d..fee08d6915 100644 --- a/sql/mariadb/MariaDBLexer.g4 +++ b/sql/mariadb/MariaDBLexer.g4 @@ -215,6 +215,8 @@ STACKED : 'STACKED'; STARTING : 'STARTING'; STATEMENT : 'STATEMENT'; STRAIGHT_JOIN : 'STRAIGHT_JOIN'; +SYSTEM : 'SYSTEM'; +SYSTEM_TIME : 'SYSTEM_TIME'; TABLE : 'TABLE'; TERMINATED : 'TERMINATED'; THEN : 'THEN'; @@ -232,6 +234,7 @@ USAGE : 'USAGE'; USE : 'USE'; USING : 'USING'; VALUES : 'VALUES'; +VERSIONING : 'VERSIONING'; WHEN : 'WHEN'; WHERE : 'WHERE'; WHILE : 'WHILE'; @@ -403,6 +406,7 @@ AT : 'AT'; AUTHORS : 'AUTHORS'; AUTOCOMMIT : 'AUTOCOMMIT'; AUTOEXTEND_SIZE : 'AUTOEXTEND_SIZE'; +AUTO : 'AUTO'; AUTO_INCREMENT : 'AUTO_INCREMENT'; AVG_ROW_LENGTH : 'AVG_ROW_LENGTH'; BEGIN : 'BEGIN'; diff --git a/sql/mariadb/MariaDBParser.g4 b/sql/mariadb/MariaDBParser.g4 index a45c2b1c8c..d4c65b0044 100644 --- a/sql/mariadb/MariaDBParser.g4 +++ b/sql/mariadb/MariaDBParser.g4 @@ -573,6 +573,7 @@ tableOption | tablespaceStorage # tableOptionTablespace | TRANSACTIONAL '='? ('0' | '1') # tableOptionTransactional | UNION '='? '(' tables ')' # tableOptionUnion + | WITH SYSTEM VERSIONING # tableOptionWithSystemVersioning // MariaDB-specific only ; tableType @@ -595,6 +596,19 @@ partitionFunctionDefinition | LINEAR? KEY (ALGORITHM '=' algType = ('1' | '2'))? '(' uidList ')' # partitionFunctionKey | RANGE ('(' expression ')' | COLUMNS '(' uidList ')') # partitionFunctionRange | LIST ('(' expression ')' | COLUMNS '(' uidList ')') # partitionFunctionList + | SYSTEM_TIME (expression | LIMIT expression) ( + STARTS (TIMESTAMP timestampValue | timestampValue) + )? AUTO? partitionSystemVersionDefinitions? # partitionSystemVersion // MariaDB-specific + ; + +// MariaDB-specific +partitionSystemVersionDefinitions + : '(' partitionSystemVersionDefinition (',' partitionSystemVersionDefinition)* ')' + ; + +// MariaDB-specific +partitionSystemVersionDefinition + : PARTITION uid (HISTORY | CURRENT) ; subpartitionFunctionDefinition @@ -709,7 +723,8 @@ alterSpecification | ADD indexFormat = (INDEX | KEY) ifNotExists? uid? indexType? // here ifNotExists is MariaDB-specific only indexColumnNames indexOption* # alterByAddIndex | ADD (CONSTRAINT name = uid?)? PRIMARY KEY index = uid? indexType? indexColumnNames indexOption* # alterByAddPrimaryKey - | ADD (CONSTRAINT name = uid?)? UNIQUE indexFormat = (INDEX | KEY)? ifNotExists? indexName = uid? indexType? indexColumnNames indexOption* #alterByAddUniqueKey + | ADD (CONSTRAINT name = uid?)? UNIQUE indexFormat = (INDEX | KEY)? ifNotExists? indexName = uid? indexType? indexColumnNames indexOption* # + alterByAddUniqueKey | ADD keyType = (FULLTEXT | SPATIAL) indexFormat = (INDEX | KEY)? uid? indexColumnNames indexOption* # alterByAddSpecialIndex | ADD (CONSTRAINT name = uid?)? FOREIGN KEY ifNotExists? // here ifNotExists is MariaDB-specific only indexName = uid? indexColumnNames referenceDefinition # alterByAddForeignKey @@ -1662,7 +1677,7 @@ privilege : ALL PRIVILEGES? | ALTER ROUTINE? | CREATE (TEMPORARY TABLES | ROUTINE | VIEW | USER | TABLESPACE | ROLE)? - | DELETE + | DELETE (HISTORY)? // HISTORY is MariaDB-specific | DROP (ROLE)? | EVENT | EXECUTE @@ -2304,10 +2319,15 @@ dataType ) # spatialDataType | typeName = LONG VARCHAR? BINARY? (charSet charsetName)? (COLLATE collationName)? # longVarcharDataType // LONG VARCHAR is the same as LONG | LONG VARBINARY # longVarbinaryDataType + | UUID # uuidDataType // MariaDB-specific only ; collectionOptions - : '(' STRING_LITERAL (',' STRING_LITERAL)* ')' + : '(' collectionOption (',' collectionOption)* ')' + ; + +collectionOption + : STRING_LITERAL ; convertedDataType @@ -3227,6 +3247,7 @@ keywordsCanBeId | SETVAL | SKIP_ | STATEMENT + | UUID | VIA | MONITOR | READ_ONLY