# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2006/08/07 12:02:28-04:00 mikael@dator5.(none)
# Made sure that strange numbers are not allowed syntax-wise.
#
# mysql-test/r/partition.result
# 2006/08/07 12:02:25-04:00 mikael@dator5.(none) +16 -0
# Added some test cases
#
# mysql-test/t/partition.test
# 2006/08/07 12:02:25-04:00 mikael@dator5.(none) +19 -0
# Added some test cases
#
# sql/share/errmsg.txt
# 2006/08/07 12:02:25-04:00 mikael@dator5.(none) +2 -0
# Added new error message
#
# sql/sql_yacc.yy
# 2006/08/07 12:02:25-04:00 mikael@dator5.(none) +37 -12
# Made sure that strange numbers are not allowed syntax-wise.
#
diff -Nru a/mysql-test/r/partition.result
b/mysql-test/r/partition.result
--- a/mysql-test/r/partition.result 2006-08-07 12:11:31 -04:00
+++ b/mysql-test/r/partition.result 2006-08-07 12:11:31 -04:00
@@ -1,5 +1,21 @@
drop table if exists t1;
create table t1 (a int)
+partition by key(a)
+partitions 0.2+e1;
+ERROR 42000: Only normal integers allowed as number here near '0.2+e1'
at line 3
+create table t1 (a int)
+partition by key(a)
+partitions -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 '-1' at line 3
+create table t1 (a int)
+partition by key(a)
+partitions 1.5;
+ERROR 42000: Only normal integers allowed as number here near '1.5' at
line 3
+create table t1 (a int)
+partition by key(a)
+partitions 1e+300;
+ERROR 42000: Only normal integers allowed as number here near '1e+300'
at line 3
+create table t1 (a int)
partition by list (a)
(partition p0 values in (1));
create procedure pz()
diff -Nru a/mysql-test/t/partition.test b/mysql-test/t/partition.test
--- a/mysql-test/t/partition.test 2006-08-07 12:11:31 -04:00
+++ b/mysql-test/t/partition.test 2006-08-07 12:11:31 -04:00
@@ -10,6 +10,25 @@
--enable_warnings
#
+# Bug 15890: Strange number of partitions accepted
+#
+-- error 1064
+create table t1 (a int)
+partition by key(a)
+partitions 0.2+e1;
+-- error 1064
+create table t1 (a int)
+partition by key(a)
+partitions -1;
+-- error 1064
+create table t1 (a int)
+partition by key(a)
+partitions 1.5;
+-- error 1064
+create table t1 (a int)
+partition by key(a)
+partitions 1e+300;
+#
# Bug 19309 Partitions: Crash if double procedural alter
#
create table t1 (a int)
diff -Nru a/sql/share/errmsg.txt b/sql/share/errmsg.txt
--- a/sql/share/errmsg.txt 2006-08-07 12:11:31 -04:00
+++ b/sql/share/errmsg.txt 2006-08-07 12:11:31 -04:00
@@ -5843,3 +5843,5 @@
eng "The server was not built with row-based replication"
ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA
eng "Triggers can not be created on system tables"
+ER_ONLY_INTEGERS_ALLOWED
+ eng "Only normal integers allowed as number here"
diff -Nru a/sql/sql_yacc.yy b/sql/sql_yacc.yy
--- a/sql/sql_yacc.yy 2006-08-07 12:11:31 -04:00
+++ b/sql/sql_yacc.yy 2006-08-07 12:11:31 -04:00
@@ -753,10 +753,10 @@
ev_alter_on_schedule_completion opt_ev_rename_to
opt_ev_sql_stmt
%type <ulong_num>
- ulong_num merge_insert_types
+ ulong_num real_ulong_num merge_insert_types
%type <ulonglong_number>
- ulonglong_num size_number
+ ulonglong_num real_ulonglong_num size_number
%type <p_elem_value>
part_bit_expr
@@ -3072,7 +3072,7 @@
};
opt_ts_nodegroup:
- NODEGROUP_SYM opt_equal ulong_num
+ NODEGROUP_SYM opt_equal real_ulong_num
{
LEX *lex= Lex;
if (lex->alter_tablespace_info->nodegroup_id !=
UNDEF_NODEGROUP)
@@ -3131,7 +3131,7 @@
};
size_number:
- ulong_num { $$= $1;}
+ real_ulong_num { $$= $1;}
| IDENT
{
ulonglong number, test_number;
@@ -3370,7 +3370,7 @@
opt_no_parts:
/* empty */ {}
- | PARTITIONS_SYM ulong_num
+ | PARTITIONS_SYM real_ulong_num
{
uint no_parts= $2;
LEX *lex= Lex;
@@ -3434,7 +3434,7 @@
opt_no_subparts:
/* empty */ {}
- | SUBPARTITIONS_SYM ulong_num
+ | SUBPARTITIONS_SYM real_ulong_num
{
uint no_parts= $2;
LEX *lex= Lex;
@@ -3774,11 +3774,11 @@
lex->part_info->curr_part_elem->engine_type= $4;
lex->part_info->default_engine_type= $4;
}
- | NODEGROUP_SYM opt_equal ulong_num
+ | NODEGROUP_SYM opt_equal real_ulong_num
{ Lex->part_info->curr_part_elem->nodegroup_id= $3; }
- | MAX_ROWS opt_equal ulonglong_num
+ | MAX_ROWS opt_equal real_ulonglong_num
{ Lex->part_info->curr_part_elem->part_max_rows= $3; }
- | MIN_ROWS opt_equal ulonglong_num
+ | MIN_ROWS opt_equal real_ulonglong_num
{ Lex->part_info->curr_part_elem->part_min_rows= $3; }
| DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
{ Lex->part_info->curr_part_elem->data_file_name= $4.str; }
@@ -4908,7 +4908,7 @@
lex->check_opt.init();
}
opt_mi_repair_type
- | COALESCE PARTITION_SYM opt_no_write_to_binlog ulong_num
+ | COALESCE PARTITION_SYM opt_no_write_to_binlog real_ulong_num
{
LEX *lex= Lex;
lex->alter_info.flags|= ALTER_COALESCE_PARTITION;
@@ -4956,7 +4956,7 @@
LEX *lex= Lex;
lex->part_info->no_parts=
lex->part_info->partitions.elements;
}
- | PARTITIONS_SYM ulong_num
+ | PARTITIONS_SYM real_ulong_num
{
LEX *lex= Lex;
lex->part_info->no_parts= $2;
@@ -7491,7 +7491,15 @@
| ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str,
(char**) 0, &error); }
| DECIMAL_NUM { int error; $$= (ulong) my_strtoll10($1.str,
(char**) 0, &error); }
| FLOAT_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0,
&error); }
- ;
+ ;
+
+real_ulong_num:
+ NUM { int error; $$= (ulong) my_strtoll10($1.str,
(char**) 0, &error); }
+ | HEX_NUM { $$= (ulong) strtol($1.str, (char**) 0, 16); }
+ | LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str,
(char**) 0, &error); }
+ | ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str,
(char**) 0, &error); }
+ | dec_num_error { YYABORT; }
+ ;
ulonglong_num:
NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0,
&error); }
@@ -7500,6 +7508,23 @@
| DECIMAL_NUM { int error; $$= (ulonglong)
my_strtoll10($1.str, (char**) 0, &error); }
| FLOAT_NUM { int error; $$= (ulonglong) my_strtoll10($1.str,
(char**) 0, &error); }
;
+
+real_ulonglong_num:
+ NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0,
&error); }
+ | ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str,
(char**) 0, &error); }
+ | LONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str,
(char**) 0, &error); }
+ | dec_num_error { YYABORT; }
+ ;
+
+dec_num_error:
+ dec_num
+ { yyerror(ER(ER_ONLY_INTEGERS_ALLOWED)); }
+ ;
+
+dec_num:
+ DECIMAL_NUM
+ | FLOAT_NUM
+ ;
procedure_clause:
/* empty */
Mikael Ronstrom, Senior Software Architect
MySQL AB, www.mysql.com
Jumpstart your cluster:
http://www.mysql.com/consulting/packaged/cluster.html
My blog:
http://mikaelronstrom.blogspot.com
| Thread |
|---|
| • bk commit - 5.1 tree (mikael:1.2265) BUG#15890 | Mikael Ronström | 7 Aug |