summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <brian@zim.tangent.org>2006-01-22 00:09:43 -0800
committerunknown <brian@zim.tangent.org>2006-01-22 00:09:43 -0800
commit4e69c153e31f16c2d46e9bd5cacc92b8e92cf00e (patch)
treea54852dae9d95a10f1e16c0ce05ecee700e8f1ba
parenta207c820e02d2fd9d25f06dcdea555410eaa1bb5 (diff)
parent49a09cc3397581d120d097f06b5b807925cfec8a (diff)
downloadmariadb-git-4e69c153e31f16c2d46e9bd5cacc92b8e92cf00e.tar.gz
Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.0
into zim.tangent.org:/home/brian/mysql/mysql-5.0
-rw-r--r--mysql-test/ndb/ndbcluster.sh2
-rw-r--r--mysql-test/r/subselect.result6
-rw-r--r--mysql-test/r/type_float.result22
-rw-r--r--mysql-test/t/func_math.test2
-rw-r--r--mysql-test/t/type_float.test17
-rw-r--r--sql/item_func.cc13
-rw-r--r--sql/spatial.h2
7 files changed, 56 insertions, 8 deletions
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh
index bc9aaf8caac..c09c013552e 100644
--- a/mysql-test/ndb/ndbcluster.sh
+++ b/mysql-test/ndb/ndbcluster.sh
@@ -134,7 +134,7 @@ if [ ! -x "$exec_waiter" ]; then
fi
exec_mgmtclient="$exec_mgmtclient --no-defaults $NDB_MGM_EXTRA_OPTS"
-exec_mgmtsrvr="$exec_mgmtsrvr $NDB_MGMD_EXTRA_OPTS"
+exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults $NDB_MGMD_EXTRA_OPTS"
exec_ndb="$exec_ndb --no-defaults $NDBD_EXTRA_OPTS"
exec_waiter="$exec_waiter --no-defaults"
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 6094d23b0d0..85976c211c5 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -215,9 +215,9 @@ select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from
a
select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)
-8 7.5000
-8 4.5000
-9 7.5000
+8 7.5
+8 4.5
+9 7.5
explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t4 ALL NULL NULL NULL NULL 3
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index c10cb7d71f7..fb8d0515c18 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -240,6 +240,28 @@ t3 CREATE TABLE `t3` (
`d` double(22,9) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2, t3;
+create table t1 select 105213674794682365.00 + 0.0 x;
+show warnings;
+Level Code Message
+desc t1;
+Field Type Null Key Default Extra
+x decimal(21,2) unsigned NO 0.00
+drop table t1;
+create table t1 select 0.0 x;
+desc t1;
+Field Type Null Key Default Extra
+x decimal(2,1) unsigned NO 0.0
+create table t2 select 105213674794682365.00 y;
+desc t2;
+Field Type Null Key Default Extra
+y decimal(20,2) unsigned NO 0.00
+create table t3 select x+y a from t1,t2;
+show warnings;
+Level Code Message
+desc t3;
+Field Type Null Key Default Extra
+a decimal(21,2) unsigned NO 0.00
+drop table t1,t2,t3;
create table t1 (s1 float(0,2));
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
create table t1 (s1 float(1,2));
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 24dd18daab1..9cf0ee452cd 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -121,7 +121,9 @@ drop table t1;
#
# InnoDB is required to reproduce the fault, but it is okay if we default to
# MyISAM when testing.
+--disable_warnings
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;
+--enable_warnings
insert into t1 values ('http://www.foo.com/', now());
select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
drop table t1;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index 6a0814ef113..79f29624e89 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -159,6 +159,23 @@ show create table t3;
drop table t1, t2, t3;
+#
+# Bug #9855 (inconsistent column type for create select
+#
+create table t1 select 105213674794682365.00 + 0.0 x;
+show warnings;
+desc t1;
+drop table t1;
+
+create table t1 select 0.0 x;
+desc t1;
+create table t2 select 105213674794682365.00 y;
+desc t2;
+create table t3 select x+y a from t1,t2;
+show warnings;
+desc t3;
+drop table t1,t2,t3;
+
# End of 4.1 tests
#
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 428a796682c..2d595e5fdc8 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -429,12 +429,19 @@ my_decimal *Item_real_func::val_decimal(my_decimal *decimal_value)
void Item_func::fix_num_length_and_dec()
{
- decimals= 0;
+ uint fl_length= 0;
+ decimals=0;
for (uint i=0 ; i < arg_count ; i++)
{
- set_if_bigger(decimals, args[i]->decimals);
+ set_if_bigger(decimals,args[i]->decimals);
+ set_if_bigger(fl_length, args[i]->max_length);
+ }
+ max_length=float_length(decimals);
+ if (fl_length > max_length)
+ {
+ decimals= NOT_FIXED_DEC;
+ max_length= float_length(NOT_FIXED_DEC);
}
- max_length= float_length(decimals);
}
diff --git a/sql/spatial.h b/sql/spatial.h
index 4253689c078..527dc750bdc 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -142,7 +142,7 @@ struct MBR
bool inner_point(double x, double y) const
{
/* The following should be safe, even if we compare doubles */
- return (xmin<x) && (xmax>x) && (ymin<y) && (ymax>x);
+ return (xmin<x) && (xmax>x) && (ymin<y) && (ymax>y);
}
int overlaps(const MBR *mbr)