Commit cd89ed9a authored by unknown's avatar unknown

1. Item now uses my_charset_bin by default,

not default_charset_into. It fixes the
problem that in some cases numbers where
treated as CHAR(N), not as BINARY(N), e.g.
wrong 'charsetnr' when sent to the client side.
2. IFNULL didn't aggregate argument charsets
and collations, so IFNULL(1,'a') produced
a CHAR(N). Now produces a BINARY(N).
3. SELECT PROCEDURE ANALIZE now returns
BINARY columns, which is much better than it worked
previously: CHAR with the default character set.
But in the future it's worth to fix the fields
'Field_name' and 'Optimal_fieldtype' to use UTF8,
and 'Min_value' and 'Max_value' to inherit their charsets
from the original items. But it is not important,
and BINARY(N) is OK for now.
4. Tests were fixed accordingly. No new tests were
made, as the old onces cover everything.


mysql-test/r/analyse.result:
  SELECT PROCEDURE ANALIZE now returns
  BINARY columns, which is much better than it worked
  previously: CHAR with the default character set.
  But in the future it's worth to fix the fields
  'Field_name' and 'Optimal_fieldtype' to use UTF8,
  and 'Min_value' and 'Max_value' to inherit their charsets
  from the original items. But it is not important,
  and BINARY(N) is OK for now.
mysql-test/r/case.result:
  Test fix according to the changes
mysql-test/r/metadata.result:
  Test fix according to the changes
mysql-test/r/ps_1general.result:
  Test fix according to the changes
mysql-test/r/ps_2myisam.result:
  Test fix according to the changes
mysql-test/r/ps_3innodb.result:
  Test fix according to the changes
mysql-test/r/ps_4heap.result:
  Test fix according to the changes
mysql-test/r/ps_5merge.result:
  Test fix according to the changes
mysql-test/r/ps_6bdb.result:
  Test fix according to the changes
mysql-test/r/ps_7ndb.result:
  Test fix according to the changes
mysql-test/r/union.result:
  Test fix according to the changes
sql/item.cc:
  Item is now BINARY by default
sql/item_cmpfunc.cc:
  IFNULL now collects arguments collations/charsets
  like other functions do.
parent 1457163c
...@@ -36,16 +36,16 @@ create table t2 select * from t1 where 0=1 procedure analyse(); ...@@ -36,16 +36,16 @@ create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`Field_name` char(255) NOT NULL default '', `Field_name` binary(255) NOT NULL default '',
`Min_value` char(255) default NULL, `Min_value` binary(255) default NULL,
`Max_value` char(255) default NULL, `Max_value` binary(255) default NULL,
`Min_length` bigint(11) NOT NULL default '0', `Min_length` bigint(11) NOT NULL default '0',
`Max_length` bigint(11) NOT NULL default '0', `Max_length` bigint(11) NOT NULL default '0',
`Empties_or_zeros` bigint(11) NOT NULL default '0', `Empties_or_zeros` bigint(11) NOT NULL default '0',
`Nulls` bigint(11) NOT NULL default '0', `Nulls` bigint(11) NOT NULL default '0',
`Avg_value_or_avg_length` char(255) NOT NULL default '', `Avg_value_or_avg_length` binary(255) NOT NULL default '',
`Std` char(255) default NULL, `Std` binary(255) default NULL,
`Optimal_fieldtype` char(64) NOT NULL default '' `Optimal_fieldtype` binary(64) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1 where 0=1 procedure analyse(); select * from t1 where 0=1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
...@@ -55,16 +55,16 @@ create table t2 select * from t1 where 0=1 procedure analyse(); ...@@ -55,16 +55,16 @@ create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`Field_name` char(255) NOT NULL default '', `Field_name` binary(255) NOT NULL default '',
`Min_value` char(255) default NULL, `Min_value` binary(255) default NULL,
`Max_value` char(255) default NULL, `Max_value` binary(255) default NULL,
`Min_length` bigint(11) NOT NULL default '0', `Min_length` bigint(11) NOT NULL default '0',
`Max_length` bigint(11) NOT NULL default '0', `Max_length` bigint(11) NOT NULL default '0',
`Empties_or_zeros` bigint(11) NOT NULL default '0', `Empties_or_zeros` bigint(11) NOT NULL default '0',
`Nulls` bigint(11) NOT NULL default '0', `Nulls` bigint(11) NOT NULL default '0',
`Avg_value_or_avg_length` char(255) NOT NULL default '', `Avg_value_or_avg_length` binary(255) NOT NULL default '',
`Std` char(255) default NULL, `Std` binary(255) default NULL,
`Optimal_fieldtype` char(64) NOT NULL default '' `Optimal_fieldtype` binary(64) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2; select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
...@@ -78,16 +78,16 @@ create table t2 select * from t1 where 0=1 procedure analyse(); ...@@ -78,16 +78,16 @@ create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`Field_name` char(255) NOT NULL default '', `Field_name` binary(255) NOT NULL default '',
`Min_value` char(255) default NULL, `Min_value` binary(255) default NULL,
`Max_value` char(255) default NULL, `Max_value` binary(255) default NULL,
`Min_length` bigint(11) NOT NULL default '0', `Min_length` bigint(11) NOT NULL default '0',
`Max_length` bigint(11) NOT NULL default '0', `Max_length` bigint(11) NOT NULL default '0',
`Empties_or_zeros` bigint(11) NOT NULL default '0', `Empties_or_zeros` bigint(11) NOT NULL default '0',
`Nulls` bigint(11) NOT NULL default '0', `Nulls` bigint(11) NOT NULL default '0',
`Avg_value_or_avg_length` char(255) NOT NULL default '', `Avg_value_or_avg_length` binary(255) NOT NULL default '',
`Std` char(255) default NULL, `Std` binary(255) default NULL,
`Optimal_fieldtype` char(64) NOT NULL default '' `Optimal_fieldtype` binary(64) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2; select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
......
...@@ -98,10 +98,10 @@ Table Create Table ...@@ -98,10 +98,10 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c1` char(1) character set latin1 collate latin1_danish_ci NOT NULL default '', `c1` char(1) character set latin1 collate latin1_danish_ci NOT NULL default '',
`c2` char(1) character set latin1 collate latin1_danish_ci NOT NULL default '', `c2` char(1) character set latin1 collate latin1_danish_ci NOT NULL default '',
`c3` char(1) NOT NULL default '', `c3` binary(1) NOT NULL default '',
`c4` char(1) NOT NULL default '', `c4` binary(1) NOT NULL default '',
`c5` char(3) NOT NULL default '', `c5` binary(3) NOT NULL default '',
`c6` char(3) NOT NULL default '', `c6` binary(3) NOT NULL default '',
`c7` double(3,1) NOT NULL default '0.0', `c7` double(3,1) NOT NULL default '0.0',
`c8` double(3,1) NOT NULL default '0.0', `c8` double(3,1) NOT NULL default '0.0',
`c9` double(3,1) default NULL `c9` double(3,1) default NULL
...@@ -149,8 +149,8 @@ t1 CREATE TABLE `t1` ( ...@@ -149,8 +149,8 @@ t1 CREATE TABLE `t1` (
`COALESCE(1.0)` double(3,1) NOT NULL default '0.0', `COALESCE(1.0)` double(3,1) NOT NULL default '0.0',
`COALESCE('a')` char(1) NOT NULL default '', `COALESCE('a')` char(1) NOT NULL default '',
`COALESCE(1,1.0)` double(3,1) NOT NULL default '0.0', `COALESCE(1,1.0)` double(3,1) NOT NULL default '0.0',
`COALESCE(1,'1')` char(1) NOT NULL default '', `COALESCE(1,'1')` binary(1) NOT NULL default '',
`COALESCE(1.1,'1')` char(3) NOT NULL default '', `COALESCE(1.1,'1')` binary(3) NOT NULL default '',
`COALESCE('a' COLLATE latin1_bin,'b')` char(1) character set latin1 collate latin1_bin NOT NULL default '' `COALESCE('a' COLLATE latin1_bin,'b')` char(1) character set latin1 collate latin1_bin NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
drop table if exists t1,t2; drop table if exists t1,t2;
select 1, 1.0, -1, "hello", NULL; select 1, 1.0, -1, "hello", NULL;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def 1 8 1 1 N 32769 0 8 def 1 8 1 1 N 32897 0 63
def 1.0 5 3 3 N 32769 1 8 def 1.0 5 3 3 N 32897 1 63
def -1 8 2 2 N 32769 0 8 def -1 8 2 2 N 32897 0 63
def hello 254 5 5 N 1 31 8 def hello 254 5 5 N 1 31 8
def NULL 6 0 0 Y 32896 0 63 def NULL 6 0 0 Y 32896 0 63
1 1.0 -1 hello NULL 1 1.0 -1 hello NULL
......
...@@ -468,15 +468,15 @@ ERROR HY000: This command is not supported in the prepared statement protocol ye ...@@ -468,15 +468,15 @@ ERROR HY000: This command is not supported in the prepared statement protocol ye
prepare stmt1 from ' explain select a from t1 order by b '; prepare stmt1 from ' explain select a from t1 order by b ';
execute stmt1; execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8 def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8 def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8 def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8 def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8 def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8 def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8 def rows 8 10 1 N 32929 0 63
def Extra 253 255 14 N 1 31 8 def Extra 253 255 14 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
...@@ -484,15 +484,15 @@ SET @arg00=1 ; ...@@ -484,15 +484,15 @@ SET @arg00=1 ;
prepare stmt1 from ' explain select a from t1 where a > ? order by b '; prepare stmt1 from ' explain select a from t1 where a > ? order by b ';
execute stmt1 using @arg00; execute stmt1 using @arg00;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8 def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8 def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8 def table 253 64 2 N 1 31 8
def type 253 10 5 N 1 31 8 def type 253 10 5 N 1 31 8
def possible_keys 253 4096 7 Y 0 31 8 def possible_keys 253 4096 7 Y 0 31 8
def key 253 64 7 Y 0 31 8 def key 253 64 7 Y 0 31 8
def key_len 8 3 1 Y 32800 0 8 def key_len 8 3 1 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8 def rows 8 10 1 N 32929 0 63
def Extra 253 255 27 N 1 31 8 def Extra 253 255 27 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
......
...@@ -1145,15 +1145,15 @@ test_sequence ...@@ -1145,15 +1145,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ; prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1; execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8 def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8 def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8 def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8 def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8 def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8 def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8 def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8 def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2 1 SIMPLE t9 ALL NULL NULL NULL NULL 2
......
...@@ -1145,15 +1145,15 @@ test_sequence ...@@ -1145,15 +1145,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ; prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1; execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8 def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8 def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8 def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8 def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8 def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8 def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8 def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8 def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2 1 SIMPLE t9 ALL NULL NULL NULL NULL 2
......
...@@ -1146,15 +1146,15 @@ test_sequence ...@@ -1146,15 +1146,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ; prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1; execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8 def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8 def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8 def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8 def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8 def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8 def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8 def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8 def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2 1 SIMPLE t9 ALL NULL NULL NULL NULL 2
......
...@@ -1188,15 +1188,15 @@ test_sequence ...@@ -1188,15 +1188,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ; prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1; execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8 def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8 def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8 def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8 def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8 def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8 def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8 def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8 def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2 1 SIMPLE t9 ALL NULL NULL NULL NULL 2
...@@ -4198,15 +4198,15 @@ test_sequence ...@@ -4198,15 +4198,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ; prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1; execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8 def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8 def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8 def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8 def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8 def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8 def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8 def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8 def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2 1 SIMPLE t9 ALL NULL NULL NULL NULL 2
......
...@@ -1145,15 +1145,15 @@ test_sequence ...@@ -1145,15 +1145,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ; prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1; execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8 def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8 def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8 def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8 def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8 def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8 def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8 def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8 def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 1 SIMPLE t9 ALL NULL NULL NULL NULL 3
......
...@@ -1145,15 +1145,15 @@ test_sequence ...@@ -1145,15 +1145,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ; prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1; execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8 def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8 def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8 def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8 def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8 def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8 def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8 def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8 def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2 1 SIMPLE t9 ALL NULL NULL NULL NULL 2
......
...@@ -554,7 +554,7 @@ aa ...@@ -554,7 +554,7 @@ aa
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` char(20) NOT NULL default '' `a` binary(20) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 SELECT 12 as a UNION select 12.2 as a; create table t1 SELECT 12 as a UNION select 12.2 as a;
......
...@@ -45,7 +45,7 @@ Item::Item(): ...@@ -45,7 +45,7 @@ Item::Item():
{ {
marker= 0; marker= 0;
maybe_null=null_value=with_sum_func=unsigned_flag=0; maybe_null=null_value=with_sum_func=unsigned_flag=0;
collation.set(default_charset(), DERIVATION_COERCIBLE); collation.set(&my_charset_bin, DERIVATION_COERCIBLE);
name= 0; name= 0;
decimals= 0; max_length= 0; decimals= 0; max_length= 0;
......
...@@ -1094,6 +1094,9 @@ Item_func_nullif::fix_length_and_dec() ...@@ -1094,6 +1094,9 @@ Item_func_nullif::fix_length_and_dec()
max_length=args[0]->max_length; max_length=args[0]->max_length;
decimals=args[0]->decimals; decimals=args[0]->decimals;
agg_result_type(&cached_result_type, args, 2); agg_result_type(&cached_result_type, args, 2);
if (cached_result_type == STRING_RESULT &&
agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV))
return;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment