Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-07-22 02:15:36+04:00, evgen@stripped +7 -0
Merge epotemkin@stripped:/home/bk/mysql-5.0-opt
into moonbone.local:/work/autopush/12185-bug-5.0-opt-mysql
MERGE: 1.2149.18.1
mysql-test/r/create.result@stripped, 2006-07-22 02:09:49+04:00, evgen@stripped +0 -0
Auto merged
MERGE: 1.115.2.1
mysql-test/r/union.result@stripped, 2006-07-22 02:15:35+04:00, evgen@stripped +0 -0
SCCS merged
MERGE: 1.81.1.1
mysql-test/t/innodb.test@stripped, 2006-07-22 02:09:49+04:00, evgen@stripped +0 -0
Auto merged
MERGE: 1.132.1.1
mysql-test/t/union.test@stripped, 2006-07-22 02:15:35+04:00, evgen@stripped +0 -0
SCCS merged
MERGE: 1.94.1.1
sql/field.cc@stripped, 2006-07-22 02:09:49+04:00, evgen@stripped +0 -0
Auto merged
MERGE: 1.307.2.1
sql/field.h@stripped, 2006-07-22 02:09:50+04:00, evgen@stripped +0 -0
Auto merged
MERGE: 1.180.1.1
sql/item.cc@stripped, 2006-07-22 02:09:50+04:00, evgen@stripped +0 -0
Auto merged
MERGE: 1.224.3.1
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: evgen
# Host: moonbone.local
# Root: /work/autopush/12185-bug-5.0-opt-mysql/RESYNC
--- 1.314/sql/field.cc 2006-07-22 02:15:40 +04:00
+++ 1.315/sql/field.cc 2006-07-22 02:15:40 +04:00
@@ -4485,6 +4485,24 @@
}
+Field_timestamp::Field_timestamp(bool maybe_null_arg,
+ const char *field_name_arg,
+ struct st_table *table_arg, CHARSET_INFO *cs)
+ :Field_str((char*) 0, 19, maybe_null_arg ? (uchar*) "": 0, 0,
+ NONE, field_name_arg, table_arg, cs)
+{
+ /* For 4.0 MYD and 4.0 InnoDB compatibility */
+ flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
+ if (table && !table->timestamp_field &&
+ unireg_check != NONE)
+ {
+ /* This timestamp has auto-update */
+ table->timestamp_field= this;
+ flags|=TIMESTAMP_FLAG;
+ }
+}
+
+
/*
Get auto-set type for TIMESTAMP field.
--- 1.183/sql/field.h 2006-07-22 02:15:40 +04:00
+++ 1.184/sql/field.h 2006-07-22 02:15:40 +04:00
@@ -782,6 +782,8 @@
enum utype unireg_check_arg, const char *field_name_arg,
struct st_table *table_arg,
CHARSET_INFO *cs);
+ Field_timestamp(bool maybe_null_arg, const char *field_name_arg,
+ struct st_table *table_arg, CHARSET_INFO *cs);
enum_field_types type() const { return FIELD_TYPE_TIMESTAMP;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
enum Item_result cmp_type () const { return INT_RESULT; }
@@ -1129,6 +1131,21 @@
packlength(4)
{
flags|= BLOB_FLAG;
+ }
+ Field_blob(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
+ struct st_table *table_arg, CHARSET_INFO *cs, bool set_packlength)
+ :Field_longstr((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
+ NONE, field_name_arg, table_arg, cs)
+ {
+ flags|= BLOB_FLAG;
+ packlength= 4;
+ if (set_packlength)
+ {
+ uint32 char_lengt= len_arg/cs->mbmaxlen;
+ packlength= char_length <= 255 ? 1 :
+ char_length <= 65535 ? 2 :
+ char_length <= 16777215 ? 3 : 4;
+ }
}
enum_field_types type() const { return FIELD_TYPE_BLOB;}
enum ha_base_keytype key_type() const
--- 1.228/sql/item.cc 2006-07-22 02:15:40 +04:00
+++ 1.229/sql/item.cc 2006-07-22 02:15:40 +04:00
@@ -3903,7 +3903,9 @@
if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
return new Field_blob(max_length, maybe_null, name, table,
collation.collation);
- if (max_length > 0)
+ /* Item_type_holder holds the exact type, do not change it */
+ if (max_length > 0 &&
+ (type() != Item::TYPE_HOLDER || field_type() != MYSQL_TYPE_STRING))
return new Field_varstring(max_length, maybe_null, name, table,
collation.collation);
return new Field_string(max_length, maybe_null, name, table,
@@ -3967,6 +3969,7 @@
case MYSQL_TYPE_TIME:
return new Field_time(maybe_null, name, table, &my_charset_bin);
case MYSQL_TYPE_TIMESTAMP:
+ return new Field_timestamp(maybe_null, name, table, &my_charset_bin);
case MYSQL_TYPE_DATETIME:
return new Field_datetime(maybe_null, name, table, &my_charset_bin);
case MYSQL_TYPE_YEAR:
@@ -3990,7 +3993,11 @@
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_GEOMETRY:
- return new Field_blob(max_length, maybe_null, name, table,
+ if (this->type() == Item::TYPE_HOLDER)
+ return new Field_blob(max_length, maybe_null, name, table,
+ collation.collation, 1);
+ else
+ return new Field_blob(max_length, maybe_null, name, table,
collation.collation);
break; // Blob handled outside of case
}
@@ -6151,7 +6158,7 @@
case MYSQL_TYPE_DOUBLE:
return 53;
case MYSQL_TYPE_NULL:
- return 4;
+ return 0;
case MYSQL_TYPE_LONGLONG:
return 20;
case MYSQL_TYPE_INT24:
--- 1.82/mysql-test/r/union.result 2006-07-22 02:15:40 +04:00
+++ 1.83/mysql-test/r/union.result 2006-07-22 02:15:40 +04:00
@@ -691,9 +691,9 @@
`da` datetime default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
-create table t1 SELECT dt from t2 UNION select sc from t2;
-select * from t1;
-dt
+create table t1 SELECT dt from t2 UNION select trim(sc) from t2;
+select trim(dt) from t1;
+trim(dt)
1972-10-22 11:50:00
testc
show create table t1;
@@ -732,7 +732,7 @@
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `dt` longblob
+ `dt` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT sv from t2 UNION select b from t2;
@@ -743,7 +743,7 @@
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `sv` longblob
+ `sv` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT i from t2 UNION select d from t2 UNION select b from t2;
@@ -755,7 +755,7 @@
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` longblob
+ `i` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT sv from t2 UNION select tx from t2;
@@ -766,7 +766,7 @@
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `sv` longtext
+ `sv` text
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT b from t2 UNION select tx from t2;
@@ -777,7 +777,7 @@
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `b` longblob
+ `b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2;
create table t1 select 1 union select -1;
@@ -1306,6 +1306,21 @@
5
99
drop table t1;
+create table t1(f1 char(1), f2 char(5), f3 binary(1), f4 binary(5), f5 timestamp, f6 varchar(1) character set utf8 collate utf8_general_ci, f7 text);
+create table t2 as select *, f6 as f8 from t1 union select *, f7 from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `f1` char(1) default NULL,
+ `f2` char(5) default NULL,
+ `f3` binary(1) default NULL,
+ `f4` binary(5) default NULL,
+ `f5` timestamp NOT NULL default '0000-00-00 00:00:00',
+ `f6` varchar(1) character set utf8 default NULL,
+ `f7` text,
+ `f8` text character set utf8
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
(select avg(1)) union (select avg(1)) union (select avg(1)) union
(select avg(1)) union (select avg(1)) union (select avg(1)) union
(select avg(1)) union (select avg(1)) union (select avg(1)) union
--- 1.95/mysql-test/t/union.test 2006-07-22 02:15:40 +04:00
+++ 1.96/mysql-test/t/union.test 2006-07-22 02:15:40 +04:00
@@ -390,8 +390,8 @@
select * from t1;
show create table t1;
drop table t1;
-create table t1 SELECT dt from t2 UNION select sc from t2;
-select * from t1;
+create table t1 SELECT dt from t2 UNION select trim(sc) from t2;
+select trim(dt) from t1;
show create table t1;
drop table t1;
create table t1 SELECT dt from t2 UNION select sv from t2;
@@ -793,6 +793,14 @@
drop table t1;
# End of 4.1 tests
+
+#
+# Bug#12185: Data type aggregation may produce wrong result
+#
+create table t1(f1 char(1), f2 char(5), f3 binary(1), f4 binary(5), f5 timestamp, f6 varchar(1) character set utf8 collate utf8_general_ci, f7 text);
+create table t2 as select *, f6 as f8 from t1 union select *, f7 from t1;
+show create table t2;
+drop table t1, t2;
#
# Bug#18175: Union select over 129 tables with a sum function fails.
--- 1.119/mysql-test/r/create.result 2006-07-22 02:15:40 +04:00
+++ 1.120/mysql-test/r/create.result 2006-07-22 02:15:40 +04:00
@@ -452,7 +452,7 @@
`ifnull(h,h)` decimal(5,4) default NULL,
`ifnull(i,i)` year(4) default NULL,
`ifnull(j,j)` date default NULL,
- `ifnull(k,k)` datetime NOT NULL default '0000-00-00 00:00:00',
+ `ifnull(k,k)` timestamp NOT NULL default '0000-00-00 00:00:00',
`ifnull(l,l)` datetime default NULL,
`ifnull(m,m)` varchar(1) default NULL,
`ifnull(n,n)` varchar(3) default NULL,
--- 1.133/mysql-test/t/innodb.test 2006-07-22 02:15:40 +04:00
+++ 1.134/mysql-test/t/innodb.test 2006-07-22 02:15:40 +04:00
@@ -1079,7 +1079,7 @@
#
create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
-select name2 from t1 union all select name from t1 union all select id from t1;
+select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1;
drop table t1;
#
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.2209) | eugene | 22 Jul |