diff options
-rwxr-xr-x | Build-tools/Do-compile | 6 | ||||
-rw-r--r-- | bdb/dist/aclocal/mutex.m4 | 2 | ||||
-rw-r--r-- | mysql-test/r/bigint.result | 21 | ||||
-rw-r--r-- | mysql-test/r/cast.result | 39 | ||||
-rw-r--r-- | mysql-test/r/constraints.result | 16 | ||||
-rw-r--r-- | mysql-test/r/func_time.result | 6 | ||||
-rw-r--r-- | mysql-test/r/innodb-deadlock.result | 20 | ||||
-rw-r--r-- | mysql-test/r/null_key.result | 33 | ||||
-rw-r--r-- | mysql-test/t/bigint.test | 8 | ||||
-rw-r--r-- | mysql-test/t/cast.test | 22 | ||||
-rw-r--r-- | mysql-test/t/constraints.test | 21 | ||||
-rw-r--r-- | mysql-test/t/func_time.test | 3 | ||||
-rw-r--r-- | mysql-test/t/innodb-deadlock.test | 38 | ||||
-rw-r--r-- | mysql-test/t/null_key.test | 21 | ||||
-rw-r--r-- | sql/item_create.cc | 1 | ||||
-rw-r--r-- | sql/item_func.h | 2 | ||||
-rw-r--r-- | sql/item_timefunc.h | 13 | ||||
-rw-r--r-- | sql/lex.h | 4 | ||||
-rw-r--r-- | sql/lock.cc | 4 | ||||
-rw-r--r-- | sql/mysqld.cc | 3 | ||||
-rw-r--r-- | sql/opt_range.cc | 18 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 19 |
22 files changed, 275 insertions, 45 deletions
diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 8d647ef0d82..52c1951f48f 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -72,6 +72,12 @@ if (@config_env > 0) $opt_config_env= join(" ", @config_env); } +if (@config_env > 0) +{ + chomp(@config_env); + $opt_config_env= join(" ", @config_env); +} + chomp($host=`hostname`); $full_host_name=$host; $connect_option= ($opt_tcpip ? "--host=$host" : ""); diff --git a/bdb/dist/aclocal/mutex.m4 b/bdb/dist/aclocal/mutex.m4 index a6b1fa1a053..5c9218da163 100644 --- a/bdb/dist/aclocal/mutex.m4 +++ b/bdb/dist/aclocal/mutex.m4 @@ -403,5 +403,7 @@ UTS/cc-assembly) ADDITIONAL_OBJS="$ADDITIONAL_OBJS uts4.cc${o}" AC_DEFINE(HAVE_MUTEX_UTS_CC_ASSEMBLY);; x86/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS" AC_DEFINE(HAVE_MUTEX_X86_GCC_ASSEMBLY);; +x86_64/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS" + AC_DEFINE(HAVE_MUTEX_X86_64_GCC_ASSEMBLY);; esac ])dnl diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index f666c5311b8..6afa74d20e2 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -52,24 +52,3 @@ select min(big),max(big),max(big)-1 from t1 group by a; min(big) max(big) max(big)-1 -1 9223372036854775807 9223372036854775806 drop table t1; -select CAST(1-2 AS UNSIGNED); -CAST(1-2 AS UNSIGNED) -18446744073709551615 -select CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER); -CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER) --1 -select CONVERT('-1',UNSIGNED); -CONVERT('-1',UNSIGNED) -18446744073709551615 -select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1; -cast(-5 as unsigned) | 1 cast(-5 as unsigned) & -1 -18446744073709551611 18446744073709551611 -select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1; -cast(-5 as unsigned) -1 cast(-5 as unsigned) + 1 -18446744073709551610 18446744073709551612 -select ~5, cast(~5 as signed); -~5 cast(~5 as signed) -18446744073709551610 -6 -select cast(5 as unsigned) -6.0; -cast(5 as unsigned) -6.0 --1.0 diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result new file mode 100644 index 00000000000..572b32c171c --- /dev/null +++ b/mysql-test/r/cast.result @@ -0,0 +1,39 @@ +select CAST(1-2 AS UNSIGNED); +CAST(1-2 AS UNSIGNED) +18446744073709551615 +select CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER); +CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER) +-1 +select CONVERT('-1',UNSIGNED); +CONVERT('-1',UNSIGNED) +18446744073709551615 +select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1; +cast(-5 as unsigned) | 1 cast(-5 as unsigned) & -1 +18446744073709551611 18446744073709551611 +select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1; +cast(-5 as unsigned) -1 cast(-5 as unsigned) + 1 +18446744073709551610 18446744073709551612 +select ~5, cast(~5 as signed); +~5 cast(~5 as signed) +18446744073709551610 -6 +select cast(5 as unsigned) -6.0; +cast(5 as unsigned) -6.0 +-1.0 +select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A"; +cast("A" as binary) = "a" cast(BINARY "a" as CHAR) = "A" +0 1 +select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME); +cast("2001-1-1" as DATE) cast("2001-1-1" as DATETIME) +2001-1-1 2001-1-1 +select cast("1:2:3" as TIME); +cast("1:2:3" as TIME) +1:2:3 +select cast("2001-1-1" as date) = "2001-01-01"; +cast("2001-1-1" as date) = "2001-01-01" +0 +select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00"; +cast("2001-1-1" as datetime) = "2001-01-01 00:00:00" +0 +select cast("1:2:3" as TIME) = "1:02:03"; +cast("1:2:3" as TIME) = "1:02:03" +0 diff --git a/mysql-test/r/constraints.result b/mysql-test/r/constraints.result new file mode 100644 index 00000000000..3b41e291e0f --- /dev/null +++ b/mysql-test/r/constraints.result @@ -0,0 +1,16 @@ +drop table if exists t1; +create table t1 (a int check (a>0)); +insert into t1 values (1); +insert into t1 values (0); +drop table t1; +create table t1 (a int ,b int, check a>b); +insert into t1 values (1,0); +insert into t1 values (0,1); +drop table t1; +create table t1 (a int ,b int, constraint abc check (a>b)); +insert into t1 values (1,0); +insert into t1 values (0,1); +drop table t1; +create table t1 (a int null); +insert into t1 values (1),(NULL); +drop table t1; diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 4a1012f73bf..2941352c776 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -24,6 +24,12 @@ now()-curdate()*1000000-curtime() select strcmp(current_timestamp(),concat(current_date()," ",current_time())); strcmp(current_timestamp(),concat(current_date()," ",current_time())) 0 +select strcmp(localtime(),concat(current_date()," ",current_time())); +strcmp(localtime(),concat(current_date()," ",current_time())) +0 +select strcmp(localtimestamp(),concat(current_date()," ",current_time())); +strcmp(localtimestamp(),concat(current_date()," ",current_time())) +0 select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"); date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w") January Thursday 2nd 1997 97 01 02 03 04 05 4 diff --git a/mysql-test/r/innodb-deadlock.result b/mysql-test/r/innodb-deadlock.result new file mode 100644 index 00000000000..121bfa8c6cb --- /dev/null +++ b/mysql-test/r/innodb-deadlock.result @@ -0,0 +1,20 @@ +drop table if exists t1; +create table t1 (id integer, x integer) type=INNODB; +insert into t1 values(0, 0); +set autocommit=0; +SELECT * from t1 where id = 0 FOR UPDATE; +id x +0 0 +set autocommit=0; +update t1 set x=2 where id = 0; +update t1 set x=1 where id = 0; +select * from t1; +id x +0 1 +commit; +commit; +select * from t1; +id x +0 2 +commit; +drop table t1; diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index ce397e11c1a..236def64b5e 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -228,3 +228,36 @@ alter table t1 add key id (id); select * from t1, t2 where t1.id = t2.id; id id drop table t1,t2; +create table t1 ( +id integer, +id2 integer not null, +index (id), +index (id2) +); +insert into t1 values(null,null),(1,1); +select * from t1; +id id2 +NULL 0 +1 1 +select * from t1 where id <=> null; +id id2 +NULL 0 +select * from t1 where id <=> null or id > 0; +id id2 +NULL 0 +1 1 +select * from t1 where id is null or id > 0; +id id2 +NULL 0 +1 1 +select * from t1 where id2 <=> null or id2 > 0; +id id2 +1 1 +select * from t1 where id2 is null or id2 > 0; +id id2 +1 1 +delete from t1 where id <=> NULL; +select * from t1; +id id2 +1 1 +drop table t1; diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 15b35ac7c87..15c61c2c0dc 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -35,11 +35,3 @@ alter table t1 modify big bigint not null; select min(big),max(big),max(big)-1 from t1; select min(big),max(big),max(big)-1 from t1 group by a; drop table t1; - -select CAST(1-2 AS UNSIGNED); -select CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER); -select CONVERT('-1',UNSIGNED); -select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1; -select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1; -select ~5, cast(~5 as signed); -select cast(5 as unsigned) -6.0; diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test new file mode 100644 index 00000000000..7a120ef5005 --- /dev/null +++ b/mysql-test/t/cast.test @@ -0,0 +1,22 @@ +# +# Test of cast function +# + +select CAST(1-2 AS UNSIGNED); +select CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER); +select CONVERT('-1',UNSIGNED); +select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1; +select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1; +select ~5, cast(~5 as signed); +select cast(5 as unsigned) -6.0; +select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A"; +select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME); +select cast("1:2:3" as TIME); + +# +# The following should be fixed in 4.1 +# + +select cast("2001-1-1" as date) = "2001-01-01"; +select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00"; +select cast("1:2:3" as TIME) = "1:02:03"; diff --git a/mysql-test/t/constraints.test b/mysql-test/t/constraints.test new file mode 100644 index 00000000000..8682cdc42a2 --- /dev/null +++ b/mysql-test/t/constraints.test @@ -0,0 +1,21 @@ +# +# Testing of constraints +# Currently MySQL only ignores the syntax. +# +drop table if exists t1; + +create table t1 (a int check (a>0)); +insert into t1 values (1); +insert into t1 values (0); +drop table t1; +create table t1 (a int ,b int, check a>b); +insert into t1 values (1,0); +insert into t1 values (0,1); +drop table t1; +create table t1 (a int ,b int, constraint abc check (a>b)); +insert into t1 values (1,0); +insert into t1 values (0,1); +drop table t1; +create table t1 (a int null); +insert into t1 values (1),(NULL); +drop table t1; diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 2ff57959965..dd589ff2e66 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -12,6 +12,8 @@ select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"), select sec_to_time(time_to_sec('-838:59:59')); select now()-curdate()*1000000-curtime(); select strcmp(current_timestamp(),concat(current_date()," ",current_time())); +select strcmp(localtime(),concat(current_date()," ",current_time())); +select strcmp(localtimestamp(),concat(current_date()," ",current_time())); select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"); select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w")); select dayofmonth("1997-01-02"),dayofmonth(19970323); @@ -164,6 +166,7 @@ select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(t),to_days(c) from t select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1; drop table t1; + # # Test problem with TIMESTAMP and BETWEEN # diff --git a/mysql-test/t/innodb-deadlock.test b/mysql-test/t/innodb-deadlock.test new file mode 100644 index 00000000000..bc2839bfb3a --- /dev/null +++ b/mysql-test/t/innodb-deadlock.test @@ -0,0 +1,38 @@ +-- source include/have_innodb.inc + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); +drop table if exists t1; + +# +# Testing of FOR UPDATE +# + +connection con1; +create table t1 (id integer, x integer) type=INNODB; +insert into t1 values(0, 0); +set autocommit=0; +SELECT * from t1 where id = 0 FOR UPDATE; + +connection con2; +set autocommit=0; + +# The following query should hang because con1 is locking the page +--send +update t1 set x=2 where id = 0; +--sleep 2; + +connection con1; +update t1 set x=1 where id = 0; +select * from t1; +commit; + +connection con2; +reap; +commit; + +connection con1; +select * from t1; +commit; + +drop table t1; diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test index 3ab8b993f43..b1cbd5cdfb0 100644 --- a/mysql-test/t/null_key.test +++ b/mysql-test/t/null_key.test @@ -135,3 +135,24 @@ select * from t1, t2 where t1.id = t2.id; alter table t1 add key id (id); select * from t1, t2 where t1.id = t2.id; drop table t1,t2; + +# +# Check bug when doing <=> NULL on an indexed null field +# + +create table t1 ( + id integer, + id2 integer not null, + index (id), + index (id2) +); +insert into t1 values(null,null),(1,1); +select * from t1; +select * from t1 where id <=> null; +select * from t1 where id <=> null or id > 0; +select * from t1 where id is null or id > 0; +select * from t1 where id2 <=> null or id2 > 0; +select * from t1 where id2 is null or id2 > 0; +delete from t1 where id <=> NULL; +select * from t1; +drop table t1; diff --git a/sql/item_create.cc b/sql/item_create.cc index f28e3248c61..c5f53f0d040 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -425,6 +425,7 @@ Item *create_func_cast(Item *a, Item_cast cast_type) LINT_INIT(res); switch (cast_type) { case ITEM_CAST_BINARY: res= new Item_func_binary(a); break; + case ITEM_CAST_CHAR: res= new Item_char_typecast(a); break; case ITEM_CAST_SIGNED_INT: res= new Item_func_signed(a); break; case ITEM_CAST_UNSIGNED_INT: res= new Item_func_unsigned(a); break; case ITEM_CAST_DATE: res= new Item_date_typecast(a); break; diff --git a/sql/item_func.h b/sql/item_func.h index 2e02d7cfd28..b7e0cee540a 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1003,7 +1003,7 @@ public: enum Item_cast { ITEM_CAST_BINARY, ITEM_CAST_SIGNED_INT, ITEM_CAST_UNSIGNED_INT, - ITEM_CAST_DATE, ITEM_CAST_TIME, ITEM_CAST_DATETIME + ITEM_CAST_DATE, ITEM_CAST_TIME, ITEM_CAST_DATETIME, ITEM_CAST_CHAR }; Item *create_func_cast(Item *a, Item_cast cast_type); diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 0fe487b7983..c0255e71d27 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -410,6 +410,7 @@ public: unsigned int size_of() { return sizeof(*this);} }; + class Item_extract :public Item_int_func { const interval_type int_type; @@ -424,10 +425,12 @@ class Item_extract :public Item_int_func unsigned int size_of() { return sizeof(*this);} }; + class Item_typecast :public Item_str_func { public: Item_typecast(Item *a) :Item_str_func(a) {} + const char *func_name() const { return "char"; } String *val_str(String *a) { a=args[0]->val_str(a); null_value=args[0]->null_value; return a; } void fix_length_and_dec() { max_length=args[0]->max_length; } @@ -435,6 +438,14 @@ public: }; +class Item_char_typecast :public Item_typecast +{ +public: + Item_char_typecast(Item *a) :Item_typecast(a) {} + void fix_length_and_dec() { binary=0; max_length=args[0]->max_length; } +}; + + class Item_date_typecast :public Item_typecast { public: @@ -450,6 +461,7 @@ public: } }; + class Item_time_typecast :public Item_typecast { public: @@ -465,6 +477,7 @@ public: } }; + class Item_datetime_typecast :public Item_typecast { public: diff --git a/sql/lex.h b/sql/lex.h index 49b6a3811e5..717e8a355ca 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -210,6 +210,8 @@ static SYMBOL symbols[] = { { "LIMIT", SYM(LIMIT),0,0}, { "LOAD", SYM(LOAD),0,0}, { "LOCAL", SYM(LOCAL_SYM),0,0}, + { "LOCALTIME", SYM(NOW_SYM),0,0}, + { "LOCALTIMESTAMP", SYM(NOW_SYM),0,0}, { "LOCK", SYM(LOCK_SYM),0,0}, { "LOCKS", SYM(LOCKS_SYM),0,0}, { "LOGS", SYM(LOGS_SYM),0,0}, @@ -394,7 +396,9 @@ static SYMBOL sql_functions[] = { { "BIT_OR", SYM(BIT_OR),0,0}, { "BIT_AND", SYM(BIT_AND),0,0}, { "CAST", SYM(CAST_SYM),0,0}, + { "CEIL", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)}, { "CEILING", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)}, + { "CURRENT_USER", SYM(USER),0,0}, { "BIT_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_bit_length)}, { "CHAR_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)}, { "CHARACTER_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)}, diff --git a/sql/lock.cc b/sql/lock.cc index 15878fe7d15..4c84bbb6e69 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -117,7 +117,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **tables,uint count) thd->proc_info=0; break; } - thd->proc_info=0; + thd->proc_info="Table lock"; thd->locked=1; if (thr_multi_lock(sql_lock->locks,sql_lock->lock_count)) { @@ -136,6 +136,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **tables,uint count) thd->locked=0; break; } + thd->proc_info=0; /* some table was altered or deleted. reopen tables marked deleted */ mysql_unlock_tables(thd,sql_lock); @@ -145,6 +146,7 @@ retry: if (wait_for_tables(thd)) break; // Couldn't open tables } + thd->proc_info=0; if (thd->killed) { my_error(ER_SERVER_SHUTDOWN,MYF(0)); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ffe3d1be47c..a60fee84d0b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4228,7 +4228,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), else { struct hostent *ent; - if (!argument || !argument[0]) + if (argument || argument[0]) ent=gethostbyname(argument); else { @@ -4417,7 +4417,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), } return 0; } - /* Initiates DEBUG - but no debugging here ! */ static void get_options(int argc,char **argv) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index f33a2d312b4..d1f99604959 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -936,8 +936,11 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part, if (!(res= value->val_str(&tmp))) DBUG_RETURN(&null_element); - // Check if this was a function. This should have be optimized away - // in the sql_select.cc + /* + TODO: + Check if this was a function. This should have be optimized away + in the sql_select.cc + */ if (res != &tmp) { tmp.copy(*res); // Get own copy @@ -1017,8 +1020,10 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part, type != Item_func::EQUAL_FUNC) DBUG_RETURN(0); // Can't optimize this - /* We can't always use indexes when comparing a string index to a number */ - /* cmp_type() is checked to allow compare of dates to numbers */ + /* + We can't always use indexes when comparing a string index to a number + cmp_type() is checked to allow compare of dates to numbers + */ if (field->result_type() == STRING_RESULT && value->result_type() != STRING_RESULT && field->cmp_type() != value->result_type()) @@ -1026,6 +1031,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part, if (value->save_in_field(field)) { + /* This happens when we try to insert a NULL field in a not null column */ // TODO; Check if we can we remove the following block. if (type == Item_func::EQUAL_FUNC) { @@ -1037,7 +1043,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part, *str = 1; DBUG_RETURN(new SEL_ARG(field,str,str)); } - DBUG_RETURN(&null_element); // NULL is never true + DBUG_RETURN(&null_element); // cmp with NULL is never true } // Get local copy of key char *str= (char*) alloc_root(param->mem_root, @@ -1045,7 +1051,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part, if (!str) DBUG_RETURN(0); if (maybe_null) - *str=0; // Not NULL + *str= (char) field->is_real_null(); // Set to 1 if null field->get_key_image(str+maybe_null,key_part->part_length); if (!(tree=new SEL_ARG(field,str,str))) DBUG_RETURN(0); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index f6a0c483bb9..c3c6d8ad66b 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -899,7 +899,7 @@ field_list: field_list_item: - field_spec + field_spec check_constraint | field_spec references { Lex->col_list.empty(); /* Alloced by sql_alloc */ @@ -914,10 +914,16 @@ field_list_item: { Lex->col_list.empty(); /* Alloced by sql_alloc */ } - | opt_constraint CHECK_SYM '(' expr ')' + | opt_constraint check_constraint { Lex->col_list.empty(); /* Alloced by sql_alloc */ - }; + } + ; + +check_constraint: + /* empty */ + | CHECK_SYM expr + ; opt_constraint: /* empty */ @@ -1986,13 +1992,15 @@ in_sum_expr: cast_type: BINARY { $$=ITEM_CAST_BINARY; } + | CHAR_SYM { $$=ITEM_CAST_CHAR; } | SIGNED_SYM { $$=ITEM_CAST_SIGNED_INT; } | SIGNED_SYM INT_SYM { $$=ITEM_CAST_SIGNED_INT; } | UNSIGNED { $$=ITEM_CAST_UNSIGNED_INT; } | UNSIGNED INT_SYM { $$=ITEM_CAST_UNSIGNED_INT; } | DATE_SYM { $$=ITEM_CAST_DATE; } | TIME_SYM { $$=ITEM_CAST_TIME; } - | DATETIME { $$=ITEM_CAST_DATETIME; }; + | DATETIME { $$=ITEM_CAST_DATETIME; } + ; expr_list: { Select->expr_list.push_front(new List<Item>); } @@ -2437,7 +2445,7 @@ table_name: { if (!add_table_to_list($1,NULL,1)) YYABORT; }; if_exists: - /* empty */ { $$=0; } + /* empty */ { $$= 0; } | IF EXISTS { $$= 1; } ; @@ -3154,7 +3162,6 @@ keyword: | CACHE_SYM {} | CHANGED {} | CHECKSUM_SYM {} - | CHECK_SYM {} | CIPHER_SYM {} | CLIENT_SYM {} | CLOSE_SYM {} |