Skip to content

Commit

Permalink
WL#8067: True bottom-up server parser: refactoring of the CREATE TABL…
Browse files Browse the repository at this point in the history
…E statement

WL#8434: True bottom-up server parser: refactoring of partitioning-related stuff
WL#8435: True bottom-up server parser: cleanup and refactoring column definition stuff
WL#8433: Separate DD commands from regular SQL queries in the parser grammar
WL#7840: Allow parsing a single expression
  • Loading branch information
GlebShchepa committed Jul 14, 2016
1 parent 227ee0b commit f5c32ea
Show file tree
Hide file tree
Showing 76 changed files with 6,567 additions and 3,177 deletions.
3 changes: 3 additions & 0 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ TAB_SIZE = 8

ALIASES =

ALIASES += SQL{1}="<small>\1</small>"
ALIASES += B{1}="<b>\1</b>"

# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
Expand Down
7 changes: 2 additions & 5 deletions mysql-test/r/parser.result
Original file line number Diff line number Diff line change
Expand Up @@ -1184,12 +1184,9 @@ CREATE PROCEDURE p1()
BEGIN
parse_gcol_expr: LOOP
SELECT 1;
END LOOP label1;
END LOOP parse_gcol_expr;
END|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ': LOOP
SELECT 1;
END LOOP label1;
END' at line 3
DROP PROCEDURE p1;
# PARSE_GCOL_EXPR is not a valid statement:
PARSE_GCOL_EXPR (1);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PARSE_GCOL_EXPR (1)' at line 1
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/partition_column.result
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ partition by range columns(a,b)
ERROR 42000: Inconsistency in usage of column lists for partitioning near '))' at line 3
create table t1 (a int, b int)
partition by range columns(a,b)
(partition p0 values less than (1,1,1);
(partition p0 values less than (1,1,1));
ERROR HY000: Inconsistency in usage of column lists for partitioning
create table t1 (a int, b int)
partition by range columns(a,b)
Expand Down
55 changes: 35 additions & 20 deletions mysql-test/r/partition_error.result
Original file line number Diff line number Diff line change
Expand Up @@ -824,13 +824,14 @@ PARTITION BY RANGE (a)
PARTITION p0 VALUES LESS THAN (1),
PARTITION p1 VALU ES LESS THAN (2)
);
ERROR HY000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VALU ES LESS THAN (2)
)' at line 7
partition by list (a)
partitions 3
(partition x1 values in (1,2,9,4) tablespace ts1,
partition x2 values in (3, 11, 5, 7) tablespace ts2,
partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
ERROR 42000: Partitioning can not be used stand-alone in query near 'partition by list (a)
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'partition by list (a)
partitions 3
(partition x1 values in (1,2,9,4) tablespace ' at line 1
CREATE TABLE t1 (
Expand Down Expand Up @@ -937,7 +938,7 @@ primary key(a,b))
partition by key (a)
partitions 3
(partition x1, partition x2);
ERROR 42000: Wrong number of partitions defined, mismatch with previous setting near ')' at line 8
ERROR 42000: Wrong number of partitions defined, mismatch with previous setting near '(partition x1, partition x2)' at line 8
CREATE TABLE t1 (
a int not null,
b int not null,
Expand All @@ -946,7 +947,7 @@ primary key(a,b))
partition by hash (rand(a))
partitions 2
(partition x1, partition x2);
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near 'rand(a))
partitions 2
(partition x1, partition x2)' at line 6
CREATE TABLE t1 (
Expand All @@ -957,9 +958,9 @@ primary key(a,b))
partition by range (rand(a))
partitions 2
(partition x1 values less than (0), partition x2 values less than (2));
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near 'rand(a))
partitions 2
(partition x1 values less than (0), partition x2 values less than' at line 6
(partition x1 values less than (0), partition x2 values le' at line 6
CREATE TABLE t1 (
a int not null,
b int not null,
Expand All @@ -968,7 +969,7 @@ primary key(a,b))
partition by list (rand(a))
partitions 2
(partition x1 values in (1), partition x2 values in (2));
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near 'rand(a))
partitions 2
(partition x1 values in (1), partition x2 values in (2))' at line 6
CREATE TABLE t1 (
Expand Down Expand Up @@ -1083,7 +1084,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by hash (rand(a+b));
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 7
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near 'rand(a+b))' at line 7
CREATE TABLE t1 (
a int not null,
b int not null,
Expand Down Expand Up @@ -1189,7 +1190,8 @@ partition by range (a)
partitions 2
(partition x1 values less than (4),
partition x2);
ERROR HY000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition
ERROR 42000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition near '
partition x2)' at line 8
CREATE TABLE t1 (
a int not null,
b int not null,
Expand Down Expand Up @@ -1219,6 +1221,17 @@ partition by list (a)
partitions 2
(partition x1 values less than 4,
partition x2 values less than (5));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4,
partition x2 values less than (5))' at line 8
CREATE TABLE t1 (
a int not null,
b int not null,
c int not null,
primary key(a,b))
partition by list (a)
partitions 2
(partition x1 values less than (4),
partition x2 values less than (5));
ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
CREATE TABLE t1 (
a int not null,
Expand Down Expand Up @@ -1275,10 +1288,9 @@ partition x2 values in (3,5,6)
( subpartition x21 nodegroup 0,
subpartition x22 nodegroup 1)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
partition x2 values in (3,5,6)
( subpartition x21 nodegroup 0,
subpartition x' at line 11
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '( subpartition x11 nodegroup 0,
subpartition x12 nodegroup 1),
partition x2 valu' at line 10
CREATE TABLE t1 (
a int not null,
b int not null,
Expand All @@ -1294,8 +1306,9 @@ partition x2 values in (2)
( subpartition x21 nodegroup 0,
subpartition x22 nodegroup 1)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ')
)' at line 14
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '( subpartition x21 nodegroup 0,
subpartition x22 nodegroup 1)
)' at line 13
CREATE TABLE t1 (
a int not null,
b int not null,
Expand Down Expand Up @@ -1370,7 +1383,8 @@ partition by list (a)
partitions 2
(partition x1 values in (4),
partition x2);
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
ERROR 42000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition near '
partition x2)' at line 8
CREATE TABLE t1 (
a int not null,
b int not null,
Expand All @@ -1390,7 +1404,8 @@ partition by list (a)
partitions 2
(partition x1 values in (4,6),
partition x2);
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
ERROR 42000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition near '
partition x2)' at line 8
CREATE TABLE t1 (
a int not null,
b int not null,
Expand Down Expand Up @@ -1444,13 +1459,13 @@ partition by range (ascii(v))
ERROR HY000: This partition function is not allowed
create table t1 (a int)
partition by hash (rand(a));
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near 'rand(a))' at line 2
create table t1 (a int)
partition by hash(CURTIME() + a);
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near 'CURTIME() + a)' at line 2
create table t1 (a int)
partition by hash (NOW()+a);
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near 'NOW()+a)' at line 2
create table t1 (a int)
partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00')));
ERROR HY000: This partition function is not allowed
Expand Down
8 changes: 4 additions & 4 deletions mysql-test/r/partition_innodb_tablespace.result
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( YEAR(purchased))
SUBPARTITION BY HASH ( TO_DAYS(purchased))
/*!50100 PARTITION BY RANGE (YEAR(purchased))
SUBPARTITION BY HASH (TO_DAYS(purchased))
(PARTITION p0 VALUES LESS THAN (1990)
(SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alternate_dir/data/' ENGINE = InnoDB,
SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alternate_dir/data2/' ENGINE = InnoDB),
Expand Down Expand Up @@ -259,8 +259,8 @@ t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
/*!50100 PARTITION BY RANGE ( YEAR(purchased))
SUBPARTITION BY HASH ( TO_DAYS(purchased))
/*!50100 PARTITION BY RANGE (YEAR(purchased))
SUBPARTITION BY HASH (TO_DAYS(purchased))
(PARTITION p0 VALUES LESS THAN (1990)
(SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/alternate_dir/data/' ENGINE = InnoDB,
SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/alternate_dir/data2/' ENGINE = InnoDB),
Expand Down
24 changes: 12 additions & 12 deletions mysql-test/suite/engines/funcs/r/tc_partition_reorg_divide.result
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ t1 CREATE TABLE `t1` (
`c1` tinyint(4) NOT NULL,
`c2` char(5) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( c1)
/*!50100 PARTITION BY RANGE (c1)
(PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE,
PARTITION s1 VALUES LESS THAN (10) ENGINE = ENGINE,
PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE,
Expand All @@ -71,7 +71,7 @@ t1 CREATE TABLE `t1` (
`c1` tinyint(4) NOT NULL,
`c2` char(5) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( c1)
/*!50100 PARTITION BY RANGE (c1)
(PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE,
PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE,
PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE,
Expand Down Expand Up @@ -125,7 +125,7 @@ t1 CREATE TABLE `t1` (
`c1` smallint(6) NOT NULL,
`c2` char(5) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( c1)
/*!50100 PARTITION BY RANGE (c1)
(PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE,
PARTITION s1 VALUES LESS THAN (10) ENGINE = ENGINE,
PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE,
Expand All @@ -152,7 +152,7 @@ t1 CREATE TABLE `t1` (
`c1` smallint(6) NOT NULL,
`c2` char(5) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( c1)
/*!50100 PARTITION BY RANGE (c1)
(PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE,
PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE,
PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE,
Expand Down Expand Up @@ -206,7 +206,7 @@ t1 CREATE TABLE `t1` (
`c1` mediumint(9) NOT NULL,
`c2` char(5) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( c1)
/*!50100 PARTITION BY RANGE (c1)
(PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE,
PARTITION s1 VALUES LESS THAN (10) ENGINE = ENGINE,
PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE,
Expand All @@ -233,7 +233,7 @@ t1 CREATE TABLE `t1` (
`c1` mediumint(9) NOT NULL,
`c2` char(5) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( c1)
/*!50100 PARTITION BY RANGE (c1)
(PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE,
PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE,
PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE,
Expand Down Expand Up @@ -287,7 +287,7 @@ t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` char(5) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( c1)
/*!50100 PARTITION BY RANGE (c1)
(PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE,
PARTITION s1 VALUES LESS THAN (10) ENGINE = ENGINE,
PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE,
Expand All @@ -314,7 +314,7 @@ t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` char(5) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( c1)
/*!50100 PARTITION BY RANGE (c1)
(PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE,
PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE,
PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE,
Expand Down Expand Up @@ -368,7 +368,7 @@ t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` char(5) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( c1)
/*!50100 PARTITION BY RANGE (c1)
(PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE,
PARTITION s1 VALUES LESS THAN (10) ENGINE = ENGINE,
PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE,
Expand All @@ -395,7 +395,7 @@ t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` char(5) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( c1)
/*!50100 PARTITION BY RANGE (c1)
(PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE,
PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE,
PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE,
Expand Down Expand Up @@ -449,7 +449,7 @@ t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL,
`c2` char(5) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( c1)
/*!50100 PARTITION BY RANGE (c1)
(PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE,
PARTITION s1 VALUES LESS THAN (10) ENGINE = ENGINE,
PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE,
Expand All @@ -476,7 +476,7 @@ t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL,
`c2` char(5) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( c1)
/*!50100 PARTITION BY RANGE (c1)
(PARTITION s0 VALUES LESS THAN (3) ENGINE = ENGINE,
PARTITION p1 VALUES LESS THAN (20) ENGINE = ENGINE,
PARTITION p2 VALUES LESS THAN (30) ENGINE = ENGINE,
Expand Down
Loading

0 comments on commit f5c32ea

Please sign in to comment.