Commit 9f194149 authored by kaa@kaamos.(none)'s avatar kaa@kaamos.(none)

Merge kaamos.(none):/data/src/opt/mysql-5.0-opt

into  kaamos.(none):/data/src/opt/mysql-5.1-opt
parents a4441374 1a67148c
...@@ -1090,6 +1090,19 @@ SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d; ...@@ -1090,6 +1090,19 @@ SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #34223: Assertion failed: (optp->var_type & 127) == 8,
# file .\my_getopt.c, line 830
#
set @my_innodb_autoextend_increment=@@global.innodb_autoextend_increment;
set global innodb_autoextend_increment=8;
set global innodb_autoextend_increment=@my_innodb_autoextend_increment;
set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency;
set global innodb_commit_concurrency=0;
set global innodb_commit_concurrency=@my_innodb_commit_concurrency;
--echo End of 5.0 tests --echo End of 5.0 tests
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY # Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
......
...@@ -256,6 +256,7 @@ set @a=repeat(' ',20); ...@@ -256,6 +256,7 @@ set @a=repeat(' ',20);
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
Warnings: Warnings:
Note 1265 Data truncated for column 'v' at row 1 Note 1265 Data truncated for column 'v' at row 1
Note 1265 Data truncated for column 'c' at row 1
select concat('*',v,'*',c,'*',t,'*') from t1; select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*') concat('*',v,'*',c,'*',t,'*')
*+ *+*+ * *+ *+*+ *
......
...@@ -1823,6 +1823,7 @@ set @a=repeat(' ',20); ...@@ -1823,6 +1823,7 @@ set @a=repeat(' ',20);
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
Warnings: Warnings:
Note 1265 Data truncated for column 'v' at row 1 Note 1265 Data truncated for column 'v' at row 1
Note 1265 Data truncated for column 'c' at row 1
select concat('*',v,'*',c,'*',t,'*') from t1; select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*') concat('*',v,'*',c,'*',t,'*')
*+ *+*+ * *+ *+*+ *
......
...@@ -1356,6 +1356,12 @@ id type d ...@@ -1356,6 +1356,12 @@ id type d
NULL member 3 NULL member 3
NULL member 4 NULL member 4
DROP TABLE t1; DROP TABLE t1;
set @my_innodb_autoextend_increment=@@global.innodb_autoextend_increment;
set global innodb_autoextend_increment=8;
set global innodb_autoextend_increment=@my_innodb_autoextend_increment;
set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency;
set global innodb_commit_concurrency=0;
set global innodb_commit_concurrency=@my_innodb_commit_concurrency;
End of 5.0 tests End of 5.0 tests
CREATE TABLE `t2` ( CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment, `k` int(11) NOT NULL auto_increment,
......
...@@ -1086,6 +1086,7 @@ set @a=repeat(' ',20); ...@@ -1086,6 +1086,7 @@ set @a=repeat(' ',20);
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
Warnings: Warnings:
Note 1265 Data truncated for column 'v' at row 1 Note 1265 Data truncated for column 'v' at row 1
Note 1265 Data truncated for column 'c' at row 1
select concat('*',v,'*',c,'*',t,'*') from t1; select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*') concat('*',v,'*',c,'*',t,'*')
*+ *+*+ * *+ *+*+ *
......
...@@ -1167,3 +1167,16 @@ explain select * from t2 where a=1000 and b<11; ...@@ -1167,3 +1167,16 @@ explain select * from t2 where a=1000 and b<11;
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 t2 ref a a 5 const 502 Using where 1 SIMPLE t2 ref a a 5 const 502 Using where
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1 (
a varchar(32), index (a)
) DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
INSERT INTO t1 VALUES
('B'), ('A'), ('A'), ('C'), ('B'), ('A'), ('A');
SELECT a FROM t1 WHERE a='b' OR a='B';
a
B
B
EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 35 NULL 3 Using where; Using index
DROP TABLE t1;
...@@ -6812,6 +6812,23 @@ DROP PROCEDURE db28318_b.t2; ...@@ -6812,6 +6812,23 @@ DROP PROCEDURE db28318_b.t2;
DROP DATABASE db28318_a; DROP DATABASE db28318_a;
DROP DATABASE db28318_b; DROP DATABASE db28318_b;
use test; use test;
#
# Bug#30787: Stored function ignores user defined alias.
#
use test;
drop function if exists func30787;
create table t1(f1 int);
insert into t1 values(1),(2);
create function func30787(p1 int) returns int
begin
return p1;
end |
select (select func30787(f1)) as ttt from t1;
ttt
1
2
drop function func30787;
drop table t1;
End of 5.0 tests End of 5.0 tests
# #
......
...@@ -934,6 +934,8 @@ NULL NULL ...@@ -934,6 +934,8 @@ NULL NULL
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6)); CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6));
INSERT INTO t1 VALUES ('hello', 'hello'),('he', 'he'),('hello ', 'hello '); INSERT INTO t1 VALUES ('hello', 'hello'),('he', 'he'),('hello ', 'hello ');
Warnings:
Note 1265 Data truncated for column 'col1' at row 3
INSERT INTO t1 (col1) VALUES ('hellobob'); INSERT INTO t1 (col1) VALUES ('hellobob');
ERROR 22001: Data too long for column 'col1' at row 1 ERROR 22001: Data too long for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES ('hellobob'); INSERT INTO t1 (col2) VALUES ('hellobob');
......
...@@ -125,6 +125,7 @@ create table t1 (c char(2), vc varchar(2)); ...@@ -125,6 +125,7 @@ create table t1 (c char(2), vc varchar(2));
insert into t1 values(0x4120, 0x4120); insert into t1 values(0x4120, 0x4120);
insert into t1 values(0x412020, 0x412020); insert into t1 values(0x412020, 0x412020);
Warnings: Warnings:
Note 1265 Data truncated for column 'c' at row 1
Note 1265 Data truncated for column 'vc' at row 1 Note 1265 Data truncated for column 'vc' at row 1
drop table t1; drop table t1;
set @old_sql_mode= @@sql_mode, sql_mode= 'traditional'; set @old_sql_mode= @@sql_mode, sql_mode= 'traditional';
......
...@@ -85,3 +85,11 @@ t1 CREATE TABLE `t1` ( ...@@ -85,3 +85,11 @@ t1 CREATE TABLE `t1` (
`f1` set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1') DEFAULT NULL `f1` set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1') DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
CREATE TABLE t1(c set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64'));
INSERT INTO t1 VALUES(7);
INSERT INTO t1 VALUES(9223372036854775808);
SELECT * FROM t1;
c
1,2,3
64
DROP TABLE t1;
...@@ -276,4 +276,42 @@ DROP TABLE t3; ...@@ -276,4 +276,42 @@ DROP TABLE t3;
DROP PROCEDURE sp1; DROP PROCEDURE sp1;
DROP PROCEDURE sp2; DROP PROCEDURE sp2;
DROP PROCEDURE sp3; DROP PROCEDURE sp3;
create table t1 (c_char char(255), c_varchar varchar(255), c_tinytext tinytext);
create table t2 (c_tinyblob tinyblob);
set @c = repeat(' ', 256);
set @q = repeat('q', 256);
set sql_mode = '';
insert into t1 values(@c, @c, @c);
Warnings:
Note 1265 Data truncated for column 'c_char' at row 1
Note 1265 Data truncated for column 'c_varchar' at row 1
Note 1265 Data truncated for column 'c_tinytext' at row 1
insert into t2 values(@c);
Warnings:
Warning 1265 Data truncated for column 'c_tinyblob' at row 1
insert into t1 values(@q, @q, @q);
Warnings:
Warning 1265 Data truncated for column 'c_char' at row 1
Warning 1265 Data truncated for column 'c_varchar' at row 1
Warning 1265 Data truncated for column 'c_tinytext' at row 1
insert into t2 values(@q);
Warnings:
Warning 1265 Data truncated for column 'c_tinyblob' at row 1
set sql_mode = 'traditional';
insert into t1 values(@c, @c, @c);
Warnings:
Note 1265 Data truncated for column 'c_char' at row 1
Note 1265 Data truncated for column 'c_varchar' at row 1
Note 1265 Data truncated for column 'c_tinytext' at row 1
insert into t2 values(@c);
ERROR 22001: Data too long for column 'c_tinyblob' at row 1
insert into t1 values(@q, NULL, NULL);
ERROR 22001: Data too long for column 'c_char' at row 1
insert into t1 values(NULL, @q, NULL);
ERROR 22001: Data too long for column 'c_varchar' at row 1
insert into t1 values(NULL, NULL, @q);
ERROR 22001: Data too long for column 'c_tinytext' at row 1
insert into t2 values(@q);
ERROR 22001: Data too long for column 'c_tinyblob' at row 1
drop table t1, t2;
End of 5.0 tests End of 5.0 tests
...@@ -955,6 +955,23 @@ explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= ' ...@@ -955,6 +955,23 @@ explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '
drop table t1; drop table t1;
#
# Bug #33833: different or-ed predicates were erroneously merged into one that
# resulted in ref access instead of range access and a wrong result set
#
CREATE TABLE t1 (
a varchar(32), index (a)
) DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
INSERT INTO t1 VALUES
('B'), ('A'), ('A'), ('C'), ('B'), ('A'), ('A');
SELECT a FROM t1 WHERE a='b' OR a='B';
EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B';
DROP TABLE t1;
# End of 5.0 tests # End of 5.0 tests
# BUG#22393 fix: Adjust 'ref' estimate if we have 'range' estimate for # BUG#22393 fix: Adjust 'ref' estimate if we have 'range' estimate for
......
...@@ -7900,6 +7900,25 @@ DROP DATABASE db28318_a; ...@@ -7900,6 +7900,25 @@ DROP DATABASE db28318_a;
DROP DATABASE db28318_b; DROP DATABASE db28318_b;
use test; use test;
--echo #
--echo # Bug#30787: Stored function ignores user defined alias.
--echo #
use test;
--disable_warnings
drop function if exists func30787;
--enable_warnings
create table t1(f1 int);
insert into t1 values(1),(2);
delimiter |;
create function func30787(p1 int) returns int
begin
return p1;
end |
delimiter ;|
select (select func30787(f1)) as ttt from t1;
drop function func30787;
drop table t1;
########################################################################### ###########################################################################
--echo End of 5.0 tests --echo End of 5.0 tests
......
...@@ -56,3 +56,23 @@ set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17', ...@@ -56,3 +56,23 @@ set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17',
'50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1')); '50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1'));
show create table t1; show create table t1;
drop table t1; drop table t1;
#
# Bug#15409: Columns with SET datatype with 64-element sets
# may not be updated with integers
#
let $i=64;
let $s='$i';
dec $i;
while ($i) {
let $s='$i',$s;
dec $i;
}
--eval CREATE TABLE t1(c set($s))
INSERT INTO t1 VALUES(7);
INSERT INTO t1 VALUES(9223372036854775808);
SELECT * FROM t1;
DROP TABLE t1;
--# echo End of 5.0 tests
...@@ -193,4 +193,37 @@ DROP PROCEDURE sp1; ...@@ -193,4 +193,37 @@ DROP PROCEDURE sp1;
DROP PROCEDURE sp2; DROP PROCEDURE sp2;
DROP PROCEDURE sp3; DROP PROCEDURE sp3;
#
# Bug#30059: End-space truncation warnings are inconsistent or incorrect
#
create table t1 (c_char char(255), c_varchar varchar(255), c_tinytext tinytext);
create table t2 (c_tinyblob tinyblob); # not affected by bug, for regression testing
set @c = repeat(' ', 256);
set @q = repeat('q', 256);
set sql_mode = '';
insert into t1 values(@c, @c, @c);
insert into t2 values(@c);
insert into t1 values(@q, @q, @q);
insert into t2 values(@q);
set sql_mode = 'traditional';
insert into t1 values(@c, @c, @c);
--error 1406
insert into t2 values(@c);
--error 1406
insert into t1 values(@q, NULL, NULL);
--error 1406
insert into t1 values(NULL, @q, NULL);
--error 1406
insert into t1 values(NULL, NULL, @q);
--error 1406
insert into t2 values(@q);
drop table t1, t2;
--echo End of 5.0 tests --echo End of 5.0 tests
...@@ -6326,26 +6326,41 @@ check_string_copy_error(Field_str *field, ...@@ -6326,26 +6326,41 @@ check_string_copy_error(Field_str *field,
} }
/* /*
Send a truncation warning or a truncation error Check if we lost any important data and send a truncation error/warning
after storing a too long character string info a field.
SYNOPSIS SYNOPSIS
report_data_too_long() Field_longstr::report_if_important_data()
field - Field ptr - Truncated rest of string
end - End of truncated string
RETURN RETURN VALUES
N/A 0 - None was truncated (or we don't count cut fields)
2 - Some bytes was truncated
NOTE
Check if we lost any important data (anything in a binary string,
or any non-space in others). If only trailing spaces was lost,
send a truncation note, otherwise send a truncation error.
*/ */
inline void int
report_data_too_long(Field_str *field) Field_longstr::report_if_important_data(const char *ptr, const char *end)
{ {
if (field->table->in_use->abort_on_warning) if ((ptr < end) && table->in_use->count_cuted_fields)
field->set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1); {
else if (test_if_important_data(field_charset, ptr, end))
field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); {
if (table->in_use->abort_on_warning)
set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
else
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
}
else /* If we lost only spaces then produce a NOTE, not a WARNING */
set_warning(MYSQL_ERROR::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
return 2;
}
return 0;
} }
...@@ -6380,19 +6395,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs) ...@@ -6380,19 +6395,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
cannot_convert_error_pos, from + length, cs)) cannot_convert_error_pos, from + length, cs))
return 2; return 2;
/* return report_if_important_data(from_end_pos, from + length);
Check if we lost any important data (anything in a binary string,
or any non-space in others).
*/
if ((from_end_pos < from + length) && table->in_use->count_cuted_fields)
{
if (test_if_important_data(field_charset, from_end_pos, from + length))
{
report_data_too_long(this);
return 2;
}
}
return 0;
} }
...@@ -6970,16 +6973,7 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs) ...@@ -6970,16 +6973,7 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
cannot_convert_error_pos, from + length, cs)) cannot_convert_error_pos, from + length, cs))
return 2; return 2;
// Check if we lost something other than just trailing spaces return report_if_important_data(from_end_pos, from + length);
if ((from_end_pos < from + length) && table->in_use->count_cuted_fields)
{
if (test_if_important_data(field_charset, from_end_pos, from + length))
report_data_too_long(this);
else /* If we lost only spaces then produce a NOTE, not a WARNING */
set_warning(MYSQL_ERROR::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
return 2;
}
return 0;
} }
...@@ -7681,13 +7675,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) ...@@ -7681,13 +7675,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
cannot_convert_error_pos, from + length, cs)) cannot_convert_error_pos, from + length, cs))
return 2; return 2;
if (from_end_pos < from + length) return report_if_important_data(from_end_pos, from + length);
{
report_data_too_long(this);
return 2;
}
return 0;
oom_error: oom_error:
/* Fatal OOM error */ /* Fatal OOM error */
...@@ -8636,10 +8624,10 @@ int Field_set::store(longlong nr, bool unsigned_val) ...@@ -8636,10 +8624,10 @@ int Field_set::store(longlong nr, bool unsigned_val)
{ {
ASSERT_COLUMN_MARKED_FOR_WRITE; ASSERT_COLUMN_MARKED_FOR_WRITE;
int error= 0; int error= 0;
if ((ulonglong) nr > (ulonglong) (((longlong) 1 << typelib->count) - ulonglong max_nr= set_bits(ulonglong, typelib->count);
(longlong) 1)) if ((ulonglong) nr > max_nr)
{ {
nr&= (longlong) (((longlong) 1 << typelib->count) - (longlong) 1); nr&= max_nr;
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
error=1; error=1;
} }
......
...@@ -593,6 +593,8 @@ class Field_str :public Field { ...@@ -593,6 +593,8 @@ class Field_str :public Field {
class Field_longstr :public Field_str class Field_longstr :public Field_str
{ {
protected:
int report_if_important_data(const char *ptr, const char *end);
public: public:
Field_longstr(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, Field_longstr(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg, uchar null_bit_arg, utype unireg_check_arg,
......
...@@ -1512,6 +1512,13 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path, ...@@ -1512,6 +1512,13 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
handler *handler::clone(MEM_ROOT *mem_root) handler *handler::clone(MEM_ROOT *mem_root)
{ {
handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type()); handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type());
/*
Allocate handler->ref here because otherwise ha_open will allocate it
on this->table->mem_root and we will not be able to reclaim that memory
when the clone handler object is destroyed.
*/
if (!(new_handler->ref= (uchar*) alloc_root(mem_root, ALIGN_SIZE(ref_length)*2)))
return NULL;
if (new_handler && !new_handler->ha_open(table, if (new_handler && !new_handler->ha_open(table,
table->s->normalized_path.str, table->s->normalized_path.str,
table->db_stat, table->db_stat,
...@@ -1580,7 +1587,9 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode, ...@@ -1580,7 +1587,9 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode,
table->db_stat|=HA_READ_ONLY; table->db_stat|=HA_READ_ONLY;
(void) extra(HA_EXTRA_NO_READCHECK); // Not needed in SQL (void) extra(HA_EXTRA_NO_READCHECK); // Not needed in SQL
if (!(ref= (uchar*) alloc_root(&table->mem_root, ALIGN_SIZE(ref_length)*2))) /* ref is already allocated for us if we're called from handler::clone() */
if (!ref && !(ref= (uchar*) alloc_root(&table->mem_root,
ALIGN_SIZE(ref_length)*2)))
{ {
close(); close();
error=HA_ERR_OUT_OF_MEM; error=HA_ERR_OUT_OF_MEM;
......
...@@ -4370,6 +4370,49 @@ String *Item::check_well_formed_result(String *str, bool send_error) ...@@ -4370,6 +4370,49 @@ String *Item::check_well_formed_result(String *str, bool send_error)
return str; return str;
} }
/*
Compare two items using a given collation
SYNOPSIS
eq_by_collation()
item item to compare with
binary_cmp TRUE <-> compare as binaries
cs collation to use when comparing strings
DESCRIPTION
This method works exactly as Item::eq if the collation cs coincides with
the collation of the compared objects. Otherwise, first the collations that
differ from cs are replaced for cs and then the items are compared by
Item::eq. After the comparison the original collations of items are
restored.
RETURN
1 compared items has been detected as equal
0 otherwise
*/
bool Item::eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs)
{
CHARSET_INFO *save_cs= 0;
CHARSET_INFO *save_item_cs= 0;
if (collation.collation != cs)
{
save_cs= collation.collation;
collation.collation= cs;
}
if (item->collation.collation != cs)
{
save_item_cs= item->collation.collation;
item->collation.collation= cs;
}
bool res= eq(item, binary_cmp);
if (save_cs)
collation.collation= save_cs;
if (save_item_cs)
item->collation.collation= save_item_cs;
return res;
}
/* /*
Create a field to hold a string value from an item Create a field to hold a string value from an item
......
...@@ -1004,6 +1004,7 @@ class Item { ...@@ -1004,6 +1004,7 @@ class Item {
virtual Field::geometry_type get_geometry_type() const virtual Field::geometry_type get_geometry_type() const
{ return Field::GEOM_GEOMETRY; }; { return Field::GEOM_GEOMETRY; };
String *check_well_formed_result(String *str, bool send_error= 0); String *check_well_formed_result(String *str, bool send_error= 0);
bool eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs);
}; };
......
...@@ -5500,6 +5500,8 @@ Item_func_sp::make_field(Send_field *tmp_field) ...@@ -5500,6 +5500,8 @@ Item_func_sp::make_field(Send_field *tmp_field)
DBUG_ENTER("Item_func_sp::make_field"); DBUG_ENTER("Item_func_sp::make_field");
DBUG_ASSERT(sp_result_field); DBUG_ASSERT(sp_result_field);
sp_result_field->make_field(tmp_field); sp_result_field->make_field(tmp_field);
if (name)
tmp_field->col_name= name;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -2931,7 +2931,9 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end, ...@@ -2931,7 +2931,9 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
} }
} }
else if (old->eq_func && new_fields->eq_func && else if (old->eq_func && new_fields->eq_func &&
old->val->eq(new_fields->val, old->field->binary())) old->val->eq_by_collation(new_fields->val,
old->field->binary(),
old->field->charset()))
{ {
old->level= and_level; old->level= and_level;
......
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