Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
cfa4548b
Commit
cfa4548b
authored
Apr 21, 2014
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
parent
8db600f9
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
188 additions
and
0 deletions
+188
-0
mysql-test/include/ctype_common.inc
mysql-test/include/ctype_common.inc
+8
-0
mysql-test/r/ctype_big5.result
mysql-test/r/ctype_big5.result
+9
-0
mysql-test/r/ctype_cp1250_ch.result
mysql-test/r/ctype_cp1250_ch.result
+18
-0
mysql-test/r/ctype_euckr.result
mysql-test/r/ctype_euckr.result
+9
-0
mysql-test/r/ctype_gb2312.result
mysql-test/r/ctype_gb2312.result
+9
-0
mysql-test/r/ctype_gbk.result
mysql-test/r/ctype_gbk.result
+9
-0
mysql-test/r/ctype_latin1.result
mysql-test/r/ctype_latin1.result
+102
-0
mysql-test/r/ctype_uca.result
mysql-test/r/ctype_uca.result
+9
-0
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_ucs.result
+9
-0
mysql-test/t/ctype_latin1.test
mysql-test/t/ctype_latin1.test
+4
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+2
-0
No files found.
mysql-test/include/ctype_common.inc
View file @
cfa4548b
...
...
@@ -64,6 +64,14 @@ select a sounds like a from t1;
select
1
from
t1
order
by
cast
(
a
as
char
(
1
));
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?
#
...
...
mysql-test/r/ctype_big5.result
View file @
cfa4548b
...
...
@@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(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
big5_chinese_ci .wwwmysqlcom
set names utf8;
create table t1 (
name varchar(10),
...
...
mysql-test/r/ctype_cp1250_ch.result
View file @
cfa4548b
...
...
@@ -75,6 +75,15 @@ select 1 from t1 order by cast(a as char(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
cp1250_general_ci .wwwmysqlcom
set names utf8;
create table t1 (
name varchar(10),
...
...
@@ -168,6 +177,15 @@ select 1 from t1 order by cast(a as char(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
cp1250_czech_cs .wwwmysqlcom
set names utf8;
create table t1 (
name varchar(10),
...
...
mysql-test/r/ctype_euckr.result
View file @
cfa4548b
...
...
@@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(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
euckr_korean_ci .wwwmysqlcom
set names utf8;
create table t1 (
name varchar(10),
...
...
mysql-test/r/ctype_gb2312.result
View file @
cfa4548b
...
...
@@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(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
gb2312_chinese_ci .wwwmysqlcom
set names utf8;
create table t1 (
name varchar(10),
...
...
mysql-test/r/ctype_gbk.result
View file @
cfa4548b
...
...
@@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(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
gbk_chinese_ci .wwwmysqlcom
set names utf8;
create table t1 (
name varchar(10),
...
...
mysql-test/r/ctype_latin1.result
View file @
cfa4548b
...
...
@@ -308,6 +308,108 @@ select 'a' regexp 'A' collate latin1_general_cs;
select 'a' regexp 'A' collate latin1_bin;
'a' regexp 'A' collate latin1_bin
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';
create table t1 select repeat('a',4000) a;
delete from t1;
...
...
mysql-test/r/ctype_uca.result
View file @
cfa4548b
...
...
@@ -2725,6 +2725,15 @@ select 1 from t1 order by cast(a as char(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
utf8_swedish_ci .wwwmysqlcom
set names utf8;
create table t1 (
name varchar(10),
...
...
mysql-test/r/ctype_ucs.result
View file @
cfa4548b
...
...
@@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(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
ucs2_general_ci .wwwmysqlcom
set names utf8;
create table t1 (
name varchar(10),
...
...
mysql-test/t/ctype_latin1.test
View file @
cfa4548b
...
...
@@ -79,6 +79,10 @@ select 'a' regexp 'A' collate latin1_general_cs;
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'
;
--
source
include
/
ctype_filesort
.
inc
--
source
include
/
ctype_like_escape
.
inc
...
...
sql/item_strfunc.cc
View file @
cfa4548b
...
...
@@ -1404,6 +1404,8 @@ String *Item_func_substr_index::val_str(String *str)
break
;
}
}
if
(
count
)
return
res
;
// Didn't find, return org string
}
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment