mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge from 5.3.
This commit is contained in:
@ -64,6 +64,14 @@ select a sounds like a from t1;
|
|||||||
select 1 from t1 order by cast(a as char(1));
|
select 1 from t1 order by cast(a as char(1));
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
--echo #
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#27580 SPACE() function collation bug?
|
# Bug#27580 SPACE() function collation bug?
|
||||||
#
|
#
|
||||||
|
@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
big5_chinese_ci .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
|
@ -75,6 +75,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
cp1250_general_ci .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
@ -168,6 +177,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
cp1250_czech_cs .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
|
@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
euckr_korean_ci .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
|
@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
gb2312_chinese_ci .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
|
@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
gbk_chinese_ci .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
|
@ -308,6 +308,108 @@ select 'a' regexp 'A' collate latin1_general_cs;
|
|||||||
select 'a' regexp 'A' collate latin1_bin;
|
select 'a' regexp 'A' collate latin1_bin;
|
||||||
'a' regexp 'A' collate latin1_bin
|
'a' regexp 'A' collate latin1_bin
|
||||||
0
|
0
|
||||||
|
SET @test_character_set= 'latin1';
|
||||||
|
SET @test_collation= 'latin1_swedish_ci';
|
||||||
|
SET @safe_character_set_server= @@character_set_server;
|
||||||
|
SET @safe_collation_server= @@collation_server;
|
||||||
|
SET @safe_character_set_client= @@character_set_client;
|
||||||
|
SET @safe_character_set_results= @@character_set_results;
|
||||||
|
SET character_set_server= @test_character_set;
|
||||||
|
SET collation_server= @test_collation;
|
||||||
|
CREATE DATABASE d1;
|
||||||
|
USE d1;
|
||||||
|
CREATE TABLE t1 (c CHAR(10), KEY(c));
|
||||||
|
SHOW FULL COLUMNS FROM t1;
|
||||||
|
Field Type Collation Null Key Default Extra Privileges Comment
|
||||||
|
c char(10) latin1_swedish_ci YES MUL NULL
|
||||||
|
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||||
|
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
|
||||||
|
want3results
|
||||||
|
aaa
|
||||||
|
aaaa
|
||||||
|
aaaaa
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
|
||||||
|
SHOW FULL COLUMNS FROM t1;
|
||||||
|
Field Type Collation Null Key Default Extra Privileges Comment
|
||||||
|
c1 varchar(15) latin1_swedish_ci YES MUL NULL
|
||||||
|
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
|
||||||
|
SELECT c1 as want3results from t1 where c1 like 'l%';
|
||||||
|
want3results
|
||||||
|
location
|
||||||
|
loberge
|
||||||
|
lotre
|
||||||
|
SELECT c1 as want3results from t1 where c1 like 'lo%';
|
||||||
|
want3results
|
||||||
|
location
|
||||||
|
loberge
|
||||||
|
lotre
|
||||||
|
SELECT c1 as want1result from t1 where c1 like 'loc%';
|
||||||
|
want1result
|
||||||
|
location
|
||||||
|
SELECT c1 as want1result from t1 where c1 like 'loca%';
|
||||||
|
want1result
|
||||||
|
location
|
||||||
|
SELECT c1 as want1result from t1 where c1 like 'locat%';
|
||||||
|
want1result
|
||||||
|
location
|
||||||
|
SELECT c1 as want1result from t1 where c1 like 'locati%';
|
||||||
|
want1result
|
||||||
|
location
|
||||||
|
SELECT c1 as want1result from t1 where c1 like 'locatio%';
|
||||||
|
want1result
|
||||||
|
location
|
||||||
|
SELECT c1 as want1result from t1 where c1 like 'location%';
|
||||||
|
want1result
|
||||||
|
location
|
||||||
|
DROP TABLE t1;
|
||||||
|
create table t1 (a set('a') not null);
|
||||||
|
insert into t1 values (),();
|
||||||
|
Warnings:
|
||||||
|
Warning 1364 Field 'a' doesn't have a default value
|
||||||
|
select cast(a as char(1)) from t1;
|
||||||
|
cast(a as char(1))
|
||||||
|
|
||||||
|
|
||||||
|
select a sounds like a from t1;
|
||||||
|
a sounds like a
|
||||||
|
1
|
||||||
|
1
|
||||||
|
select 1 from t1 order by cast(a as char(1));
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
latin1_swedish_ci .wwwmysqlcom
|
||||||
|
set names utf8;
|
||||||
|
create table t1 (
|
||||||
|
name varchar(10),
|
||||||
|
level smallint unsigned);
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`name` varchar(10) DEFAULT NULL,
|
||||||
|
`level` smallint(5) unsigned DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
insert into t1 values ('string',1);
|
||||||
|
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
|
||||||
|
concat(name,space(level)) concat(name, repeat(' ',level))
|
||||||
|
string string
|
||||||
|
drop table t1;
|
||||||
|
DROP DATABASE d1;
|
||||||
|
USE test;
|
||||||
|
SET character_set_server= @safe_character_set_server;
|
||||||
|
SET collation_server= @safe_collation_server;
|
||||||
|
SET character_set_client= @safe_character_set_client;
|
||||||
|
SET character_set_results= @safe_character_set_results;
|
||||||
SET collation_connection='latin1_swedish_ci';
|
SET collation_connection='latin1_swedish_ci';
|
||||||
create table t1 select repeat('a',4000) a;
|
create table t1 select repeat('a',4000) a;
|
||||||
delete from t1;
|
delete from t1;
|
||||||
|
@ -2725,6 +2725,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
utf8_swedish_ci .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
|
@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
ucs2_general_ci .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
|
@ -2241,6 +2241,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
utf16_swedish_ci .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
|
@ -2241,6 +2241,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
utf32_swedish_ci .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
|
@ -119,7 +119,7 @@ substring_index('aaaaaaaaa1','aaa',-3)
|
|||||||
aaaaaa1
|
aaaaaa1
|
||||||
select substring_index('aaaaaaaaa1','aaa',-4);
|
select substring_index('aaaaaaaaa1','aaa',-4);
|
||||||
substring_index('aaaaaaaaa1','aaa',-4)
|
substring_index('aaaaaaaaa1','aaa',-4)
|
||||||
|
aaaaaaaaa1
|
||||||
select substring_index('the king of thethe hill','the',-2);
|
select substring_index('the king of thethe hill','the',-2);
|
||||||
substring_index('the king of thethe hill','the',-2)
|
substring_index('the king of thethe hill','the',-2)
|
||||||
the hill
|
the hill
|
||||||
|
@ -74,6 +74,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
cp932_japanese_ci .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
|
@ -74,6 +74,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
cp932_japanese_ci .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
|
@ -79,6 +79,10 @@ select 'a' regexp 'A' collate latin1_general_cs;
|
|||||||
select 'a' regexp 'A' collate latin1_bin;
|
select 'a' regexp 'A' collate latin1_bin;
|
||||||
|
|
||||||
|
|
||||||
|
SET @test_character_set= 'latin1';
|
||||||
|
SET @test_collation= 'latin1_swedish_ci';
|
||||||
|
-- source include/ctype_common.inc
|
||||||
|
|
||||||
SET collation_connection='latin1_swedish_ci';
|
SET collation_connection='latin1_swedish_ci';
|
||||||
-- source include/ctype_filesort.inc
|
-- source include/ctype_filesort.inc
|
||||||
-- source include/ctype_like_escape.inc
|
-- source include/ctype_like_escape.inc
|
||||||
|
@ -1579,6 +1579,8 @@ String *Item_func_substr_index::val_str(String *str)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (count)
|
||||||
|
return res; // Didn't find, return org string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -76,6 +76,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
cp1250_general_ci .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
@ -169,6 +178,15 @@ select 1 from t1 order by cast(a as char(1));
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
|
||||||
|
#
|
||||||
|
SET character_set_client=latin1;
|
||||||
|
SET character_set_connection= @test_character_set;
|
||||||
|
SET collation_connection= @test_collation;
|
||||||
|
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
|
||||||
|
COLLATION('.') c1
|
||||||
|
cp1250_czech_cs .wwwmysqlcom
|
||||||
set names utf8;
|
set names utf8;
|
||||||
create table t1 (
|
create table t1 (
|
||||||
name varchar(10),
|
name varchar(10),
|
||||||
|
Reference in New Issue
Block a user