List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:August 20 2009 10:18am
Subject:bzr commit into mysql branch (bar:2862) WL#2649
View as plain text  
#At file:///home/bar/mysql-bzr/mysql-azalea.w2649/ based on revid:kostja@stripped

 2862 Alexander Barkov	2009-08-20
      WL#2649 Number-to-string conversions
     @ mysql-test/r/bigint.result
        Fixing tests
     @ mysql-test/r/case.result
        Fixing tests
     @ mysql-test/r/ctype_cp1251.result
        Adding tests
     @ mysql-test/r/ctype_latin1.result
        Adding tests
     @ mysql-test/r/ctype_ucs.result
        Adding tests
     @ mysql-test/r/explain.result
        Fixing tests
     @ mysql-test/r/func_gconcat.result
        Fixing tests
     @ mysql-test/r/func_str.result
        Fixing tests
     @ mysql-test/r/metadata.result
        Fixing tests
     @ mysql-test/r/ps_1general.result
        Fixing tests
     @ mysql-test/r/ps_2myisam.result
        Fixing tests
     @ mysql-test/r/ps_3innodb.result
        Fixing tests
     @ mysql-test/r/ps_4heap.result
        Fixing tests
     @ mysql-test/r/ps_5merge.result
        Fixing tests
     @ mysql-test/r/show_check.result
        Fixing tests
     @ mysql-test/r/type_datetime.result
        Fixing tests
     @ mysql-test/r/type_varchar.result
        Fixing tests
     @ mysql-test/r/union.result
        Fixing tests
     @ mysql-test/suite/ndb/r/ps_7ndb.result
        Fixing tests
     @ mysql-test/t/ctype_cp1251.test
        Adding tests
     @ mysql-test/t/ctype_latin1.test
        Adding tests
     @ mysql-test/t/ctype_ucs.test
        Adding tests
     @ mysql-test/t/func_str.test
        Fixing tests
     @ sql/field.cc
        - Return str result using my_charset_numeric.
        - Using real multi-byte aware str_to_XXX functions.
     @ sql/field.h
        - Changing derivation of non-string field types to DERIVATION_NUMERIC.
        - Changing binary() for numeric/datetime fields to always
        return TRUE even if charset is not my_charset_bin. We need
        this to keep ha_base_keytype() return HA_KEYTYPE_BINARY.
     @ sql/item.cc
        - Implementing generic val_str_ascii().
        - Fixing Item_num::safe_charset_converter().
        Previously it alligned binary string to 
        character string (for example by adding leading 0x00
        when doing binary->UCS2 conversion). Now it just
        converts from my_charset_numbner to "tocs".
        - Other misc changes
     @ sql/item.h
        - Adding MY_COLL_ALLOW_NUMBER_CONV -
        a new character set and collation aggregation flag
        which forces conversion of numeric/datetime data types
        to @@character_set_connection.
        - Changing MY_COLL_CMP_CONV and MY_COLL_ALLOW_CONV to
          bit operations instead of hard-coded bit masks.
        - Addding new method DTCollation.set_numeric().
        - Adding new methods to Item.
        - Adding helper functions
        - Changing charset for Item_num-derived items
          from my_charset_bin to my_charset_numeric (an alias for latin1).
     @ sql/item_cmpfunc.cc
        - Using new helper functions
        - Other misc changes
     @ sql/item_cmpfunc.h
        Fixing strcmp() to return max_length=2.
        Previously it returned 1, which was wrong,
        because it did not fit '-1'.
     @ sql/item_func.cc
        - Using new helper functions
        - Other minor changes
     @ sql/item_func.h
        - Removing unused functions
        - Adding helper functions
        - Adding set_numeric() into constructors of numeric items.
        - Using fix_length_and_charset() instead of direct write to max_length.
     @ sql/item_geofunc.cc
        - Changing class for Item_func_geometry_type and
        Item_func_as_wkt from Item_str_func to
        Item_str_ascii_func.
     @ sql/item_geofunc.h
        - Changing class for Item_func_geometry_type and
        Item_func_as_wkt from Item_str_func to
        Item_str_ascii_func. We need this to make these
        functions return correct result when 
        @@character_set_connection is real-multibyte (like UCS2).
        Previosly these functions did not work with UCS2 fine.
     @ sql/item_strfunc.cc
        - Adding val_str method for Item_str_ascii_func.
     @ sql/item_strfunc.h
        - Introducing Item_str_ascii_func - for functions
        which return pure ASCII data. For performance purposes,
        as well as for cases when the old implementation
        of val_str() was heavily 8-bit oriented.
     @ sql/item_sum.cc
        Using new helper functions.
     @ sql/item_timefunc.cc
        - Changing base class for datetime functions to Item_str_ascii_func.
          The old implementation of val_str() was heavily 8-bit oriented
          and did not work with UCS2 well.
        - Changing charset of these functions from my_charset_bin to
          my_charset_number (an alias for latin1).
     @ sql/item_timefunc.h
        - Changing base class for datetime functions to Item_str_ascii_func.
          The old implementation of val_str() was heavily 8-bit oriented
          and did not work with UCS2 well.
        - Changing charset of these functions from my_charset_bin to
          my_charset_number (an alias for latin1).
     @ sql/item_xmlfunc.cc
        - Using new helper function
     @ sql/my_decimal.cc
        - Adding a new DECIMAL to CHAR converter
          with real multibyte support (e.g. UCS2)
     @ sql/mysql_priv.h
        - Introducing a new derivation level for numeric/datetime data types.
        - Adding macros for my_charset_numeric and MY_REPERTOIRE_NUMERIC.
        - Adding prototypes for str_set_decimal()
        - Adding prototypes for character-set aware str_to_xxx() functions.
     @ sql/sql_select.cc
        - Fixing a problem in optimizer, which was revealed by changing
          character set of date/time data types from my_charset_bin to
          my_charset_number. Don't allow joining of two string constants
          when working with DATE, NEWDATE, TIME, DATETIME data types.
          These types accept very different input format, so string literal
          comparision is not possible.
     @ sql/time.cc
        - Adding to_ascii() helper function, to convert a string
          in any character set to ascii representation. In the
          future can be extended to understand digits written
          in various non-Latin word scripts.
        - Adding real multy-byte character set aware versions for str_to_XXXX,
          to make these these type of queries work correct:
        
          INSERT INTO t1 SET datetime_column=ucs2_expression;

    modified:
      mysql-test/r/bigint.result
      mysql-test/r/case.result
      mysql-test/r/ctype_cp1251.result
      mysql-test/r/ctype_latin1.result
      mysql-test/r/ctype_ucs.result
      mysql-test/r/explain.result
      mysql-test/r/func_gconcat.result
      mysql-test/r/func_str.result
      mysql-test/r/metadata.result
      mysql-test/r/ps_1general.result
      mysql-test/r/ps_2myisam.result
      mysql-test/r/ps_3innodb.result
      mysql-test/r/ps_4heap.result
      mysql-test/r/ps_5merge.result
      mysql-test/r/show_check.result
      mysql-test/r/type_datetime.result
      mysql-test/r/type_varchar.result
      mysql-test/r/union.result
      mysql-test/suite/ndb/r/ps_7ndb.result
      mysql-test/t/ctype_cp1251.test
      mysql-test/t/ctype_latin1.test
      mysql-test/t/ctype_ucs.test
      mysql-test/t/func_str.test
      sql/field.cc
      sql/field.h
      sql/item.cc
      sql/item.h
      sql/item_cmpfunc.cc
      sql/item_cmpfunc.h
      sql/item_func.cc
      sql/item_func.h
      sql/item_geofunc.cc
      sql/item_geofunc.h
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/item_sum.cc
      sql/item_timefunc.cc
      sql/item_timefunc.h
      sql/item_xmlfunc.cc
      sql/my_decimal.cc
      sql/mysql_priv.h
      sql/sql_select.cc
      sql/time.cc
=== modified file 'mysql-test/r/bigint.result'
--- a/mysql-test/r/bigint.result	2008-05-13 23:42:43 +0000
+++ b/mysql-test/r/bigint.result	2009-08-20 10:18:05 +0000
@@ -370,22 +370,22 @@ Warnings:
 Warning	1292	Truncated incorrect DECIMAL value: ''
 select -9223372036854775808;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					-9223372036854775808	8	20	20	N	32897	0	63
+def					-9223372036854775808	8	20	20	N	32769	0	8
 -9223372036854775808
 -9223372036854775808
 select -(9223372036854775808);
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					-(9223372036854775808)	8	20	20	N	32897	0	63
+def					-(9223372036854775808)	8	20	20	N	32769	0	8
 -(9223372036854775808)
 -9223372036854775808
 select -((9223372036854775808));
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					-((9223372036854775808))	8	20	20	N	32897	0	63
+def					-((9223372036854775808))	8	20	20	N	32769	0	8
 -((9223372036854775808))
 -9223372036854775808
 select -(-(9223372036854775808));
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					-(-(9223372036854775808))	246	21	19	N	129	0	63
+def					-(-(9223372036854775808))	246	21	19	N	1	0	8
 -(-(9223372036854775808))
 9223372036854775808
 select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;

=== modified file 'mysql-test/r/case.result'
--- a/mysql-test/r/case.result	2008-02-12 19:09:16 +0000
+++ b/mysql-test/r/case.result	2009-08-20 10:18:05 +0000
@@ -101,16 +101,16 @@ Table	Create Table
 t1	CREATE TABLE `t1` (
   `c1` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL DEFAULT '',
   `c2` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL DEFAULT '',
-  `c3` varbinary(1) NOT NULL DEFAULT '',
-  `c4` varbinary(1) NOT NULL DEFAULT '',
-  `c5` varbinary(4) NOT NULL DEFAULT '',
-  `c6` varbinary(4) NOT NULL DEFAULT '',
+  `c3` varchar(1) NOT NULL DEFAULT '',
+  `c4` varchar(1) NOT NULL DEFAULT '',
+  `c5` varchar(4) NOT NULL DEFAULT '',
+  `c6` varchar(4) NOT NULL DEFAULT '',
   `c7` decimal(2,1) NOT NULL DEFAULT '0.0',
   `c8` decimal(2,1) NOT NULL DEFAULT '0.0',
   `c9` decimal(2,1) DEFAULT NULL,
   `c10` double NOT NULL DEFAULT '0',
   `c11` double NOT NULL DEFAULT '0',
-  `c12` varbinary(5) NOT NULL DEFAULT ''
+  `c12` varchar(5) NOT NULL DEFAULT ''
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 DROP TABLE t1;
 SELECT CASE 
@@ -155,8 +155,8 @@ t1	CREATE TABLE `t1` (
   `COALESCE(1.0)` decimal(2,1) NOT NULL DEFAULT '0.0',
   `COALESCE('a')` varchar(1) NOT NULL DEFAULT '',
   `COALESCE(1,1.0)` decimal(2,1) NOT NULL DEFAULT '0.0',
-  `COALESCE(1,'1')` varbinary(1) NOT NULL DEFAULT '',
-  `COALESCE(1.1,'1')` varbinary(4) NOT NULL DEFAULT '',
+  `COALESCE(1,'1')` varchar(1) NOT NULL DEFAULT '',
+  `COALESCE(1.1,'1')` varchar(4) NOT NULL DEFAULT '',
   `COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 DROP TABLE t1;

=== modified file 'mysql-test/r/ctype_cp1251.result'
--- a/mysql-test/r/ctype_cp1251.result	2008-11-01 04:50:21 +0000
+++ b/mysql-test/r/ctype_cp1251.result	2009-08-20 10:18:05 +0000
@@ -81,3 +81,2154 @@ t1	CREATE TABLE `t1` (
   `e2` enum('��) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=cp1251
 DROP TABLE t1;
+#
+# Start of 5.4 tests
+#
+#
+# Start of WL#2649 Number-to-string conversions
+#
+select hex(concat(1));
+hex(concat(1))
+31
+create table t1 as select concat(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1.1));
+hex(concat(1.1))
+312E31
+create table t1 as select concat(1.1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a', 1+2)), charset(concat(1+2));
+hex(concat('a', 1+2))	charset(concat(1+2))
+6133	cp1251
+create table t1 as select concat(1+2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1-2));
+hex(concat(1-2))
+2D31
+create table t1 as select concat(1-2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1*2));
+hex(concat(1*2))
+32
+create table t1 as select concat(1*2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1/2));
+hex(concat(1/2))
+302E35303030
+create table t1 as select concat(1/2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(7) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1 div 2));
+hex(concat(1 div 2))
+30
+create table t1 as select concat(1 div 2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1 % 2));
+hex(concat(1 % 2))
+31
+create table t1 as select concat(1 % 2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(-1));
+hex(concat(-1))
+2D31
+create table t1 as select concat(-1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(-(1+2)));
+hex(concat(-(1+2)))
+2D33
+create table t1 as select concat(-(1+2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1|2));
+hex(concat(1|2))
+33
+create table t1 as select concat(1|2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1&2));
+hex(concat(1&2))
+30
+create table t1 as select concat(1&2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(bit_count(12)));
+hex(concat(bit_count(12)))
+32
+create table t1 as select concat(bit_count(12)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(2<<1));
+hex(concat(2<<1))
+34
+create table t1 as select concat(2<<1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(2>>1));
+hex(concat(2>>1))
+31
+create table t1 as select concat(2>>1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(~0));
+hex(concat(~0))
+3138343436373434303733373039353531363135
+create table t1 as select concat(~0) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(3^2));
+hex(concat(3^2))
+31
+create table t1 as select concat(3^2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(abs(-2)));
+hex(concat(abs(-2)))
+32
+create table t1 as select concat(abs(-2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(exp(2)),1));
+hex(left(concat(exp(2)),1))
+37
+create table t1 as select concat(exp(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log(2)),1));
+hex(left(concat(log(2)),1))
+30
+create table t1 as select concat(log(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log2(2)),1));
+hex(left(concat(log2(2)),1))
+31
+create table t1 as select concat(log2(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log10(2)),1));
+hex(left(concat(log10(2)),1))
+30
+create table t1 as select concat(log10(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(sqrt(2)),1));
+hex(left(concat(sqrt(2)),1))
+31
+create table t1 as select concat(sqrt(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(pow(2,2)),1));
+hex(left(concat(pow(2,2)),1))
+34
+create table t1 as select concat(pow(2,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(acos(0.5)),1));
+hex(left(concat(acos(0.5)),1))
+31
+create table t1 as select concat(acos(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(asin(0.5)),1));
+hex(left(concat(asin(0.5)),1))
+30
+create table t1 as select concat(asin(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(atan(0.5)),1));
+hex(left(concat(atan(0.5)),1))
+30
+create table t1 as select concat(atan(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(cos(0.5)),1));
+hex(left(concat(cos(0.5)),1))
+30
+create table t1 as select concat(cos(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(sin(0.5)),1));
+hex(left(concat(sin(0.5)),1))
+30
+create table t1 as select concat(sin(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(tan(0.5)),1));
+hex(left(concat(tan(0.5)),1))
+30
+create table t1 as select concat(tan(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(degrees(0)));
+hex(concat(degrees(0)))
+30
+create table t1 as select concat(degrees(0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(radians(0)));
+hex(concat(radians(0)))
+30
+create table t1 as select concat(radians(0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ceiling(0.5)));
+hex(concat(ceiling(0.5)))
+31
+create table t1 as select concat(ceiling(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(floor(0.5)));
+hex(concat(floor(0.5)))
+30
+create table t1 as select concat(floor(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(round(0.5)));
+hex(concat(round(0.5)))
+31
+create table t1 as select concat(round(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sign(0.5)));
+hex(concat(sign(0.5)))
+31
+create table t1 as select concat(sign(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(rand()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(length('a')));
+hex(concat(length('a')))
+31
+create table t1 as select concat(length('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(char_length('a')));
+hex(concat(char_length('a')))
+31
+create table t1 as select concat(char_length('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(bit_length('a')));
+hex(concat(bit_length('a')))
+38
+create table t1 as select concat(bit_length('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(coercibility('a')));
+hex(concat(coercibility('a')))
+34
+create table t1 as select concat(coercibility('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(locate('a','a')));
+hex(concat(locate('a','a')))
+31
+create table t1 as select concat(locate('a','a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(11) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(field('c','a','b','c')));
+hex(concat(field('c','a','b','c')))
+33
+create table t1 as select concat(field('c','a','b','c')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ascii(61)));
+hex(concat(ascii(61)))
+3534
+create table t1 as select concat(ascii(61)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ord(61)));
+hex(concat(ord(61)))
+3534
+create table t1 as select concat(ord(61)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(find_in_set('b','a,b,c,d')));
+hex(concat(find_in_set('b','a,b,c,d')))
+32
+create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select md5('a'), hex(md5('a'));
+md5('a')	hex(md5('a'))
+0cc175b9c0f1b6a831c399e269772661	3063633137356239633066316236613833316333393965323639373732363631
+create table t1 as select md5('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(32) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select old_password('a'), hex(old_password('a'));
+old_password('a')	hex(old_password('a'))
+60671c896665c3fa	36303637316338393636363563336661
+create table t1 as select old_password('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(16) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select password('a'), hex(password('a'));
+password('a')	hex(password('a'))
+*667F407DE7C6AD07358FA38DAED7828A72014B4E	2A36363746343037444537433641443037333538464133384441454437383238413732303134423445
+create table t1 as select password('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(41) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select sha('a'), hex(sha('a'));
+sha('a')	hex(sha('a'))
+86f7e437faa5a7fce15d1ddcb9eaeaea377667b8	38366637653433376661613561376663653135643164646362396561656165613337373636376238
+create table t1 as select sha('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(40) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select sha1('a'), hex(sha1('a'));
+sha1('a')	hex(sha1('a'))
+86f7e437faa5a7fce15d1ddcb9eaeaea377667b8	38366637653433376661613561376663653135643164646362396561656165613337373636376238
+create table t1 as select sha1('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(40) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select sha2('a',224), hex(sha2('a',224));
+sha2('a',224)	hex(sha2('a',224))
+abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5	6162643337353334633764396132656662393436356465393331636437303535666664623838373935363361653938303738643664366435
+create table t1 as select sha2('a',224) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(56) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('-1' as signed)));
+hex(concat(cast('-1' as signed)))
+2D31
+create table t1 as select concat(cast('-1' as signed)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('1' as unsigned)));
+hex(concat(cast('1' as unsigned)))
+31
+create table t1 as select concat(cast('1' as unsigned)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast(1/2 as decimal(5,5))));
+hex(concat(cast(1/2 as decimal(5,5))))
+302E3530303030
+create table t1 as select concat(cast(1/2 as decimal(5,5))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(7) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('2001-01-02 03:04:05' as date)));
+hex(concat(cast('2001-01-02 03:04:05' as date)))
+323030312D30312D3032
+create table t1 as select concat(cast('2001-01-02 03:04:05' as date)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2001-01-02
+drop table t1;
+select hex(concat(cast('2001-01-02 03:04:05' as time)));
+hex(concat(cast('2001-01-02 03:04:05' as time)))
+30333A30343A3035
+create table t1 as select concat(cast('2001-01-02 03:04:05' as time)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+03:04:05
+drop table t1;
+select hex(concat(cast('2001-01-02' as datetime)));
+hex(concat(cast('2001-01-02' as datetime)))
+323030312D30312D30322030303A30303A3030
+create table t1 as select concat(cast('2001-01-02' as datetime)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(29) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2001-01-02 00:00:00
+drop table t1;
+select hex(concat(least(1,2)));
+hex(concat(least(1,2)))
+31
+create table t1 as select concat(least(1,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(greatest(1,2)));
+hex(concat(greatest(1,2)))
+32
+create table t1 as select concat(greatest(1,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(case when 11 then 22 else 33 end));
+hex(concat(case when 11 then 22 else 33 end))
+3232
+create table t1 as select concat(case when 11 then 22 else 33 end) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(coalesce(1,2)));
+hex(concat(coalesce(1,2)))
+31
+create table t1 as select concat(coalesce(1,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat_ws(1,2,3));
+hex(concat_ws(1,2,3))
+323133
+create table t1 as select concat_ws(1,2,3) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(group_concat(1,2,3));
+hex(group_concat(1,2,3))
+313233
+create table t1 as select group_concat(1,2,3) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` text CHARACTER SET cp1251
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select 1 as c1 union select 'a';
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select hex(c1) from t1 order by c1;
+hex(c1)
+31
+61
+drop table t1;
+create table t1 as select concat(last_insert_id()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(benchmark(0,0)));
+hex(concat(benchmark(0,0)))
+30
+create table t1 as select concat(benchmark(0,0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sleep(0)));
+hex(concat(sleep(0)))
+30
+create table t1 as select concat(sleep(0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(get_lock('a',0)));
+hex(concat(get_lock('a',0)))
+31
+select hex(concat(release_lock('a')));
+hex(concat(release_lock('a')))
+31
+create table t1 as select concat(get_lock('a',0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(is_free_lock('xxxx')));
+hex(concat(is_free_lock('xxxx')))
+31
+create table t1 as select concat(is_free_lock('xxxx')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(is_used_lock('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(release_lock('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(crc32('')));
+hex(concat(crc32('')))
+30
+create table t1 as select concat(crc32('')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(uncompressed_length('')));
+hex(concat(uncompressed_length('')))
+30
+create table t1 as select concat(uncompressed_length('')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(connection_id()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(inet_aton('127.1.1.1')));
+hex(concat(inet_aton('127.1.1.1')))
+32313330373732323235
+create table t1 as select concat(inet_aton('127.1.1.1')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(inet_ntoa(2130772225)));
+hex(concat(inet_ntoa(2130772225)))
+3132372E312E312E31
+create table t1 as select concat(inet_ntoa(2130772225)) as c1;
+select * from t1;
+c1
+127.1.1.1
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(31) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(row_count()));
+hex(concat(row_count()))
+2D31
+create table t1 as select concat(row_count()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(found_rows()));
+hex(concat(found_rows()))
+30
+create table t1 as select concat(found_rows()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(uuid_short()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(uuid()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
+coercibility(uuid())	coercibility(cast('a' as char character set latin1))
+4	2
+select charset(concat(uuid(), cast('a' as char character set latin1)));
+charset(concat(uuid(), cast('a' as char character set latin1)))
+latin1
+create table t1 as select concat(uuid(), cast('a' as char character set latin1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(37) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=1));
+hex(concat(@a1:=1))
+31
+create table t1 as select concat(@a2:=2) as c1, @a3:=3 as c2;
+select hex(c1) from t1;
+hex(c1)
+32
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '',
+  `c2` int(1) NOT NULL DEFAULT '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=1;
+select hex(concat(@a2));
+hex(concat(@a2))
+31
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+31
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(20) CHARACTER SET cp1251 DEFAULT NULL,
+  `c2` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=sqrt(1)));
+hex(concat(@a1:=sqrt(1)))
+31
+create table t1 as select concat(@a2:=sqrt(1)) as c1, @a3:=sqrt(1) as c2;
+select hex(c1) from t1;
+hex(c1)
+31
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL,
+  `c2` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=sqrt(1);
+select hex(concat(@a2));
+hex(concat(@a2))
+31
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+31
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL,
+  `c2` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=1.1));
+hex(concat(@a1:=1.1))
+312E31
+create table t1 as select concat(@a2:=1.1) as c1, @a3:=1.1 as c2;
+select hex(c1) from t1;
+hex(c1)
+312E31
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT '',
+  `c2` decimal(2,1) NOT NULL DEFAULT '0.0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=1.1;
+select hex(concat(@a2));
+hex(concat(@a2))
+312E31
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+312E31
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(83) CHARACTER SET cp1251 DEFAULT NULL,
+  `c2` decimal(65,30) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@@ft_max_word_len));
+hex(concat(@@ft_max_word_len))
+3834
+create table t1 as select concat(@@ft_max_word_len) as c1;
+select hex(c1) from t1;
+hex(c1)
+3834
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a'='a' IS TRUE));
+hex(concat('a'='a' IS TRUE))
+31
+create table t1 as select concat('a'='a' IS TRUE) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a'='a' IS NOT TRUE));
+hex(concat('a'='a' IS NOT TRUE))
+30
+create table t1 as select concat('a'='a' IS NOT TRUE) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NOT 'a'='a'));
+hex(concat(NOT 'a'='a'))
+30
+create table t1 as select concat(NOT 'a'='a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' IS NULL));
+hex(concat('a' IS NULL))
+30
+create table t1 as select concat('a' IS NULL) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' IS NOT NULL));
+hex(concat('a' IS NOT NULL))
+31
+create table t1 as select concat('a' IS NOT NULL) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' rlike 'a'));
+hex(concat('a' rlike 'a'))
+31
+create table t1 as select concat('a' IS NOT NULL) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(strcmp('a','b')));
+hex(concat(strcmp('a','b')))
+2D31
+create table t1 as select concat(strcmp('a','b')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' like 'a'));
+hex(concat('a' like 'a'))
+31
+create table t1 as select concat('a' like 'b') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' between 'b' and 'c'));
+hex(concat('a' between 'b' and 'c'))
+30
+create table t1 as select concat('a' between 'b' and 'c') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' in ('a','b')));
+hex(concat('a' in ('a','b')))
+31
+create table t1 as select concat('a' in ('a','b')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
+hex(concat(interval(23, 1, 15, 17, 30, 44, 200)))
+33
+create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a varchar(10), fulltext key(a));
+insert into t1 values ('a');
+select hex(concat(match (a) against ('a'))) from t1;
+hex(concat(match (a) against ('a')))
+30
+create table t2 as select concat(match (a) against ('a')) as a from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `a` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+select hex(ifnull(1,'a'));
+hex(ifnull(1,'a'))
+31
+create table t1 as select ifnull(1,'a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ifnull(1,1)));
+hex(concat(ifnull(1,1)))
+31
+create table t1 as select concat(ifnull(1,1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ifnull(1.1,1.1)));
+hex(concat(ifnull(1.1,1.1)))
+312E31
+create table t1 as select concat(ifnull(1.1,1.1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(if(1,'b',1));
+hex(if(1,'b',1))
+62
+create table t1 as select if(1,'b',1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(if(1,1,'b'));
+hex(if(1,1,'b'))
+31
+create table t1 as select if(1,1,'b') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(if(1,1,1)));
+hex(concat(if(1,1,1)))
+31
+create table t1 as select concat(if(1,1,1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(nullif(1,2)));
+hex(concat(nullif(1,2)))
+31
+create table t1 as select concat(nullif(1,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)'))));
+hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)'))))
+31
+create table t1 as select concat(Dimension(GeomFromText('LINSTRING(0 0,10 10)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))));
+hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))))
+32
+create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))));
+hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))))
+32
+create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))));
+hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))))
+30
+create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))));
+hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))))
+31
+create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsEmpty(GeomFromText('POINT(1 1)'))));
+hex(concat(IsEmpty(GeomFromText('POINT(1 1)'))))
+30
+create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
+hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
+30
+create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))));
+hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))))
+30
+create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))));
+hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))))
+31
+create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1;
+drop table t1;
+select hex(concat(x(GeomFromText('Point(1 2)'))));
+hex(concat(x(GeomFromText('Point(1 2)'))))
+31
+create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(y(GeomFromText('Point(1 2)'))));
+hex(concat(y(GeomFromText('Point(1 2)'))))
+32
+create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)'))));
+hex(concat(GLength(GeomFromText('LineString(1 2,2 2)'))))
+31
+create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))));
+hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))))
+31
+create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(GeometryType(GeomFromText('Point(1 2)'))));
+hex(concat(GeometryType(GeomFromText('Point(1 2)'))))
+504F494E54
+create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(20) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(AsText(GeomFromText('Point(1 2)'))));
+hex(concat(AsText(GeomFromText('Point(1 2)'))))
+504F494E542831203229
+create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` longtext CHARACTER SET cp1251
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(period_add(200902, 2)));
+hex(concat(period_add(200902, 2)))
+323030393034
+create table t1 as select concat(period_add(200902, 2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(period_diff(200902, 200802)));
+hex(concat(period_diff(200902, 200802)))
+3132
+create table t1 as select concat(period_add(200902, 200802)) as c1;
+Warnings:
+Warning	1265	Data truncated for column 'c1' at row 1
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(to_days(20090224)));
+hex(concat(to_days(20090224)))
+373333383237
+create table t1 as select concat(to_days(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofmonth(20090224)));
+hex(concat(dayofmonth(20090224)))
+3234
+create table t1 as select concat(dayofmonth(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofyear(20090224)));
+hex(concat(dayofyear(20090224)))
+3535
+create table t1 as select concat(dayofyear(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(hour('10:11:12')));
+hex(concat(hour('10:11:12')))
+3130
+create table t1 as select concat(hour('10:11:12')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(minute('10:11:12')));
+hex(concat(minute('10:11:12')))
+3131
+create table t1 as select concat(minute('10:11:12')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(second('10:11:12')));
+hex(concat(second('10:11:12')))
+3132
+create table t1 as select concat(second('10:11:12')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(quarter(20090224)));
+hex(concat(quarter(20090224)))
+31
+create table t1 as select concat(quarter(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(week(20090224)));
+hex(concat(week(20090224)))
+38
+create table t1 as select concat(week(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(yearweek(20090224)));
+hex(concat(yearweek(20090224)))
+323030393038
+create table t1 as select concat(yearweek(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(year(20090224)));
+hex(concat(year(20090224)))
+32303039
+create table t1 as select concat(year(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(weekday(20090224)));
+hex(concat(weekday(20090224)))
+31
+create table t1 as select concat(weekday(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofweek(20090224)));
+hex(concat(dayofweek(20090224)))
+33
+create table t1 as select concat(dayofweek(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(unix_timestamp(20090224)));
+hex(concat(unix_timestamp(20090224)))
+31323335343232383030
+create table t1 as select concat(unix_timestamp(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(time_to_sec('10:11:12')));
+hex(concat(time_to_sec('10:11:12')))
+3336363732
+create table t1 as select concat(time_to_sec('10:11:12')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(extract(year from 20090702)));
+hex(concat(extract(year from 20090702)))
+32303039
+create table t1 as select concat(extract(year from 20090702)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(microsecond('12:00:00.123456')));
+hex(concat(microsecond('12:00:00.123456')))
+313233343536
+create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(month(20090224)));
+hex(concat(month(20090224)))
+32
+create table t1 as select concat(month(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(last_day('2003-02-05')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select c1, hex(c1) from t1;
+c1	hex(c1)
+2003-02-28	323030332D30322D3238
+drop table t1;
+create table t1 as select concat(from_days(730669)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select c1, hex(c1) from t1;
+c1	hex(c1)
+2000-07-03	323030302D30372D3033
+drop table t1;
+create table t1 as select concat(curdate()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(utc_date()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(curtime()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(8) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select repeat('a',20) as c1 limit 0;
+set timestamp=1216359724;
+insert into t1 values (current_date);
+insert into t1 values (current_time);
+select c1, hex(c1) from t1;
+c1	hex(c1)
+2008-07-18	323030382D30372D3138
+08:42:04	30383A34323A3034
+drop table t1;
+create table t1 as select concat(utc_time()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(8) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sec_to_time(2378)));
+hex(concat(sec_to_time(2378)))
+30303A33393A3338
+create table t1 as select concat(sec_to_time(2378)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')));
+hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')))
+32343A30303A3030
+create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(maketime(10,11,12)));
+hex(concat(maketime(10,11,12)))
+31303A31313A3132
+create table t1 as select concat(maketime(10,11,12)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(get_format(DATE,'USA'));
+hex(get_format(DATE,'USA'))
+256D2E25642E2559
+create table t1 as select get_format(DATE,'USA') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(17) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(from_unixtime(1111885200)),4));
+hex(left(concat(from_unixtime(1111885200)),4))
+32303035
+create table t1 as select concat(from_unixtime(1111885200)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')));
+hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')))
+323030332D31322D33312032303A30303A3030
+create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day)));
+hex(concat(date_add('2004-01-01 12:00:00', interval 1 day)))
+323030342D30312D30322031323A30303A3030
+create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(29) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2004-01-02 12:00:00
+drop table t1;
+select hex(concat(makedate(2009,1)));
+hex(concat(makedate(2009,1)))
+323030392D30312D3031
+create table t1 as select concat(makedate(2009,1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2009-01-01
+drop table t1;
+create table t1 as select concat(now()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(utc_timestamp()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(sysdate()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(addtime('00:00:00','11:22:33')));
+hex(concat(addtime('00:00:00','11:22:33')))
+31313A32323A3333
+create table t1 as select concat(addtime('00:00:00','11:22:33')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(29) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(subtime('23:59:59','11:22:33')));
+hex(concat(subtime('23:59:59','11:22:33')))
+31323A33373A3236
+create table t1 as select concat(subtime('23:59:59','11:22:33')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(29) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(elt(1,2,3));
+hex(elt(1,2,3))
+32
+create table t1 as select elt(1,2,3) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(export_set(1,2,3,4,2));
+hex(export_set(1,2,3,4,2))
+323433
+create table t1 as select export_set(1,2,3,4,2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(127) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(insert(1133,3,0,22));
+hex(insert(1133,3,0,22))
+313132323333
+create table t1 as select insert(1133,3,0,22) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lcase(123));
+hex(lcase(123))
+313233
+create table t1 as select lcase(123) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(123,1));
+hex(left(123,1))
+31
+create table t1 as select left(123,1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lower(123));
+hex(lower(123))
+313233
+create table t1 as select lower(123) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lpad(1,2,0));
+hex(lpad(1,2,0))
+3031
+create table t1 as select lpad(1,2,0) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(ltrim(1));
+hex(ltrim(1))
+31
+create table t1 as select ltrim(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(mid(1,1,1));
+hex(mid(1,1,1))
+31
+create table t1 as select mid(1,1,1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(repeat(1,2));
+hex(repeat(1,2))
+3131
+create table t1 as select repeat(1,2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(replace(1,1,2));
+hex(replace(1,1,2))
+32
+create table t1 as select replace(1,1,2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(reverse(12));
+hex(reverse(12))
+3231
+create table t1 as select reverse(12) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(right(123,1));
+hex(right(123,1))
+33
+create table t1 as select right(123,1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(rpad(1,2,0));
+hex(rpad(1,2,0))
+3130
+create table t1 as select rpad(1,2,0) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(rtrim(1));
+hex(rtrim(1))
+31
+create table t1 as select rtrim(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(soundex(1));
+hex(soundex(1))
+
+create table t1 as select soundex(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(substring(1,1,1));
+hex(substring(1,1,1))
+31
+create table t1 as select substring(1,1,1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(trim(1));
+hex(trim(1))
+31
+create table t1 as select trim(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(ucase(1));
+hex(ucase(1))
+31
+create table t1 as select ucase(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(upper(1));
+hex(upper(1))
+31
+create table t1 as select upper(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select repeat(' ', 64) as a limit 0;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` varchar(64) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ("1.1"), ("2.1");
+select a, hex(a) from t1;
+a	hex(a)
+1.1	312E31
+2.1	322E31
+update t1 set a= a + 0.1;
+select a, hex(a) from t1;
+a	hex(a)
+1.2000000000000002	312E32303030303030303030303030303032
+2.2	322E32
+drop table t1;
+create table t1 (a tinyint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a tinyint zerofill);
+insert into t1 values (1), (10), (100);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+303031	001
+303130	010
+313030	100
+drop table t1;
+create table t1 (a tinyint(30) zerofill);
+insert into t1 values (1), (10), (100);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+303030303030303030303030303030303030303030303030303030303031	000000000000000000000000000001
+303030303030303030303030303030303030303030303030303030303130	000000000000000000000000000010
+303030303030303030303030303030303030303030303030303030313030	000000000000000000000000000100
+drop table t1;
+create table t1 (a decimal(10,2));
+insert into t1 values (123.45);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3132332E3435
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(12) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a smallint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(6) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a smallint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+3030303031	00001
+3030303130	00010
+3030313030	00100
+3031303030	01000
+3130303030	10000
+drop table t1;
+create table t1 (a mediumint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(8) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a mediumint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+3030303030303031	00000001
+3030303030303130	00000010
+3030303030313030	00000100
+3030303031303030	00001000
+3030303130303030	00010000
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(11) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a int zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+30303030303030303031	0000000001
+30303030303030303130	0000000010
+30303030303030313030	0000000100
+30303030303031303030	0000001000
+30303030303130303030	0000010000
+drop table t1;
+create table t1 (a bigint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(20) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a bigint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+3030303030303030303030303030303030303031	00000000000000000001
+3030303030303030303030303030303030303130	00000000000000000010
+3030303030303030303030303030303030313030	00000000000000000100
+3030303030303030303030303030303031303030	00000000000000001000
+3030303030303030303030303030303130303030	00000000000000010000
+drop table t1;
+create table t1 (a float);
+insert into t1 values (123.456);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3132332E343536
+select concat(a) from t1;
+concat(a)
+123.456
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(12) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a float zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+303030303030303030312E31	0000000001.1
+303030303030303031302E31	0000000010.1
+303030303030303130302E31	0000000100.1
+303030303030313030302E31	0000001000.1
+303030303031303030302E31	0000010000.1
+drop table t1;
+create table t1 (a double);
+insert into t1 values (123.456);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3132332E343536
+select concat(a) from t1;
+concat(a)
+123.456
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(22) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a double zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+30303030303030303030303030303030303030312E31	00000000000000000001.1
+30303030303030303030303030303030303031302E31	00000000000000000010.1
+30303030303030303030303030303030303130302E31	00000000000000000100.1
+30303030303030303030303030303030313030302E31	00000000000000001000.1
+30303030303030303030303030303031303030302E31	00000000000000010000.1
+drop table t1;
+create table t1 (a year(2));
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a year);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+32303031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a bit(64));
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+0000000000000001
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varbinary(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a timestamp);
+insert into t1 values (0);
+insert into t1 values (20010203040506);
+insert into t1 values (19800203040506);
+insert into t1 values ('2001-02-03 04:05:06');
+select hex(concat(a)) from t1;
+hex(concat(a))
+303030302D30302D30302030303A30303A3030
+323030312D30322D30332030343A30353A3036
+313938302D30322D30332030343A30353A3036
+323030312D30322D30332030343A30353A3036
+select concat(a) from t1;
+concat(a)
+0000-00-00 00:00:00
+2001-02-03 04:05:06
+1980-02-03 04:05:06
+2001-02-03 04:05:06
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(19) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a date);
+insert into t1 values ('2001-02-03');
+insert into t1 values (20010203);
+select hex(concat(a)) from t1;
+hex(concat(a))
+323030312D30322D3033
+323030312D30322D3033
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a time);
+insert into t1 values (1);
+insert into t1 values ('01:02:03');
+select hex(concat(a)) from t1;
+hex(concat(a))
+30303A30303A3031
+30313A30323A3033
+select concat(a) from t1;
+concat(a)
+00:00:01
+01:02:03
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(8) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a datetime);
+insert into t1 values ('2001-02-03 04:05:06');
+insert into t1 values (20010203040506);
+select hex(concat(a)) from t1;
+hex(concat(a))
+323030312D30322D30332030343A30353A3036
+323030312D30322D30332030343A30353A3036
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(19) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+#
+# End of WL#2649 Number-to-string conversions
+#
+#
+# End of 5.4 tests
+#

=== modified file 'mysql-test/r/ctype_latin1.result'
--- a/mysql-test/r/ctype_latin1.result	2008-07-23 09:43:50 +0000
+++ b/mysql-test/r/ctype_latin1.result	2009-08-20 10:18:05 +0000
@@ -1123,3 +1123,2154 @@ select hex(weight_string('abc' as char(5
 hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
 FFFF9C9D9E
 set names latin1;
+#
+# Start of 5.4 tests
+#
+#
+# Start of WL#2649 Number-to-string conversions
+#
+select hex(concat(1));
+hex(concat(1))
+31
+create table t1 as select concat(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1.1));
+hex(concat(1.1))
+312E31
+create table t1 as select concat(1.1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a', 1+2)), charset(concat(1+2));
+hex(concat('a', 1+2))	charset(concat(1+2))
+6133	latin1
+create table t1 as select concat(1+2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1-2));
+hex(concat(1-2))
+2D31
+create table t1 as select concat(1-2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1*2));
+hex(concat(1*2))
+32
+create table t1 as select concat(1*2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1/2));
+hex(concat(1/2))
+302E35303030
+create table t1 as select concat(1/2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(7) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1 div 2));
+hex(concat(1 div 2))
+30
+create table t1 as select concat(1 div 2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1 % 2));
+hex(concat(1 % 2))
+31
+create table t1 as select concat(1 % 2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(-1));
+hex(concat(-1))
+2D31
+create table t1 as select concat(-1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(-(1+2)));
+hex(concat(-(1+2)))
+2D33
+create table t1 as select concat(-(1+2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1|2));
+hex(concat(1|2))
+33
+create table t1 as select concat(1|2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1&2));
+hex(concat(1&2))
+30
+create table t1 as select concat(1&2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(bit_count(12)));
+hex(concat(bit_count(12)))
+32
+create table t1 as select concat(bit_count(12)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(2<<1));
+hex(concat(2<<1))
+34
+create table t1 as select concat(2<<1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(2>>1));
+hex(concat(2>>1))
+31
+create table t1 as select concat(2>>1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(~0));
+hex(concat(~0))
+3138343436373434303733373039353531363135
+create table t1 as select concat(~0) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(3^2));
+hex(concat(3^2))
+31
+create table t1 as select concat(3^2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(abs(-2)));
+hex(concat(abs(-2)))
+32
+create table t1 as select concat(abs(-2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(exp(2)),1));
+hex(left(concat(exp(2)),1))
+37
+create table t1 as select concat(exp(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log(2)),1));
+hex(left(concat(log(2)),1))
+30
+create table t1 as select concat(log(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log2(2)),1));
+hex(left(concat(log2(2)),1))
+31
+create table t1 as select concat(log2(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log10(2)),1));
+hex(left(concat(log10(2)),1))
+30
+create table t1 as select concat(log10(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(sqrt(2)),1));
+hex(left(concat(sqrt(2)),1))
+31
+create table t1 as select concat(sqrt(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(pow(2,2)),1));
+hex(left(concat(pow(2,2)),1))
+34
+create table t1 as select concat(pow(2,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(acos(0.5)),1));
+hex(left(concat(acos(0.5)),1))
+31
+create table t1 as select concat(acos(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(asin(0.5)),1));
+hex(left(concat(asin(0.5)),1))
+30
+create table t1 as select concat(asin(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(atan(0.5)),1));
+hex(left(concat(atan(0.5)),1))
+30
+create table t1 as select concat(atan(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(cos(0.5)),1));
+hex(left(concat(cos(0.5)),1))
+30
+create table t1 as select concat(cos(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(sin(0.5)),1));
+hex(left(concat(sin(0.5)),1))
+30
+create table t1 as select concat(sin(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(tan(0.5)),1));
+hex(left(concat(tan(0.5)),1))
+30
+create table t1 as select concat(tan(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(degrees(0)));
+hex(concat(degrees(0)))
+30
+create table t1 as select concat(degrees(0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(radians(0)));
+hex(concat(radians(0)))
+30
+create table t1 as select concat(radians(0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ceiling(0.5)));
+hex(concat(ceiling(0.5)))
+31
+create table t1 as select concat(ceiling(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(floor(0.5)));
+hex(concat(floor(0.5)))
+30
+create table t1 as select concat(floor(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(round(0.5)));
+hex(concat(round(0.5)))
+31
+create table t1 as select concat(round(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sign(0.5)));
+hex(concat(sign(0.5)))
+31
+create table t1 as select concat(sign(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(rand()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(length('a')));
+hex(concat(length('a')))
+31
+create table t1 as select concat(length('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(char_length('a')));
+hex(concat(char_length('a')))
+31
+create table t1 as select concat(char_length('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(bit_length('a')));
+hex(concat(bit_length('a')))
+38
+create table t1 as select concat(bit_length('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(coercibility('a')));
+hex(concat(coercibility('a')))
+34
+create table t1 as select concat(coercibility('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(locate('a','a')));
+hex(concat(locate('a','a')))
+31
+create table t1 as select concat(locate('a','a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(11) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(field('c','a','b','c')));
+hex(concat(field('c','a','b','c')))
+33
+create table t1 as select concat(field('c','a','b','c')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ascii(61)));
+hex(concat(ascii(61)))
+3534
+create table t1 as select concat(ascii(61)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ord(61)));
+hex(concat(ord(61)))
+3534
+create table t1 as select concat(ord(61)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(find_in_set('b','a,b,c,d')));
+hex(concat(find_in_set('b','a,b,c,d')))
+32
+create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select md5('a'), hex(md5('a'));
+md5('a')	hex(md5('a'))
+0cc175b9c0f1b6a831c399e269772661	3063633137356239633066316236613833316333393965323639373732363631
+create table t1 as select md5('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(32) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select old_password('a'), hex(old_password('a'));
+old_password('a')	hex(old_password('a'))
+60671c896665c3fa	36303637316338393636363563336661
+create table t1 as select old_password('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(16) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select password('a'), hex(password('a'));
+password('a')	hex(password('a'))
+*667F407DE7C6AD07358FA38DAED7828A72014B4E	2A36363746343037444537433641443037333538464133384441454437383238413732303134423445
+create table t1 as select password('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(41) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select sha('a'), hex(sha('a'));
+sha('a')	hex(sha('a'))
+86f7e437faa5a7fce15d1ddcb9eaeaea377667b8	38366637653433376661613561376663653135643164646362396561656165613337373636376238
+create table t1 as select sha('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(40) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select sha1('a'), hex(sha1('a'));
+sha1('a')	hex(sha1('a'))
+86f7e437faa5a7fce15d1ddcb9eaeaea377667b8	38366637653433376661613561376663653135643164646362396561656165613337373636376238
+create table t1 as select sha1('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(40) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select sha2('a',224), hex(sha2('a',224));
+sha2('a',224)	hex(sha2('a',224))
+abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5	6162643337353334633764396132656662393436356465393331636437303535666664623838373935363361653938303738643664366435
+create table t1 as select sha2('a',224) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(56) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('-1' as signed)));
+hex(concat(cast('-1' as signed)))
+2D31
+create table t1 as select concat(cast('-1' as signed)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('1' as unsigned)));
+hex(concat(cast('1' as unsigned)))
+31
+create table t1 as select concat(cast('1' as unsigned)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast(1/2 as decimal(5,5))));
+hex(concat(cast(1/2 as decimal(5,5))))
+302E3530303030
+create table t1 as select concat(cast(1/2 as decimal(5,5))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(7) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('2001-01-02 03:04:05' as date)));
+hex(concat(cast('2001-01-02 03:04:05' as date)))
+323030312D30312D3032
+create table t1 as select concat(cast('2001-01-02 03:04:05' as date)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2001-01-02
+drop table t1;
+select hex(concat(cast('2001-01-02 03:04:05' as time)));
+hex(concat(cast('2001-01-02 03:04:05' as time)))
+30333A30343A3035
+create table t1 as select concat(cast('2001-01-02 03:04:05' as time)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+03:04:05
+drop table t1;
+select hex(concat(cast('2001-01-02' as datetime)));
+hex(concat(cast('2001-01-02' as datetime)))
+323030312D30312D30322030303A30303A3030
+create table t1 as select concat(cast('2001-01-02' as datetime)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(29) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2001-01-02 00:00:00
+drop table t1;
+select hex(concat(least(1,2)));
+hex(concat(least(1,2)))
+31
+create table t1 as select concat(least(1,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(greatest(1,2)));
+hex(concat(greatest(1,2)))
+32
+create table t1 as select concat(greatest(1,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(case when 11 then 22 else 33 end));
+hex(concat(case when 11 then 22 else 33 end))
+3232
+create table t1 as select concat(case when 11 then 22 else 33 end) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(coalesce(1,2)));
+hex(concat(coalesce(1,2)))
+31
+create table t1 as select concat(coalesce(1,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat_ws(1,2,3));
+hex(concat_ws(1,2,3))
+323133
+create table t1 as select concat_ws(1,2,3) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(group_concat(1,2,3));
+hex(group_concat(1,2,3))
+313233
+create table t1 as select group_concat(1,2,3) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` text
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select 1 as c1 union select 'a';
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select hex(c1) from t1 order by c1;
+hex(c1)
+31
+61
+drop table t1;
+create table t1 as select concat(last_insert_id()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(benchmark(0,0)));
+hex(concat(benchmark(0,0)))
+30
+create table t1 as select concat(benchmark(0,0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sleep(0)));
+hex(concat(sleep(0)))
+30
+create table t1 as select concat(sleep(0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(get_lock('a',0)));
+hex(concat(get_lock('a',0)))
+31
+select hex(concat(release_lock('a')));
+hex(concat(release_lock('a')))
+31
+create table t1 as select concat(get_lock('a',0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(is_free_lock('xxxx')));
+hex(concat(is_free_lock('xxxx')))
+31
+create table t1 as select concat(is_free_lock('xxxx')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(is_used_lock('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(release_lock('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(crc32('')));
+hex(concat(crc32('')))
+30
+create table t1 as select concat(crc32('')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(uncompressed_length('')));
+hex(concat(uncompressed_length('')))
+30
+create table t1 as select concat(uncompressed_length('')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(connection_id()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(inet_aton('127.1.1.1')));
+hex(concat(inet_aton('127.1.1.1')))
+32313330373732323235
+create table t1 as select concat(inet_aton('127.1.1.1')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(inet_ntoa(2130772225)));
+hex(concat(inet_ntoa(2130772225)))
+3132372E312E312E31
+create table t1 as select concat(inet_ntoa(2130772225)) as c1;
+select * from t1;
+c1
+127.1.1.1
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(31) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(row_count()));
+hex(concat(row_count()))
+2D31
+create table t1 as select concat(row_count()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(found_rows()));
+hex(concat(found_rows()))
+30
+create table t1 as select concat(found_rows()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(uuid_short()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(uuid()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
+coercibility(uuid())	coercibility(cast('a' as char character set latin1))
+4	2
+select charset(concat(uuid(), cast('a' as char character set latin1)));
+charset(concat(uuid(), cast('a' as char character set latin1)))
+latin1
+create table t1 as select concat(uuid(), cast('a' as char character set latin1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(37) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=1));
+hex(concat(@a1:=1))
+31
+create table t1 as select concat(@a2:=2) as c1, @a3:=3 as c2;
+select hex(c1) from t1;
+hex(c1)
+32
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT '',
+  `c2` int(1) NOT NULL DEFAULT '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=1;
+select hex(concat(@a2));
+hex(concat(@a2))
+31
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+31
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(20) DEFAULT NULL,
+  `c2` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=sqrt(1)));
+hex(concat(@a1:=sqrt(1)))
+31
+create table t1 as select concat(@a2:=sqrt(1)) as c1, @a3:=sqrt(1) as c2;
+select hex(c1) from t1;
+hex(c1)
+31
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL,
+  `c2` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=sqrt(1);
+select hex(concat(@a2));
+hex(concat(@a2))
+31
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+31
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL,
+  `c2` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=1.1));
+hex(concat(@a1:=1.1))
+312E31
+create table t1 as select concat(@a2:=1.1) as c1, @a3:=1.1 as c2;
+select hex(c1) from t1;
+hex(c1)
+312E31
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) NOT NULL DEFAULT '',
+  `c2` decimal(2,1) NOT NULL DEFAULT '0.0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=1.1;
+select hex(concat(@a2));
+hex(concat(@a2))
+312E31
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+312E31
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(83) DEFAULT NULL,
+  `c2` decimal(65,30) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@@ft_max_word_len));
+hex(concat(@@ft_max_word_len))
+3834
+create table t1 as select concat(@@ft_max_word_len) as c1;
+select hex(c1) from t1;
+hex(c1)
+3834
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a'='a' IS TRUE));
+hex(concat('a'='a' IS TRUE))
+31
+create table t1 as select concat('a'='a' IS TRUE) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a'='a' IS NOT TRUE));
+hex(concat('a'='a' IS NOT TRUE))
+30
+create table t1 as select concat('a'='a' IS NOT TRUE) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NOT 'a'='a'));
+hex(concat(NOT 'a'='a'))
+30
+create table t1 as select concat(NOT 'a'='a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' IS NULL));
+hex(concat('a' IS NULL))
+30
+create table t1 as select concat('a' IS NULL) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' IS NOT NULL));
+hex(concat('a' IS NOT NULL))
+31
+create table t1 as select concat('a' IS NOT NULL) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' rlike 'a'));
+hex(concat('a' rlike 'a'))
+31
+create table t1 as select concat('a' IS NOT NULL) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(strcmp('a','b')));
+hex(concat(strcmp('a','b')))
+2D31
+create table t1 as select concat(strcmp('a','b')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' like 'a'));
+hex(concat('a' like 'a'))
+31
+create table t1 as select concat('a' like 'b') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' between 'b' and 'c'));
+hex(concat('a' between 'b' and 'c'))
+30
+create table t1 as select concat('a' between 'b' and 'c') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' in ('a','b')));
+hex(concat('a' in ('a','b')))
+31
+create table t1 as select concat('a' in ('a','b')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
+hex(concat(interval(23, 1, 15, 17, 30, 44, 200)))
+33
+create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a varchar(10), fulltext key(a));
+insert into t1 values ('a');
+select hex(concat(match (a) against ('a'))) from t1;
+hex(concat(match (a) against ('a')))
+30
+create table t2 as select concat(match (a) against ('a')) as a from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `a` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+select hex(ifnull(1,'a'));
+hex(ifnull(1,'a'))
+31
+create table t1 as select ifnull(1,'a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ifnull(1,1)));
+hex(concat(ifnull(1,1)))
+31
+create table t1 as select concat(ifnull(1,1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ifnull(1.1,1.1)));
+hex(concat(ifnull(1.1,1.1)))
+312E31
+create table t1 as select concat(ifnull(1.1,1.1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(if(1,'b',1));
+hex(if(1,'b',1))
+62
+create table t1 as select if(1,'b',1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(if(1,1,'b'));
+hex(if(1,1,'b'))
+31
+create table t1 as select if(1,1,'b') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(if(1,1,1)));
+hex(concat(if(1,1,1)))
+31
+create table t1 as select concat(if(1,1,1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(nullif(1,2)));
+hex(concat(nullif(1,2)))
+31
+create table t1 as select concat(nullif(1,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)'))));
+hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)'))))
+31
+create table t1 as select concat(Dimension(GeomFromText('LINSTRING(0 0,10 10)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))));
+hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))))
+32
+create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))));
+hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))))
+32
+create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))));
+hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))))
+30
+create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))));
+hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))))
+31
+create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsEmpty(GeomFromText('POINT(1 1)'))));
+hex(concat(IsEmpty(GeomFromText('POINT(1 1)'))))
+30
+create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
+hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
+30
+create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))));
+hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))))
+30
+create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))));
+hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))))
+31
+create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1;
+drop table t1;
+select hex(concat(x(GeomFromText('Point(1 2)'))));
+hex(concat(x(GeomFromText('Point(1 2)'))))
+31
+create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(y(GeomFromText('Point(1 2)'))));
+hex(concat(y(GeomFromText('Point(1 2)'))))
+32
+create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)'))));
+hex(concat(GLength(GeomFromText('LineString(1 2,2 2)'))))
+31
+create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))));
+hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))))
+31
+create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(GeometryType(GeomFromText('Point(1 2)'))));
+hex(concat(GeometryType(GeomFromText('Point(1 2)'))))
+504F494E54
+create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(AsText(GeomFromText('Point(1 2)'))));
+hex(concat(AsText(GeomFromText('Point(1 2)'))))
+504F494E542831203229
+create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` longtext
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(period_add(200902, 2)));
+hex(concat(period_add(200902, 2)))
+323030393034
+create table t1 as select concat(period_add(200902, 2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(period_diff(200902, 200802)));
+hex(concat(period_diff(200902, 200802)))
+3132
+create table t1 as select concat(period_add(200902, 200802)) as c1;
+Warnings:
+Warning	1265	Data truncated for column 'c1' at row 1
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(to_days(20090224)));
+hex(concat(to_days(20090224)))
+373333383237
+create table t1 as select concat(to_days(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofmonth(20090224)));
+hex(concat(dayofmonth(20090224)))
+3234
+create table t1 as select concat(dayofmonth(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofyear(20090224)));
+hex(concat(dayofyear(20090224)))
+3535
+create table t1 as select concat(dayofyear(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(hour('10:11:12')));
+hex(concat(hour('10:11:12')))
+3130
+create table t1 as select concat(hour('10:11:12')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(minute('10:11:12')));
+hex(concat(minute('10:11:12')))
+3131
+create table t1 as select concat(minute('10:11:12')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(second('10:11:12')));
+hex(concat(second('10:11:12')))
+3132
+create table t1 as select concat(second('10:11:12')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(quarter(20090224)));
+hex(concat(quarter(20090224)))
+31
+create table t1 as select concat(quarter(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(week(20090224)));
+hex(concat(week(20090224)))
+38
+create table t1 as select concat(week(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(yearweek(20090224)));
+hex(concat(yearweek(20090224)))
+323030393038
+create table t1 as select concat(yearweek(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(year(20090224)));
+hex(concat(year(20090224)))
+32303039
+create table t1 as select concat(year(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(weekday(20090224)));
+hex(concat(weekday(20090224)))
+31
+create table t1 as select concat(weekday(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofweek(20090224)));
+hex(concat(dayofweek(20090224)))
+33
+create table t1 as select concat(dayofweek(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(unix_timestamp(20090224)));
+hex(concat(unix_timestamp(20090224)))
+31323335343232383030
+create table t1 as select concat(unix_timestamp(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(time_to_sec('10:11:12')));
+hex(concat(time_to_sec('10:11:12')))
+3336363732
+create table t1 as select concat(time_to_sec('10:11:12')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(extract(year from 20090702)));
+hex(concat(extract(year from 20090702)))
+32303039
+create table t1 as select concat(extract(year from 20090702)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(microsecond('12:00:00.123456')));
+hex(concat(microsecond('12:00:00.123456')))
+313233343536
+create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(month(20090224)));
+hex(concat(month(20090224)))
+32
+create table t1 as select concat(month(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(last_day('2003-02-05')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select c1, hex(c1) from t1;
+c1	hex(c1)
+2003-02-28	323030332D30322D3238
+drop table t1;
+create table t1 as select concat(from_days(730669)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select c1, hex(c1) from t1;
+c1	hex(c1)
+2000-07-03	323030302D30372D3033
+drop table t1;
+create table t1 as select concat(curdate()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(utc_date()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(curtime()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(8) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select repeat('a',20) as c1 limit 0;
+set timestamp=1216359724;
+insert into t1 values (current_date);
+insert into t1 values (current_time);
+select c1, hex(c1) from t1;
+c1	hex(c1)
+2008-07-18	323030382D30372D3138
+08:42:04	30383A34323A3034
+drop table t1;
+create table t1 as select concat(utc_time()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(8) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sec_to_time(2378)));
+hex(concat(sec_to_time(2378)))
+30303A33393A3338
+create table t1 as select concat(sec_to_time(2378)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')));
+hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')))
+32343A30303A3030
+create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(maketime(10,11,12)));
+hex(concat(maketime(10,11,12)))
+31303A31313A3132
+create table t1 as select concat(maketime(10,11,12)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(get_format(DATE,'USA'));
+hex(get_format(DATE,'USA'))
+256D2E25642E2559
+create table t1 as select get_format(DATE,'USA') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(17) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(from_unixtime(1111885200)),4));
+hex(left(concat(from_unixtime(1111885200)),4))
+32303035
+create table t1 as select concat(from_unixtime(1111885200)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')));
+hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')))
+323030332D31322D33312032303A30303A3030
+create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day)));
+hex(concat(date_add('2004-01-01 12:00:00', interval 1 day)))
+323030342D30312D30322031323A30303A3030
+create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(29) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2004-01-02 12:00:00
+drop table t1;
+select hex(concat(makedate(2009,1)));
+hex(concat(makedate(2009,1)))
+323030392D30312D3031
+create table t1 as select concat(makedate(2009,1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2009-01-01
+drop table t1;
+create table t1 as select concat(now()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(utc_timestamp()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(sysdate()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(addtime('00:00:00','11:22:33')));
+hex(concat(addtime('00:00:00','11:22:33')))
+31313A32323A3333
+create table t1 as select concat(addtime('00:00:00','11:22:33')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(29) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(subtime('23:59:59','11:22:33')));
+hex(concat(subtime('23:59:59','11:22:33')))
+31323A33373A3236
+create table t1 as select concat(subtime('23:59:59','11:22:33')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(29) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(elt(1,2,3));
+hex(elt(1,2,3))
+32
+create table t1 as select elt(1,2,3) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(export_set(1,2,3,4,2));
+hex(export_set(1,2,3,4,2))
+323433
+create table t1 as select export_set(1,2,3,4,2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(127) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(insert(1133,3,0,22));
+hex(insert(1133,3,0,22))
+313132323333
+create table t1 as select insert(1133,3,0,22) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lcase(123));
+hex(lcase(123))
+313233
+create table t1 as select lcase(123) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(123,1));
+hex(left(123,1))
+31
+create table t1 as select left(123,1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lower(123));
+hex(lower(123))
+313233
+create table t1 as select lower(123) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lpad(1,2,0));
+hex(lpad(1,2,0))
+3031
+create table t1 as select lpad(1,2,0) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(ltrim(1));
+hex(ltrim(1))
+31
+create table t1 as select ltrim(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(mid(1,1,1));
+hex(mid(1,1,1))
+31
+create table t1 as select mid(1,1,1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(repeat(1,2));
+hex(repeat(1,2))
+3131
+create table t1 as select repeat(1,2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(replace(1,1,2));
+hex(replace(1,1,2))
+32
+create table t1 as select replace(1,1,2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(reverse(12));
+hex(reverse(12))
+3231
+create table t1 as select reverse(12) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(right(123,1));
+hex(right(123,1))
+33
+create table t1 as select right(123,1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(rpad(1,2,0));
+hex(rpad(1,2,0))
+3130
+create table t1 as select rpad(1,2,0) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(rtrim(1));
+hex(rtrim(1))
+31
+create table t1 as select rtrim(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(soundex(1));
+hex(soundex(1))
+
+create table t1 as select soundex(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(substring(1,1,1));
+hex(substring(1,1,1))
+31
+create table t1 as select substring(1,1,1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(trim(1));
+hex(trim(1))
+31
+create table t1 as select trim(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(ucase(1));
+hex(ucase(1))
+31
+create table t1 as select ucase(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(upper(1));
+hex(upper(1))
+31
+create table t1 as select upper(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select repeat(' ', 64) as a limit 0;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` varchar(64) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ("1.1"), ("2.1");
+select a, hex(a) from t1;
+a	hex(a)
+1.1	312E31
+2.1	322E31
+update t1 set a= a + 0.1;
+select a, hex(a) from t1;
+a	hex(a)
+1.2000000000000002	312E32303030303030303030303030303032
+2.2	322E32
+drop table t1;
+create table t1 (a tinyint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a tinyint zerofill);
+insert into t1 values (1), (10), (100);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+303031	001
+303130	010
+313030	100
+drop table t1;
+create table t1 (a tinyint(30) zerofill);
+insert into t1 values (1), (10), (100);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+303030303030303030303030303030303030303030303030303030303031	000000000000000000000000000001
+303030303030303030303030303030303030303030303030303030303130	000000000000000000000000000010
+303030303030303030303030303030303030303030303030303030313030	000000000000000000000000000100
+drop table t1;
+create table t1 (a decimal(10,2));
+insert into t1 values (123.45);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3132332E3435
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(12) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a smallint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(6) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a smallint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+3030303031	00001
+3030303130	00010
+3030313030	00100
+3031303030	01000
+3130303030	10000
+drop table t1;
+create table t1 (a mediumint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(8) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a mediumint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+3030303030303031	00000001
+3030303030303130	00000010
+3030303030313030	00000100
+3030303031303030	00001000
+3030303130303030	00010000
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a int zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+30303030303030303031	0000000001
+30303030303030303130	0000000010
+30303030303030313030	0000000100
+30303030303031303030	0000001000
+30303030303130303030	0000010000
+drop table t1;
+create table t1 (a bigint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a bigint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+3030303030303030303030303030303030303031	00000000000000000001
+3030303030303030303030303030303030303130	00000000000000000010
+3030303030303030303030303030303030313030	00000000000000000100
+3030303030303030303030303030303031303030	00000000000000001000
+3030303030303030303030303030303130303030	00000000000000010000
+drop table t1;
+create table t1 (a float);
+insert into t1 values (123.456);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3132332E343536
+select concat(a) from t1;
+concat(a)
+123.456
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(12) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a float zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+303030303030303030312E31	0000000001.1
+303030303030303031302E31	0000000010.1
+303030303030303130302E31	0000000100.1
+303030303030313030302E31	0000001000.1
+303030303031303030302E31	0000010000.1
+drop table t1;
+create table t1 (a double);
+insert into t1 values (123.456);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3132332E343536
+select concat(a) from t1;
+concat(a)
+123.456
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(22) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a double zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+30303030303030303030303030303030303030312E31	00000000000000000001.1
+30303030303030303030303030303030303031302E31	00000000000000000010.1
+30303030303030303030303030303030303130302E31	00000000000000000100.1
+30303030303030303030303030303030313030302E31	00000000000000001000.1
+30303030303030303030303030303031303030302E31	00000000000000010000.1
+drop table t1;
+create table t1 (a year(2));
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a year);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+32303031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a bit(64));
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+0000000000000001
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varbinary(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a timestamp);
+insert into t1 values (0);
+insert into t1 values (20010203040506);
+insert into t1 values (19800203040506);
+insert into t1 values ('2001-02-03 04:05:06');
+select hex(concat(a)) from t1;
+hex(concat(a))
+303030302D30302D30302030303A30303A3030
+323030312D30322D30332030343A30353A3036
+313938302D30322D30332030343A30353A3036
+323030312D30322D30332030343A30353A3036
+select concat(a) from t1;
+concat(a)
+0000-00-00 00:00:00
+2001-02-03 04:05:06
+1980-02-03 04:05:06
+2001-02-03 04:05:06
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(19) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a date);
+insert into t1 values ('2001-02-03');
+insert into t1 values (20010203);
+select hex(concat(a)) from t1;
+hex(concat(a))
+323030312D30322D3033
+323030312D30322D3033
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a time);
+insert into t1 values (1);
+insert into t1 values ('01:02:03');
+select hex(concat(a)) from t1;
+hex(concat(a))
+30303A30303A3031
+30313A30323A3033
+select concat(a) from t1;
+concat(a)
+00:00:01
+01:02:03
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(8) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a datetime);
+insert into t1 values ('2001-02-03 04:05:06');
+insert into t1 values (20010203040506);
+select hex(concat(a)) from t1;
+hex(concat(a))
+323030312D30322D30332030343A30353A3036
+323030312D30322D30332030343A30353A3036
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(19) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+#
+# End of WL#2649 Number-to-string conversions
+#
+#
+# End of 5.4 tests
+#

=== modified file 'mysql-test/r/ctype_ucs.result'
--- a/mysql-test/r/ctype_ucs.result	2009-07-03 05:54:09 +0000
+++ b/mysql-test/r/ctype_ucs.result	2009-08-20 10:18:05 +0000
@@ -972,12 +972,12 @@ ALTER TABLE t2 ADD a int NOT NULL AFTER 
 DROP TABLE t1,t2;
 select password(name) from bug20536;
 password(name)
-????????????????????
-????????????????????
+*286C12C0F32248BD65B30EE65F3ECFB2AA3F7849
+*947A5674312754578F132655C74A11533B105FF6
 select old_password(name) from bug20536;
 old_password(name)
-????????
-????????
+10e155cb44e2adb5
+14e500b131773991
 select quote(name) from bug20536;
 quote(name)
 ????????
@@ -1594,7 +1594,9 @@ INSERT INTO t1 values ('abc'),('bcd'),('
 ALTER TABLE t1 ADD UNIQUE Index_1 (f1);
 ERROR 23000: Duplicate entry 'abc' for key 'Index_1'
 DROP TABLE t1;
-Start of 6.0 tests
+#
+# Start of 5.4 tests
+#
 SET collation_connection=ucs2_general_ci;
 CREATE TABLE t1 AS SELECT repeat('a',20) AS s1 LIMIT 0;
 SET timestamp=1216359724;
@@ -1609,3 +1611,2153 @@ s1	hex(s1)
 DROP TABLE t1;
 SET timestamp=0;
 SET NAMES latin1;
+SET collation_connection=ucs2_general_ci;
+#
+# Start of WL#2649 Number-to-string conversions
+#
+select hex(concat(1));
+hex(concat(1))
+0031
+create table t1 as select concat(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1.1));
+hex(concat(1.1))
+0031002E0031
+create table t1 as select concat(1.1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a', 1+2)), charset(concat(1+2));
+hex(concat('a', 1+2))	charset(concat(1+2))
+00610033	ucs2
+create table t1 as select concat(1+2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1-2));
+hex(concat(1-2))
+002D0031
+create table t1 as select concat(1-2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1*2));
+hex(concat(1*2))
+0032
+create table t1 as select concat(1*2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1/2));
+hex(concat(1/2))
+0030002E0035003000300030
+create table t1 as select concat(1/2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(7) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1 div 2));
+hex(concat(1 div 2))
+0030
+create table t1 as select concat(1 div 2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1 % 2));
+hex(concat(1 % 2))
+0031
+create table t1 as select concat(1 % 2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(-1));
+hex(concat(-1))
+002D0031
+create table t1 as select concat(-1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(-(1+2)));
+hex(concat(-(1+2)))
+002D0033
+create table t1 as select concat(-(1+2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1|2));
+hex(concat(1|2))
+0033
+create table t1 as select concat(1|2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1&2));
+hex(concat(1&2))
+0030
+create table t1 as select concat(1&2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(bit_count(12)));
+hex(concat(bit_count(12)))
+0032
+create table t1 as select concat(bit_count(12)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(2<<1));
+hex(concat(2<<1))
+0034
+create table t1 as select concat(2<<1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(2>>1));
+hex(concat(2>>1))
+0031
+create table t1 as select concat(2>>1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(~0));
+hex(concat(~0))
+00310038003400340036003700340034003000370033003700300039003500350031003600310035
+create table t1 as select concat(~0) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(3^2));
+hex(concat(3^2))
+0031
+create table t1 as select concat(3^2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(abs(-2)));
+hex(concat(abs(-2)))
+0032
+create table t1 as select concat(abs(-2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(exp(2)),1));
+hex(left(concat(exp(2)),1))
+0037
+create table t1 as select concat(exp(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log(2)),1));
+hex(left(concat(log(2)),1))
+0030
+create table t1 as select concat(log(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log2(2)),1));
+hex(left(concat(log2(2)),1))
+0031
+create table t1 as select concat(log2(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log10(2)),1));
+hex(left(concat(log10(2)),1))
+0030
+create table t1 as select concat(log10(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(sqrt(2)),1));
+hex(left(concat(sqrt(2)),1))
+0031
+create table t1 as select concat(sqrt(2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(pow(2,2)),1));
+hex(left(concat(pow(2,2)),1))
+0034
+create table t1 as select concat(pow(2,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(acos(0.5)),1));
+hex(left(concat(acos(0.5)),1))
+0031
+create table t1 as select concat(acos(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(asin(0.5)),1));
+hex(left(concat(asin(0.5)),1))
+0030
+create table t1 as select concat(asin(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(atan(0.5)),1));
+hex(left(concat(atan(0.5)),1))
+0030
+create table t1 as select concat(atan(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(cos(0.5)),1));
+hex(left(concat(cos(0.5)),1))
+0030
+create table t1 as select concat(cos(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(sin(0.5)),1));
+hex(left(concat(sin(0.5)),1))
+0030
+create table t1 as select concat(sin(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(tan(0.5)),1));
+hex(left(concat(tan(0.5)),1))
+0030
+create table t1 as select concat(tan(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(degrees(0)));
+hex(concat(degrees(0)))
+0030
+create table t1 as select concat(degrees(0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(radians(0)));
+hex(concat(radians(0)))
+0030
+create table t1 as select concat(radians(0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ceiling(0.5)));
+hex(concat(ceiling(0.5)))
+0031
+create table t1 as select concat(ceiling(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(floor(0.5)));
+hex(concat(floor(0.5)))
+0030
+create table t1 as select concat(floor(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(round(0.5)));
+hex(concat(round(0.5)))
+0031
+create table t1 as select concat(round(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sign(0.5)));
+hex(concat(sign(0.5)))
+0031
+create table t1 as select concat(sign(0.5)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(rand()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(length('a')));
+hex(concat(length('a')))
+0032
+create table t1 as select concat(length('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(char_length('a')));
+hex(concat(char_length('a')))
+0031
+create table t1 as select concat(char_length('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(bit_length('a')));
+hex(concat(bit_length('a')))
+00310036
+create table t1 as select concat(bit_length('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(coercibility('a')));
+hex(concat(coercibility('a')))
+0034
+create table t1 as select concat(coercibility('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(locate('a','a')));
+hex(concat(locate('a','a')))
+0031
+create table t1 as select concat(locate('a','a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(11) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(field('c','a','b','c')));
+hex(concat(field('c','a','b','c')))
+0033
+create table t1 as select concat(field('c','a','b','c')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ascii(61)));
+hex(concat(ascii(61)))
+00350034
+create table t1 as select concat(ascii(61)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ord(61)));
+hex(concat(ord(61)))
+00350034
+create table t1 as select concat(ord(61)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(find_in_set('b','a,b,c,d')));
+hex(concat(find_in_set('b','a,b,c,d')))
+0032
+create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select md5('a'), hex(md5('a'));
+md5('a')	hex(md5('a'))
+760f753576f2955b0074758acb4d5fa6	00370036003000660037003500330035003700360066003200390035003500620030003000370034003700350038006100630062003400640035006600610036
+create table t1 as select md5('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(32) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select old_password('a'), hex(old_password('a'));
+old_password('a')	hex(old_password('a'))
+0705298948d1f92f	0030003700300035003200390038003900340038006400310066003900320066
+create table t1 as select old_password('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(16) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select password('a'), hex(password('a'));
+password('a')	hex(password('a'))
+*9A48A662559C49521B25C43077059DD109FBD84A	002A0039004100340038004100360036003200350035003900430034003900350032003100420032003500430034003300300037003700300035003900440044003100300039004600420044003800340041
+create table t1 as select password('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(41) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select sha('a'), hex(sha('a'));
+sha('a')	hex(sha('a'))
+3106600e0327ca77371f2526df794ed84322585c	0033003100300036003600300030006500300033003200370063006100370037003300370031006600320035003200360064006600370039003400650064003800340033003200320035003800350063
+create table t1 as select sha('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(40) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select sha1('a'), hex(sha1('a'));
+sha1('a')	hex(sha1('a'))
+3106600e0327ca77371f2526df794ed84322585c	0033003100300036003600300030006500300033003200370063006100370037003300370031006600320035003200360064006600370039003400650064003800340033003200320035003800350063
+create table t1 as select sha1('a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(40) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select sha2('a',224), hex(sha2('a',224));
+sha2('a',224)	hex(sha2('a',224))
+d95baf2bf68a013f316b01dc606dce2c7c2b5647e7c436fb41e4a886	00640039003500620061006600320062006600360038006100300031003300660033003100360062003000310064006300360030003600640063006500320063003700630032006200350036003400370065003700630034003300360066006200340031006500340061003800380036
+create table t1 as select sha2('a',224) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(56) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('-1' as signed)));
+hex(concat(cast('-1' as signed)))
+002D0031
+create table t1 as select concat(cast('-1' as signed)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('1' as unsigned)));
+hex(concat(cast('1' as unsigned)))
+0031
+create table t1 as select concat(cast('1' as unsigned)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast(1/2 as decimal(5,5))));
+hex(concat(cast(1/2 as decimal(5,5))))
+0030002E00350030003000300030
+create table t1 as select concat(cast(1/2 as decimal(5,5))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(7) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('2001-01-02 03:04:05' as date)));
+hex(concat(cast('2001-01-02 03:04:05' as date)))
+0032003000300031002D00300031002D00300032
+create table t1 as select concat(cast('2001-01-02 03:04:05' as date)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2001-01-02
+drop table t1;
+select hex(concat(cast('2001-01-02 03:04:05' as time)));
+hex(concat(cast('2001-01-02 03:04:05' as time)))
+00300033003A00300034003A00300035
+create table t1 as select concat(cast('2001-01-02 03:04:05' as time)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+03:04:05
+drop table t1;
+select hex(concat(cast('2001-01-02' as datetime)));
+hex(concat(cast('2001-01-02' as datetime)))
+0032003000300031002D00300031002D00300032002000300030003A00300030003A00300030
+create table t1 as select concat(cast('2001-01-02' as datetime)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(29) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2001-01-02 00:00:00
+drop table t1;
+select hex(concat(least(1,2)));
+hex(concat(least(1,2)))
+0031
+create table t1 as select concat(least(1,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(greatest(1,2)));
+hex(concat(greatest(1,2)))
+0032
+create table t1 as select concat(greatest(1,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(case when 11 then 22 else 33 end));
+hex(concat(case when 11 then 22 else 33 end))
+00320032
+create table t1 as select concat(case when 11 then 22 else 33 end) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(coalesce(1,2)));
+hex(concat(coalesce(1,2)))
+0031
+create table t1 as select concat(coalesce(1,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat_ws(1,2,3));
+hex(concat_ws(1,2,3))
+003200310033
+create table t1 as select concat_ws(1,2,3) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(group_concat(1,2,3));
+hex(group_concat(1,2,3))
+003100320033
+create table t1 as select group_concat(1,2,3) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(512) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select 1 as c1 union select 'a';
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select hex(c1) from t1 order by c1;
+hex(c1)
+0031
+0061
+drop table t1;
+create table t1 as select concat(last_insert_id()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(benchmark(0,0)));
+hex(concat(benchmark(0,0)))
+0030
+create table t1 as select concat(benchmark(0,0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sleep(0)));
+hex(concat(sleep(0)))
+0030
+create table t1 as select concat(sleep(0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(get_lock('a',0)));
+hex(concat(get_lock('a',0)))
+0031
+select hex(concat(release_lock('a')));
+hex(concat(release_lock('a')))
+0031
+create table t1 as select concat(get_lock('a',0)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(is_free_lock('xxxx')));
+hex(concat(is_free_lock('xxxx')))
+0031
+create table t1 as select concat(is_free_lock('xxxx')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(is_used_lock('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(release_lock('a')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(crc32('')));
+hex(concat(crc32('')))
+0030
+create table t1 as select concat(crc32('')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(uncompressed_length('')));
+hex(concat(uncompressed_length('')))
+0030
+create table t1 as select concat(uncompressed_length('')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(connection_id()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(inet_aton('127.1.1.1')));
+hex(concat(inet_aton('127.1.1.1')))
+0032003100330030003700370032003200320035
+create table t1 as select concat(inet_aton('127.1.1.1')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(inet_ntoa(2130772225)));
+hex(concat(inet_ntoa(2130772225)))
+003100320037002E0031002E0031002E0031
+create table t1 as select concat(inet_ntoa(2130772225)) as c1;
+select * from t1;
+c1
+127.1.1.1
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(31) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(row_count()));
+hex(concat(row_count()))
+002D0031
+create table t1 as select concat(row_count()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(found_rows()));
+hex(concat(found_rows()))
+0030
+create table t1 as select concat(found_rows()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(uuid_short()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(uuid()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
+coercibility(uuid())	coercibility(cast('a' as char character set latin1))
+4	2
+select charset(concat(uuid(), cast('a' as char character set latin1)));
+charset(concat(uuid(), cast('a' as char character set latin1)))
+latin1
+create table t1 as select concat(uuid(), cast('a' as char character set latin1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(37) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=1));
+hex(concat(@a1:=1))
+0031
+create table t1 as select concat(@a2:=2) as c1, @a3:=3 as c2;
+select hex(c1) from t1;
+hex(c1)
+0032
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '',
+  `c2` int(1) NOT NULL DEFAULT '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=1;
+select hex(concat(@a2));
+hex(concat(@a2))
+0031
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+0031
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(20) CHARACTER SET ucs2 DEFAULT NULL,
+  `c2` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=sqrt(1)));
+hex(concat(@a1:=sqrt(1)))
+0031
+create table t1 as select concat(@a2:=sqrt(1)) as c1, @a3:=sqrt(1) as c2;
+select hex(c1) from t1;
+hex(c1)
+0031
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL,
+  `c2` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=sqrt(1);
+select hex(concat(@a2));
+hex(concat(@a2))
+0031
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+0031
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL,
+  `c2` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=1.1));
+hex(concat(@a1:=1.1))
+0031002E0031
+create table t1 as select concat(@a2:=1.1) as c1, @a3:=1.1 as c2;
+select hex(c1) from t1;
+hex(c1)
+0031002E0031
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT '',
+  `c2` decimal(2,1) NOT NULL DEFAULT '0.0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=1.1;
+select hex(concat(@a2));
+hex(concat(@a2))
+0031002E0031
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+0031002E0031
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(83) CHARACTER SET ucs2 DEFAULT NULL,
+  `c2` decimal(65,30) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@@ft_max_word_len));
+hex(concat(@@ft_max_word_len))
+00380034
+create table t1 as select concat(@@ft_max_word_len) as c1;
+select hex(c1) from t1;
+hex(c1)
+00380034
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a'='a' IS TRUE));
+hex(concat('a'='a' IS TRUE))
+0031
+create table t1 as select concat('a'='a' IS TRUE) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a'='a' IS NOT TRUE));
+hex(concat('a'='a' IS NOT TRUE))
+0030
+create table t1 as select concat('a'='a' IS NOT TRUE) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NOT 'a'='a'));
+hex(concat(NOT 'a'='a'))
+0030
+create table t1 as select concat(NOT 'a'='a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' IS NULL));
+hex(concat('a' IS NULL))
+0030
+create table t1 as select concat('a' IS NULL) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' IS NOT NULL));
+hex(concat('a' IS NOT NULL))
+0031
+create table t1 as select concat('a' IS NOT NULL) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' rlike 'a'));
+hex(concat('a' rlike 'a'))
+0031
+create table t1 as select concat('a' IS NOT NULL) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(strcmp('a','b')));
+hex(concat(strcmp('a','b')))
+002D0031
+create table t1 as select concat(strcmp('a','b')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' like 'a'));
+hex(concat('a' like 'a'))
+0031
+create table t1 as select concat('a' like 'b') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' between 'b' and 'c'));
+hex(concat('a' between 'b' and 'c'))
+0030
+create table t1 as select concat('a' between 'b' and 'c') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' in ('a','b')));
+hex(concat('a' in ('a','b')))
+0031
+create table t1 as select concat('a' in ('a','b')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
+hex(concat(interval(23, 1, 15, 17, 30, 44, 200)))
+0033
+create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a varchar(10), fulltext key(a));
+insert into t1 values ('a');
+select hex(concat(match (a) against ('a'))) from t1;
+hex(concat(match (a) against ('a')))
+0030
+create table t2 as select concat(match (a) against ('a')) as a from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `a` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+select hex(ifnull(1,'a'));
+hex(ifnull(1,'a'))
+0031
+create table t1 as select ifnull(1,'a') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ifnull(1,1)));
+hex(concat(ifnull(1,1)))
+0031
+create table t1 as select concat(ifnull(1,1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ifnull(1.1,1.1)));
+hex(concat(ifnull(1.1,1.1)))
+0031002E0031
+create table t1 as select concat(ifnull(1.1,1.1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(if(1,'b',1));
+hex(if(1,'b',1))
+0062
+create table t1 as select if(1,'b',1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(if(1,1,'b'));
+hex(if(1,1,'b'))
+0031
+create table t1 as select if(1,1,'b') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(if(1,1,1)));
+hex(concat(if(1,1,1)))
+0031
+create table t1 as select concat(if(1,1,1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(nullif(1,2)));
+hex(concat(nullif(1,2)))
+0031
+create table t1 as select concat(nullif(1,2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)'))));
+hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)'))))
+0031
+create table t1 as select concat(Dimension(GeomFromText('LINSTRING(0 0,10 10)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))));
+hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))))
+0032
+create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))));
+hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))))
+0032
+create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))));
+hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))))
+0030
+create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))));
+hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))))
+0031
+create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsEmpty(GeomFromText('POINT(1 1)'))));
+hex(concat(IsEmpty(GeomFromText('POINT(1 1)'))))
+0030
+create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
+hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
+0030
+create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))));
+hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))))
+0030
+create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))));
+hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))))
+0031
+create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1;
+drop table t1;
+select hex(concat(x(GeomFromText('Point(1 2)'))));
+hex(concat(x(GeomFromText('Point(1 2)'))))
+0031
+create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(y(GeomFromText('Point(1 2)'))));
+hex(concat(y(GeomFromText('Point(1 2)'))))
+0032
+create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)'))));
+hex(concat(GLength(GeomFromText('LineString(1 2,2 2)'))))
+0031
+create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))));
+hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))))
+0031
+create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(GeometryType(GeomFromText('Point(1 2)'))));
+hex(concat(GeometryType(GeomFromText('Point(1 2)'))))
+0050004F0049004E0054
+create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(20) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(AsText(GeomFromText('Point(1 2)'))));
+hex(concat(AsText(GeomFromText('Point(1 2)'))))
+0050004F0049004E005400280031002000320029
+create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` longtext CHARACTER SET ucs2
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(period_add(200902, 2)));
+hex(concat(period_add(200902, 2)))
+003200300030003900300034
+create table t1 as select concat(period_add(200902, 2)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(period_diff(200902, 200802)));
+hex(concat(period_diff(200902, 200802)))
+00310032
+create table t1 as select concat(period_add(200902, 200802)) as c1;
+Warnings:
+Warning	1265	Data truncated for column 'c1' at row 1
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(to_days(20090224)));
+hex(concat(to_days(20090224)))
+003700330033003800320037
+create table t1 as select concat(to_days(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofmonth(20090224)));
+hex(concat(dayofmonth(20090224)))
+00320034
+create table t1 as select concat(dayofmonth(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofyear(20090224)));
+hex(concat(dayofyear(20090224)))
+00350035
+create table t1 as select concat(dayofyear(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(hour('10:11:12')));
+hex(concat(hour('10:11:12')))
+00310030
+create table t1 as select concat(hour('10:11:12')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(minute('10:11:12')));
+hex(concat(minute('10:11:12')))
+00310031
+create table t1 as select concat(minute('10:11:12')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(second('10:11:12')));
+hex(concat(second('10:11:12')))
+00310032
+create table t1 as select concat(second('10:11:12')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(quarter(20090224)));
+hex(concat(quarter(20090224)))
+0031
+create table t1 as select concat(quarter(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(week(20090224)));
+hex(concat(week(20090224)))
+0038
+create table t1 as select concat(week(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(yearweek(20090224)));
+hex(concat(yearweek(20090224)))
+003200300030003900300038
+create table t1 as select concat(yearweek(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(year(20090224)));
+hex(concat(year(20090224)))
+0032003000300039
+create table t1 as select concat(year(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(weekday(20090224)));
+hex(concat(weekday(20090224)))
+0031
+create table t1 as select concat(weekday(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofweek(20090224)));
+hex(concat(dayofweek(20090224)))
+0033
+create table t1 as select concat(dayofweek(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(unix_timestamp(20090224)));
+hex(concat(unix_timestamp(20090224)))
+0031003200330035003400320032003800300030
+create table t1 as select concat(unix_timestamp(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(time_to_sec('10:11:12')));
+hex(concat(time_to_sec('10:11:12')))
+00330036003600370032
+create table t1 as select concat(time_to_sec('10:11:12')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(extract(year from 20090702)));
+hex(concat(extract(year from 20090702)))
+0032003000300039
+create table t1 as select concat(extract(year from 20090702)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(microsecond('12:00:00.123456')));
+hex(concat(microsecond('12:00:00.123456')))
+003100320033003400350036
+create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(month(20090224)));
+hex(concat(month(20090224)))
+0032
+create table t1 as select concat(month(20090224)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(last_day('2003-02-05')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select c1, hex(c1) from t1;
+c1	hex(c1)
+2003-02-28	0032003000300033002D00300032002D00320038
+drop table t1;
+create table t1 as select concat(from_days(730669)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select c1, hex(c1) from t1;
+c1	hex(c1)
+2000-07-03	0032003000300030002D00300037002D00300033
+drop table t1;
+create table t1 as select concat(curdate()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(utc_date()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(curtime()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(8) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select repeat('a',20) as c1 limit 0;
+set timestamp=1216359724;
+insert into t1 values (current_date);
+insert into t1 values (current_time);
+select c1, hex(c1) from t1;
+c1	hex(c1)
+2008-07-18	0032003000300038002D00300037002D00310038
+08:42:04	00300038003A00340032003A00300034
+drop table t1;
+create table t1 as select concat(utc_time()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(8) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sec_to_time(2378)));
+hex(concat(sec_to_time(2378)))
+00300030003A00330039003A00330038
+create table t1 as select concat(sec_to_time(2378)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')));
+hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')))
+00320034003A00300030003A00300030
+create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(maketime(10,11,12)));
+hex(concat(maketime(10,11,12)))
+00310030003A00310031003A00310032
+create table t1 as select concat(maketime(10,11,12)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(get_format(DATE,'USA'));
+hex(get_format(DATE,'USA'))
+0025006D002E00250064002E00250059
+create table t1 as select get_format(DATE,'USA') as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(17) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(from_unixtime(1111885200)),4));
+hex(left(concat(from_unixtime(1111885200)),4))
+0032003000300035
+create table t1 as select concat(from_unixtime(1111885200)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')));
+hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')))
+0032003000300033002D00310032002D00330031002000320030003A00300030003A00300030
+create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day)));
+hex(concat(date_add('2004-01-01 12:00:00', interval 1 day)))
+0032003000300034002D00300031002D00300032002000310032003A00300030003A00300030
+create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(29) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2004-01-02 12:00:00
+drop table t1;
+select hex(concat(makedate(2009,1)));
+hex(concat(makedate(2009,1)))
+0032003000300039002D00300031002D00300031
+create table t1 as select concat(makedate(2009,1)) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2009-01-01
+drop table t1;
+create table t1 as select concat(now()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(utc_timestamp()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(sysdate()) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(19) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(addtime('00:00:00','11:22:33')));
+hex(concat(addtime('00:00:00','11:22:33')))
+00310031003A00320032003A00330033
+create table t1 as select concat(addtime('00:00:00','11:22:33')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(29) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(subtime('23:59:59','11:22:33')));
+hex(concat(subtime('23:59:59','11:22:33')))
+00310032003A00330037003A00320036
+create table t1 as select concat(subtime('23:59:59','11:22:33')) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(29) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(elt(1,2,3));
+hex(elt(1,2,3))
+0032
+create table t1 as select elt(1,2,3) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(export_set(1,2,3,4,2));
+hex(export_set(1,2,3,4,2))
+003200340033
+create table t1 as select export_set(1,2,3,4,2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(127) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(insert(1133,3,0,22));
+hex(insert(1133,3,0,22))
+003100310032003200330033
+create table t1 as select insert(1133,3,0,22) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(6) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lcase(123));
+hex(lcase(123))
+003100320033
+create table t1 as select lcase(123) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(123,1));
+hex(left(123,1))
+0031
+create table t1 as select left(123,1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lower(123));
+hex(lower(123))
+003100320033
+create table t1 as select lower(123) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lpad(1,2,0));
+hex(lpad(1,2,0))
+00300031
+create table t1 as select lpad(1,2,0) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(ltrim(1));
+hex(ltrim(1))
+0031
+create table t1 as select ltrim(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(mid(1,1,1));
+hex(mid(1,1,1))
+0031
+create table t1 as select mid(1,1,1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(repeat(1,2));
+hex(repeat(1,2))
+00310031
+create table t1 as select repeat(1,2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(replace(1,1,2));
+hex(replace(1,1,2))
+0032
+create table t1 as select replace(1,1,2) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(reverse(12));
+hex(reverse(12))
+00320031
+create table t1 as select reverse(12) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(right(123,1));
+hex(right(123,1))
+0033
+create table t1 as select right(123,1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(rpad(1,2,0));
+hex(rpad(1,2,0))
+00310030
+create table t1 as select rpad(1,2,0) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(rtrim(1));
+hex(rtrim(1))
+0031
+create table t1 as select rtrim(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(soundex(1));
+hex(soundex(1))
+
+create table t1 as select soundex(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(substring(1,1,1));
+hex(substring(1,1,1))
+0031
+create table t1 as select substring(1,1,1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(trim(1));
+hex(trim(1))
+0031
+create table t1 as select trim(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(ucase(1));
+hex(ucase(1))
+0031
+create table t1 as select ucase(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(upper(1));
+hex(upper(1))
+0031
+create table t1 as select upper(1) as c1;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select repeat(' ', 64) as a limit 0;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` varchar(64) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ("1.1"), ("2.1");
+select a, hex(a) from t1;
+a	hex(a)
+1.1	0031002E0031
+2.1	0032002E0031
+update t1 set a= a + 0.1;
+select a, hex(a) from t1;
+a	hex(a)
+1.2000000000000002	0031002E0032003000300030003000300030003000300030003000300030003000300032
+2.2	0032002E0032
+drop table t1;
+create table t1 (a tinyint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+0031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a tinyint zerofill);
+insert into t1 values (1), (10), (100);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+003000300031	001
+003000310030	010
+003100300030	100
+drop table t1;
+create table t1 (a tinyint(30) zerofill);
+insert into t1 values (1), (10), (100);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300031	000000000000000000000000000001
+003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000310030	000000000000000000000000000010
+003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003100300030	000000000000000000000000000100
+drop table t1;
+create table t1 (a decimal(10,2));
+insert into t1 values (123.45);
+select hex(concat(a)) from t1;
+hex(concat(a))
+003100320033002E00340035
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(12) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a smallint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+0031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(6) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a smallint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+00300030003000300031	00001
+00300030003000310030	00010
+00300030003100300030	00100
+00300031003000300030	01000
+00310030003000300030	10000
+drop table t1;
+create table t1 (a mediumint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+0031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(8) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a mediumint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+00300030003000300030003000300031	00000001
+00300030003000300030003000310030	00000010
+00300030003000300030003100300030	00000100
+00300030003000300031003000300030	00001000
+00300030003000310030003000300030	00010000
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+0031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(11) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a int zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+0030003000300030003000300030003000300031	0000000001
+0030003000300030003000300030003000310030	0000000010
+0030003000300030003000300030003100300030	0000000100
+0030003000300030003000300031003000300030	0000001000
+0030003000300030003000310030003000300030	0000010000
+drop table t1;
+create table t1 (a bigint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+0031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(20) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a bigint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+00300030003000300030003000300030003000300030003000300030003000300030003000300031	00000000000000000001
+00300030003000300030003000300030003000300030003000300030003000300030003000310030	00000000000000000010
+00300030003000300030003000300030003000300030003000300030003000300030003100300030	00000000000000000100
+00300030003000300030003000300030003000300030003000300030003000300031003000300030	00000000000000001000
+00300030003000300030003000300030003000300030003000300030003000310030003000300030	00000000000000010000
+drop table t1;
+create table t1 (a float);
+insert into t1 values (123.456);
+select hex(concat(a)) from t1;
+hex(concat(a))
+003100320033002E003400350036
+select concat(a) from t1;
+concat(a)
+123.456
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(12) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a float zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+0030003000300030003000300030003000300031002E0031	0000000001.1
+0030003000300030003000300030003000310030002E0031	0000000010.1
+0030003000300030003000300030003100300030002E0031	0000000100.1
+0030003000300030003000300031003000300030002E0031	0000001000.1
+0030003000300030003000310030003000300030002E0031	0000010000.1
+drop table t1;
+create table t1 (a double);
+insert into t1 values (123.456);
+select hex(concat(a)) from t1;
+hex(concat(a))
+003100320033002E003400350036
+select concat(a) from t1;
+concat(a)
+123.456
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(22) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a double zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+select hex(concat(a)), a from t1;
+hex(concat(a))	a
+00300030003000300030003000300030003000300030003000300030003000300030003000300031002E0031	00000000000000000001.1
+00300030003000300030003000300030003000300030003000300030003000300030003000310030002E0031	00000000000000000010.1
+00300030003000300030003000300030003000300030003000300030003000300030003100300030002E0031	00000000000000000100.1
+00300030003000300030003000300030003000300030003000300030003000300031003000300030002E0031	00000000000000001000.1
+00300030003000300030003000300030003000300030003000300030003000310030003000300030002E0031	00000000000000010000.1
+drop table t1;
+create table t1 (a year(2));
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+00300031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a year);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+0032003000300031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a bit(64));
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+0000000000000001
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varbinary(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a timestamp);
+insert into t1 values (0);
+insert into t1 values (20010203040506);
+insert into t1 values (19800203040506);
+insert into t1 values ('2001-02-03 04:05:06');
+select hex(concat(a)) from t1;
+hex(concat(a))
+0030003000300030002D00300030002D00300030002000300030003A00300030003A00300030
+0032003000300031002D00300032002D00300033002000300034003A00300035003A00300036
+0031003900380030002D00300032002D00300033002000300034003A00300035003A00300036
+0032003000300031002D00300032002D00300033002000300034003A00300035003A00300036
+select concat(a) from t1;
+concat(a)
+0000-00-00 00:00:00
+2001-02-03 04:05:06
+1980-02-03 04:05:06
+2001-02-03 04:05:06
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(19) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a date);
+insert into t1 values ('2001-02-03');
+insert into t1 values (20010203);
+select hex(concat(a)) from t1;
+hex(concat(a))
+0032003000300031002D00300032002D00300033
+0032003000300031002D00300032002D00300033
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a time);
+insert into t1 values (1);
+insert into t1 values ('01:02:03');
+select hex(concat(a)) from t1;
+hex(concat(a))
+00300030003A00300030003A00300031
+00300031003A00300032003A00300033
+select concat(a) from t1;
+concat(a)
+00:00:01
+01:02:03
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(8) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a datetime);
+insert into t1 values ('2001-02-03 04:05:06');
+insert into t1 values (20010203040506);
+select hex(concat(a)) from t1;
+hex(concat(a))
+0032003000300031002D00300032002D00300033002000300034003A00300035003A00300036
+0032003000300031002D00300032002D00300033002000300034003A00300035003A00300036
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `concat(a)` varchar(19) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+#
+# End of WL#2649 Number-to-string conversions
+#
+SET NAMES latin1;
+#
+# End of 5.4 tests
+#

=== modified file 'mysql-test/r/explain.result'
--- a/mysql-test/r/explain.result	2009-06-15 16:18:14 +0000
+++ b/mysql-test/r/explain.result	2009-08-20 10:18:05 +0000
@@ -192,7 +192,7 @@ set optimizer_switch=default;
 End of 5.1 tests.
 explain select 1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					id	8	3	1	N	32929	0	63
+def					id	8	3	1	N	32801	0	8
 def					select_type	253	19	6	N	1	31	8
 def					table	253	64	0	Y	0	31	8
 def					type	253	10	0	Y	0	31	8
@@ -200,7 +200,7 @@ def					possible_keys	253	4096	0	Y	0	31	
 def					key	253	64	0	Y	0	31	8
 def					key_len	253	320	0	Y	0	31	8
 def					ref	253	1024	0	Y	0	31	8
-def					rows	8	10	0	Y	32928	0	63
+def					rows	8	10	0	Y	32800	0	8
 def					Extra	253	255	14	N	1	31	8
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used

=== modified file 'mysql-test/r/func_gconcat.result'
--- a/mysql-test/r/func_gconcat.result	2008-06-26 16:17:05 +0000
+++ b/mysql-test/r/func_gconcat.result	2009-08-20 10:18:05 +0000
@@ -625,7 +625,7 @@ insert into t1 values (1,repeat('a',255)
 select f2,group_concat(f1) from t1 group by f2;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
 def	test	t1	t1	f2	f2	253	255	255	Y	0	0	8
-def					group_concat(f1)	253	400	1	Y	128	0	63
+def					group_concat(f1)	253	400	1	Y	0	0	8
 f2	group_concat(f1)
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa	1
 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb	2
@@ -737,7 +737,7 @@ insert into t1 values (1,repeat('a',255)
 select f2,group_concat(f1) from t1 group by f2;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
 def	test	t1	t1	f2	f2	253	255	255	Y	0	0	8
-def					group_concat(f1)	252	1024	1	Y	128	0	63
+def					group_concat(f1)	252	1024	1	Y	0	0	8
 f2	group_concat(f1)
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa	1
 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb	2

=== modified file 'mysql-test/r/func_str.result'
--- a/mysql-test/r/func_str.result	2009-07-31 17:53:36 +0000
+++ b/mysql-test/r/func_str.result	2009-08-20 10:18:05 +0000
@@ -761,23 +761,23 @@ latin2	latin2_general_ci	2
 drop table t1;
 select charset(null), collation(null), coercibility(null);
 charset(null)	collation(null)	coercibility(null)
-binary	binary	5
+binary	binary	6
 CREATE TABLE t1 (a int, b int);
 CREATE TABLE t2 (a int, b int);
 INSERT INTO t1 VALUES (1,1),(2,2);
 INSERT INTO t2 VALUES (2,2),(3,3);
 select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
-where collation(t2.a) = _utf8'binary' order by t1.a,t2.a;
+where collation(t2.a) = 'latin1_swedish_ci' order by t1.a,t2.a;
 a	b	a	b
 1	1	NULL	NULL
 2	2	2	2
 select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
-where charset(t2.a) = _utf8'binary' order by t1.a,t2.a;
+where charset(t2.a) = 'latin1' order by t1.a,t2.a;
 a	b	a	b
 1	1	NULL	NULL
 2	2	2	2
 select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
-where coercibility(t2.a) = 2 order by t1.a,t2.a;
+where coercibility(t2.a) = 5 order by t1.a,t2.a;
 a	b	a	b
 1	1	NULL	NULL
 2	2	2	2
@@ -1230,13 +1230,13 @@ create table t1 (i int);
 insert into t1 values (1000000000),(1);
 select lpad(i, 7, ' ') as t from t1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					t	253	7	7	Y	128	31	63
+def					t	253	7	7	Y	0	31	8
 t
 1000000
       1
 select rpad(i, 7, ' ') as t from t1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					t	253	7	7	Y	128	31	63
+def					t	253	7	7	Y	0	31	8
 t
 1000000
 1      

=== modified file 'mysql-test/r/metadata.result'
--- a/mysql-test/r/metadata.result	2008-10-10 11:44:10 +0000
+++ b/mysql-test/r/metadata.result	2009-08-20 10:18:05 +0000
@@ -1,9 +1,9 @@
 drop table if exists t1,t2;
 select 1, 1.0, -1, "hello", NULL;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					1	8	1	1	N	32897	0	63
-def					1.0	246	4	3	N	129	1	63
-def					-1	8	2	2	N	32897	0	63
+def					1	8	1	1	N	32769	0	8
+def					1.0	246	4	3	N	1	1	8
+def					-1	8	2	2	N	32769	0	8
 def					hello	253	5	5	N	1	31	8
 def					NULL	6	0	0	Y	32896	0	63
 1	1.0	-1	hello	NULL
@@ -11,26 +11,26 @@ def					NULL	6	0	0	Y	32896	0	63
 create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10));
 select * from t1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t1	t1	a	a	1	4	0	Y	32768	0	63
-def	test	t1	t1	b	b	2	6	0	Y	32768	0	63
-def	test	t1	t1	c	c	9	9	0	Y	32768	0	63
-def	test	t1	t1	d	d	3	11	0	Y	32768	0	63
-def	test	t1	t1	e	e	8	20	0	Y	32768	0	63
-def	test	t1	t1	f	f	4	3	0	Y	32768	2	63
-def	test	t1	t1	g	g	5	4	0	Y	32768	3	63
-def	test	t1	t1	h	h	246	7	0	Y	0	4	63
-def	test	t1	t1	i	i	13	4	0	Y	32864	0	63
-def	test	t1	t1	j	j	10	10	0	Y	128	0	63
-def	test	t1	t1	k	k	7	19	0	N	9441	0	63
-def	test	t1	t1	l	l	12	19	0	Y	128	0	63
+def	test	t1	t1	a	a	1	4	0	Y	32768	0	8
+def	test	t1	t1	b	b	2	6	0	Y	32768	0	8
+def	test	t1	t1	c	c	9	9	0	Y	32768	0	8
+def	test	t1	t1	d	d	3	11	0	Y	32768	0	8
+def	test	t1	t1	e	e	8	20	0	Y	32768	0	8
+def	test	t1	t1	f	f	4	3	0	Y	32768	2	8
+def	test	t1	t1	g	g	5	4	0	Y	32768	3	8
+def	test	t1	t1	h	h	246	7	0	Y	0	4	8
+def	test	t1	t1	i	i	13	4	0	Y	32864	0	8
+def	test	t1	t1	j	j	10	10	0	Y	0	0	8
+def	test	t1	t1	k	k	7	19	0	N	9313	0	8
+def	test	t1	t1	l	l	12	19	0	Y	0	0	8
 def	test	t1	t1	m	m	254	1	0	Y	256	0	8
 def	test	t1	t1	n	n	254	3	0	Y	2048	0	8
 def	test	t1	t1	o	o	254	10	0	Y	0	0	8
 a	b	c	d	e	f	g	h	i	j	k	l	m	n	o
 select a b, b c from t1 as t2;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t1	t2	a	b	1	4	0	Y	32768	0	63
-def	test	t1	t2	b	c	2	6	0	Y	32768	0	63
+def	test	t1	t2	a	b	1	4	0	Y	32768	0	8
+def	test	t1	t2	b	c	2	6	0	Y	32768	0	8
 b	c
 drop table t1;
 CREATE TABLE t1 (id tinyint(3) default NULL, data varchar(255) default NULL);
@@ -39,7 +39,7 @@ CREATE TABLE t2 (id tinyint(3) unsigned 
 INSERT INTO t2 VALUES (1,'yes'),(2,'no');
 select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t1	t1	id	id	1	3	1	Y	32768	0	63
+def	test	t1	t1	id	id	1	3	1	Y	32768	0	8
 def	test	t1	t1	data	data	253	255	6	Y	0	0	8
 def	test	t2	t2	data	data	254	3	3	Y	0	0	8
 id	data	data
@@ -47,7 +47,7 @@ id	data	data
 2	female	no
 select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id order by t1.id;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t1	t1	id	id	1	3	1	Y	32768	0	63
+def	test	t1	t1	id	id	1	3	1	Y	32768	0	8
 def	test	t1	t1	data	data	253	255	6	Y	0	0	8
 def	test	t2	t2	data	data	254	3	3	Y	0	0	8
 id	data	data
@@ -55,7 +55,7 @@ id	data	data
 2	female	no
 select t1.id from t1 union select t2.id from t2;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def				id	id	1	4	1	Y	32768	0	63
+def				id	id	1	4	1	Y	32768	0	8
 id
 1
 2
@@ -66,22 +66,22 @@ insert into t1 values (2,'two');
 set @arg00=1 ;
 select @arg00 FROM t1 where a=1 union distinct select 1 FROM t1 where a=1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def				@arg00	@arg00	8	20	1	Y	32768	0	63
+def				@arg00	@arg00	8	20	1	Y	32768	0	8
 @arg00
 1
 select * from (select @arg00) aaa;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def			aaa	@arg00	@arg00	8	20	1	Y	32768	0	63
+def			aaa	@arg00	@arg00	8	20	1	Y	32768	0	8
 @arg00
 1
 select 1 union select 1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def				1	1	8	20	1	N	32769	0	63
+def				1	1	8	20	1	N	32769	0	8
 1
 1
 select * from (select 1 union select 1) aaa;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def			aaa	1	1	8	20	1	N	32769	0	63
+def			aaa	1	1	8	20	1	N	32769	0	8
 1
 1
 drop table t1;
@@ -103,41 +103,41 @@ CREATE  VIEW v2 AS select t1.id as renam
 CREATE  VIEW v3 AS select t1.id + 12 as renamed from t1;
 select * from v1 group by id limit 1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t1	v1	id	id	3	10	1	Y	32768	0	63
+def	test	t1	v1	id	id	3	10	1	Y	32768	0	8
 id
 1
 select * from v1 group by id limit 0;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	v1	v1	id	id	3	10	0	Y	32768	0	63
+def	test	v1	v1	id	id	3	10	0	Y	32768	0	8
 id
 select * from v1 where id=1000 group by id;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	v1	v1	id	id	3	10	0	Y	32768	0	63
+def	test	v1	v1	id	id	3	10	0	Y	32768	0	8
 id
 select * from v1 where id=1 group by id;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t1	v1	id	id	3	10	1	Y	32768	0	63
+def	test	t1	v1	id	id	3	10	1	Y	32768	0	8
 id
 1
 select * from v2 where renamed=1 group by renamed;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t1	v2	id	renamed	3	10	1	Y	32768	0	63
+def	test	t1	v2	id	renamed	3	10	1	Y	32768	0	8
 renamed
 1
 select * from v3 where renamed=1 group by renamed;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def		v3	v3	renamed	renamed	8	12	0	Y	32896	0	63
+def		v3	v3	renamed	renamed	8	12	0	Y	32768	0	8
 renamed
 drop table t1;
 drop view v1,v2,v3;
 select a.* from (select 2147483648 as v_large) a;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def			a	v_large	v_large	8	10	10	N	32769	0	63
+def			a	v_large	v_large	8	10	10	N	32769	0	8
 v_large
 2147483648
 select a.* from (select 214748364 as v_small) a;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def			a	v_small	v_small	3	9	9	N	32769	0	63
+def			a	v_small	v_small	3	9	9	N	32769	0	8
 v_small
 214748364
 CREATE TABLE t1 (c1 CHAR(1));
@@ -191,11 +191,11 @@ Catalog	Database	Table	Table_alias	Colum
 2008-01-02	2008-01-02	2008-01-02	2008-01-02	2008-01-02	2008-01-02
 2008-01-03	2008-01-03	2008-01-03	2008-01-03	2008-01-03	2008-01-03
 COALESCE(d, d)	IFNULL(d, d)	IF(i, d, d)	CASE i WHEN i THEN d ELSE d END	GREATEST(d, d)	LEAST(d, d)
-def				CASE i WHEN i THEN d ELSE d END	CASE i WHEN i THEN d ELSE d END	10	10	10	Y	128	0	63
-def				COALESCE(d, d)	COALESCE(d, d)	10	10	10	Y	128	0	63
-def				GREATEST(d, d)	GREATEST(d, d)	10	10	10	Y	128	0	63
-def				IF(i, d, d)	IF(i, d, d)	10	10	10	Y	128	0	63
-def				IFNULL(d, d)	IFNULL(d, d)	10	10	10	Y	128	0	63
-def				LEAST(d, d)	LEAST(d, d)	10	10	10	Y	128	0	63
+def				CASE i WHEN i THEN d ELSE d END	CASE i WHEN i THEN d ELSE d END	10	10	10	Y	128	0	8
+def				COALESCE(d, d)	COALESCE(d, d)	10	10	10	Y	128	0	8
+def				GREATEST(d, d)	GREATEST(d, d)	10	10	10	Y	128	0	8
+def				IF(i, d, d)	IF(i, d, d)	10	10	10	Y	128	0	8
+def				IFNULL(d, d)	IFNULL(d, d)	10	10	10	Y	128	0	8
+def				LEAST(d, d)	LEAST(d, d)	10	10	10	Y	128	0	8
 DROP TABLE t1;
 End of 5.0 tests

=== modified file 'mysql-test/r/ps_1general.result'
--- a/mysql-test/r/ps_1general.result	2009-04-01 09:28:23 +0000
+++ b/mysql-test/r/ps_1general.result	2009-08-20 10:18:05 +0000
@@ -441,7 +441,7 @@ prepare stmt1 from ' KILL 0 ';
 prepare stmt1 from ' explain select a from t1 order by b ';
 execute stmt1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					id	8	3	1	N	32929	0	63
+def					id	8	3	1	N	32801	0	8
 def					select_type	253	19	6	N	1	31	8
 def					table	253	64	2	Y	0	31	8
 def					type	253	10	3	Y	0	31	8
@@ -449,7 +449,7 @@ def					possible_keys	253	4096	0	Y	0	31	
 def					key	253	64	0	Y	0	31	8
 def					key_len	253	320	0	Y	0	31	8
 def					ref	253	1024	0	Y	0	31	8
-def					rows	8	10	1	Y	32928	0	63
+def					rows	8	10	1	Y	32800	0	8
 def					Extra	253	255	14	N	1	31	8
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	Using filesort
@@ -457,7 +457,7 @@ SET @arg00=1 ;
 prepare stmt1 from ' explain select a from t1 where a > ? order by b ';
 execute stmt1 using @arg00;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					id	8	3	1	N	32929	0	63
+def					id	8	3	1	N	32801	0	8
 def					select_type	253	19	6	N	1	31	8
 def					table	253	64	2	Y	0	31	8
 def					type	253	10	5	Y	0	31	8
@@ -465,7 +465,7 @@ def					possible_keys	253	4096	7	Y	0	31	
 def					key	253	64	7	Y	0	31	8
 def					key_len	253	320	1	Y	0	31	8
 def					ref	253	1024	0	Y	0	31	8
-def					rows	8	10	1	Y	32928	0	63
+def					rows	8	10	1	Y	32800	0	8
 def					Extra	253	255	48	N	1	31	8
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	3	Using index condition; Using MRR; Using filesort

=== modified file 'mysql-test/r/ps_2myisam.result'
--- a/mysql-test/r/ps_2myisam.result	2009-03-11 17:17:00 +0000
+++ b/mysql-test/r/ps_2myisam.result	2009-08-20 10:18:05 +0000
@@ -49,25 +49,25 @@ test_sequence
 prepare stmt1 from ' select * from t9 order by c1 ' ;
 execute stmt1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t9	t9	c1	c1	1	4	1	N	49155	0	63
-def	test	t9	t9	c2	c2	2	6	1	Y	32768	0	63
-def	test	t9	t9	c3	c3	9	9	1	Y	32768	0	63
-def	test	t9	t9	c4	c4	3	11	1	Y	32768	0	63
-def	test	t9	t9	c5	c5	3	11	1	Y	32768	0	63
-def	test	t9	t9	c6	c6	8	20	1	Y	32768	0	63
-def	test	t9	t9	c7	c7	4	12	1	Y	32768	31	63
-def	test	t9	t9	c8	c8	5	22	1	Y	32768	31	63
-def	test	t9	t9	c9	c9	5	22	1	Y	32768	31	63
-def	test	t9	t9	c10	c10	5	22	1	Y	32768	31	63
-def	test	t9	t9	c11	c11	246	9	6	Y	0	4	63
-def	test	t9	t9	c12	c12	246	10	6	Y	0	4	63
-def	test	t9	t9	c13	c13	10	10	10	Y	128	0	63
-def	test	t9	t9	c14	c14	12	19	19	Y	128	0	63
-def	test	t9	t9	c15	c15	7	19	19	N	9441	0	63
-def	test	t9	t9	c16	c16	11	8	8	Y	128	0	63
-def	test	t9	t9	c17	c17	13	4	4	Y	32864	0	63
-def	test	t9	t9	c18	c18	1	4	1	Y	32768	0	63
-def	test	t9	t9	c19	c19	1	1	1	Y	32768	0	63
+def	test	t9	t9	c1	c1	1	4	1	N	49155	0	8
+def	test	t9	t9	c2	c2	2	6	1	Y	32768	0	8
+def	test	t9	t9	c3	c3	9	9	1	Y	32768	0	8
+def	test	t9	t9	c4	c4	3	11	1	Y	32768	0	8
+def	test	t9	t9	c5	c5	3	11	1	Y	32768	0	8
+def	test	t9	t9	c6	c6	8	20	1	Y	32768	0	8
+def	test	t9	t9	c7	c7	4	12	1	Y	32768	31	8
+def	test	t9	t9	c8	c8	5	22	1	Y	32768	31	8
+def	test	t9	t9	c9	c9	5	22	1	Y	32768	31	8
+def	test	t9	t9	c10	c10	5	22	1	Y	32768	31	8
+def	test	t9	t9	c11	c11	246	9	6	Y	0	4	8
+def	test	t9	t9	c12	c12	246	10	6	Y	0	4	8
+def	test	t9	t9	c13	c13	10	10	10	Y	0	0	8
+def	test	t9	t9	c14	c14	12	19	19	Y	0	0	8
+def	test	t9	t9	c15	c15	7	19	19	N	9313	0	8
+def	test	t9	t9	c16	c16	11	8	8	Y	0	0	8
+def	test	t9	t9	c17	c17	13	4	4	Y	32864	0	8
+def	test	t9	t9	c18	c18	1	4	1	Y	32768	0	8
+def	test	t9	t9	c19	c19	1	1	1	Y	32768	0	8
 def	test	t9	t9	c20	c20	254	1	1	Y	0	0	8
 def	test	t9	t9	c21	c21	254	10	10	Y	0	0	8
 def	test	t9	t9	c22	c22	253	30	30	Y	0	0	8
@@ -1152,7 +1152,7 @@ test_sequence
 prepare stmt1 from ' explain select * from t9 ' ;
 execute stmt1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					id	8	3	1	N	32929	0	63
+def					id	8	3	1	N	32801	0	8
 def					select_type	253	19	6	N	1	31	8
 def					table	253	64	2	Y	0	31	8
 def					type	253	10	3	Y	0	31	8
@@ -1160,7 +1160,7 @@ def					possible_keys	253	4096	0	Y	0	31	
 def					key	253	64	0	Y	0	31	8
 def					key_len	253	320	0	Y	0	31	8
 def					ref	253	1024	0	Y	0	31	8
-def					rows	8	10	1	Y	32928	0	63
+def					rows	8	10	1	Y	32800	0	8
 def					Extra	253	255	0	N	1	31	8
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t9	ALL	NULL	NULL	NULL	NULL	2	
@@ -1788,11 +1788,11 @@ t5	CREATE TABLE `t5` (
   `const06` varchar(10) NOT NULL DEFAULT '',
   `param06` longtext,
   `const07` date DEFAULT NULL,
-  `param07` longblob,
+  `param07` longtext,
   `const08` varchar(19) NOT NULL DEFAULT '',
   `param08` longtext,
   `const09` datetime DEFAULT NULL,
-  `param09` longblob,
+  `param09` longtext,
   `const10` int(10) NOT NULL DEFAULT '0',
   `param10` bigint(20) DEFAULT NULL,
   `const11` int(4) DEFAULT NULL,
@@ -1805,31 +1805,31 @@ t5	CREATE TABLE `t5` (
 ) 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
-def	test	t5	t5	const01	const01	3	1	1	N	32769	0	63
-def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	63
-def	test	t5	t5	const02	const02	246	4	3	N	1	1	63
-def	test	t5	t5	param02	param02	246	67	32	Y	0	30	63
-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	const01	const01	3	1	1	N	32769	0	8
+def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	8
+def	test	t5	t5	const02	const02	246	4	3	N	1	1	8
+def	test	t5	t5	param02	param02	246	67	32	Y	0	30	8
+def	test	t5	t5	const03	const03	5	17	1	N	32769	31	8
+def	test	t5	t5	param03	param03	5	23	1	Y	32768	31	8
 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	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	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	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	const07	const07	10	10	10	Y	0	0	8
+def	test	t5	t5	param07	param07	252	4294967295	10	Y	16	0	8
 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	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	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
-def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	63
+def	test	t5	t5	const09	const09	12	19	19	Y	0	0	8
+def	test	t5	t5	param09	param09	252	4294967295	19	Y	16	0	8
+def	test	t5	t5	const10	const10	3	10	9	N	32769	0	8
+def	test	t5	t5	param10	param10	8	20	9	Y	32768	0	8
+def	test	t5	t5	const11	const11	3	4	4	Y	32768	0	8
+def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	8
 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	param12	param12	8	20	0	Y	32768	0	8
+def	test	t5	t5	param13	param13	246	67	0	Y	0	30	8
 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
 const01	8
@@ -1917,25 +1917,25 @@ from t9 where c1= 1 ;
 1	1	1	1	1	1	1	1	1	1	1.0000	1.0000	2004-02-29	2004-02-29 11:11:11	2004-02-29 11:11:11	11:11:11	2004	1	1	a	123456789a	123456789a123456789b123456789c	tinyblob	tinytext	blob	text	mediumblob	mediumtext	longblob	longtext	one	monday
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -1964,25 +1964,25 @@ from t9 where c1= 0 ;
 0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1991-01-01 01:01:01	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -2014,25 +2014,25 @@ execute stmt1 using @my_key ;
 1	1	1	1	1	1	1	1	1	1	1.0000	1.0000	2004-02-29	2004-02-29 11:11:11	2004-02-29 11:11:11	11:11:11	2004	1	1	a	123456789a	123456789a123456789b123456789c	tinyblob	tinytext	blob	text	mediumblob	mediumtext	longblob	longtext	one	monday
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2054,25 +2054,25 @@ execute stmt1 using @my_key ;
 0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1991-01-01 01:01:01	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -2102,25 +2102,25 @@ into @arg01, @arg02, @arg03, @arg04, @ar
 from t9 where c1= 1 ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2146,25 +2146,25 @@ into @arg01, @arg02, @arg03, @arg04, @ar
 from t9 where c1= 0 ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -2192,25 +2192,25 @@ set @my_key= 1 ;
 execute stmt1 using @my_key ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2230,25 +2230,25 @@ set @my_key= 0 ;
 execute stmt1 using @my_key ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8

=== modified file 'mysql-test/r/ps_3innodb.result'
--- a/mysql-test/r/ps_3innodb.result	2009-03-11 17:17:00 +0000
+++ b/mysql-test/r/ps_3innodb.result	2009-08-20 10:18:05 +0000
@@ -49,25 +49,25 @@ test_sequence
 prepare stmt1 from ' select * from t9 order by c1 ' ;
 execute stmt1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t9	t9	c1	c1	1	4	1	N	49155	0	63
-def	test	t9	t9	c2	c2	2	6	1	Y	32768	0	63
-def	test	t9	t9	c3	c3	9	9	1	Y	32768	0	63
-def	test	t9	t9	c4	c4	3	11	1	Y	32768	0	63
-def	test	t9	t9	c5	c5	3	11	1	Y	32768	0	63
-def	test	t9	t9	c6	c6	8	20	1	Y	32768	0	63
-def	test	t9	t9	c7	c7	4	12	1	Y	32768	31	63
-def	test	t9	t9	c8	c8	5	22	1	Y	32768	31	63
-def	test	t9	t9	c9	c9	5	22	1	Y	32768	31	63
-def	test	t9	t9	c10	c10	5	22	1	Y	32768	31	63
-def	test	t9	t9	c11	c11	246	9	6	Y	0	4	63
-def	test	t9	t9	c12	c12	246	10	6	Y	0	4	63
-def	test	t9	t9	c13	c13	10	10	10	Y	128	0	63
-def	test	t9	t9	c14	c14	12	19	19	Y	128	0	63
-def	test	t9	t9	c15	c15	7	19	19	N	9441	0	63
-def	test	t9	t9	c16	c16	11	8	8	Y	128	0	63
-def	test	t9	t9	c17	c17	13	4	4	Y	32864	0	63
-def	test	t9	t9	c18	c18	1	4	1	Y	32768	0	63
-def	test	t9	t9	c19	c19	1	1	1	Y	32768	0	63
+def	test	t9	t9	c1	c1	1	4	1	N	49155	0	8
+def	test	t9	t9	c2	c2	2	6	1	Y	32768	0	8
+def	test	t9	t9	c3	c3	9	9	1	Y	32768	0	8
+def	test	t9	t9	c4	c4	3	11	1	Y	32768	0	8
+def	test	t9	t9	c5	c5	3	11	1	Y	32768	0	8
+def	test	t9	t9	c6	c6	8	20	1	Y	32768	0	8
+def	test	t9	t9	c7	c7	4	12	1	Y	32768	31	8
+def	test	t9	t9	c8	c8	5	22	1	Y	32768	31	8
+def	test	t9	t9	c9	c9	5	22	1	Y	32768	31	8
+def	test	t9	t9	c10	c10	5	22	1	Y	32768	31	8
+def	test	t9	t9	c11	c11	246	9	6	Y	0	4	8
+def	test	t9	t9	c12	c12	246	10	6	Y	0	4	8
+def	test	t9	t9	c13	c13	10	10	10	Y	0	0	8
+def	test	t9	t9	c14	c14	12	19	19	Y	0	0	8
+def	test	t9	t9	c15	c15	7	19	19	N	9313	0	8
+def	test	t9	t9	c16	c16	11	8	8	Y	0	0	8
+def	test	t9	t9	c17	c17	13	4	4	Y	32864	0	8
+def	test	t9	t9	c18	c18	1	4	1	Y	32768	0	8
+def	test	t9	t9	c19	c19	1	1	1	Y	32768	0	8
 def	test	t9	t9	c20	c20	254	1	1	Y	0	0	8
 def	test	t9	t9	c21	c21	254	10	10	Y	0	0	8
 def	test	t9	t9	c22	c22	253	30	30	Y	0	0	8
@@ -1152,7 +1152,7 @@ test_sequence
 prepare stmt1 from ' explain select * from t9 ' ;
 execute stmt1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					id	8	3	1	N	32929	0	63
+def					id	8	3	1	N	32801	0	8
 def					select_type	253	19	6	N	1	31	8
 def					table	253	64	2	Y	0	31	8
 def					type	253	10	3	Y	0	31	8
@@ -1160,7 +1160,7 @@ def					possible_keys	253	4096	0	Y	0	31	
 def					key	253	64	0	Y	0	31	8
 def					key_len	253	320	0	Y	0	31	8
 def					ref	253	1024	0	Y	0	31	8
-def					rows	8	10	1	Y	32928	0	63
+def					rows	8	10	1	Y	32800	0	8
 def					Extra	253	255	0	N	1	31	8
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t9	ALL	NULL	NULL	NULL	NULL	2	
@@ -1771,11 +1771,11 @@ t5	CREATE TABLE `t5` (
   `const06` varchar(10) NOT NULL DEFAULT '',
   `param06` longtext,
   `const07` date DEFAULT NULL,
-  `param07` longblob,
+  `param07` longtext,
   `const08` varchar(19) NOT NULL DEFAULT '',
   `param08` longtext,
   `const09` datetime DEFAULT NULL,
-  `param09` longblob,
+  `param09` longtext,
   `const10` int(10) NOT NULL DEFAULT '0',
   `param10` bigint(20) DEFAULT NULL,
   `const11` int(4) DEFAULT NULL,
@@ -1788,31 +1788,31 @@ t5	CREATE TABLE `t5` (
 ) 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
-def	test	t5	t5	const01	const01	3	1	1	N	32769	0	63
-def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	63
-def	test	t5	t5	const02	const02	246	4	3	N	1	1	63
-def	test	t5	t5	param02	param02	246	67	32	Y	0	30	63
-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	const01	const01	3	1	1	N	32769	0	8
+def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	8
+def	test	t5	t5	const02	const02	246	4	3	N	1	1	8
+def	test	t5	t5	param02	param02	246	67	32	Y	0	30	8
+def	test	t5	t5	const03	const03	5	17	1	N	32769	31	8
+def	test	t5	t5	param03	param03	5	23	1	Y	32768	31	8
 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	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	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	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	const07	const07	10	10	10	Y	0	0	8
+def	test	t5	t5	param07	param07	252	4294967295	10	Y	16	0	8
 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	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	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
-def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	63
+def	test	t5	t5	const09	const09	12	19	19	Y	0	0	8
+def	test	t5	t5	param09	param09	252	4294967295	19	Y	16	0	8
+def	test	t5	t5	const10	const10	3	10	9	N	32769	0	8
+def	test	t5	t5	param10	param10	8	20	9	Y	32768	0	8
+def	test	t5	t5	const11	const11	3	4	4	Y	32768	0	8
+def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	8
 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	param12	param12	8	20	0	Y	32768	0	8
+def	test	t5	t5	param13	param13	246	67	0	Y	0	30	8
 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
 const01	8
@@ -1900,25 +1900,25 @@ from t9 where c1= 1 ;
 1	1	1	1	1	1	1	1	1	1	1.0000	1.0000	2004-02-29	2004-02-29 11:11:11	2004-02-29 11:11:11	11:11:11	2004	1	1	a	123456789a	123456789a123456789b123456789c	tinyblob	tinytext	blob	text	mediumblob	mediumtext	longblob	longtext	one	monday
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -1947,25 +1947,25 @@ from t9 where c1= 0 ;
 0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1991-01-01 01:01:01	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -1997,25 +1997,25 @@ execute stmt1 using @my_key ;
 1	1	1	1	1	1	1	1	1	1	1.0000	1.0000	2004-02-29	2004-02-29 11:11:11	2004-02-29 11:11:11	11:11:11	2004	1	1	a	123456789a	123456789a123456789b123456789c	tinyblob	tinytext	blob	text	mediumblob	mediumtext	longblob	longtext	one	monday
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2037,25 +2037,25 @@ execute stmt1 using @my_key ;
 0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1991-01-01 01:01:01	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -2085,25 +2085,25 @@ into @arg01, @arg02, @arg03, @arg04, @ar
 from t9 where c1= 1 ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2129,25 +2129,25 @@ into @arg01, @arg02, @arg03, @arg04, @ar
 from t9 where c1= 0 ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -2175,25 +2175,25 @@ set @my_key= 1 ;
 execute stmt1 using @my_key ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2213,25 +2213,25 @@ set @my_key= 0 ;
 execute stmt1 using @my_key ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8

=== modified file 'mysql-test/r/ps_4heap.result'
--- a/mysql-test/r/ps_4heap.result	2009-03-11 17:17:00 +0000
+++ b/mysql-test/r/ps_4heap.result	2009-08-20 10:18:05 +0000
@@ -50,25 +50,25 @@ test_sequence
 prepare stmt1 from ' select * from t9 order by c1 ' ;
 execute stmt1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t9	t9	c1	c1	1	4	1	N	49155	0	63
-def	test	t9	t9	c2	c2	2	6	1	Y	32768	0	63
-def	test	t9	t9	c3	c3	9	9	1	Y	32768	0	63
-def	test	t9	t9	c4	c4	3	11	1	Y	32768	0	63
-def	test	t9	t9	c5	c5	3	11	1	Y	32768	0	63
-def	test	t9	t9	c6	c6	8	20	1	Y	32768	0	63
-def	test	t9	t9	c7	c7	4	12	1	Y	32768	31	63
-def	test	t9	t9	c8	c8	5	22	1	Y	32768	31	63
-def	test	t9	t9	c9	c9	5	22	1	Y	32768	31	63
-def	test	t9	t9	c10	c10	5	22	1	Y	32768	31	63
-def	test	t9	t9	c11	c11	246	9	6	Y	0	4	63
-def	test	t9	t9	c12	c12	246	10	6	Y	0	4	63
-def	test	t9	t9	c13	c13	10	10	10	Y	128	0	63
-def	test	t9	t9	c14	c14	12	19	19	Y	128	0	63
-def	test	t9	t9	c15	c15	7	19	19	N	9441	0	63
-def	test	t9	t9	c16	c16	11	8	8	Y	128	0	63
-def	test	t9	t9	c17	c17	13	4	4	Y	32864	0	63
-def	test	t9	t9	c18	c18	1	4	1	Y	32768	0	63
-def	test	t9	t9	c19	c19	1	1	1	Y	32768	0	63
+def	test	t9	t9	c1	c1	1	4	1	N	49155	0	8
+def	test	t9	t9	c2	c2	2	6	1	Y	32768	0	8
+def	test	t9	t9	c3	c3	9	9	1	Y	32768	0	8
+def	test	t9	t9	c4	c4	3	11	1	Y	32768	0	8
+def	test	t9	t9	c5	c5	3	11	1	Y	32768	0	8
+def	test	t9	t9	c6	c6	8	20	1	Y	32768	0	8
+def	test	t9	t9	c7	c7	4	12	1	Y	32768	31	8
+def	test	t9	t9	c8	c8	5	22	1	Y	32768	31	8
+def	test	t9	t9	c9	c9	5	22	1	Y	32768	31	8
+def	test	t9	t9	c10	c10	5	22	1	Y	32768	31	8
+def	test	t9	t9	c11	c11	246	9	6	Y	0	4	8
+def	test	t9	t9	c12	c12	246	10	6	Y	0	4	8
+def	test	t9	t9	c13	c13	10	10	10	Y	0	0	8
+def	test	t9	t9	c14	c14	12	19	19	Y	0	0	8
+def	test	t9	t9	c15	c15	7	19	19	N	9313	0	8
+def	test	t9	t9	c16	c16	11	8	8	Y	0	0	8
+def	test	t9	t9	c17	c17	13	4	4	Y	32864	0	8
+def	test	t9	t9	c18	c18	1	4	1	Y	32768	0	8
+def	test	t9	t9	c19	c19	1	1	1	Y	32768	0	8
 def	test	t9	t9	c20	c20	254	1	1	Y	0	0	8
 def	test	t9	t9	c21	c21	254	10	10	Y	0	0	8
 def	test	t9	t9	c22	c22	253	30	30	Y	0	0	8
@@ -1153,7 +1153,7 @@ test_sequence
 prepare stmt1 from ' explain select * from t9 ' ;
 execute stmt1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					id	8	3	1	N	32929	0	63
+def					id	8	3	1	N	32801	0	8
 def					select_type	253	19	6	N	1	31	8
 def					table	253	64	2	Y	0	31	8
 def					type	253	10	3	Y	0	31	8
@@ -1161,7 +1161,7 @@ def					possible_keys	253	4096	0	Y	0	31	
 def					key	253	64	0	Y	0	31	8
 def					key_len	253	320	0	Y	0	31	8
 def					ref	253	1024	0	Y	0	31	8
-def					rows	8	10	1	Y	32928	0	63
+def					rows	8	10	1	Y	32800	0	8
 def					Extra	253	255	0	N	1	31	8
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t9	ALL	NULL	NULL	NULL	NULL	2	
@@ -1772,11 +1772,11 @@ t5	CREATE TABLE `t5` (
   `const06` varchar(10) NOT NULL DEFAULT '',
   `param06` longtext,
   `const07` date DEFAULT NULL,
-  `param07` longblob,
+  `param07` longtext,
   `const08` varchar(19) NOT NULL DEFAULT '',
   `param08` longtext,
   `const09` datetime DEFAULT NULL,
-  `param09` longblob,
+  `param09` longtext,
   `const10` int(10) NOT NULL DEFAULT '0',
   `param10` bigint(20) DEFAULT NULL,
   `const11` int(4) DEFAULT NULL,
@@ -1789,31 +1789,31 @@ t5	CREATE TABLE `t5` (
 ) 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
-def	test	t5	t5	const01	const01	3	1	1	N	32769	0	63
-def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	63
-def	test	t5	t5	const02	const02	246	4	3	N	1	1	63
-def	test	t5	t5	param02	param02	246	67	32	Y	0	30	63
-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	const01	const01	3	1	1	N	32769	0	8
+def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	8
+def	test	t5	t5	const02	const02	246	4	3	N	1	1	8
+def	test	t5	t5	param02	param02	246	67	32	Y	0	30	8
+def	test	t5	t5	const03	const03	5	17	1	N	32769	31	8
+def	test	t5	t5	param03	param03	5	23	1	Y	32768	31	8
 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	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	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	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	const07	const07	10	10	10	Y	0	0	8
+def	test	t5	t5	param07	param07	252	4294967295	10	Y	16	0	8
 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	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	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
-def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	63
+def	test	t5	t5	const09	const09	12	19	19	Y	0	0	8
+def	test	t5	t5	param09	param09	252	4294967295	19	Y	16	0	8
+def	test	t5	t5	const10	const10	3	10	9	N	32769	0	8
+def	test	t5	t5	param10	param10	8	20	9	Y	32768	0	8
+def	test	t5	t5	const11	const11	3	4	4	Y	32768	0	8
+def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	8
 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	param12	param12	8	20	0	Y	32768	0	8
+def	test	t5	t5	param13	param13	246	67	0	Y	0	30	8
 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
 const01	8
@@ -1901,25 +1901,25 @@ from t9 where c1= 1 ;
 1	1	1	1	1	1	1	1	1	1	1.0000	1.0000	2004-02-29	2004-02-29 11:11:11	2004-02-29 11:11:11	11:11:11	2004	1	1	a	123456789a	123456789a123456789b123456789c	tinyblob	tinytext	blob	text	mediumblob	mediumtext	longblob	longtext	one	monday
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -1948,25 +1948,25 @@ from t9 where c1= 0 ;
 0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1991-01-01 01:01:01	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -1998,25 +1998,25 @@ execute stmt1 using @my_key ;
 1	1	1	1	1	1	1	1	1	1	1.0000	1.0000	2004-02-29	2004-02-29 11:11:11	2004-02-29 11:11:11	11:11:11	2004	1	1	a	123456789a	123456789a123456789b123456789c	tinyblob	tinytext	blob	text	mediumblob	mediumtext	longblob	longtext	one	monday
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2038,25 +2038,25 @@ execute stmt1 using @my_key ;
 0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1991-01-01 01:01:01	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -2086,25 +2086,25 @@ into @arg01, @arg02, @arg03, @arg04, @ar
 from t9 where c1= 1 ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2130,25 +2130,25 @@ into @arg01, @arg02, @arg03, @arg04, @ar
 from t9 where c1= 0 ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -2176,25 +2176,25 @@ set @my_key= 1 ;
 execute stmt1 using @my_key ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2214,25 +2214,25 @@ set @my_key= 0 ;
 execute stmt1 using @my_key ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8

=== modified file 'mysql-test/r/ps_5merge.result'
--- a/mysql-test/r/ps_5merge.result	2009-03-11 17:17:00 +0000
+++ b/mysql-test/r/ps_5merge.result	2009-08-20 10:18:05 +0000
@@ -92,25 +92,25 @@ test_sequence
 prepare stmt1 from ' select * from t9 order by c1 ' ;
 execute stmt1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t9	t9	c1	c1	1	4	1	N	49155	0	63
-def	test	t9	t9	c2	c2	2	6	1	Y	32768	0	63
-def	test	t9	t9	c3	c3	9	9	1	Y	32768	0	63
-def	test	t9	t9	c4	c4	3	11	1	Y	32768	0	63
-def	test	t9	t9	c5	c5	3	11	1	Y	32768	0	63
-def	test	t9	t9	c6	c6	8	20	1	Y	32768	0	63
-def	test	t9	t9	c7	c7	4	12	1	Y	32768	31	63
-def	test	t9	t9	c8	c8	5	22	1	Y	32768	31	63
-def	test	t9	t9	c9	c9	5	22	1	Y	32768	31	63
-def	test	t9	t9	c10	c10	5	22	1	Y	32768	31	63
-def	test	t9	t9	c11	c11	246	9	6	Y	0	4	63
-def	test	t9	t9	c12	c12	246	10	6	Y	0	4	63
-def	test	t9	t9	c13	c13	10	10	10	Y	128	0	63
-def	test	t9	t9	c14	c14	12	19	19	Y	128	0	63
-def	test	t9	t9	c15	c15	7	19	19	N	9441	0	63
-def	test	t9	t9	c16	c16	11	8	8	Y	128	0	63
-def	test	t9	t9	c17	c17	13	4	4	Y	32864	0	63
-def	test	t9	t9	c18	c18	1	4	1	Y	32768	0	63
-def	test	t9	t9	c19	c19	1	1	1	Y	32768	0	63
+def	test	t9	t9	c1	c1	1	4	1	N	49155	0	8
+def	test	t9	t9	c2	c2	2	6	1	Y	32768	0	8
+def	test	t9	t9	c3	c3	9	9	1	Y	32768	0	8
+def	test	t9	t9	c4	c4	3	11	1	Y	32768	0	8
+def	test	t9	t9	c5	c5	3	11	1	Y	32768	0	8
+def	test	t9	t9	c6	c6	8	20	1	Y	32768	0	8
+def	test	t9	t9	c7	c7	4	12	1	Y	32768	31	8
+def	test	t9	t9	c8	c8	5	22	1	Y	32768	31	8
+def	test	t9	t9	c9	c9	5	22	1	Y	32768	31	8
+def	test	t9	t9	c10	c10	5	22	1	Y	32768	31	8
+def	test	t9	t9	c11	c11	246	9	6	Y	0	4	8
+def	test	t9	t9	c12	c12	246	10	6	Y	0	4	8
+def	test	t9	t9	c13	c13	10	10	10	Y	0	0	8
+def	test	t9	t9	c14	c14	12	19	19	Y	0	0	8
+def	test	t9	t9	c15	c15	7	19	19	N	9313	0	8
+def	test	t9	t9	c16	c16	11	8	8	Y	0	0	8
+def	test	t9	t9	c17	c17	13	4	4	Y	32864	0	8
+def	test	t9	t9	c18	c18	1	4	1	Y	32768	0	8
+def	test	t9	t9	c19	c19	1	1	1	Y	32768	0	8
 def	test	t9	t9	c20	c20	254	1	1	Y	0	0	8
 def	test	t9	t9	c21	c21	254	10	10	Y	0	0	8
 def	test	t9	t9	c22	c22	253	30	30	Y	0	0	8
@@ -1195,7 +1195,7 @@ test_sequence
 prepare stmt1 from ' explain select * from t9 ' ;
 execute stmt1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					id	8	3	1	N	32929	0	63
+def					id	8	3	1	N	32801	0	8
 def					select_type	253	19	6	N	1	31	8
 def					table	253	64	2	Y	0	31	8
 def					type	253	10	3	Y	0	31	8
@@ -1203,7 +1203,7 @@ def					possible_keys	253	4096	0	Y	0	31	
 def					key	253	64	0	Y	0	31	8
 def					key_len	253	320	0	Y	0	31	8
 def					ref	253	1024	0	Y	0	31	8
-def					rows	8	10	1	Y	32928	0	63
+def					rows	8	10	1	Y	32800	0	8
 def					Extra	253	255	0	N	1	31	8
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t9	ALL	NULL	NULL	NULL	NULL	2	
@@ -1708,11 +1708,11 @@ t5	CREATE TABLE `t5` (
   `const06` varchar(10) NOT NULL DEFAULT '',
   `param06` longtext,
   `const07` date DEFAULT NULL,
-  `param07` longblob,
+  `param07` longtext,
   `const08` varchar(19) NOT NULL DEFAULT '',
   `param08` longtext,
   `const09` datetime DEFAULT NULL,
-  `param09` longblob,
+  `param09` longtext,
   `const10` int(10) NOT NULL DEFAULT '0',
   `param10` bigint(20) DEFAULT NULL,
   `const11` int(4) DEFAULT NULL,
@@ -1725,31 +1725,31 @@ t5	CREATE TABLE `t5` (
 ) 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
-def	test	t5	t5	const01	const01	3	1	1	N	32769	0	63
-def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	63
-def	test	t5	t5	const02	const02	246	4	3	N	1	1	63
-def	test	t5	t5	param02	param02	246	67	32	Y	0	30	63
-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	const01	const01	3	1	1	N	32769	0	8
+def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	8
+def	test	t5	t5	const02	const02	246	4	3	N	1	1	8
+def	test	t5	t5	param02	param02	246	67	32	Y	0	30	8
+def	test	t5	t5	const03	const03	5	17	1	N	32769	31	8
+def	test	t5	t5	param03	param03	5	23	1	Y	32768	31	8
 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	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	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	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	const07	const07	10	10	10	Y	0	0	8
+def	test	t5	t5	param07	param07	252	4294967295	10	Y	16	0	8
 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	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	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
-def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	63
+def	test	t5	t5	const09	const09	12	19	19	Y	0	0	8
+def	test	t5	t5	param09	param09	252	4294967295	19	Y	16	0	8
+def	test	t5	t5	const10	const10	3	10	9	N	32769	0	8
+def	test	t5	t5	param10	param10	8	20	9	Y	32768	0	8
+def	test	t5	t5	const11	const11	3	4	4	Y	32768	0	8
+def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	8
 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	param12	param12	8	20	0	Y	32768	0	8
+def	test	t5	t5	param13	param13	246	67	0	Y	0	30	8
 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
 const01	8
@@ -1837,25 +1837,25 @@ from t9 where c1= 1 ;
 1	1	1	1	1	1	1	1	1	1	1.0000	1.0000	2004-02-29	2004-02-29 11:11:11	2004-02-29 11:11:11	11:11:11	2004	1	1	a	123456789a	123456789a123456789b123456789c	tinyblob	tinytext	blob	text	mediumblob	mediumtext	longblob	longtext	one	monday
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -1884,25 +1884,25 @@ from t9 where c1= 0 ;
 0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1991-01-01 01:01:01	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -1934,25 +1934,25 @@ execute stmt1 using @my_key ;
 1	1	1	1	1	1	1	1	1	1	1.0000	1.0000	2004-02-29	2004-02-29 11:11:11	2004-02-29 11:11:11	11:11:11	2004	1	1	a	123456789a	123456789a123456789b123456789c	tinyblob	tinytext	blob	text	mediumblob	mediumtext	longblob	longtext	one	monday
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -1974,25 +1974,25 @@ execute stmt1 using @my_key ;
 0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1991-01-01 01:01:01	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -2022,25 +2022,25 @@ into @arg01, @arg02, @arg03, @arg04, @ar
 from t9 where c1= 1 ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2066,25 +2066,25 @@ into @arg01, @arg02, @arg03, @arg04, @ar
 from t9 where c1= 0 ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -2112,25 +2112,25 @@ set @my_key= 1 ;
 execute stmt1 using @my_key ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2150,25 +2150,25 @@ set @my_key= 0 ;
 execute stmt1 using @my_key ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -3114,25 +3114,25 @@ test_sequence
 prepare stmt1 from ' select * from t9 order by c1 ' ;
 execute stmt1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t9	t9	c1	c1	1	4	1	N	49155	0	63
-def	test	t9	t9	c2	c2	2	6	1	Y	32768	0	63
-def	test	t9	t9	c3	c3	9	9	1	Y	32768	0	63
-def	test	t9	t9	c4	c4	3	11	1	Y	32768	0	63
-def	test	t9	t9	c5	c5	3	11	1	Y	32768	0	63
-def	test	t9	t9	c6	c6	8	20	1	Y	32768	0	63
-def	test	t9	t9	c7	c7	4	12	1	Y	32768	31	63
-def	test	t9	t9	c8	c8	5	22	1	Y	32768	31	63
-def	test	t9	t9	c9	c9	5	22	1	Y	32768	31	63
-def	test	t9	t9	c10	c10	5	22	1	Y	32768	31	63
-def	test	t9	t9	c11	c11	246	9	6	Y	0	4	63
-def	test	t9	t9	c12	c12	246	10	6	Y	0	4	63
-def	test	t9	t9	c13	c13	10	10	10	Y	128	0	63
-def	test	t9	t9	c14	c14	12	19	19	Y	128	0	63
-def	test	t9	t9	c15	c15	7	19	19	N	9441	0	63
-def	test	t9	t9	c16	c16	11	8	8	Y	128	0	63
-def	test	t9	t9	c17	c17	13	4	4	Y	32864	0	63
-def	test	t9	t9	c18	c18	1	4	1	Y	32768	0	63
-def	test	t9	t9	c19	c19	1	1	1	Y	32768	0	63
+def	test	t9	t9	c1	c1	1	4	1	N	49155	0	8
+def	test	t9	t9	c2	c2	2	6	1	Y	32768	0	8
+def	test	t9	t9	c3	c3	9	9	1	Y	32768	0	8
+def	test	t9	t9	c4	c4	3	11	1	Y	32768	0	8
+def	test	t9	t9	c5	c5	3	11	1	Y	32768	0	8
+def	test	t9	t9	c6	c6	8	20	1	Y	32768	0	8
+def	test	t9	t9	c7	c7	4	12	1	Y	32768	31	8
+def	test	t9	t9	c8	c8	5	22	1	Y	32768	31	8
+def	test	t9	t9	c9	c9	5	22	1	Y	32768	31	8
+def	test	t9	t9	c10	c10	5	22	1	Y	32768	31	8
+def	test	t9	t9	c11	c11	246	9	6	Y	0	4	8
+def	test	t9	t9	c12	c12	246	10	6	Y	0	4	8
+def	test	t9	t9	c13	c13	10	10	10	Y	0	0	8
+def	test	t9	t9	c14	c14	12	19	19	Y	0	0	8
+def	test	t9	t9	c15	c15	7	19	19	N	9313	0	8
+def	test	t9	t9	c16	c16	11	8	8	Y	0	0	8
+def	test	t9	t9	c17	c17	13	4	4	Y	32864	0	8
+def	test	t9	t9	c18	c18	1	4	1	Y	32768	0	8
+def	test	t9	t9	c19	c19	1	1	1	Y	32768	0	8
 def	test	t9	t9	c20	c20	254	1	1	Y	0	0	8
 def	test	t9	t9	c21	c21	254	10	10	Y	0	0	8
 def	test	t9	t9	c22	c22	253	30	30	Y	0	0	8
@@ -4217,7 +4217,7 @@ test_sequence
 prepare stmt1 from ' explain select * from t9 ' ;
 execute stmt1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					id	8	3	1	N	32929	0	63
+def					id	8	3	1	N	32801	0	8
 def					select_type	253	19	6	N	1	31	8
 def					table	253	64	2	Y	0	31	8
 def					type	253	10	3	Y	0	31	8
@@ -4225,7 +4225,7 @@ def					possible_keys	253	4096	0	Y	0	31	
 def					key	253	64	0	Y	0	31	8
 def					key_len	253	320	0	Y	0	31	8
 def					ref	253	1024	0	Y	0	31	8
-def					rows	8	10	1	Y	32928	0	63
+def					rows	8	10	1	Y	32800	0	8
 def					Extra	253	255	0	N	1	31	8
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t9	ALL	NULL	NULL	NULL	NULL	2	
@@ -4730,11 +4730,11 @@ t5	CREATE TABLE `t5` (
   `const06` varchar(10) NOT NULL DEFAULT '',
   `param06` longtext,
   `const07` date DEFAULT NULL,
-  `param07` longblob,
+  `param07` longtext,
   `const08` varchar(19) NOT NULL DEFAULT '',
   `param08` longtext,
   `const09` datetime DEFAULT NULL,
-  `param09` longblob,
+  `param09` longtext,
   `const10` int(10) NOT NULL DEFAULT '0',
   `param10` bigint(20) DEFAULT NULL,
   `const11` int(4) DEFAULT NULL,
@@ -4747,31 +4747,31 @@ t5	CREATE TABLE `t5` (
 ) 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
-def	test	t5	t5	const01	const01	3	1	1	N	32769	0	63
-def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	63
-def	test	t5	t5	const02	const02	246	4	3	N	1	1	63
-def	test	t5	t5	param02	param02	246	67	32	Y	0	30	63
-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	const01	const01	3	1	1	N	32769	0	8
+def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	8
+def	test	t5	t5	const02	const02	246	4	3	N	1	1	8
+def	test	t5	t5	param02	param02	246	67	32	Y	0	30	8
+def	test	t5	t5	const03	const03	5	17	1	N	32769	31	8
+def	test	t5	t5	param03	param03	5	23	1	Y	32768	31	8
 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	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	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	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	const07	const07	10	10	10	Y	0	0	8
+def	test	t5	t5	param07	param07	252	4294967295	10	Y	16	0	8
 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	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	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
-def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	63
+def	test	t5	t5	const09	const09	12	19	19	Y	0	0	8
+def	test	t5	t5	param09	param09	252	4294967295	19	Y	16	0	8
+def	test	t5	t5	const10	const10	3	10	9	N	32769	0	8
+def	test	t5	t5	param10	param10	8	20	9	Y	32768	0	8
+def	test	t5	t5	const11	const11	3	4	4	Y	32768	0	8
+def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	8
 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	param12	param12	8	20	0	Y	32768	0	8
+def	test	t5	t5	param13	param13	246	67	0	Y	0	30	8
 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
 const01	8
@@ -4859,25 +4859,25 @@ from t9 where c1= 1 ;
 1	1	1	1	1	1	1	1	1	1	1.0000	1.0000	2004-02-29	2004-02-29 11:11:11	2004-02-29 11:11:11	11:11:11	2004	1	1	a	123456789a	123456789a123456789b123456789c	tinyblob	tinytext	blob	text	mediumblob	mediumtext	longblob	longtext	one	monday
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -4906,25 +4906,25 @@ from t9 where c1= 0 ;
 0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1991-01-01 01:01:01	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -4956,25 +4956,25 @@ execute stmt1 using @my_key ;
 1	1	1	1	1	1	1	1	1	1	1.0000	1.0000	2004-02-29	2004-02-29 11:11:11	2004-02-29 11:11:11	11:11:11	2004	1	1	a	123456789a	123456789a123456789b123456789c	tinyblob	tinytext	blob	text	mediumblob	mediumtext	longblob	longtext	one	monday
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -4996,25 +4996,25 @@ execute stmt1 using @my_key ;
 0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1991-01-01 01:01:01	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -5044,25 +5044,25 @@ into @arg01, @arg02, @arg03, @arg04, @ar
 from t9 where c1= 1 ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -5088,25 +5088,25 @@ into @arg01, @arg02, @arg03, @arg04, @ar
 from t9 where c1= 0 ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -5134,25 +5134,25 @@ set @my_key= 1 ;
 execute stmt1 using @my_key ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -5172,25 +5172,25 @@ set @my_key= 0 ;
 execute stmt1 using @my_key ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8

=== modified file 'mysql-test/r/show_check.result'
--- a/mysql-test/r/show_check.result	2009-07-27 15:57:53 +0000
+++ b/mysql-test/r/show_check.result	2009-08-20 10:18:05 +0000
@@ -62,13 +62,13 @@ test.t1	check	status	OK
 show index from t1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
 def	information_schema	STATISTICS	STATISTICS	TABLE_NAME	Table	253	64	2	N	1	0	8
-def	information_schema	STATISTICS	STATISTICS	NON_UNIQUE	Non_unique	8	1	1	N	32769	0	63
+def	information_schema	STATISTICS	STATISTICS	NON_UNIQUE	Non_unique	8	1	1	N	32769	0	8
 def	information_schema	STATISTICS	STATISTICS	INDEX_NAME	Key_name	253	64	7	N	1	0	8
-def	information_schema	STATISTICS	STATISTICS	SEQ_IN_INDEX	Seq_in_index	8	2	1	N	32769	0	63
+def	information_schema	STATISTICS	STATISTICS	SEQ_IN_INDEX	Seq_in_index	8	2	1	N	32769	0	8
 def	information_schema	STATISTICS	STATISTICS	COLUMN_NAME	Column_name	253	64	1	N	1	0	8
 def	information_schema	STATISTICS	STATISTICS	COLLATION	Collation	253	1	1	Y	0	0	8
-def	information_schema	STATISTICS	STATISTICS	CARDINALITY	Cardinality	8	21	1	Y	32768	0	63
-def	information_schema	STATISTICS	STATISTICS	SUB_PART	Sub_part	8	3	0	Y	32768	0	63
+def	information_schema	STATISTICS	STATISTICS	CARDINALITY	Cardinality	8	21	1	Y	32768	0	8
+def	information_schema	STATISTICS	STATISTICS	SUB_PART	Sub_part	8	3	0	Y	32768	0	8
 def	information_schema	STATISTICS	STATISTICS	PACKED	Packed	253	10	0	Y	0	0	8
 def	information_schema	STATISTICS	STATISTICS	NULLABLE	Null	253	3	0	N	1	0	8
 def	information_schema	STATISTICS	STATISTICS	INDEX_TYPE	Index_type	253	16	5	N	1	0	8
@@ -119,20 +119,20 @@ show table status from test like "this_d
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
 def	information_schema	TABLES	TABLES	TABLE_NAME	Name	253	64	0	N	1	0	8
 def	information_schema	TABLES	TABLES	ENGINE	Engine	253	64	0	Y	0	0	8
-def	information_schema	TABLES	TABLES	VERSION	Version	8	21	0	Y	32800	0	63
+def	information_schema	TABLES	TABLES	VERSION	Version	8	21	0	Y	32800	0	8
 def	information_schema	TABLES	TABLES	ROW_FORMAT	Row_format	253	10	0	Y	0	0	8
-def	information_schema	TABLES	TABLES	TABLE_ROWS	Rows	8	21	0	Y	32800	0	63
-def	information_schema	TABLES	TABLES	AVG_ROW_LENGTH	Avg_row_length	8	21	0	Y	32800	0	63
-def	information_schema	TABLES	TABLES	DATA_LENGTH	Data_length	8	21	0	Y	32800	0	63
-def	information_schema	TABLES	TABLES	MAX_DATA_LENGTH	Max_data_length	8	21	0	Y	32800	0	63
-def	information_schema	TABLES	TABLES	INDEX_LENGTH	Index_length	8	21	0	Y	32800	0	63
-def	information_schema	TABLES	TABLES	DATA_FREE	Data_free	8	21	0	Y	32800	0	63
-def	information_schema	TABLES	TABLES	AUTO_INCREMENT	Auto_increment	8	21	0	Y	32800	0	63
-def	information_schema	TABLES	TABLES	CREATE_TIME	Create_time	12	19	0	Y	128	0	63
-def	information_schema	TABLES	TABLES	UPDATE_TIME	Update_time	12	19	0	Y	128	0	63
-def	information_schema	TABLES	TABLES	CHECK_TIME	Check_time	12	19	0	Y	128	0	63
+def	information_schema	TABLES	TABLES	TABLE_ROWS	Rows	8	21	0	Y	32800	0	8
+def	information_schema	TABLES	TABLES	AVG_ROW_LENGTH	Avg_row_length	8	21	0	Y	32800	0	8
+def	information_schema	TABLES	TABLES	DATA_LENGTH	Data_length	8	21	0	Y	32800	0	8
+def	information_schema	TABLES	TABLES	MAX_DATA_LENGTH	Max_data_length	8	21	0	Y	32800	0	8
+def	information_schema	TABLES	TABLES	INDEX_LENGTH	Index_length	8	21	0	Y	32800	0	8
+def	information_schema	TABLES	TABLES	DATA_FREE	Data_free	8	21	0	Y	32800	0	8
+def	information_schema	TABLES	TABLES	AUTO_INCREMENT	Auto_increment	8	21	0	Y	32800	0	8
+def	information_schema	TABLES	TABLES	CREATE_TIME	Create_time	12	19	0	Y	128	0	8
+def	information_schema	TABLES	TABLES	UPDATE_TIME	Update_time	12	19	0	Y	128	0	8
+def	information_schema	TABLES	TABLES	CHECK_TIME	Check_time	12	19	0	Y	128	0	8
 def	information_schema	TABLES	TABLES	TABLE_COLLATION	Collation	253	32	0	Y	0	0	8
-def	information_schema	TABLES	TABLES	CHECKSUM	Checksum	8	21	0	Y	32800	0	63
+def	information_schema	TABLES	TABLES	CHECKSUM	Checksum	8	21	0	Y	32800	0	8
 def	information_schema	TABLES	TABLES	CREATE_OPTIONS	Create_options	253	255	0	Y	0	0	8
 def	information_schema	TABLES	TABLES	TABLE_COMMENT	Comment	253	2048	0	N	1	0	8
 Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
@@ -853,7 +853,7 @@ Catalog	Database	Table	Table_alias	Colum
 def	information_schema	CHARACTER_SETS	CHARACTER_SETS	CHARACTER_SET_NAME	Charset	253	96	4	N	1	0	33
 def	information_schema	CHARACTER_SETS	CHARACTER_SETS	DESCRIPTION	Description	253	180	13	N	1	0	33
 def	information_schema	CHARACTER_SETS	CHARACTER_SETS	DEFAULT_COLLATE_NAME	Default collation	253	96	15	N	1	0	33
-def	information_schema	CHARACTER_SETS	CHARACTER_SETS	MAXLEN	Maxlen	8	3	1	N	32769	0	63
+def	information_schema	CHARACTER_SETS	CHARACTER_SETS	MAXLEN	Maxlen	8	9	1	N	32769	0	33
 Charset	Description	Default collation	Maxlen
 utf8	UTF-8 Unicode	utf8_general_ci	3
 ----------------------------------------------------------------
@@ -861,10 +861,10 @@ SHOW COLLATION LIKE 'latin1_bin';
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
 def	information_schema	COLLATIONS	COLLATIONS	COLLATION_NAME	Collation	253	96	10	N	1	0	33
 def	information_schema	COLLATIONS	COLLATIONS	CHARACTER_SET_NAME	Charset	253	96	6	N	1	0	33
-def	information_schema	COLLATIONS	COLLATIONS	ID	Id	8	11	2	N	32769	0	63
+def	information_schema	COLLATIONS	COLLATIONS	ID	Id	8	33	2	N	32769	0	33
 def	information_schema	COLLATIONS	COLLATIONS	IS_DEFAULT	Default	253	9	0	N	1	0	33
 def	information_schema	COLLATIONS	COLLATIONS	IS_COMPILED	Compiled	253	9	3	N	1	0	33
-def	information_schema	COLLATIONS	COLLATIONS	SORTLEN	Sortlen	8	3	1	N	32769	0	63
+def	information_schema	COLLATIONS	COLLATIONS	SORTLEN	Sortlen	8	9	1	N	32769	0	33
 Collation	Charset	Id	Default	Compiled	Sortlen
 latin1_bin	latin1	47		Yes	1
 ----------------------------------------------------------------
@@ -894,13 +894,13 @@ t1	CREATE TABLE `t1` (
 SHOW INDEX FROM t1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
 def	information_schema	STATISTICS	STATISTICS	TABLE_NAME	Table	253	192	2	N	1	0	33
-def	information_schema	STATISTICS	STATISTICS	NON_UNIQUE	Non_unique	8	1	1	N	32769	0	63
+def	information_schema	STATISTICS	STATISTICS	NON_UNIQUE	Non_unique	8	3	1	N	32769	0	33
 def	information_schema	STATISTICS	STATISTICS	INDEX_NAME	Key_name	253	192	7	N	1	0	33
-def	information_schema	STATISTICS	STATISTICS	SEQ_IN_INDEX	Seq_in_index	8	2	1	N	32769	0	63
+def	information_schema	STATISTICS	STATISTICS	SEQ_IN_INDEX	Seq_in_index	8	6	1	N	32769	0	33
 def	information_schema	STATISTICS	STATISTICS	COLUMN_NAME	Column_name	253	192	1	N	1	0	33
 def	information_schema	STATISTICS	STATISTICS	COLLATION	Collation	253	3	1	Y	0	0	33
-def	information_schema	STATISTICS	STATISTICS	CARDINALITY	Cardinality	8	21	1	Y	32768	0	63
-def	information_schema	STATISTICS	STATISTICS	SUB_PART	Sub_part	8	3	0	Y	32768	0	63
+def	information_schema	STATISTICS	STATISTICS	CARDINALITY	Cardinality	8	63	1	Y	32768	0	33
+def	information_schema	STATISTICS	STATISTICS	SUB_PART	Sub_part	8	9	0	Y	32768	0	33
 def	information_schema	STATISTICS	STATISTICS	PACKED	Packed	253	30	0	Y	0	0	33
 def	information_schema	STATISTICS	STATISTICS	NULLABLE	Null	253	9	0	N	1	0	33
 def	information_schema	STATISTICS	STATISTICS	INDEX_TYPE	Index_type	253	48	5	N	1	0	33
@@ -993,7 +993,7 @@ def	information_schema	TRIGGERS	TRIGGERS
 def	information_schema	TRIGGERS	TRIGGERS	EVENT_OBJECT_TABLE	Table	253	192	2	N	1	0	33
 def	information_schema	TRIGGERS	TRIGGERS	ACTION_STATEMENT	Statement	252	589815	10	N	17	0	33
 def	information_schema	TRIGGERS	TRIGGERS	ACTION_TIMING	Timing	253	18	6	N	1	0	33
-def	information_schema	TRIGGERS	TRIGGERS	CREATED	Created	12	19	0	Y	128	0	63
+def	information_schema	TRIGGERS	TRIGGERS	CREATED	Created	12	57	0	Y	128	0	33
 def	information_schema	TRIGGERS	TRIGGERS	SQL_MODE	sql_mode	253	24576	0	N	1	0	33
 def	information_schema	TRIGGERS	TRIGGERS	DEFINER	Definer	253	231	14	N	1	0	33
 def	information_schema	TRIGGERS	TRIGGERS	CHARACTER_SET_CLIENT	character_set_client	253	96	6	N	1	0	33

=== modified file 'mysql-test/r/type_datetime.result'
--- a/mysql-test/r/type_datetime.result	2009-03-19 17:03:58 +0000
+++ b/mysql-test/r/type_datetime.result	2009-08-20 10:18:05 +0000
@@ -449,11 +449,11 @@ f4	datetime	YES		NULL	
 create table t5 as select coalesce(f1,f3) as f4 from t1;
 desc t5;
 Field	Type	Null	Key	Default	Extra
-f4	varbinary(20)	YES		NULL	
+f4	varchar(20)	YES		NULL	
 create table t6 as select coalesce(f2,f3) as f4 from t1;
 desc t6;
 Field	Type	Null	Key	Default	Extra
-f4	varbinary(20)	YES		NULL	
+f4	varchar(20)	YES		NULL	
 create table t7 as select coalesce(makedate(1997,1),f2) as f4 from t1;
 desc t7;
 Field	Type	Null	Key	Default	Extra

=== modified file 'mysql-test/r/type_varchar.result'
--- a/mysql-test/r/type_varchar.result	2008-12-22 10:11:13 +0000
+++ b/mysql-test/r/type_varchar.result	2009-08-20 10:18:05 +0000
@@ -443,9 +443,9 @@ insert into t2 (id) values (1), (2), (3)
 select t1.*, t2.id, t3.en, t3.cz from t1 left join t2 on t1.id=t2.id
 left join t3 on t1.id=t3.id order by t3.id;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t1	t1	id	id	3	11	1	Y	32768	0	63
-def	test	t1	t1	name_id	name_id	3	11	1	Y	32768	0	63
-def	test	t2	t2	id	id	3	11	1	Y	32768	0	63
+def	test	t1	t1	id	id	3	11	1	Y	32768	0	8
+def	test	t1	t1	name_id	name_id	3	11	1	Y	32768	0	8
+def	test	t2	t2	id	id	3	11	1	Y	32768	0	8
 def	test	t3	t3	en	en	253	255	11	Y	0	0	8
 def	test	t3	t3	cz	cz	253	255	11	Y	0	0	8
 id	name_id	id	en	cz

=== modified file 'mysql-test/r/union.result'
--- a/mysql-test/r/union.result	2009-05-15 07:27:27 +0000
+++ b/mysql-test/r/union.result	2009-08-20 10:18:05 +0000
@@ -554,7 +554,7 @@ aa
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `a` varbinary(2) NOT NULL DEFAULT ''
+  `a` varchar(2) NOT NULL DEFAULT ''
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT 12 as a UNION select 12.2 as a;
@@ -655,7 +655,7 @@ f
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `f` varbinary(12) DEFAULT NULL
+  `f` varchar(12) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT y from t2 UNION select da from t2;
@@ -666,7 +666,7 @@ y
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `y` varbinary(10) DEFAULT NULL
+  `y` varchar(10) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT y from t2 UNION select dt from t2;
@@ -677,7 +677,7 @@ y
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `y` varbinary(19) DEFAULT NULL
+  `y` varchar(19) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT da from t2 UNION select dt from t2;
@@ -699,7 +699,7 @@ testc
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `dt` varbinary(19) DEFAULT NULL
+  `dt` varchar(19) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT dt from t2 UNION select sv from t2;
@@ -710,7 +710,7 @@ testv
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `dt` varbinary(19) DEFAULT NULL
+  `dt` varchar(19) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT sc from t2 UNION select sv from t2;

=== modified file 'mysql-test/suite/ndb/r/ps_7ndb.result'
--- a/mysql-test/suite/ndb/r/ps_7ndb.result	2009-03-11 17:17:00 +0000
+++ b/mysql-test/suite/ndb/r/ps_7ndb.result	2009-08-20 10:18:05 +0000
@@ -49,25 +49,25 @@ test_sequence
 prepare stmt1 from ' select * from t9 order by c1 ' ;
 execute stmt1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def	test	t9	t9	c1	c1	1	4	1	N	49155	0	63
-def	test	t9	t9	c2	c2	2	6	1	Y	32768	0	63
-def	test	t9	t9	c3	c3	9	9	1	Y	32768	0	63
-def	test	t9	t9	c4	c4	3	11	1	Y	32768	0	63
-def	test	t9	t9	c5	c5	3	11	1	Y	32768	0	63
-def	test	t9	t9	c6	c6	8	20	1	Y	32768	0	63
-def	test	t9	t9	c7	c7	4	12	1	Y	32768	31	63
-def	test	t9	t9	c8	c8	5	22	1	Y	32768	31	63
-def	test	t9	t9	c9	c9	5	22	1	Y	32768	31	63
-def	test	t9	t9	c10	c10	5	22	1	Y	32768	31	63
-def	test	t9	t9	c11	c11	246	9	6	Y	0	4	63
-def	test	t9	t9	c12	c12	246	10	6	Y	0	4	63
-def	test	t9	t9	c13	c13	10	10	10	Y	128	0	63
-def	test	t9	t9	c14	c14	12	19	19	Y	128	0	63
-def	test	t9	t9	c15	c15	7	19	19	N	9441	0	63
-def	test	t9	t9	c16	c16	11	8	8	Y	128	0	63
-def	test	t9	t9	c17	c17	13	4	4	Y	32864	0	63
-def	test	t9	t9	c18	c18	1	4	1	Y	32768	0	63
-def	test	t9	t9	c19	c19	1	1	1	Y	32768	0	63
+def	test	t9	t9	c1	c1	1	4	1	N	49155	0	8
+def	test	t9	t9	c2	c2	2	6	1	Y	32768	0	8
+def	test	t9	t9	c3	c3	9	9	1	Y	32768	0	8
+def	test	t9	t9	c4	c4	3	11	1	Y	32768	0	8
+def	test	t9	t9	c5	c5	3	11	1	Y	32768	0	8
+def	test	t9	t9	c6	c6	8	20	1	Y	32768	0	8
+def	test	t9	t9	c7	c7	4	12	1	Y	32768	31	8
+def	test	t9	t9	c8	c8	5	22	1	Y	32768	31	8
+def	test	t9	t9	c9	c9	5	22	1	Y	32768	31	8
+def	test	t9	t9	c10	c10	5	22	1	Y	32768	31	8
+def	test	t9	t9	c11	c11	246	9	6	Y	0	4	8
+def	test	t9	t9	c12	c12	246	10	6	Y	0	4	8
+def	test	t9	t9	c13	c13	10	10	10	Y	0	0	8
+def	test	t9	t9	c14	c14	12	19	19	Y	0	0	8
+def	test	t9	t9	c15	c15	7	19	19	N	9313	0	8
+def	test	t9	t9	c16	c16	11	8	8	Y	0	0	8
+def	test	t9	t9	c17	c17	13	4	4	Y	32864	0	8
+def	test	t9	t9	c18	c18	1	4	1	Y	32768	0	8
+def	test	t9	t9	c19	c19	1	1	1	Y	32768	0	8
 def	test	t9	t9	c20	c20	254	1	1	Y	0	0	8
 def	test	t9	t9	c21	c21	254	10	10	Y	0	0	8
 def	test	t9	t9	c22	c22	253	30	30	Y	0	0	8
@@ -1152,7 +1152,7 @@ test_sequence
 prepare stmt1 from ' explain select * from t9 ' ;
 execute stmt1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					id	8	3	1	N	32929	0	63
+def					id	8	3	1	N	32801	0	8
 def					select_type	253	19	6	N	1	31	8
 def					table	253	64	2	Y	0	31	8
 def					type	253	10	3	Y	0	31	8
@@ -1160,7 +1160,7 @@ def					possible_keys	253	4096	0	Y	0	31	
 def					key	253	64	0	Y	0	31	8
 def					key_len	253	320	0	Y	0	31	8
 def					ref	253	1024	0	Y	0	31	8
-def					rows	8	10	1	Y	32928	0	63
+def					rows	8	10	1	Y	32800	0	8
 def					Extra	253	255	0	N	1	31	8
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t9	ALL	NULL	NULL	NULL	NULL	2	
@@ -1771,11 +1771,11 @@ t5	CREATE TABLE `t5` (
   `const06` varchar(10) NOT NULL DEFAULT '',
   `param06` longtext,
   `const07` date DEFAULT NULL,
-  `param07` longblob,
+  `param07` longtext,
   `const08` varchar(19) NOT NULL DEFAULT '',
   `param08` longtext,
   `const09` datetime DEFAULT NULL,
-  `param09` longblob,
+  `param09` longtext,
   `const10` int(10) NOT NULL DEFAULT '0',
   `param10` bigint(20) DEFAULT NULL,
   `const11` int(4) DEFAULT NULL,
@@ -1788,31 +1788,31 @@ t5	CREATE TABLE `t5` (
 ) 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
-def	test	t5	t5	const01	const01	3	1	1	N	32769	0	63
-def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	63
-def	test	t5	t5	const02	const02	246	4	3	N	1	1	63
-def	test	t5	t5	param02	param02	246	67	32	Y	0	30	63
-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	const01	const01	3	1	1	N	32769	0	8
+def	test	t5	t5	param01	param01	8	20	1	Y	32768	0	8
+def	test	t5	t5	const02	const02	246	4	3	N	1	1	8
+def	test	t5	t5	param02	param02	246	67	32	Y	0	30	8
+def	test	t5	t5	const03	const03	5	17	1	N	32769	31	8
+def	test	t5	t5	param03	param03	5	23	1	Y	32768	31	8
 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	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	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	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	const07	const07	10	10	10	Y	0	0	8
+def	test	t5	t5	param07	param07	252	4294967295	10	Y	16	0	8
 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	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	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
-def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	63
+def	test	t5	t5	const09	const09	12	19	19	Y	0	0	8
+def	test	t5	t5	param09	param09	252	4294967295	19	Y	16	0	8
+def	test	t5	t5	const10	const10	3	10	9	N	32769	0	8
+def	test	t5	t5	param10	param10	8	20	9	Y	32768	0	8
+def	test	t5	t5	const11	const11	3	4	4	Y	32768	0	8
+def	test	t5	t5	param11	param11	8	20	4	Y	32768	0	8
 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	param12	param12	8	20	0	Y	32768	0	8
+def	test	t5	t5	param13	param13	246	67	0	Y	0	30	8
 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
 const01	8
@@ -1900,25 +1900,25 @@ from t9 where c1= 1 ;
 1	1	1	1	1	1	1	1	1	1	1.0000	1.0000	2004-02-29	2004-02-29 11:11:11	2004-02-29 11:11:11	11:11:11	2004	1	1	a	123456789a	123456789a123456789b123456789c	tinyblob	tinytext	blob	text	mediumblob	mediumtext	longblob	longtext	one	monday
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -1947,25 +1947,25 @@ from t9 where c1= 0 ;
 0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1991-01-01 01:01:01	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -1997,25 +1997,25 @@ execute stmt1 using @my_key ;
 1	1	1	1	1	1	1	1	1	1	1.0000	1.0000	2004-02-29	2004-02-29 11:11:11	2004-02-29 11:11:11	11:11:11	2004	1	1	a	123456789a	123456789a123456789b123456789c	tinyblob	tinytext	blob	text	mediumblob	mediumtext	longblob	longtext	one	monday
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2037,25 +2037,25 @@ execute stmt1 using @my_key ;
 0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1991-01-01 01:01:01	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -2085,25 +2085,25 @@ into @arg01, @arg02, @arg03, @arg04, @ar
 from t9 where c1= 1 ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2129,25 +2129,25 @@ into @arg01, @arg02, @arg03, @arg04, @ar
 from t9 where c1= 0 ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8
@@ -2175,25 +2175,25 @@ set @my_key= 1 ;
 execute stmt1 using @my_key ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	1	Y	32896	0	63
-def					@arg03	8	20	1	Y	32896	0	63
-def					@arg04	8	20	1	Y	32896	0	63
-def					@arg05	8	20	1	Y	32896	0	63
-def					@arg06	8	20	1	Y	32896	0	63
-def					@arg07	5	23	1	Y	32896	31	63
-def					@arg08	5	23	1	Y	32896	31	63
-def					@arg09	5	23	1	Y	32896	31	63
-def					@arg10	5	23	1	Y	32896	31	63
-def					@arg11	246	83	6	Y	128	30	63
-def					@arg12	246	83	6	Y	128	30	63
-def					@arg13	251	16777216	10	Y	128	31	63
-def					@arg14	251	16777216	19	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	8	Y	128	31	63
-def					@arg17	8	20	4	Y	32928	0	63
-def					@arg18	8	20	1	Y	32896	0	63
-def					@arg19	8	20	1	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	1	Y	32768	0	8
+def					@arg03	8	20	1	Y	32768	0	8
+def					@arg04	8	20	1	Y	32768	0	8
+def					@arg05	8	20	1	Y	32768	0	8
+def					@arg06	8	20	1	Y	32768	0	8
+def					@arg07	5	23	1	Y	32768	31	8
+def					@arg08	5	23	1	Y	32768	31	8
+def					@arg09	5	23	1	Y	32768	31	8
+def					@arg10	5	23	1	Y	32768	31	8
+def					@arg11	246	83	6	Y	0	30	8
+def					@arg12	246	83	6	Y	0	30	8
+def					@arg13	251	16777216	10	Y	0	31	8
+def					@arg14	251	16777216	19	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	8	Y	0	31	8
+def					@arg17	8	20	4	Y	32800	0	8
+def					@arg18	8	20	1	Y	32768	0	8
+def					@arg19	8	20	1	Y	32768	0	8
 def					@arg20	251	16777216	1	Y	0	31	8
 def					@arg21	251	16777216	10	Y	0	31	8
 def					@arg22	251	16777216	30	Y	0	31	8
@@ -2213,25 +2213,25 @@ set @my_key= 0 ;
 execute stmt1 using @my_key ;
 execute full_info ;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					@arg01	8	20	1	Y	32896	0	63
-def					@arg02	8	20	0	Y	32896	0	63
-def					@arg03	8	20	0	Y	32896	0	63
-def					@arg04	8	20	0	Y	32896	0	63
-def					@arg05	8	20	0	Y	32896	0	63
-def					@arg06	8	20	0	Y	32896	0	63
-def					@arg07	5	23	0	Y	32896	31	63
-def					@arg08	5	23	0	Y	32896	31	63
-def					@arg09	5	23	0	Y	32896	31	63
-def					@arg10	5	23	0	Y	32896	31	63
-def					@arg11	246	83	0	Y	128	30	63
-def					@arg12	246	83	0	Y	128	30	63
-def					@arg13	251	16777216	0	Y	128	31	63
-def					@arg14	251	16777216	0	Y	128	31	63
-def					@arg15	251	16777216	19	Y	128	31	63
-def					@arg16	251	16777216	0	Y	128	31	63
-def					@arg17	8	20	0	Y	32928	0	63
-def					@arg18	8	20	0	Y	32896	0	63
-def					@arg19	8	20	0	Y	32896	0	63
+def					@arg01	8	20	1	Y	32768	0	8
+def					@arg02	8	20	0	Y	32768	0	8
+def					@arg03	8	20	0	Y	32768	0	8
+def					@arg04	8	20	0	Y	32768	0	8
+def					@arg05	8	20	0	Y	32768	0	8
+def					@arg06	8	20	0	Y	32768	0	8
+def					@arg07	5	23	0	Y	32768	31	8
+def					@arg08	5	23	0	Y	32768	31	8
+def					@arg09	5	23	0	Y	32768	31	8
+def					@arg10	5	23	0	Y	32768	31	8
+def					@arg11	246	83	0	Y	0	30	8
+def					@arg12	246	83	0	Y	0	30	8
+def					@arg13	251	16777216	0	Y	0	31	8
+def					@arg14	251	16777216	0	Y	0	31	8
+def					@arg15	251	16777216	19	Y	0	31	8
+def					@arg16	251	16777216	0	Y	0	31	8
+def					@arg17	8	20	0	Y	32800	0	8
+def					@arg18	8	20	0	Y	32768	0	8
+def					@arg19	8	20	0	Y	32768	0	8
 def					@arg20	251	16777216	0	Y	0	31	8
 def					@arg21	251	16777216	0	Y	0	31	8
 def					@arg22	251	16777216	0	Y	0	31	8

=== modified file 'mysql-test/t/ctype_cp1251.test'
--- a/mysql-test/t/ctype_cp1251.test	2008-11-01 04:50:21 +0000
+++ b/mysql-test/t/ctype_cp1251.test	2009-08-20 10:18:05 +0000
@@ -58,3 +58,13 @@ SHOW CREATE TABLE t1;
 DROP TABLE t1;
 
 # End of 4.1 tests
+
+--echo #
+--echo # Start of 5.4 tests
+--echo #
+
+--source include/ctype_numconv.inc
+
+--echo #
+--echo # End of 5.4 tests
+--echo #

=== modified file 'mysql-test/t/ctype_latin1.test'
--- a/mysql-test/t/ctype_latin1.test	2008-07-23 09:43:50 +0000
+++ b/mysql-test/t/ctype_latin1.test	2009-08-20 10:18:05 +0000
@@ -151,3 +151,13 @@ set @@collation_connection=binary;
 --source include/weight_string_l1.inc
 
 set names latin1;
+
+--echo #
+--echo # Start of 5.4 tests
+--echo #
+
+--source include/ctype_numconv.inc
+
+--echo #
+--echo # End of 5.4 tests
+--echo #

=== modified file 'mysql-test/t/ctype_ucs.test'
--- a/mysql-test/t/ctype_ucs.test	2009-07-03 05:54:09 +0000
+++ b/mysql-test/t/ctype_ucs.test	2009-08-20 10:18:05 +0000
@@ -710,7 +710,10 @@ INSERT INTO t1 values ('abc'),('bcd'),('
 ALTER TABLE t1 ADD UNIQUE Index_1 (f1);
 DROP TABLE t1;
 
---echo Start of 6.0 tests
+--echo #
+--echo # Start of 5.4 tests
+--echo #
+
 #
 # Test how character set works with date/time
 #
@@ -718,3 +721,10 @@ SET collation_connection=ucs2_general_ci
 --source include/ctype_datetime.inc
 SET NAMES latin1;
 
+SET collation_connection=ucs2_general_ci;
+--source include/ctype_numconv.inc
+SET NAMES latin1;
+
+--echo #
+--echo # End of 5.4 tests
+--echo #

=== modified file 'mysql-test/t/func_str.test'
--- a/mysql-test/t/func_str.test	2009-07-02 08:19:17 +0000
+++ b/mysql-test/t/func_str.test	2009-08-20 10:18:05 +0000
@@ -438,11 +438,11 @@ CREATE TABLE t2 (a int, b int);
 INSERT INTO t1 VALUES (1,1),(2,2);
 INSERT INTO t2 VALUES (2,2),(3,3);
 select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
-where collation(t2.a) = _utf8'binary' order by t1.a,t2.a;
+where collation(t2.a) = 'latin1_swedish_ci' order by t1.a,t2.a;
 select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
-where charset(t2.a) = _utf8'binary' order by t1.a,t2.a;
+where charset(t2.a) = 'latin1' order by t1.a,t2.a;
 select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
-where coercibility(t2.a) = 2 order by t1.a,t2.a;
+where coercibility(t2.a) = 5 order by t1.a,t2.a;
 DROP TABLE t1, t2;
 
 #

=== modified file 'sql/field.cc'
--- a/sql/field.cc	2009-07-31 17:53:36 +0000
+++ b/sql/field.cc	2009-08-20 10:18:05 +0000
@@ -1774,7 +1774,7 @@ bool Field::get_date(MYSQL_TIME *ltime,u
   char buff[40];
   String tmp(buff,sizeof(buff),&my_charset_bin),*res;
   if (!(res=val_str(&tmp)) ||
-      str_to_datetime_with_warn(res->ptr(), res->length(),
+      str_to_datetime_with_warn(res->charset(), res->ptr(), res->length(),
                                 ltime, fuzzydate) <= MYSQL_TIMESTAMP_ERROR)
     return 1;
   return 0;
@@ -1785,7 +1785,7 @@ bool Field::get_time(MYSQL_TIME *ltime)
   char buff[40];
   String tmp(buff,sizeof(buff),&my_charset_bin),*res;
   if (!(res=val_str(&tmp)) ||
-      str_to_time_with_warn(res->ptr(), res->length(), ltime))
+      str_to_time_with_warn(res->charset(), res->ptr(), res->length(), ltime))
     return 1;
   return 0;
 }
@@ -2401,7 +2401,7 @@ String *Field_decimal::val_str(String *v
   size_t tmp_length;
 
   for (str=ptr ; *str == ' ' ; str++) ;
-  val_ptr->set_charset(&my_charset_bin);
+  val_ptr->set_charset(&my_charset_numeric);
   tmp_length= (size_t) (str-ptr);
   if (field_length < tmp_length)		// Error in data
     val_ptr->length(0);
@@ -2775,6 +2775,7 @@ String *Field_new_decimal::val_str(Strin
   uint fixed_precision= zerofill ? precision : 0;
   my_decimal2string(E_DEC_FATAL_ERROR, val_decimal(&decimal_value),
                     fixed_precision, dec, '0', val_buffer);
+  val_buffer->set_charset(&my_charset_numeric);
   return val_buffer;
 }
 
@@ -3063,7 +3064,7 @@ String *Field_tiny::val_str(String *val_
 			    String *val_ptr __attribute__((unused)))
 {
   ASSERT_COLUMN_MARKED_FOR_READ;
-  CHARSET_INFO *cs= &my_charset_bin;
+  CHARSET_INFO *cs= &my_charset_numeric;
   uint length;
   uint mlength=max(field_length+1,5*cs->mbmaxlen);
   val_buffer->alloc(mlength);
@@ -3079,6 +3080,7 @@ String *Field_tiny::val_str(String *val_
   val_buffer->length(length);
   if (zerofill)
     prepend_zeros(val_buffer);
+  val_buffer->set_charset(cs);
   return val_buffer;
 }
 
@@ -3275,7 +3277,7 @@ String *Field_short::val_str(String *val
 			     String *val_ptr __attribute__((unused)))
 {
   ASSERT_COLUMN_MARKED_FOR_READ;
-  CHARSET_INFO *cs= &my_charset_bin;
+  CHARSET_INFO *cs= &my_charset_numeric;
   uint length;
   uint mlength=max(field_length+1,7*cs->mbmaxlen);
   val_buffer->alloc(mlength);
@@ -3296,6 +3298,7 @@ String *Field_short::val_str(String *val
   val_buffer->length(length);
   if (zerofill)
     prepend_zeros(val_buffer);
+  val_buffer->set_charset(cs);
   return val_buffer;
 }
 
@@ -3492,7 +3495,7 @@ String *Field_medium::val_str(String *va
 			      String *val_ptr __attribute__((unused)))
 {
   ASSERT_COLUMN_MARKED_FOR_READ;
-  CHARSET_INFO *cs= &my_charset_bin;
+  CHARSET_INFO *cs= &my_charset_numeric;
   uint length;
   uint mlength=max(field_length+1,10*cs->mbmaxlen);
   val_buffer->alloc(mlength);
@@ -3503,6 +3506,7 @@ String *Field_medium::val_str(String *va
   val_buffer->length(length);
   if (zerofill)
     prepend_zeros(val_buffer); /* purecov: inspected */
+  val_buffer->set_charset(cs);
   return val_buffer;
 }
 
@@ -3711,7 +3715,7 @@ String *Field_long::val_str(String *val_
 			    String *val_ptr __attribute__((unused)))
 {
   ASSERT_COLUMN_MARKED_FOR_READ;
-  CHARSET_INFO *cs= &my_charset_bin;
+  CHARSET_INFO *cs= &my_charset_numeric;
   uint length;
   uint mlength=max(field_length+1,12*cs->mbmaxlen);
   val_buffer->alloc(mlength);
@@ -3731,6 +3735,7 @@ String *Field_long::val_str(String *val_
   val_buffer->length(length);
   if (zerofill)
     prepend_zeros(val_buffer);
+  val_buffer->set_charset(cs);
   return val_buffer;
 }
 
@@ -3952,7 +3957,7 @@ longlong Field_longlong::val_int(void)
 String *Field_longlong::val_str(String *val_buffer,
 				String *val_ptr __attribute__((unused)))
 {
-  CHARSET_INFO *cs= &my_charset_bin;
+  CHARSET_INFO *cs= &my_charset_numeric;
   uint length;
   uint mlength=max(field_length+1,22*cs->mbmaxlen);
   val_buffer->alloc(mlength);
@@ -3970,6 +3975,7 @@ String *Field_longlong::val_str(String *
   val_buffer->length(length);
   if (zerofill)
     prepend_zeros(val_buffer);
+  val_buffer->set_charset(cs);
   return val_buffer;
 }
 
@@ -4196,6 +4202,7 @@ String *Field_float::val_str(String *val
   val_buffer->length((uint) len);
   if (zerofill)
     prepend_zeros(val_buffer);
+  val_buffer->set_charset(&my_charset_numeric);
   return val_buffer;
 }
 
@@ -4506,6 +4513,7 @@ String *Field_double::val_str(String *va
   val_buffer->length((uint) len);
   if (zerofill)
     prepend_zeros(val_buffer);
+  val_buffer->set_charset(&my_charset_numeric);
   return val_buffer;
 }
 
@@ -4713,7 +4721,7 @@ int Field_timestamp::store(const char *f
   THD *thd= table ? table->in_use : current_thd;
 
   /* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
-  have_smth_to_conv= (str_to_datetime(from, len, &l_time,
+  have_smth_to_conv= (str_to_datetime(cs, from, len, &l_time,
                                       (thd->variables.sql_mode &
                                        MODE_NO_ZERO_DATE) |
                                       MODE_NO_ZERO_IN_DATE, &error) >
@@ -4862,10 +4870,10 @@ String *Field_timestamp::val_str(String 
 
   if (temp == 0L)
   {				      /* Zero time is "000000" */
-    val_ptr->set(STRING_WITH_LEN("0000-00-00 00:00:00"), &my_charset_bin);
+    val_ptr->set(STRING_WITH_LEN("0000-00-00 00:00:00"), &my_charset_numeric);
     return val_ptr;
   }
-  val_buffer->set_charset(&my_charset_bin);	// Safety
+  val_buffer->set_charset(&my_charset_numeric);	// Safety
   
   thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp,(my_time_t)temp);
 
@@ -4909,6 +4917,7 @@ String *Field_timestamp::val_str(String 
   *to++= (char) ('0'+(char) (temp2));
   *to++= (char) ('0'+(char) (temp));
   *to= 0;
+  val_buffer->set_charset(&my_charset_numeric);
   return val_buffer;
 }
 
@@ -5019,7 +5028,7 @@ int Field_time::store(const char *from,u
   int error= 0;
   int warning;
 
-  if (str_to_time(from, len, &ltime, &warning))
+  if (str_to_time(cs, from, len, &ltime, &warning))
   {
     tmp=0L;
     error= 2;
@@ -5178,6 +5187,7 @@ String *Field_time::val_str(String *val_
   ltime.minute= (uint) (tmp/100 % 100);
   ltime.second= (uint) (tmp % 100);
   make_time((DATE_TIME_FORMAT*) 0, &ltime, val_buffer);
+  val_buffer->set_charset(&my_charset_numeric);
   return val_buffer;
 }
 
@@ -5375,6 +5385,7 @@ String *Field_year::val_str(String *val_
   val_buffer->length(field_length);
   char *to=(char*) val_buffer->ptr();
   sprintf(to,field_length == 2 ? "%02d" : "%04d",(int) Field_year::val_int());
+  val_buffer->set_charset(&my_charset_numeric);
   return val_buffer;
 }
 
@@ -5402,7 +5413,7 @@ int Field_date::store(const char *from, 
   int error;
   THD *thd= table ? table->in_use : current_thd;
 
-  if (str_to_datetime(from, len, &l_time, TIME_FUZZY_DATE |
+  if (str_to_datetime(cs, from, len, &l_time, TIME_FUZZY_DATE |
                       (thd->variables.sql_mode &
                        (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
                         MODE_INVALID_DATES)),
@@ -5547,6 +5558,7 @@ String *Field_date::val_str(String *val_
   ltime.month= (int) ((uint32) tmp/100 % 100);
   ltime.day= (int) ((uint32) tmp % 100);
   make_date((DATE_TIME_FORMAT *) 0, &ltime, val_buffer);
+  val_buffer->set_charset(&my_charset_numeric);
   return val_buffer;
 }
 
@@ -5636,7 +5648,7 @@ int Field_newdate::store(const char *fro
   int error;
   THD *thd= table ? table->in_use : current_thd;
   enum enum_mysql_timestamp_type ret;
-  if ((ret= str_to_datetime(from, len, &l_time,
+  if ((ret= str_to_datetime(cs, from, len, &l_time,
                             (TIME_FUZZY_DATE |
                              (thd->variables.sql_mode &
                               (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
@@ -5808,6 +5820,7 @@ String *Field_newdate::val_str(String *v
   *pos--= (char) ('0'+part%10); part/=10;
   *pos--= (char) ('0'+part%10); part/=10;
   *pos=   (char) ('0'+part);
+  val_buffer->set_charset(&my_charset_numeric);
   return val_buffer;
 }
 
@@ -5870,7 +5883,7 @@ int Field_datetime::store(const char *fr
   enum enum_mysql_timestamp_type func_res;
   THD *thd= table ? table->in_use : current_thd;
 
-  func_res= str_to_datetime(from, len, &time_tmp,
+  func_res= str_to_datetime(cs, from, len, &time_tmp,
                             (TIME_FUZZY_DATE |
                              (thd->variables.sql_mode &
                               (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
@@ -6070,6 +6083,7 @@ String *Field_datetime::val_str(String *
   *pos--= (char) ('0'+(char) (part3%10)); part3/=10;
   *pos--= (char) ('0'+(char) (part3%10)); part3/=10;
   *pos=(char) ('0'+(char) part3);
+  val_buffer->set_charset(&my_charset_numeric);
   return val_buffer;
 }
 
@@ -6313,7 +6327,7 @@ int Field_str::store(double nr)
     else
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
   }
-  return store(buff, length, charset());
+  return store(buff, length, &my_charset_numeric);
 }
 
 
@@ -6359,7 +6373,7 @@ int Field_string::store(longlong nr, boo
 int Field_longstr::store_decimal(const my_decimal *d)
 {
   char buff[DECIMAL_MAX_STR_LENGTH+1];
-  String str(buff, sizeof(buff), &my_charset_bin);
+  String str(buff, sizeof(buff), &my_charset_numeric);
   my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, 0, &str);
   return store(str.ptr(), str.length(), str.charset());
 }
@@ -9488,7 +9502,7 @@ Field *make_field(TABLE_SHARE *share, uc
   case MYSQL_TYPE_TIME:
   case MYSQL_TYPE_DATETIME:
   case MYSQL_TYPE_TIMESTAMP:
-    field_charset= &my_charset_bin;
+    field_charset= &my_charset_numeric;
   default: break;
   }
 

=== modified file 'sql/field.h'
--- a/sql/field.h	2009-07-10 12:26:38 +0000
+++ b/sql/field.h	2009-08-20 10:18:05 +0000
@@ -644,6 +644,7 @@ public:
 	    const char *field_name_arg,
             uint8 dec_arg, bool zero_arg, bool unsigned_arg);
   Item_result result_type () const { return REAL_RESULT; }
+  enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
   void prepend_zeros(String *value);
   void add_zerofill_and_unsigned(String &res) const;
   friend class Create_field;
@@ -1207,6 +1208,8 @@ public:
   enum_field_types type() const { return MYSQL_TYPE_TIMESTAMP;}
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
   enum Item_result cmp_type () const { return INT_RESULT; }
+  enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
+  bool binary() const { return 1; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
   int  store(longlong nr, bool unsigned_val);
@@ -1307,6 +1310,8 @@ public:
   enum_field_types type() const { return MYSQL_TYPE_DATE;}
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
   enum Item_result cmp_type () const { return INT_RESULT; }
+  enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
+  bool binary() const { return 1; }
   int store(const char *to,uint length,CHARSET_INFO *charset);
   int store(double nr);
   int store(longlong nr, bool unsigned_val);
@@ -1352,6 +1357,8 @@ public:
   enum_field_types real_type() const { return MYSQL_TYPE_NEWDATE; }
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_UINT24; }
   enum Item_result cmp_type () const { return INT_RESULT; }
+  enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
+  bool binary() const { return 1; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
   int  store(longlong nr, bool unsigned_val);
@@ -1387,6 +1394,8 @@ public:
   enum_field_types type() const { return MYSQL_TYPE_TIME;}
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
   enum Item_result cmp_type () const { return INT_RESULT; }
+  enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
+  bool binary() const { return 1; }
   int store_time(MYSQL_TIME *ltime, timestamp_type type);
   int store(const char *to,uint length,CHARSET_INFO *charset);
   int store(double nr);
@@ -1424,6 +1433,8 @@ public:
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
 #endif
   enum Item_result cmp_type () const { return INT_RESULT; }
+  enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
+  bool binary() const { return 1; }
   uint decimals() const { return DATETIME_DEC; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2009-07-23 12:21:41 +0000
+++ b/sql/item.cc	2009-08-20 10:18:05 +0000
@@ -201,6 +201,34 @@ bool Item::val_bool()
 }
 
 
+/*
+  For the items which don't have its own fast val_str_ascii()
+  implementation we provide the slow version, which converts
+  from the Item character set to ASCII.
+*/
+String *Item::val_str_ascii(String *str)
+{
+  DBUG_ASSERT(fixed == 1);
+
+  if (!(collation.collation->state & MY_CS_NONASCII))
+    return val_str(str);
+  
+  DBUG_ASSERT(str != &str_value);
+  
+  uint errors;
+  String *res= val_str(&str_value);
+  if (!res)
+    return 0;
+  
+  if ((null_value= str->copy(res->ptr(), res->length(),
+                             collation.collation, &my_charset_latin1,
+                             &errors)))
+    return 0;
+  
+  return str;
+}
+
+
 String *Item::val_string_from_real(String *str)
 {
   double nr= val_real();
@@ -442,10 +470,11 @@ uint Item::decimal_precision() const
   if ((restype == DECIMAL_RESULT) || (restype == INT_RESULT))
   {
     uint prec= 
-      my_decimal_length_to_precision(max_length, decimals, unsigned_flag);
+      my_decimal_length_to_precision(max_char_length(), decimals,
+                                     unsigned_flag);
     return min(prec, DECIMAL_MAX_PRECISION);
   }
-  return min(max_length, DECIMAL_MAX_PRECISION);
+  return min(max_char_length(), DECIMAL_MAX_PRECISION);
 }
 
 
@@ -795,44 +824,29 @@ Item *Item::safe_charset_converter(CHARS
 */
 Item *Item_num::safe_charset_converter(CHARSET_INFO *tocs)
 {
-  const size_t max_mbminlen= 4;
   Item_string *conv;
-  char buf[64 + max_mbminlen];
-  String tmp(buf + max_mbminlen, sizeof(buf) - max_mbminlen, &my_charset_bin);
-  String *s= val_str(&tmp);
-  uint32 nzeros= tocs->mbminlen - (s->length() % tocs->mbminlen);
-  
-  if (nzeros) 
+  uint conv_errors;
+  char *ptr;
+  String tmp, cstr, *ostr= val_str(&tmp);
+  cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors);
+  if (conv_errors || !(conv= new Item_string(cstr.ptr(), cstr.length(),
+                                             cstr.charset(),
+                                             collation.derivation)))
   {
     /*
-      Need to left-pad some 0x00 bytes to return correct length.
-      Make sure that we reserved enough space for the leading 0x00 bytes,
-      then clear the leading bytes:
-      Note, int4store() should be a little bit faster than memset(buf,4).
-    */
-    DBUG_ASSERT(tocs->mbminlen <= max_mbminlen);
-    int4store(buf, 0);
-    
-    /*
-      Make sure val_str returns pointer to "buf",
-      (otherwise padding won't work).
-      That should be always true, according to
-      Item_num::val_str() implementation.
+      Safe conversion is not possible (or EOM).
+      We could not convert a string into the requested character set
+      without data loss. The target charset does not cover all the
+      characters from the string. Operation cannot be done correctly.
     */
-    DBUG_ASSERT(s->ptr() == ((const char*) &buf) + 4);
-  }
-  
-  
-  /*
-    TODO for 6.1: remove this trick with zeros
-    when WL#2649 "Number-to-string conversions" is done.
-  */
-  if ((conv= new Item_string(s->ptr() - nzeros,
-                             s->length() + nzeros, s->charset())))
-  {
-    conv->str_value.copy();
-    conv->str_value.mark_as_const();
+    return NULL;
   }
+  if (!(ptr= current_thd->strmake(cstr.ptr(), cstr.length())))
+    return NULL;
+  conv->str_value.set(ptr, cstr.length(), cstr.charset());
+  /* Ensure that no one is going to change the result string */
+  conv->str_value.mark_as_const();
+  conv->fix_char_length(max_char_length());
   return conv;
 }
 
@@ -951,7 +965,7 @@ bool Item::get_date(MYSQL_TIME *ltime,ui
     char buff[40];
     String tmp(buff,sizeof(buff), &my_charset_bin),*res;
     if (!(res=val_str(&tmp)) ||
-        str_to_datetime_with_warn(res->ptr(), res->length(),
+        str_to_datetime_with_warn(res->charset(), res->ptr(), res->length(),
                                   ltime, fuzzydate) <= MYSQL_TIMESTAMP_ERROR)
       goto err;
   }
@@ -986,8 +1000,8 @@ bool Item::get_time(MYSQL_TIME *ltime)
 {
   char buff[40];
   String tmp(buff,sizeof(buff),&my_charset_bin),*res;
-  if (!(res=val_str(&tmp)) ||
-      str_to_time_with_warn(res->ptr(), res->length(), ltime))
+  if (!(res=val_str_ascii(&tmp)) ||
+      str_to_time_with_warn(res->charset(), res->ptr(), res->length(), ltime))
   {
     bzero((char*) ltime,sizeof(*ltime));
     return 1;
@@ -1693,6 +1707,11 @@ bool agg_item_collations(DTCollation &c,
     my_coll_agg_error(av, count, fname, item_sep);
     return TRUE;
   }
+  
+  /* If all arguments where numbers, reset to @@collation_connection */
+  if (c.derivation == DERIVATION_NUMERIC)
+    c.set(Item::default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_NUMERIC);
+
   return FALSE;
 }
 
@@ -1940,13 +1959,19 @@ void Item_field::set_field(Field *field_
   field=result_field=field_par;			// for easy coding with fields
   maybe_null=field->maybe_null();
   decimals= field->decimals();
-  max_length= field_par->max_display_length();
   table_name= *field_par->table_name;
   field_name= field_par->field_name;
   db_name= field_par->table->s->db.str;
   alias_name_used= field_par->table->alias_name_used;
   unsigned_flag=test(field_par->flags & UNSIGNED_FLAG);
-  collation.set(field_par->charset(), field_par->derivation());
+  collation.set(field_par->derivation() == DERIVATION_NUMERIC ?
+                &my_charset_numeric : field_par->charset(),
+                field_par->derivation(),
+                field_par->derivation() == DERIVATION_NUMERIC ?
+                MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30);
+  max_length= field_par->max_display_length() *
+               (field_par->derivation() == DERIVATION_NUMERIC ?
+                collation.collation->mbmaxlen : 1);
   fixed= 1;
   if (field->table->s->tmp_table == SYSTEM_TMP_TABLE)
     any_privileges= 0;
@@ -2268,7 +2293,7 @@ String *Item_int::val_str(String *str)
 {
   // following assert is redundant, because fixed=1 assigned in constructor
   DBUG_ASSERT(fixed == 1);
-  str->set(value, &my_charset_bin);
+  str->set(value, collation.collation);
   return str;
 }
 
@@ -2398,7 +2423,7 @@ double Item_decimal::val_real()
 
 String *Item_decimal::val_str(String *result)
 {
-  result->set_charset(&my_charset_bin);
+  result->set_charset(&my_charset_numeric);
   my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, 0, 0, 0, result);
   return result;
 }

=== modified file 'sql/item.h'
--- a/sql/item.h	2009-05-25 10:10:18 +0000
+++ b/sql/item.h	2009-08-20 10:18:05 +0000
@@ -33,6 +33,8 @@ class Item_field;
                                  (i.e. constant).
   MY_COLL_ALLOW_CONV           - allow any kind of conversion
                                  (combination of the above two)
+  MY_COLL_ALLOW_NUMBER_CONV    - allow number-to-string conversion
+                                 (using @@collation_connection)
   MY_COLL_DISALLOW_NONE        - don't allow return DERIVATION_NONE
                                  (e.g. when aggregating for comparison)
   MY_COLL_CMP_CONV             - combination of MY_COLL_ALLOW_CONV
@@ -41,9 +43,11 @@ class Item_field;
 
 #define MY_COLL_ALLOW_SUPERSET_CONV   1
 #define MY_COLL_ALLOW_COERCIBLE_CONV  2
-#define MY_COLL_ALLOW_CONV            3
 #define MY_COLL_DISALLOW_NONE         4
-#define MY_COLL_CMP_CONV              7
+#define MY_COLL_ALLOW_NUMBER_CONV     8
+
+#define MY_COLL_ALLOW_CONV (MY_COLL_ALLOW_SUPERSET_CONV | MY_COLL_ALLOW_COERCIBLE_CONV)
+#define MY_COLL_CMP_CONV   (MY_COLL_ALLOW_CONV | MY_COLL_DISALLOW_NONE)
 
 class DTCollation {
 public:
@@ -88,6 +92,12 @@ public:
     derivation= derivation_arg;
     repertoire= repertoire_arg;
   }
+  void set_numeric()
+  {
+    collation= &my_charset_numeric;
+    derivation= DERIVATION_NUMERIC;
+    repertoire= MY_REPERTOIRE_NUMERIC;
+  }
   void set(CHARSET_INFO *collation_arg)
   {
     collation= collation_arg;
@@ -102,6 +112,7 @@ public:
   {
     switch(derivation)
     {
+      case DERIVATION_NUMERIC:   return "NUMERIC";
       case DERIVATION_IGNORABLE: return "IGNORABLE";
       case DERIVATION_COERCIBLE: return "COERCIBLE";
       case DERIVATION_IMPLICIT:  return "IMPLICIT";
@@ -687,6 +698,77 @@ public:
       If value is not null null_value flag will be reset to FALSE.
   */
   virtual String *val_str(String *str)=0;
+
+  /*
+    Returns string representation of this item in ASCII format.
+
+    SYNOPSIS
+      val_str_ascii()
+      str - similar to val_str();
+
+    NOTE
+      This method is introduced for performance optimization purposes.
+
+      1. val_str() result of some Items in string context
+      depends on @@character_set_results.
+      @@character_set_results can be set to a "real multibyte" character
+      set like UCS2, UTF16, UTF32. (We'll use only UTF32 in the examples
+      below for convenience.)
+
+      So the default string result of such functions
+      in these circumstances is real multi-byte character set, like UTF32.
+
+      For example, all numbers in string context
+      return result in @@character_set_results:
+
+      SELECT CONCAT(20010101); -> UTF32
+
+      We do sprintf() first (to get ASCII representation)
+      and then convert to UTF32;
+      
+      So these kind "data sources" can use ASCII representation
+      internally, but return multi-byte data only because
+      @@character_set_results wants so.
+      Therefore, conversion from ASCII to UTF32 is applied internally.
+
+
+      2. Some other functions need in fact ASCII input.
+
+      For example,
+        inet_aton(), GeometryFromText(), Convert_TZ(), GET_FORMAT().
+
+      Similar, fields of certain type, like DATE, TIME,
+      when you insert string data into them, expect in fact ASCII input.
+      If they get non-ASCII input, for example UTF32, they
+      convert input from UTF32 to ASCII, and then use ASCII
+      representation to do further processing.
+
+
+      3. Now imagine we pass result of a data source of the first type
+         to a data destination of the second type.
+
+      What happens:
+        a. data source converts data from ASCII to UTF32, because
+           @@character_set_results wants so and passes the result to
+           data destination.
+        b. data destination gets UTF32 string.
+        c. data destination converts UTF32 string to ASCII,
+           because it needs ASCII representation to be able to handle data
+           correctly.
+
+      As a result we get two steps of unnecessary conversion:
+      From ASCII to UTF32, then from UTF32 to ASCII.
+
+      A better way to handle these situations is to pass ASCII
+      representation directly from the source to the destination.
+
+      This is why val_str_ascii() introduced.
+
+    RETURN
+      Similar to val_str()
+  */
+  virtual String *val_str_ascii(String *str);
+
   /*
     Return decimal representation of item with fixed point.
 
@@ -1051,6 +1133,15 @@ public:
     { return Field::GEOM_GEOMETRY; };
   String *check_well_formed_result(String *str, bool send_error= 0);
   bool eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs); 
+  uint32 max_char_length() const
+  { return max_length / collation.collation->mbmaxlen; }
+  void fix_length_and_charset(uint32 max_char_length_arg, CHARSET_INFO *cs)
+  {
+    max_length= max_char_length_arg * cs->mbmaxlen;
+    collation.collation= cs;
+  }
+  void fix_char_length(uint32 max_char_length_arg)
+  { max_length= max_char_length_arg * collation.collation->mbmaxlen; }
 };
 
 
@@ -1350,12 +1441,32 @@ bool agg_item_set_converter(DTCollation 
                             Item **args, uint nargs, uint flags, int item_sep);
 bool agg_item_charsets(DTCollation &c, const char *name,
                        Item **items, uint nitems, uint flags, int item_sep);
-
+inline bool
+agg_item_charsets_for_string_result(DTCollation &c, const char *name,
+                                    Item **items, uint nitems,
+                                    int item_sep= 1)
+{
+  uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
+              MY_COLL_ALLOW_COERCIBLE_CONV |
+              MY_COLL_ALLOW_NUMBER_CONV;
+  return agg_item_charsets(c, name, items, nitems, flags, item_sep);
+}
+inline bool
+agg_item_charsets_for_comparison(DTCollation &c, const char *name,
+                                 Item **items, uint nitems,
+                                 int item_sep= 1)
+{
+  uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
+              MY_COLL_ALLOW_COERCIBLE_CONV |
+              MY_COLL_ALLOW_NUMBER_CONV |
+              MY_COLL_DISALLOW_NONE;
+  return agg_item_charsets(c, name, items, nitems, flags, item_sep);
+}
 
 class Item_num: public Item_basic_constant
 {
 public:
-  Item_num() {}                               /* Remove gcc warning */
+  Item_num() { collation.set_numeric(); } /* Remove gcc warning */
   virtual Item_num *neg()= 0;
   Item *safe_charset_converter(CHARSET_INFO *tocs);
   bool check_partition_func_processor(uchar *int_arg) { return FALSE;}

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2009-07-03 10:39:01 +0000
+++ b/sql/item_cmpfunc.cc	2009-08-20 10:18:05 +0000
@@ -472,7 +472,7 @@ void Item_bool_func2::fix_length_and_dec
   DTCollation coll;
   if (args[0]->result_type() == STRING_RESULT &&
       args[1]->result_type() == STRING_RESULT &&
-      agg_arg_charsets(coll, args, 2, MY_COLL_CMP_CONV, 1))
+      agg_arg_charsets_for_comparison(coll, args, 2))
     return;
     
   args[0]->cmp_context= args[1]->cmp_context=
@@ -2025,7 +2025,7 @@ void Item_func_between::fix_length_and_d
   if ( agg_cmp_type(&cmp_type, args, 3))
     return;
   if (cmp_type == STRING_RESULT &&
-      agg_arg_charsets(cmp_collation, args, 3, MY_COLL_CMP_CONV, 1))
+      agg_arg_charsets_for_comparison(cmp_collation, args, 3))
    return;
 
   /*
@@ -2226,7 +2226,7 @@ Item_func_ifnull::fix_length_and_dec()
 
   switch (hybrid_type) {
   case STRING_RESULT:
-    agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1);
+    agg_arg_charsets_for_comparison(collation, args, arg_count);
     break;
   case DECIMAL_RESULT:
   case REAL_RESULT:
@@ -2401,12 +2401,12 @@ Item_func_if::fix_length_and_dec()
     agg_result_type(&cached_result_type, args+1, 2);
     if (cached_result_type == STRING_RESULT)
     {
-      if (agg_arg_charsets(collation, args+1, 2, MY_COLL_ALLOW_CONV, 1))
+      if (agg_arg_charsets_for_string_result(collation, args + 1, 2))
         return;
     }
     else
     {
-      collation.set(&my_charset_bin);	// Number
+      collation.set_numeric(); // Number
     }
     cached_field_type= agg_field_type(args + 1, 2);
   }
@@ -2492,7 +2492,7 @@ Item_func_nullif::fix_length_and_dec()
     unsigned_flag= args[0]->unsigned_flag;
     cached_result_type= args[0]->result_type();
     if (cached_result_type == STRING_RESULT &&
-        agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1))
+        agg_arg_charsets_for_comparison(collation, args, arg_count))
       return;
   }
 }
@@ -2769,9 +2769,13 @@ void Item_func_case::fix_length_and_dec(
     agg[nagg++]= args[else_expr_num];
   
   agg_result_type(&cached_result_type, agg, nagg);
-  if ((cached_result_type == STRING_RESULT) &&
-      agg_arg_charsets(collation, agg, nagg, MY_COLL_ALLOW_CONV, 1))
-    return;
+  if (cached_result_type == STRING_RESULT)
+  {
+    if (agg_arg_charsets_for_string_result(collation, agg, nagg))
+      return;
+  }
+  else
+    collation.set_numeric();
   
   cached_field_type= agg_field_type(agg, nagg);
   /*
@@ -2796,7 +2800,7 @@ void Item_func_case::fix_length_and_dec(
       {
         DBUG_ASSERT((Item_result)i != ROW_RESULT);
         if ((Item_result)i == STRING_RESULT &&
-            agg_arg_charsets(cmp_collation, agg, nagg, MY_COLL_CMP_CONV, 1))
+            agg_arg_charsets_for_comparison(cmp_collation, agg, nagg))
           return;
         if (!(cmp_items[i]=
             cmp_item::get_comparator((Item_result)i,
@@ -2959,7 +2963,7 @@ void Item_func_coalesce::fix_length_and_
   case STRING_RESULT:
     count_only_length();
     decimals= NOT_FIXED_DEC;
-    agg_arg_charsets(collation, args, arg_count, MY_COLL_ALLOW_CONV, 1);
+    agg_arg_charsets_for_string_result(collation, args, arg_count);
     break;
   case DECIMAL_RESULT:
     count_decimal_length();
@@ -3604,7 +3608,7 @@ void Item_func_in::fix_length_and_dec()
   if (type_cnt == 1)
   {
     if (cmp_type == STRING_RESULT && 
-        agg_arg_charsets(cmp_collation, args, arg_count, MY_COLL_CMP_CONV, 1))
+        agg_arg_charsets_for_comparison(cmp_collation, args, arg_count))
       return;
     arg_types_compatible= TRUE;
   }
@@ -3780,8 +3784,7 @@ void Item_func_in::fix_length_and_dec()
         if (found_types & (1 << i) && !cmp_items[i])
         {
           if ((Item_result)i == STRING_RESULT &&
-              agg_arg_charsets(cmp_collation, args, arg_count,
-                               MY_COLL_CMP_CONV, 1))
+              agg_arg_charsets_for_comparison(cmp_collation, args, arg_count))
             return;
           if (!cmp_items[i] && !(cmp_items[i]=
               cmp_item::get_comparator((Item_result)i,
@@ -4650,7 +4653,7 @@ Item_func_regex::fix_fields(THD *thd, It
   max_length= 1;
   decimals= 0;
 
-  if (agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV, 1))
+  if (agg_arg_charsets_for_comparison(cmp_collation, args, 2))
     return TRUE;
 
   regex_lib_flags= (cmp_collation.collation->state &

=== modified file 'sql/item_cmpfunc.h'
--- a/sql/item_cmpfunc.h	2009-01-26 16:03:39 +0000
+++ b/sql/item_cmpfunc.h	2009-08-20 10:18:05 +0000
@@ -631,6 +631,11 @@ public:
   {
     Item_func::print(str, query_type);
   }
+  void fix_length_and_dec()
+  {
+    Item_bool_func2::fix_length_and_dec();
+    fix_char_length(2); // returns "1" or "0" or "-1"
+  }
 };
 
 

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2009-07-28 22:45:02 +0000
+++ b/sql/item_func.cc	2009-08-20 10:18:05 +0000
@@ -465,13 +465,15 @@ Field *Item_func::tmp_table_field(TABLE 
 
   switch (result_type()) {
   case INT_RESULT:
-    if (max_length > MY_INT32_NUM_DECIMAL_DIGITS)
-      field= new Field_longlong(max_length, maybe_null, name, unsigned_flag);
+    if (max_char_length() > MY_INT32_NUM_DECIMAL_DIGITS)
+      field= new Field_longlong(max_char_length(), maybe_null, name,
+                                unsigned_flag);
     else
-      field= new Field_long(max_length, maybe_null, name, unsigned_flag);
+      field= new Field_long(max_char_length(), maybe_null, name,
+                            unsigned_flag);
     break;
   case REAL_RESULT:
-    field= new Field_double(max_length, maybe_null, name, decimals);
+    field= new Field_double(max_char_length(), maybe_null, name, decimals);
     break;
   case STRING_RESULT:
     return make_string_field(table);
@@ -479,7 +481,7 @@ Field *Item_func::tmp_table_field(TABLE 
   {
     uint8 dec= decimals;
     uint8 intg= decimal_precision() - dec;
-    uint32 len= max_length;
+    uint32 len= max_char_length();
 
     /*
       Trying to put too many digits overall in a DECIMAL(prec,dec)
@@ -542,7 +544,7 @@ String *Item_real_func::val_str(String *
   double nr= val_real();
   if (null_value)
     return 0; /* purecov: inspected */
-  str->set_real(nr,decimals, &my_charset_bin);
+  str->set_real(nr, decimals, collation.collation);
   return str;
 }
 
@@ -681,7 +683,7 @@ String *Item_int_func::val_str(String *s
   longlong nr=val_int();
   if (null_value)
     return 0;
-  str->set_int(nr, unsigned_flag, &my_charset_bin);
+  str->set_int(nr, unsigned_flag, collation.collation);
   return str;
 }
 
@@ -801,6 +803,7 @@ String *Item_func_numhybrid::val_str(Str
     if (!(val= decimal_op(&decimal_value)))
       return 0;                                 // null is set
     my_decimal_round(E_DEC_FATAL_ERROR, val, decimals, FALSE, val);
+    str->set_charset(collation.collation);
     my_decimal2string(E_DEC_FATAL_ERROR, val, 0, 0, 0, str);
     break;
   }
@@ -809,7 +812,7 @@ String *Item_func_numhybrid::val_str(Str
     longlong nr= int_op();
     if (null_value)
       return 0; /* purecov: inspected */
-    str->set_int(nr, unsigned_flag, &my_charset_bin);
+    str->set_int(nr, unsigned_flag, collation.collation);
     break;
   }
   case REAL_RESULT:
@@ -817,7 +820,7 @@ String *Item_func_numhybrid::val_str(Str
     double nr= real_op();
     if (null_value)
       return 0; /* purecov: inspected */
-    str->set_real(nr,decimals,&my_charset_bin);
+    str->set_real(nr, decimals, collation.collation);
     break;
   }
   case STRING_RESULT:
@@ -952,6 +955,7 @@ longlong Item_func_signed::val_int_from_
   uint32 length;
   String tmp(buff,sizeof(buff), &my_charset_bin), *res;
   longlong value;
+  CHARSET_INFO *cs;
 
   /*
     For a string result, we must first get the string and then convert it
@@ -967,9 +971,10 @@ longlong Item_func_signed::val_int_from_
   null_value= 0;
   start= (char *)res->ptr();
   length= res->length();
+  cs= res->charset();
 
   end= start + length;
-  value= my_strtoll10(start, &end, error);
+  value= cs->cset->strtoll10(cs, start, &end, error);
   if (*error > 0 || end != start+ length)
   {
     char err_buff[128];
@@ -2322,7 +2327,7 @@ void Item_func_min_max::fix_length_and_d
   }
   if (cmp_type == STRING_RESULT)
   {
-    agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1);
+    agg_arg_charsets_for_comparison(collation, args, arg_count);
     if (datetime_found)
     {
       thd= current_thd;
@@ -2330,9 +2335,12 @@ void Item_func_min_max::fix_length_and_d
     }
   }
   else if ((cmp_type == DECIMAL_RESULT) || (cmp_type == INT_RESULT))
+  {
+    collation.set_numeric();
     max_length= my_decimal_precision_to_length_no_truncation(max_int_part +
                                                              decimals, decimals,
                                                              unsigned_flag);
+  }
   cached_field_type= agg_field_type(args, arg_count);
 }
 
@@ -2403,7 +2411,7 @@ String *Item_func_min_max::val_str(Strin
     longlong nr=val_int();
     if (null_value)
       return 0;
-    str->set_int(nr, unsigned_flag, &my_charset_bin);
+    str->set_int(nr, unsigned_flag, collation.collation);
     return str;
   }
   case DECIMAL_RESULT:
@@ -2419,7 +2427,7 @@ String *Item_func_min_max::val_str(Strin
     double nr= val_real();
     if (null_value)
       return 0; /* purecov: inspected */
-    str->set_real(nr,decimals,&my_charset_bin);
+    str->set_real(nr, decimals, collation.collation);
     return str;
   }
   case STRING_RESULT:
@@ -2592,7 +2600,7 @@ longlong Item_func_coercibility::val_int
 void Item_func_locate::fix_length_and_dec()
 {
   max_length= MY_INT32_NUM_DECIMAL_DIGITS;
-  agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV, 1);
+  agg_arg_charsets_for_comparison(cmp_collation, args, 2);
 }
 
 
@@ -2716,7 +2724,7 @@ void Item_func_field::fix_length_and_dec
   for (uint i=1; i < arg_count ; i++)
     cmp_type= item_cmp_type(cmp_type, args[i]->result_type());
   if (cmp_type == STRING_RESULT)
-    agg_arg_charsets(cmp_collation, args, arg_count, MY_COLL_CMP_CONV, 1);
+    agg_arg_charsets_for_comparison(cmp_collation, args, arg_count);
 }
 
 
@@ -2783,7 +2791,7 @@ void Item_func_find_in_set::fix_length_a
       }
     }
   }
-  agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV, 1);
+  agg_arg_charsets_for_comparison(cmp_collation, args, 2);
 }
 
 static const char separator=',';
@@ -4022,7 +4030,9 @@ bool Item_func_set_user_var::fix_fields(
   */
   null_item= (args[0]->type() == NULL_ITEM);
   if (!entry->collation.collation || !null_item)
-    entry->collation.set(args[0]->collation.collation, DERIVATION_IMPLICIT);
+    entry->collation.set(args[0]->collation.derivation == DERIVATION_NUMERIC ?
+                         default_charset() : args[0]->collation.collation,
+                         DERIVATION_IMPLICIT);
   collation.set(entry->collation.collation, DERIVATION_IMPLICIT);
   cached_result_type= args[0]->result_type();
   return FALSE;
@@ -4033,9 +4043,15 @@ void
 Item_func_set_user_var::fix_length_and_dec()
 {
   maybe_null=args[0]->maybe_null;
-  max_length=args[0]->max_length;
   decimals=args[0]->decimals;
-  collation.set(args[0]->collation.collation, DERIVATION_IMPLICIT);
+  collation.set(DERIVATION_IMPLICIT);
+  if (args[0]->collation.derivation == DERIVATION_NUMERIC)
+    fix_length_and_charset(args[0]->max_char_length(), default_charset());
+  else
+  {
+    collation.set(args[0]->collation.collation);
+    max_length= args[0]->max_length;
+  }
 }
 
 
@@ -4236,16 +4252,16 @@ String *user_var_entry::val_str(my_bool 
 
   switch (type) {
   case REAL_RESULT:
-    str->set_real(*(double*) value, decimals, &my_charset_bin);
+    str->set_real(*(double*) value, decimals, collation.collation);
     break;
   case INT_RESULT:
     if (!unsigned_flag)
-      str->set(*(longlong*) value, &my_charset_bin);
+      str->set(*(longlong*) value, collation.collation);
     else
-      str->set(*(ulonglong*) value, &my_charset_bin);
+      str->set(*(ulonglong*) value, collation.collation);
     break;
   case DECIMAL_RESULT:
-    my_decimal2string(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, 0, 0, str);
+    str_set_decimal((my_decimal *) value, str, collation.collation);
     break;
   case STRING_RESULT:
     if (str->copy(value, length, collation.collation))
@@ -4411,13 +4427,13 @@ Item_func_set_user_var::update()
   case REAL_RESULT:
   {
     res= update_hash((void*) &save_result.vreal,sizeof(save_result.vreal),
-		     REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
+		     REAL_RESULT, default_charset(), DERIVATION_IMPLICIT, 0);
     break;
   }
   case INT_RESULT:
   {
     res= update_hash((void*) &save_result.vint, sizeof(save_result.vint),
-                     INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
+                     INT_RESULT, default_charset(), DERIVATION_IMPLICIT,
                      unsigned_flag);
     break;
   }
@@ -4441,7 +4457,7 @@ Item_func_set_user_var::update()
     else
       res= update_hash((void*) save_result.vdec,
                        sizeof(my_decimal), DECIMAL_RESULT,
-                       &my_charset_bin, DERIVATION_IMPLICIT, 0);
+                       default_charset(), DERIVATION_IMPLICIT, 0);
     break;
   }
   case ROW_RESULT:
@@ -4874,17 +4890,17 @@ void Item_func_get_user_var::fix_length_
     collation.set(var_entry->collation);
     switch(m_cached_result_type) {
     case REAL_RESULT:
-      max_length= DBL_DIG + 8;
+      fix_char_length(DBL_DIG + 8);
       break;
     case INT_RESULT:
-      max_length= MAX_BIGINT_WIDTH;
+      fix_char_length(MAX_BIGINT_WIDTH);
       decimals=0;
       break;
     case STRING_RESULT:
       max_length= MAX_BLOB_WIDTH;
       break;
     case DECIMAL_RESULT:
-      max_length= DECIMAL_MAX_STR_LENGTH;
+      fix_char_length(DECIMAL_MAX_STR_LENGTH);
       decimals= DECIMAL_MAX_SCALE;
       break;
     case ROW_RESULT:                            // Keep compiler happy
@@ -5070,12 +5086,14 @@ void Item_func_get_system_var::fix_lengt
     case SHOW_INT:
     case SHOW_HA_ROWS:
       unsigned_flag= TRUE;
-      max_length= MY_INT64_NUM_DECIMAL_DIGITS;
+      collation.set_numeric();
+      fix_char_length(MY_INT64_NUM_DECIMAL_DIGITS);
       decimals=0;
       break;
     case SHOW_LONGLONG:
       unsigned_flag= FALSE;
-      max_length= MY_INT64_NUM_DECIMAL_DIGITS;
+      collation.set_numeric();
+      fix_char_length(MY_INT64_NUM_DECIMAL_DIGITS);
       decimals=0;
       break;
     case SHOW_CHAR:
@@ -5093,13 +5111,15 @@ void Item_func_get_system_var::fix_lengt
     case SHOW_BOOL:
     case SHOW_MY_BOOL:
       unsigned_flag= FALSE;
-      max_length= 1;
+      collation.set_numeric();
+      fix_char_length(1);
       decimals=0;
       break;
     case SHOW_DOUBLE:
       unsigned_flag= FALSE;
       decimals= 6;
-      max_length= DBL_DIG + 6;
+      collation.set_numeric();
+      fix_char_length(DBL_DIG + 6);
       break;
     default:
       my_error(ER_VAR_CANT_BE_READ, MYF(0), var->name);
@@ -5455,8 +5475,8 @@ longlong Item_func_inet_aton::val_int()
   char buff[36];
   int dot_count= 0;
 
-  String *s,tmp(buff,sizeof(buff),&my_charset_bin);
-  if (!(s = args[0]->val_str(&tmp)))		// If null value
+  String *s, tmp(buff, sizeof(buff), &my_charset_latin1);
+  if (!(s = args[0]->val_str_ascii(&tmp)))       // If null value
     goto err;
   null_value=0;
 
@@ -5464,7 +5484,7 @@ longlong Item_func_inet_aton::val_int()
   while (p < end)
   {
     c = *p++;
-    int digit = (int) (c - '0');		// Assume ascii
+    int digit = (int) (c - '0');
     if (digit >= 0 && digit <= 9)
     {
       if ((byte_result = byte_result * 10 + digit) > 255)
@@ -5615,8 +5635,8 @@ bool Item_func_match::fix_fields(THD *th
     return 1;
   }
   table->fulltext_searched=1;
-  return agg_arg_collations_for_comparison(cmp_collation,
-                                           args+1, arg_count-1, 0);
+  return agg_item_collations_for_comparison(cmp_collation, func_name(),
+                                            args+1, arg_count-1, 0);
 }
 
 bool Item_func_match::fix_index()

=== modified file 'sql/item_func.h'
--- a/sql/item_func.h	2009-07-15 11:11:12 +0000
+++ b/sql/item_func.h	2009-08-20 10:18:05 +0000
@@ -169,23 +169,25 @@ public:
 
   my_decimal *val_decimal(my_decimal *);
 
-  bool agg_arg_collations(DTCollation &c, Item **items, uint nitems,
-                          uint flags)
-  {
-    return agg_item_collations(c, func_name(), items, nitems, flags, 1);
-  }
-  bool agg_arg_collations_for_comparison(DTCollation &c,
-                                         Item **items, uint nitems,
-                                         uint flags)
-  {
-    return agg_item_collations_for_comparison(c, func_name(),
-                                              items, nitems, flags);
-  }
   bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems,
                         uint flags, int item_sep)
   {
     return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep);
   }
+  bool agg_arg_charsets_for_string_result(DTCollation &c,
+                                          Item **items, uint nitems,
+                                          int item_sep= 1)
+  {
+    return agg_item_charsets_for_string_result(c, func_name(),
+                                               items, nitems, item_sep);
+  }
+  bool agg_arg_charsets_for_comparison(DTCollation &c,
+                                       Item **items, uint nitems,
+                                       int item_sep= 1)
+  {
+    return agg_item_charsets_for_comparison(c, func_name(),
+                                            items, nitems, item_sep);
+  }
   bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
   Item *transform(Item_transformer transformer, uchar *arg);
   Item* compile(Item_analyzer analyzer, uchar **arg_p,
@@ -205,10 +207,10 @@ public:
 class Item_real_func :public Item_func
 {
 public:
-  Item_real_func() :Item_func() {}
-  Item_real_func(Item *a) :Item_func(a) {}
-  Item_real_func(Item *a,Item *b) :Item_func(a,b) {}
-  Item_real_func(List<Item> &list) :Item_func(list) {}
+  Item_real_func() :Item_func() { collation.set_numeric(); }
+  Item_real_func(Item *a) :Item_func(a) { collation.set_numeric(); }
+  Item_real_func(Item *a,Item *b) :Item_func(a,b) { collation.set_numeric(); }
+  Item_real_func(List<Item> &list) :Item_func(list) { collation.set_numeric(); }
   String *val_str(String*str);
   my_decimal *val_decimal(my_decimal *decimal_value);
   longlong val_int()
@@ -225,13 +227,13 @@ protected:
   Item_result hybrid_type;
 public:
   Item_func_numhybrid(Item *a) :Item_func(a), hybrid_type(REAL_RESULT)
-  {}
+  { collation.set_numeric(); }
   Item_func_numhybrid(Item *a,Item *b)
     :Item_func(a,b), hybrid_type(REAL_RESULT)
-  {}
+  { collation.set_numeric(); }
   Item_func_numhybrid(List<Item> &list)
     :Item_func(list), hybrid_type(REAL_RESULT)
-  {}
+  { collation.set_numeric(); }
 
   enum Item_result result_type () const { return hybrid_type; }
   void fix_length_and_dec();
@@ -314,13 +316,18 @@ class Item_num_op :public Item_func_numh
 class Item_int_func :public Item_func
 {
 public:
-  Item_int_func() :Item_func() { max_length= 21; }
-  Item_int_func(Item *a) :Item_func(a) { max_length= 21; }
-  Item_int_func(Item *a,Item *b) :Item_func(a,b) { max_length= 21; }
+  Item_int_func() :Item_func()
+  { collation.set_numeric(); fix_char_length(21); }
+  Item_int_func(Item *a) :Item_func(a)
+  { collation.set_numeric(); fix_char_length(21); }
+  Item_int_func(Item *a,Item *b) :Item_func(a,b)
+  { collation.set_numeric(); fix_char_length(21); }
   Item_int_func(Item *a,Item *b,Item *c) :Item_func(a,b,c)
-  { max_length= 21; }
-  Item_int_func(List<Item> &list) :Item_func(list) { max_length= 21; }
-  Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item) {}
+  { collation.set_numeric(); fix_char_length(21); }
+  Item_int_func(List<Item> &list) :Item_func(list)
+  { collation.set_numeric(); fix_char_length(21); }
+  Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item)
+  { collation.set_numeric(); }
   double val_real();
   String *val_str(String*str);
   enum Item_result result_type () const { return INT_RESULT; }
@@ -349,7 +356,10 @@ public:
   longlong val_int();
   longlong val_int_from_str(int *error);
   void fix_length_and_dec()
-  { max_length=args[0]->max_length; unsigned_flag=0; }
+  {
+    fix_length_and_charset(args[0]->max_char_length(), default_charset());
+    unsigned_flag=0;
+  }
   virtual void print(String *str, enum_query_type query_type);
   uint decimal_precision() const { return args[0]->decimal_precision(); }
 };
@@ -362,7 +372,9 @@ public:
   const char *func_name() const { return "cast_as_unsigned"; }
   void fix_length_and_dec()
   {
-    max_length= min(args[0]->max_length, DECIMAL_MAX_PRECISION + 2);
+    fix_length_and_charset(min(args[0]->max_char_length(),
+                               DECIMAL_MAX_PRECISION + 2),
+                           default_charset());
     unsigned_flag=1;
   }
   longlong val_int();
@@ -379,6 +391,7 @@ public:
     decimals= dec;
     max_length= my_decimal_precision_to_length_no_truncation(len, dec,
                                                              unsigned_flag);
+    collation.set_numeric();
   }
   String *val_str(String *str);
   double val_real();
@@ -1489,7 +1502,12 @@ public:
   longlong val_int();
   const char *func_name() const { return "inet_aton"; }
   void fix_length_and_dec()
-    { decimals= 0; max_length= 21; maybe_null= 1; unsigned_flag= 1;}
+  {
+    decimals= 0;
+    fix_length_and_charset(21, default_charset());
+    maybe_null= 1;
+    unsigned_flag= 1;
+  }
 };
 
 

=== modified file 'sql/item_geofunc.cc'
--- a/sql/item_geofunc.cc	2009-07-28 14:16:37 +0000
+++ b/sql/item_geofunc.cc	2009-08-20 10:18:05 +0000
@@ -52,7 +52,7 @@ String *Item_func_geometry_from_text::va
   DBUG_ASSERT(fixed == 1);
   Geometry_buffer buffer;
   String arg_val;
-  String *wkt= args[0]->val_str(&arg_val);
+  String *wkt= args[0]->val_str_ascii(&arg_val);
 
   if ((null_value= args[0]->null_value))
     return 0;
@@ -105,7 +105,7 @@ String *Item_func_geometry_from_wkb::val
 }
 
 
-String *Item_func_as_wkt::val_str(String *str)
+String *Item_func_as_wkt::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   String arg_val;
@@ -129,6 +129,7 @@ String *Item_func_as_wkt::val_str(String
 
 void Item_func_as_wkt::fix_length_and_dec()
 {
+  collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
   max_length=MAX_BLOB_WIDTH;
   maybe_null= 1;
 }
@@ -152,7 +153,7 @@ String *Item_func_as_wkb::val_str(String
 }
 
 
-String *Item_func_geometry_type::val_str(String *str)
+String *Item_func_geometry_type::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   String *swkb= args[0]->val_str(str);

=== modified file 'sql/item_geofunc.h'
--- a/sql/item_geofunc.h	2008-02-22 10:30:33 +0000
+++ b/sql/item_geofunc.h	2009-08-20 10:18:05 +0000
@@ -54,12 +54,12 @@ public:
   String *val_str(String *);
 };
 
-class Item_func_as_wkt: public Item_str_func
+class Item_func_as_wkt: public Item_str_ascii_func
 {
 public:
-  Item_func_as_wkt(Item *a): Item_str_func(a) {}
+  Item_func_as_wkt(Item *a): Item_str_ascii_func(a) {}
   const char *func_name() const { return "astext"; }
-  String *val_str(String *);
+  String *val_str_ascii(String *);
   void fix_length_and_dec();
 };
 
@@ -72,16 +72,17 @@ public:
   enum_field_types field_type() const  { return MYSQL_TYPE_BLOB; }
 };
 
-class Item_func_geometry_type: public Item_str_func
+class Item_func_geometry_type: public Item_str_ascii_func
 {
 public:
-  Item_func_geometry_type(Item *a): Item_str_func(a) {}
-  String *val_str(String *);
+  Item_func_geometry_type(Item *a): Item_str_ascii_func(a) {}
+  String *val_str_ascii(String *);
   const char *func_name() const { return "geometrytype"; }
   void fix_length_and_dec() 
   {
-     max_length=20; // "GeometryCollection" is the most long
-     maybe_null= 1;
+    // "GeometryCollection" is the longest
+    fix_length_and_charset(20, default_charset());
+    maybe_null= 1;
   };
 };
 

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2009-07-06 08:38:21 +0000
+++ b/sql/item_strfunc.cc	2009-08-20 10:18:05 +0000
@@ -86,6 +86,27 @@ double Item_str_func::val_real()
 }
 
 
+String *Item_str_ascii_func::val_str(String *str)
+{
+  DBUG_ASSERT(fixed == 1);
+
+  if (!(collation.collation->state & MY_CS_NONASCII))
+    return val_str_ascii(str);
+  
+  uint errors;
+  String *res= val_str_ascii(&ascii_buf);
+  if (!res)
+    return 0;
+  
+  if ((null_value= str->copy(res->ptr(), res->length(),
+                             &my_charset_latin1, collation.collation,
+                             &errors)))
+    return 0;
+  
+  return str;
+}
+
+
 longlong Item_str_func::val_int()
 {
   DBUG_ASSERT(fixed == 1);
@@ -100,7 +121,7 @@ longlong Item_str_func::val_int()
 }
 
 
-String *Item_func_md5::val_str(String *str)
+String *Item_func_md5::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   String * sptr= args[0]->val_str(str);
@@ -132,7 +153,6 @@ String *Item_func_md5::val_str(String *s
 
 void Item_func_md5::fix_length_and_dec()
 {
-  max_length=32;
   /*
     The MD5() function treats its parameter as being a case sensitive. Thus
     we set binary collation on it so different instances of MD5() will be
@@ -141,10 +161,11 @@ void Item_func_md5::fix_length_and_dec()
   args[0]->collation.set(
       get_charset_by_csname(args[0]->collation.collation->csname,
                             MY_CS_BINSORT,MYF(0)), DERIVATION_COERCIBLE);
+  fix_length_and_charset(32, default_charset());
 }
 
 
-String *Item_func_sha::val_str(String *str)
+String *Item_func_sha::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   String * sptr= args[0]->val_str(str);
@@ -182,7 +203,6 @@ String *Item_func_sha::val_str(String *s
 
 void Item_func_sha::fix_length_and_dec()
 {
-  max_length=SHA1_HASH_SIZE*2; // size of hex representation of hash
   /*
     The SHA() function treats its parameter as being a case sensitive. Thus
     we set binary collation on it so different instances of MD5() will be
@@ -191,9 +211,11 @@ void Item_func_sha::fix_length_and_dec()
   args[0]->collation.set(
       get_charset_by_csname(args[0]->collation.collation->csname,
                             MY_CS_BINSORT,MYF(0)), DERIVATION_COERCIBLE);
+  // size of hex representation of hash
+  fix_length_and_charset(SHA1_HASH_SIZE * 2, default_charset());
 }
 
-String *Item_func_sha2::val_str(String *str)
+String *Item_func_sha2::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
 #ifdef HAVE_OPENSSL
@@ -289,24 +311,24 @@ void Item_func_sha2::fix_length_and_dec(
   max_length = 0;
 
   int sha_variant= args[1]->const_item() ? args[1]->val_int() : 512;
-
+  collation.set(default_charset());
 #if defined(HAVE_OPENSSL)
   switch (sha_variant) {
 #ifndef OPENSSL_NO_SHA512
   case 512:
-    max_length= SHA512_DIGEST_LENGTH*2;
+    fix_char_length(SHA512_DIGEST_LENGTH * 2);
     break;
   case 384:
-    max_length= SHA384_DIGEST_LENGTH*2;
+    fix_char_length(SHA384_DIGEST_LENGTH * 2);
     break;
 #endif
 #ifndef OPENSSL_NO_SHA256
   case 256:
   case 0: // SHA-256 is the default
-    max_length= SHA256_DIGEST_LENGTH*2;
+    fix_char_length(SHA256_DIGEST_LENGTH * 2);
     break;
   case 224:
-    max_length= SHA224_DIGEST_LENGTH*2;
+    fix_char_length(SHA224_DIGEST_LENGTH * 2);
     break;
 #endif
   default:
@@ -558,7 +580,7 @@ void Item_func_concat::fix_length_and_de
 {
   ulonglong max_result_length= 0;
 
-  if (agg_arg_charsets(collation, args, arg_count, MY_COLL_ALLOW_CONV, 1))
+  if (agg_arg_charsets_for_string_result(collation, args, arg_count))
     return;
 
   for (uint i=0 ; i < arg_count ; i++)
@@ -910,7 +932,7 @@ void Item_func_concat_ws::fix_length_and
 {
   ulonglong max_result_length;
 
-  if (agg_arg_charsets(collation, args, arg_count, MY_COLL_ALLOW_CONV, 1))
+  if (agg_arg_charsets_for_string_result(collation, args, arg_count))
     return;
 
   /*
@@ -981,8 +1003,8 @@ String *Item_func_reverse::val_str(Strin
 
 void Item_func_reverse::fix_length_and_dec()
 {
-  collation.set(args[0]->collation);
-  max_length = args[0]->max_length;
+  agg_arg_charsets_for_string_result(collation, args, 1);
+  fix_char_length(args[0]->max_char_length());
 }
 
 /**
@@ -1125,7 +1147,7 @@ void Item_func_replace::fix_length_and_d
   }
   max_length= (ulong) max_result_length;
   
-  if (agg_arg_charsets(collation, args, 3, MY_COLL_CMP_CONV, 1))
+  if (agg_arg_charsets_for_comparison(collation, args, 3))
     return;
 }
 
@@ -1184,7 +1206,7 @@ void Item_func_insert::fix_length_and_de
   ulonglong max_result_length;
 
   // Handle character set for args[0] and args[3].
-  if (agg_arg_charsets(collation, &args[0], 2, MY_COLL_ALLOW_CONV, 3))
+  if (agg_arg_charsets_for_string_result(collation, args, 2, 3))
     return;
   max_result_length= ((ulonglong) args[0]->max_length+
                       (ulonglong) args[3]->max_length);
@@ -1232,7 +1254,7 @@ String *Item_str_conv::val_str(String *s
 
 void Item_func_lcase::fix_length_and_dec()
 {
-  collation.set(args[0]->collation);
+  agg_arg_charsets_for_string_result(collation, args, 1);
   multiply= collation.collation->casedn_multiply;
   converter= collation.collation->cset->casedn;
   max_length= args[0]->max_length * multiply;
@@ -1240,7 +1262,7 @@ void Item_func_lcase::fix_length_and_dec
 
 void Item_func_ucase::fix_length_and_dec()
 {
-  collation.set(args[0]->collation);
+  agg_arg_charsets_for_string_result(collation, args, 1);
   multiply= collation.collation->caseup_multiply;
   converter= collation.collation->cset->caseup;
   max_length= args[0]->max_length * multiply;
@@ -1288,7 +1310,7 @@ void Item_str_func::left_right_max_lengt
 
 void Item_func_left::fix_length_and_dec()
 {
-  collation.set(args[0]->collation);
+  agg_arg_charsets_for_string_result(collation, args, 1);
   left_right_max_length();
 }
 
@@ -1321,7 +1343,7 @@ String *Item_func_right::val_str(String 
 
 void Item_func_right::fix_length_and_dec()
 {
-  collation.set(args[0]->collation);
+  agg_arg_charsets_for_string_result(collation, args, 1);
   left_right_max_length();
 }
 
@@ -1377,7 +1399,7 @@ void Item_func_substr::fix_length_and_de
 {
   max_length=args[0]->max_length;
 
-  collation.set(args[0]->collation);
+  agg_arg_charsets_for_string_result(collation, args, 1);
   if (args[1]->const_item())
   {
     int32 start= (int32) args[1]->val_int();
@@ -1402,7 +1424,7 @@ void Item_func_substr_index::fix_length_
 { 
   max_length= args[0]->max_length;
 
-  if (agg_arg_charsets(collation, args, 2, MY_COLL_CMP_CONV, 1))
+  if (agg_arg_charsets_for_comparison(collation, args, 2))
     return;
 }
 
@@ -1732,7 +1754,7 @@ void Item_func_trim::fix_length_and_dec(
   max_length= args[0]->max_length;
   if (arg_count == 1)
   {
-    collation.set(args[0]->collation);
+    agg_arg_charsets_for_string_result(collation, args, 1);
     remove.set_charset(collation.collation);
     remove.set_ascii(" ",1);
   }
@@ -1740,7 +1762,7 @@ void Item_func_trim::fix_length_and_dec(
   {
     // Handle character set for args[1] and args[0].
     // Note that we pass args[1] as the first item, and args[0] as the second.
-    if (agg_arg_charsets(collation, &args[1], 2, MY_COLL_CMP_CONV, -1))
+    if (agg_arg_charsets_for_comparison(collation, &args[1], 2, -1))
       return;
   }
 }
@@ -1765,7 +1787,7 @@ void Item_func_trim::print(String *str, 
 
 /* Item_func_password */
 
-String *Item_func_password::val_str(String *str)
+String *Item_func_password::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   String *res= args[0]->val_str(str); 
@@ -1774,7 +1796,7 @@ String *Item_func_password::val_str(Stri
   if (res->length() == 0)
     return &my_empty_string;
   my_make_scrambled_password(tmp_value, res->ptr(), res->length());
-  str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, res->charset());
+  str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, &my_charset_latin1);
   return str;
 }
 
@@ -1789,7 +1811,7 @@ char *Item_func_password::alloc(THD *thd
 
 /* Item_func_old_password */
 
-String *Item_func_old_password::val_str(String *str)
+String *Item_func_old_password::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   String *res= args[0]->val_str(str);
@@ -1798,7 +1820,7 @@ String *Item_func_old_password::val_str(
   if (res->length() == 0)
     return &my_empty_string;
   my_make_scrambled_password_323(tmp_value, res->ptr(), res->length());
-  str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH_323, res->charset());
+  str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH_323, &my_charset_latin1);
   return str;
 }
 
@@ -2020,7 +2042,7 @@ bool Item_func_current_user::fix_fields(
 
 void Item_func_soundex::fix_length_and_dec()
 {
-  collation.set(args[0]->collation);
+  agg_arg_charsets_for_string_result(collation, args, 1);
   max_length=args[0]->max_length;
   set_if_bigger(max_length, 4 * collation.collation->mbminlen);
   tmp_value.set_charset(collation.collation);
@@ -2326,7 +2348,7 @@ void Item_func_elt::fix_length_and_dec()
   max_length=0;
   decimals=0;
 
-  if (agg_arg_charsets(collation, args+1, arg_count-1, MY_COLL_ALLOW_CONV, 1))
+  if (agg_arg_charsets_for_string_result(collation, args + 1, arg_count - 1))
     return;
 
   for (uint i= 1 ; i < arg_count ; i++)
@@ -2393,7 +2415,7 @@ void Item_func_make_set::fix_length_and_
 {
   max_length=arg_count-1;
 
-  if (agg_arg_charsets(collation, args, arg_count, MY_COLL_ALLOW_CONV, 1))
+  if (agg_arg_charsets_for_string_result(collation, args, arg_count))
     return;
   
   for (uint i=0 ; i < arg_count ; i++)
@@ -2563,7 +2585,7 @@ inline String* alloc_buffer(String *res,
 
 void Item_func_repeat::fix_length_and_dec()
 {
-  collation.set(args[0]->collation);
+  agg_arg_charsets_for_string_result(collation, args, 1);
   if (args[1]->const_item())
   {
     /* must be longlong to avoid truncation */
@@ -2647,7 +2669,7 @@ err:
 void Item_func_rpad::fix_length_and_dec()
 {
   // Handle character set for args[0] and args[2].
-  if (agg_arg_charsets(collation, &args[0], 2, MY_COLL_ALLOW_CONV, 2))
+  if (agg_arg_charsets_for_string_result(collation, &args[0], 2, 2))
     return;
   if (args[1]->const_item())
   {
@@ -2749,7 +2771,7 @@ String *Item_func_rpad::val_str(String *
 void Item_func_lpad::fix_length_and_dec()
 {
   // Handle character set for args[0] and args[2].
-  if (agg_arg_charsets(collation, &args[0], 2, MY_COLL_ALLOW_CONV, 2))
+  if (agg_arg_charsets_for_string_result(collation, &args[0], 2, 2))
     return;
   
   if (args[1]->const_item())
@@ -2919,7 +2941,7 @@ String *Item_func_conv_charset::val_str(
 void Item_func_conv_charset::fix_length_and_dec()
 {
   collation.set(conv_charset, DERIVATION_IMPLICIT);
-  max_length = args[0]->max_length*conv_charset->mbmaxlen;
+  fix_char_length(args[0]->max_char_length());
 }
 
 void Item_func_conv_charset::print(String *str, enum_query_type query_type)
@@ -3312,11 +3334,11 @@ void Item_func_export_set::fix_length_an
 {
   uint length=max(args[1]->max_length,args[2]->max_length);
   uint sep_length=(arg_count > 3 ? args[3]->max_length : 1);
-  max_length=length*64+sep_length*63;
 
-  if (agg_arg_charsets(collation, args+1, min(4,arg_count)-1,
-                       MY_COLL_ALLOW_CONV, 1))
+  if (agg_arg_charsets_for_string_result(collation,
+                                         args + 1, min(4, arg_count) - 1))
     return;
+  fix_char_length(length * 64 + sep_length * 63);
 }
 
 String* Item_func_inet_ntoa::val_str(String* str)
@@ -3335,6 +3357,7 @@ String* Item_func_inet_ntoa::val_str(Str
   if ((null_value= (args[0]->null_value || n > 4294967295ULL)))
     return 0;					// Null value
 
+  str->set_charset(collation.collation);
   str->length(0);
   int4store(buf,n);
 
@@ -3352,11 +3375,11 @@ String* Item_func_inet_ntoa::val_str(Str
     num[0]=(char) n1+'0';
     num[1]=(char) n2+'0';
     num[2]=(char) c+'0';
-    uint length=(n1 ? 4 : n2 ? 3 : 2);		// Remove pre-zero
-
-    (void) str->append(num+4-length,length);
+    uint length=(n1 ? 4 : n2 ? 3 : 2);          // Remove pre-zero
+    uint dot_length= (p <= buf) ? 1 : 0;
+    (void) str->append(num + 4 - length, length - dot_length,
+                       &my_charset_latin1);
   }
-  str->length(str->length()-1);			// Remove last '.';
   return str;
 }
 

=== modified file 'sql/item_strfunc.h'
--- a/sql/item_strfunc.h	2009-06-24 08:14:35 +0000
+++ b/sql/item_strfunc.h	2009-08-20 10:18:05 +0000
@@ -38,40 +38,48 @@ public:
   bool fix_fields(THD *thd, Item **ref);
 };
 
-class Item_func_md5 :public Item_str_func
+
+/*
+  Functions that return values with ASCII repertoire
+*/
+class Item_str_ascii_func :public Item_str_func
 {
-  String tmp_value;
+  String ascii_buf;
 public:
-  Item_func_md5(Item *a) :Item_str_func(a)
-  {
-    collation.set(&my_charset_bin);
-  }
+  Item_str_ascii_func() :Item_str_func() {}
+  Item_str_ascii_func(Item *a) :Item_str_func(a) {}
+  Item_str_ascii_func(Item *a,Item *b) :Item_str_func(a,b) {}
+  Item_str_ascii_func(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
   String *val_str(String *);
+  virtual String *val_str_ascii(String *)= 0;
+};
+
+
+class Item_func_md5 :public Item_str_ascii_func
+{
+  String tmp_value;
+public:
+  Item_func_md5(Item *a) :Item_str_ascii_func(a) {}
+  String *val_str_ascii(String *);
   void fix_length_and_dec();
   const char *func_name() const { return "md5"; }
 };
 
 
-class Item_func_sha :public Item_str_func
+class Item_func_sha :public Item_str_ascii_func
 {
 public:
-  Item_func_sha(Item *a) :Item_str_func(a)
-  {
-    collation.set(&my_charset_bin);
-  }
-  String *val_str(String *);    
+  Item_func_sha(Item *a) :Item_str_ascii_func(a) {}
+  String *val_str_ascii(String *);    
   void fix_length_and_dec();      
   const char *func_name() const { return "sha"; }	
 };
 
-class Item_func_sha2 :public Item_str_func
+class Item_func_sha2 :public Item_str_ascii_func
 {
 public:
-  Item_func_sha2(Item *a, Item *b) :Item_str_func(a, b)
-  {
-    collation.set(&my_charset_bin);
-  }
-  String *val_str(String *);    
+  Item_func_sha2(Item *a, Item *b) :Item_str_ascii_func(a, b) {}
+  String *val_str_ascii(String *);    
   void fix_length_and_dec();      
   const char *func_name() const { return "sha2"; }	
 };
@@ -272,13 +280,16 @@ public:
   authentication procedure works, see comments in password.c.
 */
 
-class Item_func_password :public Item_str_func
+class Item_func_password :public Item_str_ascii_func
 {
   char tmp_value[SCRAMBLED_PASSWORD_CHAR_LENGTH+1]; 
 public:
-  Item_func_password(Item *a) :Item_str_func(a) {}
-  String *val_str(String *str);
-  void fix_length_and_dec() { max_length= SCRAMBLED_PASSWORD_CHAR_LENGTH; }
+  Item_func_password(Item *a) :Item_str_ascii_func(a) {}
+  String *val_str_ascii(String *str);
+  void fix_length_and_dec()
+  {
+    fix_length_and_charset(SCRAMBLED_PASSWORD_CHAR_LENGTH, default_charset());
+  }
   const char *func_name() const { return "password"; }
   static char *alloc(THD *thd, const char *password, size_t pass_len);
 };
@@ -291,13 +302,16 @@ public:
   function.
 */
 
-class Item_func_old_password :public Item_str_func
+class Item_func_old_password :public Item_str_ascii_func
 {
   char tmp_value[SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1];
 public:
-  Item_func_old_password(Item *a) :Item_str_func(a) {}
-  String *val_str(String *str);
-  void fix_length_and_dec() { max_length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323; } 
+  Item_func_old_password(Item *a) :Item_str_ascii_func(a) {}
+  String *val_str_ascii(String *str);
+  void fix_length_and_dec()
+  {
+    fix_length_and_charset(SCRAMBLED_PASSWORD_CHAR_LENGTH_323, default_charset());
+  } 
   const char *func_name() const { return "old_password"; }
   static char *alloc(THD *thd, const char *password, size_t pass_len);
 };
@@ -686,7 +700,7 @@ public:
   void fix_length_and_dec() 
   { 
     decimals= 0; 
-    max_length= 3 * 8 + 7; 
+    fix_length_and_charset(3 * 8 + 7, default_charset()); 
     maybe_null= 1;
   }
 };
@@ -868,14 +882,11 @@ class Item_func_uuid: public Item_str_fu
 {
 public:
   Item_func_uuid(): Item_str_func() {}
-  void fix_length_and_dec() {
-    collation.set(system_charset_info);
-    /*
-       NOTE! uuid() should be changed to use 'ascii'
-       charset when hex(), format(), md5(), etc, and implicit
-       number-to-string conversion will use 'ascii'
-    */
-    max_length= MY_UUID_STRING_LENGTH * system_charset_info->mbmaxlen;
+  void fix_length_and_dec()
+  {
+    collation.set(system_charset_info,
+                  DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
+    fix_char_length(MY_UUID_STRING_LENGTH);
   }
   const char *func_name() const{ return "uuid"; }
   String *val_str(String *);

=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc	2009-07-10 14:13:29 +0000
+++ b/sql/item_sum.cc	2009-08-20 10:18:05 +0000
@@ -3344,11 +3344,9 @@ Item_func_group_concat::fix_fields(THD *
       return TRUE;
   }
 
-  if (agg_item_charsets(collation, func_name(),
-                        args,
-			/* skip charset aggregation for order columns */
-			arg_count - arg_count_order,
-			MY_COLL_ALLOW_CONV, 1))
+  /* skip charset aggregation for order columns */
+  if (agg_item_charsets_for_string_result(collation, func_name(),
+                                          args, arg_count - arg_count_order))
     return 1;
 
   result.set_charset(collation.collation);

=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc	2009-07-03 05:54:09 +0000
+++ b/sql/item_timefunc.cc	2009-08-20 10:18:05 +0000
@@ -57,7 +57,7 @@ static bool make_datetime(date_time_form
 			  String *str)
 {
   char *buff;
-  CHARSET_INFO *cs= &my_charset_bin;
+  CHARSET_INFO *cs= &my_charset_numeric;
   uint length= MAX_DATE_STRING_REP_LENGTH;
 
   if (str->alloc(length))
@@ -1583,10 +1583,10 @@ bool Item_func_curdate::get_date(MYSQL_T
 }
 
 
-String *Item_func_curtime::val_str(String *str)
+String *Item_func_curtime::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
-  str_value.set(buff, buff_length, &my_charset_bin);
+  str_value.set(buff, buff_length, &my_charset_latin1);
   return &str_value;
 }
 
@@ -1596,11 +1596,10 @@ void Item_func_curtime::fix_length_and_d
   MYSQL_TIME ltime;
 
   decimals= DATETIME_DEC;
-  collation.set(&my_charset_bin);
   store_now_in_TIME(&ltime);
   value= TIME_to_ulonglong_time(&ltime);
   buff_length= (uint) my_time_to_str(&ltime, buff);
-  max_length= buff_length;
+  fix_length_and_charset(buff_length, default_charset());
 }
 
 
@@ -1632,10 +1631,10 @@ void Item_func_curtime_utc::store_now_in
 }
 
 
-String *Item_func_now::val_str(String *str)
+String *Item_func_now::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
-  str_value.set(buff,buff_length, &my_charset_bin);
+  str_value.set(buff, buff_length, &my_charset_numeric);
   return &str_value;
 }
 
@@ -1643,13 +1642,12 @@ String *Item_func_now::val_str(String *s
 void Item_func_now::fix_length_and_dec()
 {
   decimals= DATETIME_DEC;
-  collation.set(&my_charset_bin);
 
   store_now_in_TIME(&ltime);
   value= (longlong) TIME_to_ulonglong_datetime(&ltime);
 
   buff_length= (uint) my_datetime_to_str(&ltime, buff);
-  max_length= buff_length;
+  fix_length_and_charset(buff_length, default_charset());
 }
 
 
@@ -1708,12 +1706,12 @@ void Item_func_sysdate_local::store_now_
 }
 
 
-String *Item_func_sysdate_local::val_str(String *str)
+String *Item_func_sysdate_local::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   store_now_in_TIME(&ltime);
   buff_length= (uint) my_datetime_to_str(&ltime, buff);
-  str_value.set(buff, buff_length, &my_charset_bin);
+  str_value.set(buff, buff_length, &my_charset_numeric);
   return &str_value;
 }
 
@@ -1737,8 +1735,7 @@ double Item_func_sysdate_local::val_real
 void Item_func_sysdate_local::fix_length_and_dec()
 {
   decimals= 0;
-  collation.set(&my_charset_bin);
-  max_length= MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
+  fix_length_and_charset(MAX_DATETIME_WIDTH, default_charset());
 }
 
 
@@ -1760,7 +1757,7 @@ int Item_func_sysdate_local::save_in_fie
 }
 
 
-String *Item_func_sec_to_time::val_str(String *str)
+String *Item_func_sec_to_time::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   MYSQL_TIME ltime;
@@ -1942,7 +1939,8 @@ String *Item_func_date_format::val_str(S
   {
     String *res;
     if (!(res=args[0]->val_str(str)) ||
-	(str_to_time_with_warn(res->ptr(), res->length(), &l_time)))
+	(str_to_time_with_warn(res->charset(), res->ptr(), res->length(),
+	                       &l_time)))
       goto null_date;
 
     l_time.year=l_time.month=l_time.day=0;
@@ -1986,15 +1984,14 @@ null_date:
 void Item_func_from_unixtime::fix_length_and_dec()
 { 
   thd= current_thd;
-  collation.set(&my_charset_bin);
   decimals= DATETIME_DEC;
-  max_length=MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
+  fix_length_and_charset(MAX_DATETIME_WIDTH, default_charset());
   maybe_null= 1;
   thd->time_zone_used= 1;
 }
 
 
-String *Item_func_from_unixtime::val_str(String *str)
+String *Item_func_from_unixtime::val_str_ascii(String *str)
 {
   MYSQL_TIME time_tmp;
 
@@ -2046,14 +2043,13 @@ bool Item_func_from_unixtime::get_date(M
 
 void Item_func_convert_tz::fix_length_and_dec()
 {
-  collation.set(&my_charset_bin);
   decimals= 0;
-  max_length= MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
+  fix_length_and_charset(MAX_DATETIME_WIDTH, default_charset());
   maybe_null= 1;
 }
 
 
-String *Item_func_convert_tz::val_str(String *str)
+String *Item_func_convert_tz::val_str_ascii(String *str)
 {
   MYSQL_TIME time_tmp;
 
@@ -2092,13 +2088,13 @@ bool Item_func_convert_tz::get_date(MYSQ
 
   if (!from_tz_cached)
   {
-    from_tz= my_tz_find(thd, args[1]->val_str(&str));
+    from_tz= my_tz_find(thd, args[1]->val_str_ascii(&str));
     from_tz_cached= args[1]->const_item();
   }
 
   if (!to_tz_cached)
   {
-    to_tz= my_tz_find(thd, args[2]->val_str(&str));
+    to_tz= my_tz_find(thd, args[2]->val_str_ascii(&str));
     to_tz_cached= args[2]->const_item();
   }
 
@@ -2132,9 +2128,8 @@ void Item_date_add_interval::fix_length_
 {
   enum_field_types arg0_field_type;
 
-  collation.set(&my_charset_bin);
   maybe_null=1;
-  max_length=MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
+  fix_length_and_charset(MAX_DATETIME_FULL_WIDTH, default_charset());
   value.alloc(max_length);
 
   /*
@@ -2182,7 +2177,7 @@ bool Item_date_add_interval::get_date(MY
 }
 
 
-String *Item_date_add_interval::val_str(String *str)
+String *Item_date_add_interval::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   MYSQL_TIME ltime;
@@ -2312,7 +2307,9 @@ longlong Item_extract::val_int()
   else
   {
     String *res= args[0]->val_str(&value);
-    if (!res || str_to_time_with_warn(res->ptr(), res->length(), &ltime))
+    if (!res ||
+        str_to_time_with_warn(res->charset(), res->ptr(), res->length(),
+                              &ltime))
     {
       null_value=1;
       return 0;
@@ -2674,7 +2671,7 @@ longlong Item_date_typecast::val_int()
     for dates between 0000-01-01 and 0099-12-31
 */
 
-String *Item_func_makedate::val_str(String *str)
+String *Item_func_makedate::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   MYSQL_TIME l_time;
@@ -2751,7 +2748,7 @@ void Item_func_add_time::fix_length_and_
 {
   enum_field_types arg0_field_type;
   decimals=0;
-  max_length=MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
+  fix_length_and_charset(MAX_DATETIME_FULL_WIDTH, default_charset());
   maybe_null= 1;
 
   /*
@@ -2784,7 +2781,7 @@ void Item_func_add_time::fix_length_and_
   Result: Time value or datetime value
 */
 
-String *Item_func_add_time::val_str(String *str)
+String *Item_func_add_time::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   MYSQL_TIME l_time1, l_time2, l_time3;
@@ -2884,7 +2881,7 @@ void Item_func_add_time::print(String *s
   Result: Time value
 */
 
-String *Item_func_timediff::val_str(String *str)
+String *Item_func_timediff::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   longlong seconds;
@@ -2932,7 +2929,7 @@ null_date:
   Result: Time value
 */
 
-String *Item_func_maketime::val_str(String *str)
+String *Item_func_maketime::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   MYSQL_TIME ltime;
@@ -3162,12 +3159,12 @@ void Item_func_timestamp_diff::print(Str
 }
 
 
-String *Item_func_get_format::val_str(String *str)
+String *Item_func_get_format::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   const char *format_name;
   KNOWN_DATE_TIME_FORMAT *format;
-  String *val= args[0]->val_str(str);
+  String *val= args[0]->val_str_ascii(str);
   ulong val_len;
 
   if ((null_value= args[0]->null_value))
@@ -3186,7 +3183,7 @@ String *Item_func_get_format::val_str(St
 		      (const uchar *) format_name, val_len))
     {
       const char *format_str= get_date_time_format_str(format, type);
-      str->set(format_str, strlen(format_str), &my_charset_bin);
+      str->set(format_str, strlen(format_str), &my_charset_latin1);
       return str;
     }
   }

=== modified file 'sql/item_timefunc.h'
--- a/sql/item_timefunc.h	2009-05-18 05:14:37 +0000
+++ b/sql/item_timefunc.h	2009-08-20 10:18:05 +0000
@@ -92,20 +92,19 @@ public:
 class Item_func_month :public Item_func
 {
 public:
-  Item_func_month(Item *a) :Item_func(a) {}
+  Item_func_month(Item *a) :Item_func(a) { collation.set_numeric(); }
   longlong val_int();
   double val_real()
   { DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
   String *val_str(String *str) 
   {
-    str->set(val_int(), &my_charset_bin);
+    str->set(val_int(), collation.collation);
     return null_value ? 0 : str;
   }
   const char *func_name() const { return "month"; }
   enum Item_result result_type () const { return INT_RESULT; }
   void fix_length_and_dec() 
   { 
-    collation.set(&my_charset_bin);
     decimals=0;
     max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
     maybe_null=1; 
@@ -130,7 +129,7 @@ public:
 class Item_func_dayofyear :public Item_int_func
 {
 public:
-  Item_func_dayofyear(Item *a) :Item_int_func(a) {}
+  Item_func_dayofyear(Item *a) :Item_int_func(a) { collation.set_numeric(); }
   longlong val_int();
   const char *func_name() const { return "dayofyear"; }
   void fix_length_and_dec() 
@@ -260,7 +259,7 @@ class Item_func_weekday :public Item_fun
   bool odbc_type;
 public:
   Item_func_weekday(Item *a,bool type_arg)
-    :Item_func(a), odbc_type(type_arg) {}
+    :Item_func(a), odbc_type(type_arg) { collation.set_numeric(); }
   longlong val_int();
   double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
   String *val_str(String *str)
@@ -276,7 +275,6 @@ public:
   enum Item_result result_type () const { return INT_RESULT; }
   void fix_length_and_dec()
   {
-    collation.set(&my_charset_bin);
     decimals=0;
     max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
     maybe_null=1;
@@ -335,8 +333,8 @@ public:
 class Item_date :public Item_func
 {
 public:
-  Item_date() :Item_func() {}
-  Item_date(Item *a) :Item_func(a) {}
+  Item_date() :Item_func() { collation.set_numeric(); }
+  Item_date(Item *a) :Item_func(a) { collation.set_numeric(); }
   enum Item_result result_type () const { return STRING_RESULT; }
   enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
   String *val_str(String *str);
@@ -345,7 +343,6 @@ public:
   const char *func_name() const { return "date"; }
   void fix_length_and_dec()
   { 
-    collation.set(&my_charset_bin);
     decimals=0;
     max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
   }
@@ -366,13 +363,13 @@ public:
 };
 
 
-class Item_date_func :public Item_str_func
+class Item_date_func :public Item_str_ascii_func
 {
 public:
-  Item_date_func() :Item_str_func() {}
-  Item_date_func(Item *a) :Item_str_func(a) {}
-  Item_date_func(Item *a,Item *b) :Item_str_func(a,b) {}
-  Item_date_func(Item *a,Item *b, Item *c) :Item_str_func(a,b,c) {}
+  Item_date_func() :Item_str_ascii_func() {}
+  Item_date_func(Item *a) :Item_str_ascii_func(a) {}
+  Item_date_func(Item *a,Item *b) :Item_str_ascii_func(a,b) {}
+  Item_date_func(Item *a,Item *b, Item *c) :Item_str_ascii_func(a,b,c) {}
   enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
   Field *tmp_table_field(TABLE *table)
   {
@@ -392,18 +389,18 @@ public:
 };
 
 
-class Item_str_timefunc :public Item_str_func
+class Item_str_timefunc :public Item_str_ascii_func
 {
 public:
-  Item_str_timefunc() :Item_str_func() {}
-  Item_str_timefunc(Item *a) :Item_str_func(a) {}
-  Item_str_timefunc(Item *a,Item *b) :Item_str_func(a,b) {}
-  Item_str_timefunc(Item *a, Item *b, Item *c) :Item_str_func(a, b ,c) {}
+  Item_str_timefunc() :Item_str_ascii_func() {}
+  Item_str_timefunc(Item *a) :Item_str_ascii_func(a) {}
+  Item_str_timefunc(Item *a,Item *b) :Item_str_ascii_func(a,b) {}
+  Item_str_timefunc(Item *a, Item *b, Item *c) :Item_str_ascii_func(a, b ,c) {}
   enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
   void fix_length_and_dec()
   {
     decimals= DATETIME_DEC;
-    max_length=MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
+    fix_length_and_charset(MAX_TIME_WIDTH, default_charset());
   }
   Field *tmp_table_field(TABLE *table)
   {
@@ -436,7 +433,7 @@ public:
   Item_func_curtime(Item *a) :Item_str_timefunc(a) {}
   double val_real() { DBUG_ASSERT(fixed == 1); return (double) value; }
   longlong val_int() { DBUG_ASSERT(fixed == 1); return value; }
-  String *val_str(String *str);
+  String *val_str_ascii(String *str);
   void fix_length_and_dec();
   /* 
     Abstract method that defines which time zone is used for conversion.
@@ -517,7 +514,7 @@ public:
   enum Item_result result_type () const { return STRING_RESULT; }
   longlong val_int() { DBUG_ASSERT(fixed == 1); return value; }
   int save_in_field(Field *to, bool no_conversions);
-  String *val_str(String *str);
+  String *val_str_ascii(String *str);
   void fix_length_and_dec();
   bool get_date(MYSQL_TIME *res, uint fuzzy_date);
   virtual void store_now_in_TIME(MYSQL_TIME *now_time)=0;
@@ -560,7 +557,7 @@ public:
   double val_real();
   longlong val_int();
   int save_in_field(Field *to, bool no_conversions);
-  String *val_str(String *str);
+  String *val_str_ascii(String *str);
   void fix_length_and_dec();
   bool get_date(MYSQL_TIME *res, uint fuzzy_date);
   void update_used_tables()
@@ -604,7 +601,7 @@ class Item_func_from_unixtime :public It
  public:
   Item_func_from_unixtime(Item *a) :Item_date_func(a) {}
   longlong val_int();
-  String *val_str(String *str);
+  String *val_str_ascii(String *str);
   const char *func_name() const { return "from_unixtime"; }
   void fix_length_and_dec();
   bool get_date(MYSQL_TIME *res, uint fuzzy_date);
@@ -639,7 +636,7 @@ class Item_func_convert_tz :public Item_
   Item_func_convert_tz(Item *a, Item *b, Item *c):
     Item_date_func(a, b, c), from_tz_cached(0), to_tz_cached(0) {}
   longlong val_int();
-  String *val_str(String *str);
+  String *val_str_ascii(String *str);
   const char *func_name() const { return "convert_tz"; }
   void fix_length_and_dec();
   bool get_date(MYSQL_TIME *res, uint fuzzy_date);
@@ -657,11 +654,10 @@ public:
     return (double) Item_func_sec_to_time::val_int();
   }
   longlong val_int();
-  String *val_str(String *);
+  String *val_str_ascii(String *);
   void fix_length_and_dec()
   { 
     Item_str_timefunc::fix_length_and_dec();
-    collation.set(&my_charset_bin);
     maybe_null=1;
   }
   const char *func_name() const { return "sec_to_time"; }
@@ -679,7 +675,7 @@ public:
   const bool date_sub_interval; // keep it public
   Item_date_add_interval(Item *a,Item *b,interval_type type_arg,bool neg_arg)
     :Item_date_func(a,b),int_type(type_arg), date_sub_interval(neg_arg) {}
-  String *val_str(String *);
+  String *val_str_ascii(String *);
   const char *func_name() const { return "date_add_interval"; }
   void fix_length_and_dec();
   enum_field_types field_type() const { return cached_field_type; }
@@ -734,12 +730,11 @@ public:
 class Item_typecast_maybe_null :public Item_typecast
 {
 public:
-  Item_typecast_maybe_null(Item *a) :Item_typecast(a) {}
+  Item_typecast_maybe_null(Item *a) :Item_typecast(a) { maybe_null= 1; }
   void fix_length_and_dec()
   {
     collation.set(&my_charset_bin);
     max_length=args[0]->max_length;
-    maybe_null= 1;
   }
 };
 
@@ -766,7 +761,8 @@ public:
 class Item_date_typecast :public Item_typecast_maybe_null
 {
 public:
-  Item_date_typecast(Item *a) :Item_typecast_maybe_null(a) {}
+  Item_date_typecast(Item *a) :Item_typecast_maybe_null(a) 
+  { collation.set_numeric(); }
   const char *func_name() const { return "cast_as_date"; }
   String *val_str(String *str);
   bool get_date(MYSQL_TIME *ltime, uint fuzzy_date);
@@ -776,13 +772,8 @@ public:
   Field *tmp_table_field(TABLE *table)
   {
     return tmp_table_field_from_field_type(table, 0);
-  }  
-  void fix_length_and_dec()
-  {
-    collation.set(&my_charset_bin);
-    max_length= 10;
-    maybe_null= 1;
   }
+  void fix_length_and_dec() { fix_char_length(10); }
   bool result_as_longlong() { return TRUE; }
   longlong val_int();
   double val_real() { return (double) val_int(); }
@@ -801,7 +792,8 @@ public:
 class Item_time_typecast :public Item_typecast_maybe_null
 {
 public:
-  Item_time_typecast(Item *a) :Item_typecast_maybe_null(a) {}
+  Item_time_typecast(Item *a) :Item_typecast_maybe_null(a)
+  { collation.set_numeric(); }
   const char *func_name() const { return "cast_as_time"; }
   String *val_str(String *str);
   bool get_time(MYSQL_TIME *ltime);
@@ -823,13 +815,18 @@ public:
   {
     return save_time_in_field(field);
   }
+  void fix_length_and_dec()
+  {
+    fix_char_length(args[0]->max_char_length());
+  }
 };
 
 
 class Item_datetime_typecast :public Item_typecast_maybe_null
 {
 public:
-  Item_datetime_typecast(Item *a) :Item_typecast_maybe_null(a) {}
+  Item_datetime_typecast(Item *a) :Item_typecast_maybe_null(a)
+  { collation.set_numeric(); }
   const char *func_name() const { return "cast_as_datetime"; }
   String *val_str(String *str);
   const char *cast_type() const { return "datetime"; }
@@ -840,9 +837,7 @@ public:
   }
   void fix_length_and_dec()
   {
-    collation.set(&my_charset_bin);
-    maybe_null= 1;
-    max_length= MAX_DATETIME_FULL_WIDTH * MY_CHARSET_BIN_MB_MAXLEN;
+    fix_char_length(MAX_DATETIME_FULL_WIDTH);
     decimals= DATETIME_DEC;
   }
   bool result_as_longlong() { return TRUE; }
@@ -863,21 +858,22 @@ public:
 class Item_func_makedate :public Item_date_func
 {
 public:
-  Item_func_makedate(Item *a,Item *b) :Item_date_func(a,b) {}
-  String *val_str(String *str);
+  Item_func_makedate(Item *a,Item *b) :Item_date_func(a,b)
+  { collation.set_numeric(); }
+  String *val_str_ascii(String *str);
   const char *func_name() const { return "makedate"; }
   enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
   void fix_length_and_dec()
   { 
     decimals=0;
-    max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
+    fix_length_and_charset(MAX_DATE_WIDTH, default_charset());
     maybe_null= 1;
   }
   longlong val_int();
 };
 
 
-class Item_func_add_time :public Item_str_func
+class Item_func_add_time :public Item_str_ascii_func
 {
   const bool is_date;
   int sign;
@@ -885,8 +881,8 @@ class Item_func_add_time :public Item_st
 
 public:
   Item_func_add_time(Item *a, Item *b, bool type_arg, bool neg_arg)
-    :Item_str_func(a, b), is_date(type_arg) { sign= neg_arg ? -1 : 1; }
-  String *val_str(String *str);
+    :Item_str_ascii_func(a, b), is_date(type_arg) { sign= neg_arg ? -1 : 1; }
+  String *val_str_ascii(String *str);
   enum_field_types field_type() const { return cached_field_type; }
   void fix_length_and_dec();
 
@@ -921,7 +917,7 @@ class Item_func_timediff :public Item_st
 public:
   Item_func_timediff(Item *a, Item *b)
     :Item_str_timefunc(a, b) {}
-  String *val_str(String *str);
+  String *val_str_ascii(String *str);
   const char *func_name() const { return "timediff"; }
   void fix_length_and_dec()
   {
@@ -938,7 +934,7 @@ public:
   {
     maybe_null= TRUE;
   }
-  String *val_str(String *str);
+  String *val_str_ascii(String *str);
   const char *func_name() const { return "maketime"; }
 };
 
@@ -979,20 +975,20 @@ enum date_time_format
   USA_FORMAT, JIS_FORMAT, ISO_FORMAT, EUR_FORMAT, INTERNAL_FORMAT
 };
 
-class Item_func_get_format :public Item_str_func
+class Item_func_get_format :public Item_str_ascii_func
 {
 public:
   const timestamp_type type; // keep it public
   Item_func_get_format(timestamp_type type_arg, Item *a)
-    :Item_str_func(a), type(type_arg)
+    :Item_str_ascii_func(a), type(type_arg)
   {}
-  String *val_str(String *str);
+  String *val_str_ascii(String *str);
   const char *func_name() const { return "get_format"; }
   void fix_length_and_dec()
   {
     maybe_null= 1;
     decimals=0;
-    max_length=17*MY_CHARSET_BIN_MB_MAXLEN;
+    fix_length_and_charset(17, default_charset());
   }
   virtual void print(String *str, enum_query_type query_type);
 };

=== modified file 'sql/item_xmlfunc.cc'
--- a/sql/item_xmlfunc.cc	2009-07-28 14:16:37 +0000
+++ b/sql/item_xmlfunc.cc	2009-08-20 10:18:05 +0000
@@ -2577,7 +2577,7 @@ void Item_xml_str_func::fix_length_and_d
 
   nodeset_func= 0;
 
-  if (agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1))
+  if (agg_arg_charsets_for_comparison(collation, args, arg_count))
     return;
 
   if (collation.collation->mbminlen > 1)

=== modified file 'sql/my_decimal.cc'
--- a/sql/my_decimal.cc	2008-11-27 16:44:19 +0000
+++ b/sql/my_decimal.cc	2009-08-20 10:18:05 +0000
@@ -110,10 +110,56 @@ int my_decimal2string(uint mask, const m
                          &length, (int)fixed_prec, fixed_dec,
                          filler);
   str->length(length);
+  str->set_charset(&my_charset_numeric);
   return check_result(mask, result);
 }
 
 
+/**
+  @brief Converting decimal to string with character set conversion
+
+  @details Convert given my_decimal to String; allocate buffer as needed.
+
+  @param[in]   mask        what problems to warn on (mask of E_DEC_* values)
+  @param[in]   val         the decimal to print
+  @param[in]   fixed_prec  overall number of digits if ZEROFILL, 0 otherwise
+  @param[in]   fixed_dec   number of decimal places (if fixed_prec != 0)
+  @param[in]   filler      what char to pad with (ZEROFILL et al.)
+  @param[out]  *str        where to store the resulting string
+  @param[in]   cs          character set
+
+  @return error coce
+    @retval E_DEC_OK
+    @retval E_DEC_TRUNCATED
+    @retval E_DEC_OVERFLOW
+    @retval E_DEC_OOM
+
+  Would be great to make it a method of the String class,
+  but this would need to include
+  my_decimal.h from sql_string.h and sql_string.cc, which is not desirable.
+*/
+bool
+str_set_decimal(uint mask, const my_decimal *val,
+                uint fixed_prec, uint fixed_dec, char filler,
+                String *str, CHARSET_INFO *cs)
+{
+  if (!(cs->state & MY_CS_NONASCII))
+  {
+    my_decimal2string(mask, val, fixed_prec, fixed_dec, filler, str);
+    str->set_charset(cs);
+    return FALSE;
+  }
+  else
+  {
+    uint errors;
+    char buf[DECIMAL_MAX_STR_LENGTH];
+    String tmp(buf, sizeof(buf), &my_charset_latin1);
+    my_decimal2string(mask, val, fixed_prec, fixed_dec, filler, &tmp);
+    return str->copy(tmp.ptr(), tmp.length(), &my_charset_latin1, cs, &errors);
+  }
+}
+
+
 /*
   Convert from decimal to binary representation
 

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2009-08-14 19:52:00 +0000
+++ b/sql/mysql_priv.h	2009-08-20 10:18:05 +0000
@@ -175,7 +175,8 @@ extern CHARSET_INFO *error_message_chars
 
 enum Derivation
 {
-  DERIVATION_IGNORABLE= 5,
+  DERIVATION_IGNORABLE= 6,
+  DERIVATION_NUMERIC= 5,
   DERIVATION_COERCIBLE= 4,
   DERIVATION_SYSCONST= 3,
   DERIVATION_IMPLICIT= 2,
@@ -183,6 +184,8 @@ enum Derivation
   DERIVATION_EXPLICIT= 0
 };
 
+#define my_charset_numeric      my_charset_latin1
+#define MY_REPERTOIRE_NUMERIC   MY_REPERTOIRE_ASCII
 
 typedef struct my_locale_errmsgs
 {
@@ -827,6 +830,16 @@ typedef Comp_creator* (*chooser_compare_
 #include "item.h"
 extern my_decimal decimal_zero;
 
+/* my_decimal.cc */
+bool str_set_decimal(uint mask, const my_decimal *val, uint fixed_prec,
+                     uint fixed_dec, char filler, String *str,
+                     CHARSET_INFO *cs);
+inline bool str_set_decimal(const my_decimal *val, String *str,
+                            CHARSET_INFO *cs)
+{
+  return str_set_decimal(E_DEC_FATAL_ERROR, val, 0, 0, 0, str, cs);
+}
+
 /* sql_parse.cc */
 void free_items(Item *item);
 void cleanup_items(Item *item);
@@ -2201,8 +2214,17 @@ ulong convert_month_to_period(ulong mont
 void get_date_from_daynr(long daynr,uint *year, uint *month,
 			 uint *day);
 my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, my_bool *not_exist);
-bool str_to_time_with_warn(const char *str,uint length,MYSQL_TIME *l_time);
-timestamp_type str_to_datetime_with_warn(const char *str, uint length,
+/* Character set-aware version of str_to_time() */
+bool str_to_time(CHARSET_INFO *cs, const char *str,uint length,
+                 MYSQL_TIME *l_time, int *warning);
+/* Character set-aware version of str_to_datetime() */
+timestamp_type str_to_datetime(CHARSET_INFO *cs,
+                               const char *str, uint length,
+                               MYSQL_TIME *l_time, uint flags, int *was_cut);
+bool str_to_time_with_warn(CHARSET_INFO *cs, const char *str,uint length,
+                           MYSQL_TIME *l_time);
+timestamp_type str_to_datetime_with_warn(CHARSET_INFO *cs,
+                                         const char *str, uint length,
                                          MYSQL_TIME *l_time, uint flags);
 void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
 void calc_time_from_sec(MYSQL_TIME *to, long seconds, long microseconds);

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2009-07-28 14:16:37 +0000
+++ b/sql/sql_select.cc	2009-08-20 10:18:05 +0000
@@ -12080,6 +12080,69 @@ static void update_const_equal_items(CON
 
 
 /*
+  Check if 
+    field=const_a AND field=const_b
+  can be changed to
+    field=const_a AND const_a=const_b
+  
+  This is not always possible:
+  
+    field_datetime='2001-02-03 00:00:00' AND field_datetime='2001-02-03'
+  
+  cannot be changed to
+  
+    field_datetime='2001-02-03 00:00:00' AND '2001-02-03 00:00:00'='2001-02-03'
+  
+  because '2001-02-03 00:00:00' will be compared to '2001-02-03'
+  as string (instead of datetime) and we'll get "Impossible WHERE condition".
+  
+*/
+static bool
+can_join_constants(Item *field, Item *a, Item *b)
+{
+  if (a->result_type() != STRING_RESULT ||
+      b->result_type() != STRING_RESULT)
+    return TRUE;
+
+  switch (field->field_type())
+  {
+    case MYSQL_TYPE_DECIMAL:
+    case MYSQL_TYPE_NEWDECIMAL:
+    case MYSQL_TYPE_TINY:
+    case MYSQL_TYPE_SHORT:
+    case MYSQL_TYPE_INT24:
+    case MYSQL_TYPE_LONG:
+    case MYSQL_TYPE_LONGLONG:
+    case MYSQL_TYPE_FLOAT:
+    case MYSQL_TYPE_DOUBLE:
+    case MYSQL_TYPE_NULL:
+    case MYSQL_TYPE_TIMESTAMP:
+    case MYSQL_TYPE_YEAR:
+    case MYSQL_TYPE_DATE:
+    case MYSQL_TYPE_NEWDATE:
+    case MYSQL_TYPE_TIME:
+    case MYSQL_TYPE_DATETIME:
+     return FALSE;
+     
+    case MYSQL_TYPE_VARCHAR:
+    case MYSQL_TYPE_BLOB:
+    case MYSQL_TYPE_GEOMETRY:
+    case MYSQL_TYPE_STRING:
+    case MYSQL_TYPE_BIT:
+    case MYSQL_TYPE_ENUM:
+    case MYSQL_TYPE_SET:
+    case MYSQL_TYPE_TINY_BLOB:
+    case MYSQL_TYPE_MEDIUM_BLOB:
+    case MYSQL_TYPE_LONG_BLOB:
+    case MYSQL_TYPE_VAR_STRING:
+    case MAX_NO_FIELD_TYPES:
+      break;
+  }
+  return a->collation.collation == b->collation.collation;
+}
+
+
+/*
   change field = field to field = const for each found field = const in the
   and_level
 */
@@ -12111,9 +12174,7 @@ change_cond_ref_to_const(THD *thd, I_Lis
 
   if (right_item->eq(field,0) && left_item != value &&
       right_item->cmp_context == field->cmp_context &&
-      (left_item->result_type() != STRING_RESULT ||
-       value->result_type() != STRING_RESULT ||
-       left_item->collation.collation == value->collation.collation))
+      can_join_constants(field, left_item, value))
   {
     Item *tmp=value->clone_item();
     tmp->collation.set(right_item->collation);
@@ -12135,9 +12196,7 @@ change_cond_ref_to_const(THD *thd, I_Lis
   }
   else if (left_item->eq(field,0) && right_item != value &&
            left_item->cmp_context == field->cmp_context &&
-           (right_item->result_type() != STRING_RESULT ||
-            value->result_type() != STRING_RESULT ||
-            right_item->collation.collation == value->collation.collation))
+           can_join_constants(field, right_item, value))
   {
     Item *tmp= value->clone_item();
     tmp->collation.set(left_item->collation);

=== modified file 'sql/time.cc'
--- a/sql/time.cc	2009-06-17 15:26:50 +0000
+++ b/sql/time.cc	2009-08-20 10:18:05 +0000
@@ -214,6 +214,69 @@ ulong convert_month_to_period(ulong mont
 
 
 /*
+  Convert a string to 8-bit representation,
+  for use in str_to_time/str_to_date/str_to_date.
+  
+  In the future to_ascii() can be extended to convert
+  non-ASCII digits to ASCII digits
+  (for example, ARABIC-INDIC, DEVANAGARI, BENGALI, and so on)
+  so DATE/TIME/DATETIME values understand digits in the
+  respected scripts.
+*/
+static uint
+to_ascii(CHARSET_INFO *cs,
+         const char *src, uint src_length,
+         char *dst, uint dst_length)
+                     
+{
+  int cnvres;
+  my_wc_t wc;
+  const char *srcend= src + src_length;
+  char *dst0= dst, *dstend= dst + dst_length - 1;
+  while (dst < dstend &&
+         (cnvres= (cs->cset->mb_wc)(cs, &wc,
+                                    (const uchar*) src,
+                                    (const uchar*) srcend)) > 0 &&
+         wc < 128)
+  {
+    src+= cnvres;
+    *dst++= wc;
+  }
+  *dst= '\0';
+  return dst - dst0;
+}
+
+
+/* Character set-aware version of str_to_time() */
+bool str_to_time(CHARSET_INFO *cs, const char *str,uint length,
+                 MYSQL_TIME *l_time, int *warning)
+{
+  char cnv[32];
+  if ((cs->state & MY_CS_NONASCII) != 0)
+  {
+    length= to_ascii(cs, str, length, cnv, sizeof(cnv));
+    str= cnv;
+  }
+  return str_to_time(str, length, l_time, warning);
+}
+
+
+/* Character set-aware version of str_to_datetime() */
+timestamp_type str_to_datetime(CHARSET_INFO *cs,
+                               const char *str, uint length,
+                               MYSQL_TIME *l_time, uint flags, int *was_cut)
+{
+  char cnv[32];
+  if ((cs->state & MY_CS_NONASCII) != 0)
+  {
+    length= to_ascii(cs, str, length, cnv, sizeof(cnv));
+    str= cnv;
+  }
+  return str_to_datetime(str, length, l_time, flags, was_cut);
+}
+
+
+/*
   Convert a timestamp string to a MYSQL_TIME value and produce a warning 
   if string was truncated during conversion.
 
@@ -222,14 +285,15 @@ ulong convert_month_to_period(ulong mont
 */
 
 timestamp_type
-str_to_datetime_with_warn(const char *str, uint length, MYSQL_TIME *l_time,
+str_to_datetime_with_warn(CHARSET_INFO *cs,
+                          const char *str, uint length, MYSQL_TIME *l_time,
                           uint flags)
 {
   int was_cut;
   THD *thd= current_thd;
   timestamp_type ts_type;
   
-  ts_type= str_to_datetime(str, length, l_time,
+  ts_type= str_to_datetime(cs, str, length, l_time,
                            (flags | (thd->variables.sql_mode &
                                      (MODE_INVALID_DATES |
                                       MODE_NO_ZERO_DATE))),
@@ -284,7 +348,8 @@ my_time_t TIME_to_timestamp(THD *thd, co
     See str_to_time() for more info.
 */
 bool
-str_to_time_with_warn(const char *str, uint length, MYSQL_TIME *l_time)
+str_to_time_with_warn(CHARSET_INFO *cs,
+                      const char *str, uint length, MYSQL_TIME *l_time)
 {
   int warning;
   bool ret_val= str_to_time(str, length, l_time, &warning);
@@ -697,7 +762,7 @@ void make_time(const DATE_TIME_FORMAT *f
 {
   uint length= (uint) my_time_to_str(l_time, (char*) str->ptr());
   str->length(length);
-  str->set_charset(&my_charset_bin);
+  str->set_charset(&my_charset_numeric);
 }
 
 
@@ -706,7 +771,7 @@ void make_date(const DATE_TIME_FORMAT *f
 {
   uint length= (uint) my_date_to_str(l_time, (char*) str->ptr());
   str->length(length);
-  str->set_charset(&my_charset_bin);
+  str->set_charset(&my_charset_numeric);
 }
 
 
@@ -715,7 +780,7 @@ void make_datetime(const DATE_TIME_FORMA
 {
   uint length= (uint) my_datetime_to_str(l_time, (char*) str->ptr());
   str->length(length);
-  str->set_charset(&my_charset_bin);
+  str->set_charset(&my_charset_numeric);
 }
 
 

Attachment: [text/bzr-bundle] bzr/bar@mysql.com-20090820101805-vfkt7p7py9ffitua.bundle
Thread
bzr commit into mysql branch (bar:2862) WL#2649Alexander Barkov20 Aug
  • Re: bzr commit into mysql branch (bar:2862) WL#2649Øystein Grøvlen9 Sep
    • Re: bzr commit into mysql branch (bar:2862) WL#2649Alexander Barkov25 Dec
      • Re: bzr commit into mysql branch (bar:2862) WL#2649Øystein Grøvlen13 Jan
      • Re: bzr commit into mysql branch (bar:2862) WL#2649Øystein Grøvlen18 Jan
        • Re: bzr commit into mysql branch (bar:2862) WL#2649Alexander Barkov18 Jan