From e8a7651d737bff103563d7ec4bb215440ce080c9 Mon Sep 17 00:00:00 2001 From: harveyyue Date: Sat, 13 Aug 2022 10:52:54 +0800 Subject: [PATCH] DBZ-5508 DDL statement couldn't be parsed : mismatched input 'ENGINE' --- .../io/debezium/ddl/parser/mysql/generated/MySqlParser.g4 | 6 +++++- .../src/test/resources/mysql/examples/ddl_create.sql | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/debezium-ddl-parser/src/main/antlr4/io/debezium/ddl/parser/mysql/generated/MySqlParser.g4 b/debezium-ddl-parser/src/main/antlr4/io/debezium/ddl/parser/mysql/generated/MySqlParser.g4 index b35d8338b..e6045b559 100644 --- a/debezium-ddl-parser/src/main/antlr4/io/debezium/ddl/parser/mysql/generated/MySqlParser.g4 +++ b/debezium-ddl-parser/src/main/antlr4/io/debezium/ddl/parser/mysql/generated/MySqlParser.g4 @@ -463,6 +463,8 @@ indexColumnDefinition tableOption : ENGINE '='? engineName? #tableOptionEngine + | ENGINE_ATTRIBUTE '='? STRING_LITERAL #tableOptionEngineAttribute + | AUTOEXTEND_SIZE '='? decimalLiteral #tableOptionAutoextendSize | AUTO_INCREMENT '='? decimalLiteral #tableOptionAutoIncrement | AVG_ROW_LENGTH '='? decimalLiteral #tableOptionAverage | DEFAULT? (CHARACTER SET | CHARSET | CHAR SET) '='? (charsetName|DEFAULT) #tableOptionCharset @@ -471,7 +473,7 @@ tableOption | COMMENT '='? STRING_LITERAL #tableOptionComment | COMPRESSION '='? (STRING_LITERAL | ID) #tableOptionCompression | CONNECTION '='? STRING_LITERAL #tableOptionConnection - | DATA DIRECTORY '='? STRING_LITERAL #tableOptionDataDirectory + | (DATA | INDEX) DIRECTORY '='? STRING_LITERAL #tableOptionDataDirectory | DELAY_KEY_WRITE '='? boolValue=('0' | '1') #tableOptionDelay | ENCRYPTION '='? STRING_LITERAL #tableOptionEncryption | encryptedLiteral '='? (YES | NO) #tableOptionEncrypted @@ -490,6 +492,8 @@ tableOption DEFAULT | DYNAMIC | FIXED | COMPRESSED | REDUNDANT | COMPACT | ID ) #tableOptionRowFormat + | START TRANSACTION #tableOptionStartTransaction + | SECONDARY_ENGINE_ATTRIBUTE '='? STRING_LITERAL #tableOptionSecondaryEngineAttribute | STATS_AUTO_RECALC '='? extBoolValue=(DEFAULT | '0' | '1') #tableOptionRecalculation | STATS_PERSISTENT '='? extBoolValue=(DEFAULT | '0' | '1') #tableOptionPersistent | STATS_SAMPLE_PAGES '='? decimalLiteral #tableOptionSamplePage diff --git a/debezium-ddl-parser/src/test/resources/mysql/examples/ddl_create.sql b/debezium-ddl-parser/src/test/resources/mysql/examples/ddl_create.sql index 70e667ce9..d611661ab 100644 --- a/debezium-ddl-parser/src/test/resources/mysql/examples/ddl_create.sql +++ b/debezium-ddl-parser/src/test/resources/mysql/examples/ddl_create.sql @@ -149,6 +149,14 @@ CREATE TABLE IF NOT EXISTS `contract_center`.`ent_folder_letter_relationship` ( `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, +`client_id` varchar(150) NOT NULL, +`client_secret` blob NOT NULL, +PRIMARY KEY (`pk_realm`), +KEY `auth_realms_auth_realm_clients` (`fk_realm`) +) START TRANSACTION ENGINE=InnoDB DEFAULT CHARSET=latin1; #end #begin -- Rename table