Skip to content

Commit 11a337f

Browse files
authored
Merge pull request zendesk#2076 from mavenlink/fix-create-table-tablespace-quoting
Add `tablespace` token to accept backtick'd names
2 parents a17a666 + 03f40b4 commit 11a337f

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/main/antlr4/imports/mysql_create_table.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ creation_stats_auto_recalc: STATS_AUTO_RECALC '='? (DEFAULT | INTEGER_LITERAL);
7272
creation_stats_persistent: STATS_PERSISTENT '='? (DEFAULT | INTEGER_LITERAL);
7373
creation_stats_sample_pages: STATS_SAMPLE_PAGES '='? (DEFAULT | INTEGER_LITERAL);
7474
creation_storage_option: STORAGE (DISK | MEMORY | DEFAULT);
75-
creation_tablespace: TABLESPACE '='? string;
75+
creation_tablespace: tablespace;
7676
creation_union: UNION '='? '(' name (',' name)* ')';
7777
creation_encryption: ENCRYPTION '='? string_literal;
7878
creation_start_transaction: START TRANSACTION;

src/main/antlr4/imports/mysql_idents.g4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ default_collation: DEFAULT? collation;
4040
charset_token: (CHARSET | (CHARACTER SET) | (CHAR SET));
4141
collation: COLLATE '='? (IDENT | string_literal | QUOTED_IDENT | DEFAULT);
4242

43+
tablespace: TABLESPACE '='? (id | string_literal);
44+
4345
if_not_exists: IF NOT EXISTS;
4446

4547

src/test/resources/sql/ddl/mysql-test-fixed.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL,
219219
CREATE TABLE time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions'
220220
CREATE TABLE time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types'
221221
CREATE TABLE ДОЛЕН_регистър_утф8 (s1 INT)
222+
CREATE TABLE t_with_tablespace (a INT) TABLESPACE innodb_system
223+
CREATE TABLE t_with_tablespace (a INT) TABLESPACE `innodb_system`
224+
CREATE TABLE t_with_tablespace (a INT) /*!50100 TABLESPACE `innodb_system` */
222225
DROP TABLE IF EXISTS `t1`,`t2`,`t3`,`t4`,`t9`,`t1a``b`,`v1`,`v2`,`v3`,`v4`,`v5`,`v6` /* generated by server */
223226
DROP TABLE IF EXISTS `t1`,`t``1`,`t 1` /* generated by server */
224227
DROP TABLE ```ab````cd``` /* generated by server */

0 commit comments

Comments
 (0)