mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
Fix for Bug #2075 - negative default values not accepted for integer columns
Allow numeric literals have a sign
This commit is contained in:
parent
7576f1a81f
commit
7f83c17637
3 changed files with 35 additions and 5 deletions
|
@ -423,6 +423,17 @@ strnull varchar(10) YES NULL
|
|||
intg int(11) YES NULL
|
||||
rel double YES NULL
|
||||
drop table t1, t2;
|
||||
create table t1(name varchar(10), age smallint default -1);
|
||||
describe t1;
|
||||
Field Type Null Key Default Extra
|
||||
name varchar(10) YES NULL
|
||||
age smallint(6) YES -1
|
||||
create table t2(name varchar(10), age smallint default - 1);
|
||||
describe t2;
|
||||
Field Type Null Key Default Extra
|
||||
name varchar(10) YES NULL
|
||||
age smallint(6) YES -1
|
||||
drop table t1, t2;
|
||||
create database test_$1;
|
||||
use test_$1;
|
||||
select database();
|
||||
|
|
|
@ -330,6 +330,16 @@ create table t2 select default(str) as str, default(strnull) as strnull, default
|
|||
describe t2;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug #2075
|
||||
#
|
||||
|
||||
create table t1(name varchar(10), age smallint default -1);
|
||||
describe t1;
|
||||
create table t2(name varchar(10), age smallint default - 1);
|
||||
describe t2;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug #1209
|
||||
#
|
||||
|
|
|
@ -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.
|
||||
**********************************************************************/
|
||||
|
|
Loading…
Add table
Reference in a new issue