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
e26a344d
Commit
e26a344d
authored
Jul 22, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix calculation for length of LPAD() and RPAD() reported to
client via mysql_fetch_fields(). (Bug #11311)
parent
44a446dc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+15
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+11
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+0
-2
No files found.
mysql-test/r/func_str.result
View file @
e26a344d
...
@@ -868,3 +868,18 @@ drop table t1;
...
@@ -868,3 +868,18 @@ drop table t1;
select hex(29223372036854775809), hex(-29223372036854775809);
select hex(29223372036854775809), hex(-29223372036854775809);
hex(29223372036854775809) hex(-29223372036854775809)
hex(29223372036854775809) hex(-29223372036854775809)
FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF
create table t1 (i int);
insert into t1 values (1000000000),(1);
select lpad(i, 7, ' ') as t from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def t 253 7 7 Y 128 31 63
t
1000000
1
select rpad(i, 7, ' ') as t from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def t 253 7 7 Y 128 31 63
t
1000000
1
drop table t1;
mysql-test/t/func_str.test
View file @
e26a344d
...
@@ -611,3 +611,14 @@ drop table t1;
...
@@ -611,3 +611,14 @@ drop table t1;
# Bug #9854 hex() and out of range handling
# Bug #9854 hex() and out of range handling
#
#
select
hex
(
29223372036854775809
),
hex
(
-
29223372036854775809
);
select
hex
(
29223372036854775809
),
hex
(
-
29223372036854775809
);
#
# Bug #11311: Incorrect length returned from LPAD() and RPAD()
#
create
table
t1
(
i
int
);
insert
into
t1
values
(
1000000000
),(
1
);
--
enable_metadata
select
lpad
(
i
,
7
,
' '
)
as
t
from
t1
;
select
rpad
(
i
,
7
,
' '
)
as
t
from
t1
;
--
disable_metadata
drop
table
t1
;
sql/item_strfunc.cc
View file @
e26a344d
...
@@ -2042,7 +2042,6 @@ void Item_func_rpad::fix_length_and_dec()
...
@@ -2042,7 +2042,6 @@ void Item_func_rpad::fix_length_and_dec()
{
{
ulonglong
length
=
((
ulonglong
)
args
[
1
]
->
val_int
()
*
ulonglong
length
=
((
ulonglong
)
args
[
1
]
->
val_int
()
*
collation
.
collation
->
mbmaxlen
);
collation
.
collation
->
mbmaxlen
);
length
=
max
((
ulonglong
)
args
[
0
]
->
max_length
,
length
);
if
(
length
>=
MAX_BLOB_WIDTH
)
if
(
length
>=
MAX_BLOB_WIDTH
)
{
{
length
=
MAX_BLOB_WIDTH
;
length
=
MAX_BLOB_WIDTH
;
...
@@ -2130,7 +2129,6 @@ void Item_func_lpad::fix_length_and_dec()
...
@@ -2130,7 +2129,6 @@ void Item_func_lpad::fix_length_and_dec()
{
{
ulonglong
length
=
((
ulonglong
)
args
[
1
]
->
val_int
()
*
ulonglong
length
=
((
ulonglong
)
args
[
1
]
->
val_int
()
*
collation
.
collation
->
mbmaxlen
);
collation
.
collation
->
mbmaxlen
);
length
=
max
((
ulonglong
)
args
[
0
]
->
max_length
,
length
);
if
(
length
>=
MAX_BLOB_WIDTH
)
if
(
length
>=
MAX_BLOB_WIDTH
)
{
{
length
=
MAX_BLOB_WIDTH
;
length
=
MAX_BLOB_WIDTH
;
...
...
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