summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 426f6d4d057..8aad067944a 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1817,7 +1817,19 @@ key_list:
key_part:
ident { $$=new key_part_spec($1.str); }
- | ident '(' NUM ')' { $$=new key_part_spec($1.str,(uint) atoi($3.str)); };
+ | ident '(' NUM ')'
+ {
+ int key_part_len= atoi($3.str);
+#ifdef MYSQL_VERSION_ID < 50000
+ if (!key_part_len)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR,
+ "Key part '%s' length cannot be 0",
+ MYF(0), $1.str);
+ }
+#endif
+ $$=new key_part_spec($1.str,(uint) key_part_len);
+ };
opt_ident:
/* empty */ { $$=(char*) 0; } /* Defaultlength */