Commit 7b93f385 authored by unknown's avatar unknown

Function INSERT() now works according to coercibility rules

Test for INSERT() has been added

parent 54c04738
......@@ -303,6 +303,9 @@ latin2_general_ci 3
select collation(substring(_latin2'ab',1)), coercibility(substring(_latin2'ab',1));
collation(substring(_latin2'ab',1)) coercibility(substring(_latin2'ab',1))
latin2_general_ci 3
select collation(insert(_latin2'abcd',2,3,_latin2'ef')), coercibility(insert(_latin2'abcd',2,3,_latin2'ef'));
collation(insert(_latin2'abcd',2,3,_latin2'ef')) coercibility(insert(_latin2'abcd',2,3,_latin2'ef'))
latin2_general_ci 3
create table t1
select
left(_latin2'a',1),
......@@ -322,7 +325,8 @@ repeat(_latin2'a',10),
reverse(_latin2'ab'),
quote(_latin2'ab'),
soundex(_latin2'ab'),
substring(_latin2'ab',1)
substring(_latin2'ab',1),
insert(_latin2'abcd',2,3,_latin2'ef')
;
show create table t1;
Table Create Table
......@@ -344,6 +348,7 @@ t1 CREATE TABLE `t1` (
`reverse(_latin2'ab')` char(2) character set latin2 NOT NULL default '',
`quote(_latin2'ab')` char(6) character set latin2 NOT NULL default '',
`soundex(_latin2'ab')` char(4) character set latin2 NOT NULL default '',
`substring(_latin2'ab',1)` char(2) character set latin2 NOT NULL default ''
`substring(_latin2'ab',1)` char(2) character set latin2 NOT NULL default '',
`insert(_latin2'abcd',2,3,_latin2'ef')` char(6) character set latin2 NOT NULL default ''
) TYPE=MyISAM CHARSET=latin1
drop table t1;
......@@ -154,6 +154,7 @@ select collation(reverse(_latin2'ab')), coercibility(reverse(_latin2'ab'));
select collation(quote(_latin2'ab')), coercibility(quote(_latin2'ab'));
select collation(soundex(_latin2'ab')), coercibility(soundex(_latin2'ab'));
select collation(substring(_latin2'ab',1)), coercibility(substring(_latin2'ab',1));
select collation(insert(_latin2'abcd',2,3,_latin2'ef')), coercibility(insert(_latin2'abcd',2,3,_latin2'ef'));
create table t1
select
......@@ -174,7 +175,8 @@ select
reverse(_latin2'ab'),
quote(_latin2'ab'),
soundex(_latin2'ab'),
substring(_latin2'ab',1)
substring(_latin2'ab',1),
insert(_latin2'abcd',2,3,_latin2'ef')
;
show create table t1;
......
......@@ -861,6 +861,14 @@ String *Item_func_insert::val_str(String *str)
void Item_func_insert::fix_length_and_dec()
{
if (set_charset(args[0]->charset(), args[0]->coercibility,
args[3]->charset(), args[3]->coercibility))
{
my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0),
args[0]->charset()->name,coercion_name(args[0]->coercibility),
args[3]->charset()->name,coercion_name(args[3]->coercibility),
func_name());
}
max_length=args[0]->max_length+args[3]->max_length;
if (max_length > MAX_BLOB_WIDTH)
{
......
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