diff --git a/src/main/antlr4/com/zendesk/maxwell/schema/ddl/mysql.g4 b/src/main/antlr4/com/zendesk/maxwell/schema/ddl/mysql.g4 index a97c445bd..ea1905d2e 100644 --- a/src/main/antlr4/com/zendesk/maxwell/schema/ddl/mysql.g4 +++ b/src/main/antlr4/com/zendesk/maxwell/schema/ddl/mysql.g4 @@ -27,7 +27,6 @@ create_table: | create_like_tbl ); -// TODO: support if-not-exists create_table_preamble: CREATE TEMPORARY? TABLE (IF NOT EXISTS)? table_name; create_specifications: '(' create_specification (',' create_specification)* ')'; diff --git a/src/main/antlr4/imports/column_definitions.g4 b/src/main/antlr4/imports/column_definitions.g4 index e859850f8..5a5f17e45 100644 --- a/src/main/antlr4/imports/column_definitions.g4 +++ b/src/main/antlr4/imports/column_definitions.g4 @@ -38,8 +38,10 @@ signed_type: // we need the UNSIGNED flag here string_type: // getting the encoding here col_type=(CHAR | VARCHAR) length? + BINARY? charset_def? - | col_type=(TINYTEXT | TEXT | MEDIUMTEXT | LONGTEXT) + | col_type=(TINYTEXT | TEXT | MEDIUMTEXT | LONGTEXT) + BINARY? charset_def? ; diff --git a/src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java b/src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java index a58a4f4a9..f9af60f41 100644 --- a/src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java +++ b/src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java @@ -358,4 +358,9 @@ public void testCurrentTimestamp() { assertThat(changes.size(), is(1)); } + @Test + public void testBinaryChar() { + List changes = parse("CREATE TABLE `foo` ( `id` char(16) BINARY character set 'utf8' )"); + assertThat(changes.size(), is(1)); + } }