diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 48f9b04c15f..5c4fc34cc8a 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -848,4 +848,8 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (NULL) ENGINE = MyISAM) DROP TABLE t1; +CREATE TABLE t1 (a int) +PARTITION BY RANGE(a) +(PARTITION p0 VALUES LESS THAN (NULL)); +ERROR 42000: Not allowed to use NULL value in VALUES LESS THAN near '))' at line 3 End of 5.1 tests diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 4eb27765f5f..9c73c00d2df 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -965,4 +965,9 @@ PARTITION BY LIST (a) SHOW CREATE TABLE t1; DROP TABLE t1; +--error 1064 +CREATE TABLE t1 (a int) +PARTITION BY RANGE(a) +(PARTITION p0 VALUES LESS THAN (NULL)); + --echo End of 5.1 tests diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index e8766b3d882..d7bf7304638 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5826,3 +5826,6 @@ ER_NDB_CANT_SWITCH_BINLOG_FORMAT eng "The NDB cluster engine does not support changing the binlog format on the fly yet" ER_PARTITION_NO_TEMPORARY eng "Cannot create temporary table with partitions" +ER_NULL_IN_VALUES_LESS_THAN + eng "Not allowed to use NULL value in VALUES LESS THAN" + swe "Det är inte tillåtet att använda NULL-värden i VALUES LESS THAN" diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index e48748bcfa5..cda35f1a538 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3721,6 +3721,11 @@ part_func_max: yyerror(ER(ER_PARTITION_MAXVALUE_ERROR)); YYABORT; } + if (Lex->part_info->curr_part_elem->has_null_value) + { + yyerror(ER(ER_NULL_IN_VALUES_LESS_THAN)); + YYABORT; + } } ;