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