diff options
author | unknown <antony@ltantony.rdg.cyberkinetica.homeunix.net> | 2003-12-11 00:28:25 +0000 |
---|---|---|
committer | unknown <antony@ltantony.rdg.cyberkinetica.homeunix.net> | 2003-12-11 00:28:25 +0000 |
commit | 8086aa3542394a747aa39c29a061a93a8c1a5d65 (patch) | |
tree | b4960a072927a63e9ad304fd4c7cb7501a92bf2e /sql | |
parent | 4de973336f4fed6786da07f9c1a053330d2d1254 (diff) | |
download | mariadb-git-8086aa3542394a747aa39c29a061a93a8c1a5d65.tar.gz |
Fix for Bug #2075 - negative default values not accepted for integer columns
Allow numeric literals have a sign
sql/sql_yacc.yy:
Bug#2075 - Numeric literals need to handle sign.
mysql-test/r/create.result:
New test for Bug #2075
mysql-test/t/create.test:
New test for Bug #2075
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_yacc.yy | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0aa7e4c2738..e1262561ea8 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -627,6 +627,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); using_list expr_or_default set_expr_or_default interval_expr param_marker singlerow_subselect singlerow_subselect_init exists_subselect exists_subselect_init + NUM_literal %type <item_list> expr_list udf_expr_list when_list ident_list ident_list_arg @@ -4409,11 +4410,8 @@ param_marker: literal: text_literal { $$ = $1; } - | NUM { $$ = new Item_int($1.str, (longlong) strtol($1.str, NULL, 10),$1.length); } - | LONG_NUM { $$ = new Item_int($1.str, (longlong) strtoll($1.str,NULL,10), $1.length); } - | ULONGLONG_NUM { $$ = new Item_uint($1.str, $1.length); } - | REAL_NUM { $$ = new Item_real($1.str, $1.length); } - | FLOAT_NUM { $$ = new Item_float($1.str, $1.length); } + | opt_plus NUM_literal { $$ = $2; } + | '-' NUM_literal { $$ = new Item_func_neg($2); } | NULL_SYM { $$ = new Item_null(); Lex->next_state=MY_LEX_OPERATOR_OR_IDENT;} | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length);} @@ -4429,6 +4427,17 @@ literal: | TIME_SYM text_literal { $$ = $2; } | TIMESTAMP text_literal { $$ = $2; }; +opt_plus: + | '+' ; + +NUM_literal: + NUM { $$ = new Item_int($1.str, (longlong) strtol($1.str, NULL, 10),$1.length); } + | LONG_NUM { $$ = new Item_int($1.str, (longlong) strtoll($1.str,NULL,10), $1.length); } + | ULONGLONG_NUM { $$ = new Item_uint($1.str, $1.length); } + | REAL_NUM { $$ = new Item_real($1.str, $1.length); } + | FLOAT_NUM { $$ = new Item_float($1.str, $1.length); } + ; + /********************************************************************** ** Createing different items. **********************************************************************/ |