Skip to content

Commit

Permalink
ignore the BINARY flag in string column creation
Browse files Browse the repository at this point in the history
a quick spelunk into the mysql source code shows that this flag only
affects the collation of the column.  We don't give even the slightest
care about that, so we'll parse and ignore it.
  • Loading branch information
Ben Osheroff committed Aug 31, 2015
1 parent 91d5524 commit bf3083f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/main/antlr4/com/zendesk/maxwell/schema/ddl/mysql.g4
Original file line number Diff line number Diff line change
Expand Up @@ -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)* ')';

Expand Down
4 changes: 3 additions & 1 deletion src/main/antlr4/imports/column_definitions.g4
Original file line number Diff line number Diff line change
Expand Up @@ -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?
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,9 @@ public void testCurrentTimestamp() {
assertThat(changes.size(), is(1));
}

@Test
public void testBinaryChar() {
List<SchemaChange> changes = parse("CREATE TABLE `foo` ( `id` char(16) BINARY character set 'utf8' )");
assertThat(changes.size(), is(1));
}
}

0 comments on commit bf3083f

Please sign in to comment.