diff options
author | unknown <hf@deer.(none)> | 2005-10-25 22:04:20 +0500 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2005-10-25 22:04:20 +0500 |
commit | 015f5bd553b9e5cca95a35eec468257e7928e9c9 (patch) | |
tree | 257aaa7e3931e4b30212ab87e0ce0b9e825e2947 | |
parent | 54d1558c2f5b74c79e629e17f2bd57c7c0c83e3b (diff) | |
parent | e579fe3eee0f6e0551777ae6c07861bf5af511f3 (diff) | |
download | mariadb-git-015f5bd553b9e5cca95a35eec468257e7928e9c9.tar.gz |
Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-5.0
into deer.(none):/home/hf/work/mysql-5.0.12267
sql/sql_yacc.yy:
Auto merged
-rw-r--r-- | mysql-test/r/func_math.result | 27 | ||||
-rw-r--r-- | mysql-test/r/gis.result | 8 | ||||
-rw-r--r-- | mysql-test/r/type_newdecimal.result | 2 | ||||
-rw-r--r-- | mysql-test/t/func_math.test | 12 | ||||
-rw-r--r-- | mysql-test/t/gis.test | 11 | ||||
-rw-r--r-- | mysql-test/t/type_newdecimal.test | 6 | ||||
-rw-r--r-- | sql/item_func.cc | 38 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 6 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 4 |
10 files changed, 107 insertions, 9 deletions
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 5b6c29f87fb..b7ba2273956 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -170,3 +170,30 @@ insert into t1 values (1); select rand(i) from t1; ERROR HY000: Incorrect arguments to RAND drop table t1; +set sql_mode='traditional'; +select ln(-1); +ln(-1) +NULL +Warnings: +Error 1365 Division by 0 +select log10(-1); +log10(-1) +NULL +Warnings: +Error 1365 Division by 0 +select log2(-1); +log2(-1) +NULL +Warnings: +Error 1365 Division by 0 +select log(2,-1); +log(2,-1) +NULL +Warnings: +Error 1365 Division by 0 +select log(-2,1); +log(-2,1) +NULL +Warnings: +Error 1365 Division by 0 +set sql_mode=''; diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 78014137b50..90857ecfc6d 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -680,3 +680,11 @@ select astext(fn3()); astext(fn3()) POINT(1 1) drop function fn3; +create table t1(pt POINT); +alter table t1 add primary key pti(pt); +drop table t1; +create table t1(pt GEOMETRY); +alter table t1 add primary key pti(pt); +ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key length +alter table t1 add primary key pti(pt(20)); +drop table t1; diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index be5e29ab662..dbae646c362 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -1019,3 +1019,5 @@ drop procedure wg2; select cast(@non_existing_user_var/2 as DECIMAL); cast(@non_existing_user_var/2 as DECIMAL) NULL +create table t (d decimal(0,10)); +ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'd'). diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index 633e36f51ab..2935f24f2d7 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -117,3 +117,15 @@ select rand(i) from t1; drop table t1; # End of 4.1 tests + +# +# Bug #13820 (No warning on log(negative) +# +set sql_mode='traditional'; +select ln(-1); +select log10(-1); +select log2(-1); +select log(2,-1); +select log(-2,1); +set sql_mode=''; + diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index aba2f33833a..142bd29fa2d 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -395,3 +395,14 @@ show create function fn3; select astext(fn3()); drop function fn3; +# +# Bug #12267 (primary key over GIS) +# +create table t1(pt POINT); +alter table t1 add primary key pti(pt); +drop table t1; +create table t1(pt GEOMETRY); +--error 1170 +alter table t1 add primary key pti(pt); +alter table t1 add primary key pti(pt(20)); +drop table t1; diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 3f04aa931d2..a7087d46dca 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -1044,3 +1044,9 @@ drop procedure wg2; # select cast(@non_existing_user_var/2 as DECIMAL); + +# +# Bug #13667 (Inconsistency for decimal(m,d) specification +# +--error 1427 +create table t (d decimal(0,10)); diff --git a/sql/item_func.cc b/sql/item_func.cc index 35ed9b615f2..92d57d826a5 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1386,8 +1386,13 @@ double Item_func_ln::val_real() { DBUG_ASSERT(fixed == 1); double value= args[0]->val_real(); - if ((null_value=(args[0]->null_value || value <= 0.0))) + if ((null_value=args[0]->null_value)) + return 0.0; + if ((null_value= value <=0.0)) + { + signal_divide_by_null(); return 0.0; + } return log(value); } @@ -1400,13 +1405,23 @@ double Item_func_log::val_real() { DBUG_ASSERT(fixed == 1); double value= args[0]->val_real(); - if ((null_value=(args[0]->null_value || value <= 0.0))) + if ((null_value=args[0]->null_value)) + return 0.0; + if ((null_value= value <=0.0)) + { + signal_divide_by_null(); return 0.0; + } if (arg_count == 2) { double value2= args[1]->val_real(); - if ((null_value=(args[1]->null_value || value2 <= 0.0 || value == 1.0))) + if ((null_value=args[1]->null_value)) return 0.0; + if ((null_value= value2 <=0.0) || (value == 1.0)) + { + signal_divide_by_null(); + return 0.0; + } return log(value2) / log(value); } return log(value); @@ -1416,8 +1431,14 @@ double Item_func_log2::val_real() { DBUG_ASSERT(fixed == 1); double value= args[0]->val_real(); - if ((null_value=(args[0]->null_value || value <= 0.0))) + + if ((null_value=args[0]->null_value)) return 0.0; + if ((null_value= value <=0.0)) + { + signal_divide_by_null(); + return 0.0; + } return log(value) / M_LN2; } @@ -1425,8 +1446,13 @@ double Item_func_log10::val_real() { DBUG_ASSERT(fixed == 1); double value= args[0]->val_real(); - if ((null_value=(args[0]->null_value || value <= 0.0))) - return 0.0; /* purecov: inspected */ + if ((null_value=args[0]->null_value)) + return 0.0; + if ((null_value= value <=0.0)) + { + signal_divide_by_null(); + return 0.0; + } return log10(value); } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d0585dd1a65..33020fccd8e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5791,7 +5791,7 @@ new_create_field(THD *thd, char *field_name, enum_field_types type, case FIELD_TYPE_NULL: break; case FIELD_TYPE_NEWDECIMAL: - if (!length) + if (!length && !new_field->decimals) new_field->length= 10; if (new_field->length > DECIMAL_MAX_PRECISION) { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1e96891113b..56a55d9fbc0 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1149,13 +1149,17 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, { column->length*= sql_field->charset->mbmaxlen; - if (f_is_blob(sql_field->pack_flag)) + if (f_is_blob(sql_field->pack_flag) || + (f_is_geom(sql_field->pack_flag) && key->type != Key::SPATIAL)) { if (!(file->table_flags() & HA_CAN_INDEX_BLOBS)) { my_error(ER_BLOB_USED_AS_KEY, MYF(0), column->field_name); DBUG_RETURN(-1); } + if (f_is_geom(sql_field->pack_flag) && sql_field->geom_type == + Field::GEOM_POINT) + column->length= 21; if (!column->length) { my_error(ER_BLOB_KEY_WITHOUT_LENGTH, MYF(0), column->field_name); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index e0493eab121..fb77f01d38c 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2982,7 +2982,9 @@ type: spatial_type: GEOMETRY_SYM { $$= Field::GEOM_GEOMETRY; } | GEOMETRYCOLLECTION { $$= Field::GEOM_GEOMETRYCOLLECTION; } - | POINT_SYM { $$= Field::GEOM_POINT; } + | POINT_SYM { Lex->length= (char*)"21"; + $$= Field::GEOM_POINT; + } | MULTIPOINT { $$= Field::GEOM_MULTIPOINT; } | LINESTRING { $$= Field::GEOM_LINESTRING; } | MULTILINESTRING { $$= Field::GEOM_MULTILINESTRING; } |