MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:mhansson Date:December 18 2007 9:30am
Subject:bk commit into 5.0 tree (mhansson:1.2498) BUG#20765
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of martin. When martin 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, 2007-12-18 10:30:45+01:00, mhansson@stripped +12 -0
  Bug #20765: Subselect causes datatype to be changed erroneously
  
  When blob fields are created from functions results and other fields as in 
  CREATE TABLE ... SELECT ..., they are always created with the greatest 
  possible length, regardless of the length of the field they 
  originate from. 
  Fixed by taking into account the original length when creating fields from 
  existing Item's.

  mysql-test/r/create.result@stripped, 2007-12-18 10:30:40+01:00, mhansson@stripped +1 -1
    bug#20765: Changed test result.

  mysql-test/r/ps_2myisam.result@stripped, 2007-12-18 10:30:41+01:00, mhansson@stripped +16 -16
    bug#20765: Changed test result.

  mysql-test/r/ps_3innodb.result@stripped, 2007-12-18 10:30:41+01:00, mhansson@stripped +16 -16
    bug#20765: Changed test result.

  mysql-test/r/ps_4heap.result@stripped, 2007-12-18 10:30:41+01:00, mhansson@stripped +16 -16
    bug#20765: Changed test result.

  mysql-test/r/ps_5merge.result@stripped, 2007-12-18 10:30:41+01:00, mhansson@stripped +32 -32
    bug#20765: Changed test result.

  mysql-test/r/type_blob.result@stripped, 2007-12-18 10:30:41+01:00, mhansson@stripped +32 -1
    bug#20765: Correct test result

  mysql-test/r/type_ranges.result@stripped, 2007-12-18 10:30:41+01:00, mhansson@stripped +2 -2
    bug#20765: Changed test result.

  mysql-test/r/union.result@stripped, 2007-12-18 10:30:41+01:00, mhansson@stripped +1 -1
    bug#20765: Changed test result.

  mysql-test/r/user_var.result@stripped, 2007-12-18 10:30:41+01:00, mhansson@stripped +3 -3
    bug#20765: Changed test result.

  mysql-test/r/variables.result@stripped, 2007-12-18 10:30:41+01:00, mhansson@stripped +1 -1
    bug#20765: Changed test result.

  mysql-test/t/type_blob.test@stripped, 2007-12-18 10:30:41+01:00, mhansson@stripped +29 -0
    bug#20765: Test case

  sql/item.cc@stripped, 2007-12-18 10:30:41+01:00, mhansson@stripped +3 -3
    bug#20765: Added the choice to always create a blob field if the original field 
    was blob or text, and preserving length unconditionally when creating blob fields.

# 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:	mhansson
# Host:	linux-st28.site
# Root:	/home/martin/mysql/src/bug20765/my50-bug20765

--- 1.269/sql/item.cc	2007-05-18 19:09:12 +02:00
+++ 1.270/sql/item.cc	2007-12-18 10:30:41 +01:00
@@ -4196,10 +4196,10 @@ bool Item::is_datetime()
 Field *Item::make_string_field(TABLE *table)
 {
   DBUG_ASSERT(collation.collation);
-  if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
+  if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB
+      || field_type() == MYSQL_TYPE_BLOB)
     return new Field_blob(max_length, maybe_null, name, table,
-                          collation.collation);
-  /* Item_type_holder holds the exact type, do not change it */
+                          collation.collation, true);
   if (max_length > 0 &&
       (type() != Item::TYPE_HOLDER || field_type() != MYSQL_TYPE_STRING))
     return new Field_varstring(max_length, maybe_null, name, table,

--- 1.91/mysql-test/r/union.result	2007-03-22 14:58:37 +01:00
+++ 1.92/mysql-test/r/union.result	2007-12-18 10:30:41 +01:00
@@ -1284,7 +1284,7 @@ create table t3 SELECT left(a,100000000)
 show create table t3;
 Table	Create Table
 t3	CREATE TABLE `t3` (
-  `left(a,100000000)` longtext
+  `left(a,100000000)` mediumtext
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop tables t1,t2,t3;
 create table t1 ( id int not null auto_increment, primary key (id), col1 int);

--- 1.47/mysql-test/r/ps_2myisam.result	2007-05-21 10:02:01 +02:00
+++ 1.48/mysql-test/r/ps_2myisam.result	2007-12-18 10:30:41 +01:00
@@ -1782,17 +1782,17 @@ t5	CREATE TABLE `t5` (
   `const03` double NOT NULL default '0',
   `param03` double default NULL,
   `const04` varchar(3) NOT NULL default '',
-  `param04` longtext,
+  `param04` text,
   `const05` varbinary(3) NOT NULL default '',
-  `param05` longblob,
+  `param05` blob,
   `const06` varchar(10) NOT NULL default '',
-  `param06` longtext,
+  `param06` text,
   `const07` date default NULL,
-  `param07` longblob,
+  `param07` blob,
   `const08` varchar(19) NOT NULL default '',
-  `param08` longtext,
+  `param08` text,
   `const09` datetime default NULL,
-  `param09` longblob,
+  `param09` blob,
   `const10` int(10) NOT NULL default '0',
   `param10` bigint(20) default NULL,
   `const11` int(4) default NULL,
@@ -1800,8 +1800,8 @@ t5	CREATE TABLE `t5` (
   `const12` binary(0) default NULL,
   `param12` bigint(20) default NULL,
   `param13` decimal(65,30) default NULL,
-  `param14` longtext,
-  `param15` longblob
+  `param14` text,
+  `param15` blob
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 select * from t5 ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
@@ -1812,17 +1812,17 @@ def	test	t5	t5	param02	param02	246	67	32
 def	test	t5	t5	const03	const03	5	17	1	N	32769	31	63
 def	test	t5	t5	param03	param03	5	23	1	Y	32768	31	63
 def	test	t5	t5	const04	const04	253	3	3	N	1	0	8
-def	test	t5	t5	param04	param04	252	4294967295	3	Y	16	0	8
+def	test	t5	t5	param04	param04	252	65535	3	Y	16	0	8
 def	test	t5	t5	const05	const05	253	3	3	N	129	0	63
-def	test	t5	t5	param05	param05	252	4294967295	3	Y	144	0	63
+def	test	t5	t5	param05	param05	252	65535	3	Y	144	0	63
 def	test	t5	t5	const06	const06	253	10	10	N	1	0	8
-def	test	t5	t5	param06	param06	252	4294967295	10	Y	16	0	8
+def	test	t5	t5	param06	param06	252	65535	10	Y	16	0	8
 def	test	t5	t5	const07	const07	10	10	10	Y	128	0	63
-def	test	t5	t5	param07	param07	252	4294967295	10	Y	144	0	63
+def	test	t5	t5	param07	param07	252	65535	10	Y	144	0	63
 def	test	t5	t5	const08	const08	253	19	19	N	1	0	8
-def	test	t5	t5	param08	param08	252	4294967295	19	Y	16	0	8
+def	test	t5	t5	param08	param08	252	65535	19	Y	16	0	8
 def	test	t5	t5	const09	const09	12	19	19	Y	128	0	63
-def	test	t5	t5	param09	param09	252	4294967295	19	Y	144	0	63
+def	test	t5	t5	param09	param09	252	65535	19	Y	144	0	63
 def	test	t5	t5	const10	const10	3	10	9	N	32769	0	63
 def	test	t5	t5	param10	param10	8	20	9	Y	32768	0	63
 def	test	t5	t5	const11	const11	3	4	4	Y	32768	0	63
@@ -1830,8 +1830,8 @@ def	test	t5	t5	param11	param11	8	20	4	Y	
 def	test	t5	t5	const12	const12	254	0	0	Y	128	0	63
 def	test	t5	t5	param12	param12	8	20	0	Y	32768	0	63
 def	test	t5	t5	param13	param13	246	67	0	Y	0	30	63
-def	test	t5	t5	param14	param14	252	4294967295	0	Y	16	0	8
-def	test	t5	t5	param15	param15	252	4294967295	0	Y	144	0	63
+def	test	t5	t5	param14	param14	252	65535	0	Y	16	0	8
+def	test	t5	t5	param15	param15	252	65535	0	Y	144	0	63
 const01	8
 param01	8
 const02	8.0

--- 1.50/mysql-test/r/ps_3innodb.result	2007-05-21 10:02:01 +02:00
+++ 1.51/mysql-test/r/ps_3innodb.result	2007-12-18 10:30:41 +01:00
@@ -1765,17 +1765,17 @@ t5	CREATE TABLE `t5` (
   `const03` double NOT NULL default '0',
   `param03` double default NULL,
   `const04` varchar(3) NOT NULL default '',
-  `param04` longtext,
+  `param04` text,
   `const05` varbinary(3) NOT NULL default '',
-  `param05` longblob,
+  `param05` blob,
   `const06` varchar(10) NOT NULL default '',
-  `param06` longtext,
+  `param06` text,
   `const07` date default NULL,
-  `param07` longblob,
+  `param07` blob,
   `const08` varchar(19) NOT NULL default '',
-  `param08` longtext,
+  `param08` text,
   `const09` datetime default NULL,
-  `param09` longblob,
+  `param09` blob,
   `const10` int(10) NOT NULL default '0',
   `param10` bigint(20) default NULL,
   `const11` int(4) default NULL,
@@ -1783,8 +1783,8 @@ t5	CREATE TABLE `t5` (
   `const12` binary(0) default NULL,
   `param12` bigint(20) default NULL,
   `param13` decimal(65,30) default NULL,
-  `param14` longtext,
-  `param15` longblob
+  `param14` text,
+  `param15` blob
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 select * from t5 ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
@@ -1795,17 +1795,17 @@ def	test	t5	t5	param02	param02	246	67	32
 def	test	t5	t5	const03	const03	5	17	1	N	32769	31	63
 def	test	t5	t5	param03	param03	5	23	1	Y	32768	31	63
 def	test	t5	t5	const04	const04	253	3	3	N	1	0	8
-def	test	t5	t5	param04	param04	252	4294967295	3	Y	16	0	8
+def	test	t5	t5	param04	param04	252	65535	3	Y	16	0	8
 def	test	t5	t5	const05	const05	253	3	3	N	129	0	63
-def	test	t5	t5	param05	param05	252	4294967295	3	Y	144	0	63
+def	test	t5	t5	param05	param05	252	65535	3	Y	144	0	63
 def	test	t5	t5	const06	const06	253	10	10	N	1	0	8
-def	test	t5	t5	param06	param06	252	4294967295	10	Y	16	0	8
+def	test	t5	t5	param06	param06	252	65535	10	Y	16	0	8
 def	test	t5	t5	const07	const07	10	10	10	Y	128	0	63
-def	test	t5	t5	param07	param07	252	4294967295	10	Y	144	0	63
+def	test	t5	t5	param07	param07	252	65535	10	Y	144	0	63
 def	test	t5	t5	const08	const08	253	19	19	N	1	0	8
-def	test	t5	t5	param08	param08	252	4294967295	19	Y	16	0	8
+def	test	t5	t5	param08	param08	252	65535	19	Y	16	0	8
 def	test	t5	t5	const09	const09	12	19	19	Y	128	0	63
-def	test	t5	t5	param09	param09	252	4294967295	19	Y	144	0	63
+def	test	t5	t5	param09	param09	252	65535	19	Y	144	0	63
 def	test	t5	t5	const10	const10	3	10	9	N	32769	0	63
 def	test	t5	t5	param10	param10	8	20	9	Y	32768	0	63
 def	test	t5	t5	const11	const11	3	4	4	Y	32768	0	63
@@ -1813,8 +1813,8 @@ def	test	t5	t5	param11	param11	8	20	4	Y	
 def	test	t5	t5	const12	const12	254	0	0	Y	128	0	63
 def	test	t5	t5	param12	param12	8	20	0	Y	32768	0	63
 def	test	t5	t5	param13	param13	246	67	0	Y	0	30	63
-def	test	t5	t5	param14	param14	252	4294967295	0	Y	16	0	8
-def	test	t5	t5	param15	param15	252	4294967295	0	Y	144	0	63
+def	test	t5	t5	param14	param14	252	65535	0	Y	16	0	8
+def	test	t5	t5	param15	param15	252	65535	0	Y	144	0	63
 const01	8
 param01	8
 const02	8.0

--- 1.46/mysql-test/r/ps_4heap.result	2007-05-21 10:02:01 +02:00
+++ 1.47/mysql-test/r/ps_4heap.result	2007-12-18 10:30:41 +01:00
@@ -1766,17 +1766,17 @@ t5	CREATE TABLE `t5` (
   `const03` double NOT NULL default '0',
   `param03` double default NULL,
   `const04` varchar(3) NOT NULL default '',
-  `param04` longtext,
+  `param04` text,
   `const05` varbinary(3) NOT NULL default '',
-  `param05` longblob,
+  `param05` blob,
   `const06` varchar(10) NOT NULL default '',
-  `param06` longtext,
+  `param06` text,
   `const07` date default NULL,
-  `param07` longblob,
+  `param07` blob,
   `const08` varchar(19) NOT NULL default '',
-  `param08` longtext,
+  `param08` text,
   `const09` datetime default NULL,
-  `param09` longblob,
+  `param09` blob,
   `const10` int(10) NOT NULL default '0',
   `param10` bigint(20) default NULL,
   `const11` int(4) default NULL,
@@ -1784,8 +1784,8 @@ t5	CREATE TABLE `t5` (
   `const12` binary(0) default NULL,
   `param12` bigint(20) default NULL,
   `param13` decimal(65,30) default NULL,
-  `param14` longtext,
-  `param15` longblob
+  `param14` text,
+  `param15` blob
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 select * from t5 ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
@@ -1796,17 +1796,17 @@ def	test	t5	t5	param02	param02	246	67	32
 def	test	t5	t5	const03	const03	5	17	1	N	32769	31	63
 def	test	t5	t5	param03	param03	5	23	1	Y	32768	31	63
 def	test	t5	t5	const04	const04	253	3	3	N	1	0	8
-def	test	t5	t5	param04	param04	252	4294967295	3	Y	16	0	8
+def	test	t5	t5	param04	param04	252	65535	3	Y	16	0	8
 def	test	t5	t5	const05	const05	253	3	3	N	129	0	63
-def	test	t5	t5	param05	param05	252	4294967295	3	Y	144	0	63
+def	test	t5	t5	param05	param05	252	65535	3	Y	144	0	63
 def	test	t5	t5	const06	const06	253	10	10	N	1	0	8
-def	test	t5	t5	param06	param06	252	4294967295	10	Y	16	0	8
+def	test	t5	t5	param06	param06	252	65535	10	Y	16	0	8
 def	test	t5	t5	const07	const07	10	10	10	Y	128	0	63
-def	test	t5	t5	param07	param07	252	4294967295	10	Y	144	0	63
+def	test	t5	t5	param07	param07	252	65535	10	Y	144	0	63
 def	test	t5	t5	const08	const08	253	19	19	N	1	0	8
-def	test	t5	t5	param08	param08	252	4294967295	19	Y	16	0	8
+def	test	t5	t5	param08	param08	252	65535	19	Y	16	0	8
 def	test	t5	t5	const09	const09	12	19	19	Y	128	0	63
-def	test	t5	t5	param09	param09	252	4294967295	19	Y	144	0	63
+def	test	t5	t5	param09	param09	252	65535	19	Y	144	0	63
 def	test	t5	t5	const10	const10	3	10	9	N	32769	0	63
 def	test	t5	t5	param10	param10	8	20	9	Y	32768	0	63
 def	test	t5	t5	const11	const11	3	4	4	Y	32768	0	63
@@ -1814,8 +1814,8 @@ def	test	t5	t5	param11	param11	8	20	4	Y	
 def	test	t5	t5	const12	const12	254	0	0	Y	128	0	63
 def	test	t5	t5	param12	param12	8	20	0	Y	32768	0	63
 def	test	t5	t5	param13	param13	246	67	0	Y	0	30	63
-def	test	t5	t5	param14	param14	252	4294967295	0	Y	16	0	8
-def	test	t5	t5	param15	param15	252	4294967295	0	Y	144	0	63
+def	test	t5	t5	param14	param14	252	65535	0	Y	16	0	8
+def	test	t5	t5	param15	param15	252	65535	0	Y	144	0	63
 const01	8
 param01	8
 const02	8.0

--- 1.47/mysql-test/r/ps_5merge.result	2007-05-21 10:02:01 +02:00
+++ 1.48/mysql-test/r/ps_5merge.result	2007-12-18 10:30:41 +01:00
@@ -1702,17 +1702,17 @@ t5	CREATE TABLE `t5` (
   `const03` double NOT NULL default '0',
   `param03` double default NULL,
   `const04` varchar(3) NOT NULL default '',
-  `param04` longtext,
+  `param04` text,
   `const05` varbinary(3) NOT NULL default '',
-  `param05` longblob,
+  `param05` blob,
   `const06` varchar(10) NOT NULL default '',
-  `param06` longtext,
+  `param06` text,
   `const07` date default NULL,
-  `param07` longblob,
+  `param07` blob,
   `const08` varchar(19) NOT NULL default '',
-  `param08` longtext,
+  `param08` text,
   `const09` datetime default NULL,
-  `param09` longblob,
+  `param09` blob,
   `const10` int(10) NOT NULL default '0',
   `param10` bigint(20) default NULL,
   `const11` int(4) default NULL,
@@ -1720,8 +1720,8 @@ t5	CREATE TABLE `t5` (
   `const12` binary(0) default NULL,
   `param12` bigint(20) default NULL,
   `param13` decimal(65,30) default NULL,
-  `param14` longtext,
-  `param15` longblob
+  `param14` text,
+  `param15` blob
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 select * from t5 ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
@@ -1732,17 +1732,17 @@ def	test	t5	t5	param02	param02	246	67	32
 def	test	t5	t5	const03	const03	5	17	1	N	32769	31	63
 def	test	t5	t5	param03	param03	5	23	1	Y	32768	31	63
 def	test	t5	t5	const04	const04	253	3	3	N	1	0	8
-def	test	t5	t5	param04	param04	252	4294967295	3	Y	16	0	8
+def	test	t5	t5	param04	param04	252	65535	3	Y	16	0	8
 def	test	t5	t5	const05	const05	253	3	3	N	129	0	63
-def	test	t5	t5	param05	param05	252	4294967295	3	Y	144	0	63
+def	test	t5	t5	param05	param05	252	65535	3	Y	144	0	63
 def	test	t5	t5	const06	const06	253	10	10	N	1	0	8
-def	test	t5	t5	param06	param06	252	4294967295	10	Y	16	0	8
+def	test	t5	t5	param06	param06	252	65535	10	Y	16	0	8
 def	test	t5	t5	const07	const07	10	10	10	Y	128	0	63
-def	test	t5	t5	param07	param07	252	4294967295	10	Y	144	0	63
+def	test	t5	t5	param07	param07	252	65535	10	Y	144	0	63
 def	test	t5	t5	const08	const08	253	19	19	N	1	0	8
-def	test	t5	t5	param08	param08	252	4294967295	19	Y	16	0	8
+def	test	t5	t5	param08	param08	252	65535	19	Y	16	0	8
 def	test	t5	t5	const09	const09	12	19	19	Y	128	0	63
-def	test	t5	t5	param09	param09	252	4294967295	19	Y	144	0	63
+def	test	t5	t5	param09	param09	252	65535	19	Y	144	0	63
 def	test	t5	t5	const10	const10	3	10	9	N	32769	0	63
 def	test	t5	t5	param10	param10	8	20	9	Y	32768	0	63
 def	test	t5	t5	const11	const11	3	4	4	Y	32768	0	63
@@ -1750,8 +1750,8 @@ def	test	t5	t5	param11	param11	8	20	4	Y	
 def	test	t5	t5	const12	const12	254	0	0	Y	128	0	63
 def	test	t5	t5	param12	param12	8	20	0	Y	32768	0	63
 def	test	t5	t5	param13	param13	246	67	0	Y	0	30	63
-def	test	t5	t5	param14	param14	252	4294967295	0	Y	16	0	8
-def	test	t5	t5	param15	param15	252	4294967295	0	Y	144	0	63
+def	test	t5	t5	param14	param14	252	65535	0	Y	16	0	8
+def	test	t5	t5	param15	param15	252	65535	0	Y	144	0	63
 const01	8
 param01	8
 const02	8.0
@@ -4716,17 +4716,17 @@ t5	CREATE TABLE `t5` (
   `const03` double NOT NULL default '0',
   `param03` double default NULL,
   `const04` varchar(3) NOT NULL default '',
-  `param04` longtext,
+  `param04` text,
   `const05` varbinary(3) NOT NULL default '',
-  `param05` longblob,
+  `param05` blob,
   `const06` varchar(10) NOT NULL default '',
-  `param06` longtext,
+  `param06` text,
   `const07` date default NULL,
-  `param07` longblob,
+  `param07` blob,
   `const08` varchar(19) NOT NULL default '',
-  `param08` longtext,
+  `param08` text,
   `const09` datetime default NULL,
-  `param09` longblob,
+  `param09` blob,
   `const10` int(10) NOT NULL default '0',
   `param10` bigint(20) default NULL,
   `const11` int(4) default NULL,
@@ -4734,8 +4734,8 @@ t5	CREATE TABLE `t5` (
   `const12` binary(0) default NULL,
   `param12` bigint(20) default NULL,
   `param13` decimal(65,30) default NULL,
-  `param14` longtext,
-  `param15` longblob
+  `param14` text,
+  `param15` blob
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 select * from t5 ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
@@ -4746,17 +4746,17 @@ def	test	t5	t5	param02	param02	246	67	32
 def	test	t5	t5	const03	const03	5	17	1	N	32769	31	63
 def	test	t5	t5	param03	param03	5	23	1	Y	32768	31	63
 def	test	t5	t5	const04	const04	253	3	3	N	1	0	8
-def	test	t5	t5	param04	param04	252	4294967295	3	Y	16	0	8
+def	test	t5	t5	param04	param04	252	65535	3	Y	16	0	8
 def	test	t5	t5	const05	const05	253	3	3	N	129	0	63
-def	test	t5	t5	param05	param05	252	4294967295	3	Y	144	0	63
+def	test	t5	t5	param05	param05	252	65535	3	Y	144	0	63
 def	test	t5	t5	const06	const06	253	10	10	N	1	0	8
-def	test	t5	t5	param06	param06	252	4294967295	10	Y	16	0	8
+def	test	t5	t5	param06	param06	252	65535	10	Y	16	0	8
 def	test	t5	t5	const07	const07	10	10	10	Y	128	0	63
-def	test	t5	t5	param07	param07	252	4294967295	10	Y	144	0	63
+def	test	t5	t5	param07	param07	252	65535	10	Y	144	0	63
 def	test	t5	t5	const08	const08	253	19	19	N	1	0	8
-def	test	t5	t5	param08	param08	252	4294967295	19	Y	16	0	8
+def	test	t5	t5	param08	param08	252	65535	19	Y	16	0	8
 def	test	t5	t5	const09	const09	12	19	19	Y	128	0	63
-def	test	t5	t5	param09	param09	252	4294967295	19	Y	144	0	63
+def	test	t5	t5	param09	param09	252	65535	19	Y	144	0	63
 def	test	t5	t5	const10	const10	3	10	9	N	32769	0	63
 def	test	t5	t5	param10	param10	8	20	9	Y	32768	0	63
 def	test	t5	t5	const11	const11	3	4	4	Y	32768	0	63
@@ -4764,8 +4764,8 @@ def	test	t5	t5	param11	param11	8	20	4	Y	
 def	test	t5	t5	const12	const12	254	0	0	Y	128	0	63
 def	test	t5	t5	param12	param12	8	20	0	Y	32768	0	63
 def	test	t5	t5	param13	param13	246	67	0	Y	0	30	63
-def	test	t5	t5	param14	param14	252	4294967295	0	Y	16	0	8
-def	test	t5	t5	param15	param15	252	4294967295	0	Y	144	0	63
+def	test	t5	t5	param14	param14	252	65535	0	Y	16	0	8
+def	test	t5	t5	param15	param15	252	65535	0	Y	144	0	63
 const01	8
 param01	8
 const02	8.0

--- 1.127/mysql-test/r/create.result	2007-05-11 18:33:10 +02:00
+++ 1.128/mysql-test/r/create.result	2007-12-18 10:30:40 +01:00
@@ -430,7 +430,7 @@ d	date	YES		NULL	
 e	varchar(1)	NO			
 f	datetime	YES		NULL	
 g	time	YES		NULL	
-h	longblob	NO			
+h	blob	NO			
 dd	time	YES		NULL	
 select * from t2;
 a	b	c	d	e	f	g	h	dd

--- 1.55/mysql-test/r/type_blob.result	2007-03-01 17:59:52 +01:00
+++ 1.56/mysql-test/r/type_blob.result	2007-12-18 10:30:41 +01:00
@@ -528,7 +528,7 @@ drop table t1;
 create table t1 select load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat') l;
 show full fields from t1;
 Field	Type	Collation	Null	Key	Default	Extra	Privileges	Comment
-l	longblob	NULL	YES		NULL		#	
+l	blob	NULL	YES		NULL		#	
 drop table t1;
 create table t1 (id integer primary key auto_increment, txt text not null, unique index txt_index (txt (20)));
 insert into t1 (txt) values ('Chevy'), ('Chevy ');
@@ -808,3 +808,34 @@ create table t1 (a text default '');
 ERROR 42000: BLOB/TEXT column 'a' can't have a default value
 set @@sql_mode='';
 End of 5.0 tests
+CREATE TABLE t1 (
+a TINYBLOB, 
+b BLOB, 
+c MEDIUMBLOB, 
+d LONGBLOB        
+);
+INSERT INTO t1 VALUES ('1', '2', '3', '4');
+CREATE TABLE t2
+AS 
+SELECT 
+(SELECT a FROM t1) as a,
+(SELECT b FROM t1) as b,
+(SELECT c FROM t1) as c,
+(SELECT d FROM t1) as d;
+CREATE TABLE t3 
+AS 
+SELECT *
+FROM t1;
+DESC t2;
+Field	Type	Null	Key	Default	Extra
+a	tinyblob	YES		NULL	
+b	blob	YES		NULL	
+c	mediumblob	YES		NULL	
+d	longblob	YES		NULL	
+DESC t3;
+Field	Type	Null	Key	Default	Extra
+a	tinyblob	YES		NULL	
+b	blob	YES		NULL	
+c	mediumblob	YES		NULL	
+d	longblob	YES		NULL	
+DROP TABLE t1, t2, t3;

--- 1.44/mysql-test/r/type_ranges.result	2006-12-13 10:17:37 +01:00
+++ 1.45/mysql-test/r/type_ranges.result	2007-12-18 10:30:41 +01:00
@@ -280,8 +280,8 @@ t1	int(1)	NULL	NO		0		#	
 t2	varchar(1)	latin1_swedish_ci	NO				#	
 t3	varchar(256)	latin1_swedish_ci	NO				#	
 t4	varbinary(256)	NULL	NO				#	
-t5	longtext	latin1_swedish_ci	NO				#	
-t6	longblob	NULL	NO				#	
+t5	text	latin1_swedish_ci	NO				#	
+t6	blob	NULL	NO				#	
 t7	char(0)	latin1_swedish_ci	NO				#	
 t8	binary(0)	NULL	NO				#	
 select t1,t2,length(t3),length(t4),length(t5),length(t6),t7,t8 from t2;

--- 1.92/mysql-test/r/variables.result	2007-04-09 14:58:53 +02:00
+++ 1.93/mysql-test/r/variables.result	2007-12-18 10:30:41 +01:00
@@ -559,7 +559,7 @@ Table	Create Table
 t1	CREATE TABLE `t1` (
   `c1` bigint(20) default NULL,
   `c2` decimal(65,30) default NULL,
-  `c3` longtext,
+  `c3` text,
   `c4` double default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;

--- 1.34/mysql-test/t/type_blob.test	2007-02-14 14:44:31 +01:00
+++ 1.35/mysql-test/t/type_blob.test	2007-12-18 10:30:41 +01:00
@@ -437,3 +437,32 @@ create table t1 (a text default '');
 set @@sql_mode='';
 
 --echo End of 5.0 tests
+
+#
+# Bug #20765: Subselect causes datatype to be changed erroneously
+#
+CREATE TABLE t1 (
+  a TINYBLOB, 
+  b BLOB, 
+  c MEDIUMBLOB, 
+  d LONGBLOB        
+);
+INSERT INTO t1 VALUES ('1', '2', '3', '4');
+
+CREATE TABLE t2
+AS 
+SELECT 
+  (SELECT a FROM t1) as a,
+  (SELECT b FROM t1) as b,
+  (SELECT c FROM t1) as c,
+  (SELECT d FROM t1) as d;
+
+CREATE TABLE t3 
+AS 
+SELECT *
+FROM t1; 
+
+DESC t2;
+DESC t3;
+
+DROP TABLE t1, t2, t3;

--- 1.44/mysql-test/r/user_var.result	2007-01-09 21:23:57 +01:00
+++ 1.45/mysql-test/r/user_var.result	2007-12-18 10:30:41 +01:00
@@ -221,7 +221,7 @@ create table t1 select @first_var;
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `@first_var` longblob
+  `@first_var` blob
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 set @first_var= cast(NULL as signed integer);
@@ -245,7 +245,7 @@ create table t1 select @first_var;
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `@first_var` longblob
+  `@first_var` blob
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 set @first_var=1;
@@ -254,7 +254,7 @@ create table t1 select @first_var;
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `@first_var` longtext
+  `@first_var` text
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 set @a=18446744071710965857;
Thread
bk commit into 5.0 tree (mhansson:1.2498) BUG#20765mhansson18 Dec