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
213f1036
Commit
213f1036
authored
Apr 21, 2014
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-6045 MySQL Bug#11829861 - SUBSTRING_INDEX() RESULTS "OMIT" CHARACTER WHEN USED INSIDE LOWER()
parent
5fc5195f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
3 deletions
+61
-3
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+30
-1
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+27
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+4
-2
No files found.
mysql-test/r/func_str.result
View file @
213f1036
...
...
@@ -119,7 +119,7 @@ substring_index('aaaaaaaaa1','aaa',-3)
aaaaaa1
select substring_index('aaaaaaaaa1','aaa',-4);
substring_index('aaaaaaaaa1','aaa',-4)
aaaaaaaaa1
select substring_index('the king of thethe hill','the',-2);
substring_index('the king of thethe hill','the',-2)
the hill
...
...
@@ -2657,3 +2657,32 @@ NULL NULL
8
drop table t1;
End of 5.1 tests
#
# Start of 5.3 tests
#
#
# Bug#11829861: SUBSTRING_INDEX() RESULTS IN MISSING CHARACTERS WHEN USED
# INSIDE LOWER()
#
SET @user_at_host = 'root@mytinyhost-PC.local';
SELECT LOWER(SUBSTRING_INDEX(@user_at_host, '@', -1));
LOWER(SUBSTRING_INDEX(@user_at_host, '@', -1))
mytinyhost-pc.local
# End of test BUG#11829861
#
# Bug#42404: SUBSTRING_INDEX() RESULTS ARE INCONSISTENT
#
CREATE TABLE t (i INT NOT NULL, c CHAR(255) NOT NULL);
INSERT INTO t VALUES (0,'.www.mysql.com'),(1,'.wwwmysqlcom');
SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t WHERE i = 1;
i SUBSTRING_INDEX(c, '.', -2)
1 .wwwmysqlcom
SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t;
i SUBSTRING_INDEX(c, '.', -2)
0 mysql.com
1 .wwwmysqlcom
DROP TABLE t;
# End of test BUG#42404
#
# End of 5.3 tests
#
mysql-test/t/func_str.test
View file @
213f1036
...
...
@@ -1405,3 +1405,30 @@ select group_concat( i ), make_set( i, 'a', 'b' ) field from t1 group by field;
drop
table
t1
;
--
echo
End
of
5.1
tests
--
echo
#
--
echo
# Start of 5.3 tests
--
echo
#
--
echo
#
--
echo
# Bug#11829861: SUBSTRING_INDEX() RESULTS IN MISSING CHARACTERS WHEN USED
--
echo
# INSIDE LOWER()
--
echo
#
SET
@
user_at_host
=
'root@mytinyhost-PC.local'
;
SELECT
LOWER
(
SUBSTRING_INDEX
(
@
user_at_host
,
'@'
,
-
1
));
--
echo
# End of test BUG#11829861
--
echo
#
--
echo
# Bug#42404: SUBSTRING_INDEX() RESULTS ARE INCONSISTENT
--
echo
#
CREATE
TABLE
t
(
i
INT
NOT
NULL
,
c
CHAR
(
255
)
NOT
NULL
);
INSERT
INTO
t
VALUES
(
0
,
'.www.mysql.com'
),(
1
,
'.wwwmysqlcom'
);
SELECT
i
,
SUBSTRING_INDEX
(
c
,
'.'
,
-
2
)
FROM
t
WHERE
i
=
1
;
SELECT
i
,
SUBSTRING_INDEX
(
c
,
'.'
,
-
2
)
FROM
t
;
DROP
TABLE
t
;
--
echo
# End of test BUG#42404
--
echo
#
--
echo
# End of 5.3 tests
--
echo
#
sql/item_strfunc.cc
View file @
213f1036
...
...
@@ -1095,7 +1095,7 @@ String *Item_str_conv::val_str(String *str)
if
(
multiply
==
1
)
{
uint
len
;
res
=
copy_if_not_alloced
(
str
,
res
,
res
->
length
());
res
=
copy_if_not_alloced
(
&
tmp_value
,
res
,
res
->
length
());
len
=
converter
(
collation
.
collation
,
(
char
*
)
res
->
ptr
(),
res
->
length
(),
(
char
*
)
res
->
ptr
(),
res
->
length
());
DBUG_ASSERT
(
len
<=
res
->
length
());
...
...
@@ -1296,8 +1296,10 @@ void Item_func_substr_index::fix_length_and_dec()
String
*
Item_func_substr_index
::
val_str
(
String
*
str
)
{
DBUG_ASSERT
(
fixed
==
1
);
char
buff
[
MAX_FIELD_WIDTH
];
String
tmp
(
buff
,
sizeof
(
buff
),
system_charset_info
);
String
*
res
=
args
[
0
]
->
val_str
(
str
);
String
*
delimiter
=
args
[
1
]
->
val_str
(
&
tmp
_value
);
String
*
delimiter
=
args
[
1
]
->
val_str
(
&
tmp
);
int32
count
=
(
int32
)
args
[
2
]
->
val_int
();
uint
offset
;
...
...
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