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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
8ffd9a91
Commit
8ffd9a91
authored
Mar 09, 2004
by
ram@gw.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for the bug #3089: SUBSTRING bug when mixed with CONCAT and ORDER BY
parent
6a10859b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+10
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+13
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+1
-1
No files found.
mysql-test/r/func_str.result
View file @
8ffd9a91
...
@@ -624,3 +624,13 @@ Note 1003 select high_priority md5(_latin1'hello') AS `md5('hello')`,sha(_latin1
...
@@ -624,3 +624,13 @@ Note 1003 select high_priority md5(_latin1'hello') AS `md5('hello')`,sha(_latin1
SELECT lpad(12345, 5, "#");
SELECT lpad(12345, 5, "#");
lpad(12345, 5, "#")
lpad(12345, 5, "#")
12345
12345
create table t1 (id int(1), str varchar(10)) DEFAULT CHARSET=utf8;
insert into t1 values (1,'aaaaaaaaaa'), (2,'bbbbbbbbbb');
create table t2 (id int(1), str varchar(10)) DEFAULT CHARSET=utf8;
insert into t2 values (1,'cccccccccc'), (2,'dddddddddd');
select substring(concat(t1.str, t2.str), 1, 15) "name" from t1, t2
where t2.id=t1.id order by name;
name
aaaaaaaaaaccccc
bbbbbbbbbbddddd
drop table t1, t2;
mysql-test/t/func_str.test
View file @
8ffd9a91
...
@@ -360,3 +360,16 @@ explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'moo
...
@@ -360,3 +360,16 @@ explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'moo
#
#
SELECT
lpad
(
12345
,
5
,
"#"
);
SELECT
lpad
(
12345
,
5
,
"#"
);
#
# Bug #3089
#
create
table
t1
(
id
int
(
1
),
str
varchar
(
10
))
DEFAULT
CHARSET
=
utf8
;
insert
into
t1
values
(
1
,
'aaaaaaaaaa'
),
(
2
,
'bbbbbbbbbb'
);
create
table
t2
(
id
int
(
1
),
str
varchar
(
10
))
DEFAULT
CHARSET
=
utf8
;
insert
into
t2
values
(
1
,
'cccccccccc'
),
(
2
,
'dddddddddd'
);
select
substring
(
concat
(
t1
.
str
,
t2
.
str
),
1
,
15
)
"name"
from
t1
,
t2
where
t2
.
id
=
t1
.
id
order
by
name
;
drop
table
t1
,
t2
;
sql/item_strfunc.cc
View file @
8ffd9a91
...
@@ -1033,7 +1033,7 @@ void Item_func_substr::fix_length_and_dec()
...
@@ -1033,7 +1033,7 @@ void Item_func_substr::fix_length_and_dec()
}
}
if
(
arg_count
==
3
&&
args
[
2
]
->
const_item
())
if
(
arg_count
==
3
&&
args
[
2
]
->
const_item
())
{
{
int32
length
=
(
int32
)
args
[
2
]
->
val_int
()
*
default_charset_info
->
mbmaxlen
;
int32
length
=
(
int32
)
args
[
2
]
->
val_int
()
*
collation
.
collation
->
mbmaxlen
;
if
(
length
<=
0
)
if
(
length
<=
0
)
max_length
=
0
;
/* purecov: inspected */
max_length
=
0
;
/* purecov: inspected */
else
else
...
...
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