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
e400450f
Commit
e400450f
authored
Jan 25, 2013
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Plain Diff
5.1 merge
parents
9142c50b
7f208d3c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
9 deletions
+64
-9
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+18
-0
mysql-test/r/group_min_max.result
mysql-test/r/group_min_max.result
+7
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+11
-0
mysql-test/t/group_min_max.test
mysql-test/t/group_min_max.test
+9
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+14
-6
sql/opt_range.cc
sql/opt_range.cc
+5
-3
No files found.
mysql-test/r/func_str.result
View file @
e400450f
...
...
@@ -2628,4 +2628,22 @@ SELECT * FROM t1;
a
aaaaaaaaaaaaaa
DROP TABLE t1;
SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1)));
SUBSTRING('1', DAY(FROM_UNIXTIME(-1)))
NULL
SELECT LEFT('1', DAY(FROM_UNIXTIME(-1)));
LEFT('1', DAY(FROM_UNIXTIME(-1)))
NULL
SELECT RIGHT('1', DAY(FROM_UNIXTIME(-1)));
RIGHT('1', DAY(FROM_UNIXTIME(-1)))
NULL
SELECT REPEAT('1', DAY(FROM_UNIXTIME(-1)));
REPEAT('1', DAY(FROM_UNIXTIME(-1)))
NULL
SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?')
NULL
SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?')
NULL
End of 5.1 tests
mysql-test/r/group_min_max.result
View file @
e400450f
...
...
@@ -2780,6 +2780,13 @@ ORDER BY min_a;
min_a
NULL
DROP TABLE t1;
create table t1 (a int, b varchar(1), key(b,a)) engine=myisam;
insert t1 values (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(null,'i');
select min(a), b from t1 where a=7 or b='z' group by b;
min(a) b
7 g
flush tables;
drop table t1;
#
# LP BUG#888456 Wrong result with DISTINCT , ANY , subquery_cache=off , NOT NULL
#
...
...
mysql-test/t/func_str.test
View file @
e400450f
...
...
@@ -1380,4 +1380,15 @@ LOAD DATA INFILE 'bug58165.txt' INTO TABLE t1;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
#
# MDEV-759 lp:998340 - Valgrind complains on simple selects containing expression DAY(FROM_UNIXTIME(-1))
#
SELECT
SUBSTRING
(
'1'
,
DAY
(
FROM_UNIXTIME
(
-
1
)));
SELECT
LEFT
(
'1'
,
DAY
(
FROM_UNIXTIME
(
-
1
)));
SELECT
RIGHT
(
'1'
,
DAY
(
FROM_UNIXTIME
(
-
1
)));
SELECT
REPEAT
(
'1'
,
DAY
(
FROM_UNIXTIME
(
-
1
)));
SELECT
RPAD
(
'hi'
,
DAY
(
FROM_UNIXTIME
(
-
1
)),
'?'
);
SELECT
LPAD
(
'hi'
,
DAY
(
FROM_UNIXTIME
(
-
1
)),
'?'
);
--
echo
End
of
5.1
tests
mysql-test/t/group_min_max.test
View file @
e400450f
...
...
@@ -1099,6 +1099,15 @@ ORDER BY min_a;
DROP
TABLE
t1
;
#
# MDEV-729 lp:998028 - Server crashes on normal shutdown in closefrm after executing a query from MyISAM table
#
create
table
t1
(
a
int
,
b
varchar
(
1
),
key
(
b
,
a
))
engine
=
myisam
;
insert
t1
values
(
1
,
'a'
),(
2
,
'b'
),(
3
,
'c'
),(
4
,
'd'
),(
5
,
'e'
),(
6
,
'f'
),(
7
,
'g'
),(
8
,
'h'
),(
null
,
'i'
);
select
min
(
a
),
b
from
t1
where
a
=
7
or
b
=
'z'
group
by
b
;
flush
tables
;
drop
table
t1
;
--
echo
#
--
echo
# LP BUG#888456 Wrong result with DISTINCT , ANY , subquery_cache=off , NOT NULL
--
echo
#
...
...
sql/item_strfunc.cc
View file @
e400450f
...
...
@@ -1167,7 +1167,7 @@ void Item_str_func::left_right_max_length()
if
(
args
[
1
]
->
const_item
())
{
int
length
=
(
int
)
args
[
1
]
->
val_int
()
*
collation
.
collation
->
mbmaxlen
;
if
(
length
<=
0
)
if
(
args
[
1
]
->
null_value
||
length
<=
0
)
max_length
=
0
;
else
set_if_smaller
(
max_length
,(
uint
)
length
);
...
...
@@ -1270,7 +1270,9 @@ void Item_func_substr::fix_length_and_dec()
if
(
args
[
1
]
->
const_item
())
{
int32
start
=
(
int32
)
args
[
1
]
->
val_int
();
if
(
start
<
0
)
if
(
args
[
1
]
->
null_value
)
max_length
=
0
;
else
if
(
start
<
0
)
max_length
=
((
uint
)(
-
start
)
>
max_length
)
?
0
:
(
uint
)(
-
start
);
else
max_length
-=
min
((
uint
)(
start
-
1
),
max_length
);
...
...
@@ -1278,7 +1280,7 @@ void Item_func_substr::fix_length_and_dec()
if
(
arg_count
==
3
&&
args
[
2
]
->
const_item
())
{
int32
length
=
(
int32
)
args
[
2
]
->
val_int
();
if
(
length
<=
0
)
if
(
args
[
2
]
->
null_value
||
length
<=
0
)
max_length
=
0
;
/* purecov: inspected */
else
set_if_smaller
(
max_length
,(
uint
)
length
);
...
...
@@ -2411,7 +2413,9 @@ void Item_func_repeat::fix_length_and_dec()
/* Assumes that the maximum length of a String is < INT_MAX32. */
/* Set here so that rest of code sees out-of-bound value as such. */
if
(
count
>
INT_MAX32
)
if
(
args
[
1
]
->
null_value
)
count
=
0
;
else
if
(
count
>
INT_MAX32
)
count
=
INT_MAX32
;
ulonglong
max_result_length
=
(
ulonglong
)
args
[
0
]
->
max_length
*
count
;
...
...
@@ -2499,7 +2503,9 @@ void Item_func_rpad::fix_length_and_dec()
/* Assumes that the maximum length of a String is < INT_MAX32. */
/* Set here so that rest of code sees out-of-bound value as such. */
if
(
temp
>
INT_MAX32
)
if
(
args
[
1
]
->
null_value
)
temp
=
0
;
else
if
(
temp
>
INT_MAX32
)
temp
=
INT_MAX32
;
length
=
temp
*
collation
.
collation
->
mbmaxlen
;
...
...
@@ -2616,7 +2622,9 @@ void Item_func_lpad::fix_length_and_dec()
/* Assumes that the maximum length of a String is < INT_MAX32. */
/* Set here so that rest of code sees out-of-bound value as such. */
if
(
temp
>
INT_MAX32
)
if
(
args
[
1
]
->
null_value
)
temp
=
0
;
else
if
(
temp
>
INT_MAX32
)
temp
=
INT_MAX32
;
length
=
temp
*
collation
.
collation
->
mbmaxlen
;
...
...
sql/opt_range.cc
View file @
e400450f
...
...
@@ -10826,9 +10826,10 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min()
*/
if
(
min_max_arg_part
&&
min_max_arg_part
->
field
->
is_null
())
{
uchar
*
tmp_key_buff
=
(
uchar
*
)
my_alloca
(
max_used_key_length
);
/* Find the first subsequent record without NULL in the MIN/MAX field. */
key_copy
(
tmp_
record
,
record
,
index_info
,
max_used_key_length
);
result
=
file
->
ha_index_read_map
(
record
,
tmp_
record
,
key_copy
(
tmp_
key_buff
,
record
,
index_info
,
max_used_key_length
);
result
=
file
->
ha_index_read_map
(
record
,
tmp_
key_buff
,
make_keypart_map
(
real_key_parts
),
HA_READ_AFTER_KEY
);
/*
...
...
@@ -10844,10 +10845,11 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min()
if
(
!
result
)
{
if
(
key_cmp
(
index_info
->
key_part
,
group_prefix
,
real_prefix_len
))
key_restore
(
record
,
tmp_
record
,
index_info
,
0
);
key_restore
(
record
,
tmp_
key_buff
,
index_info
,
0
);
}
else
if
(
result
==
HA_ERR_KEY_NOT_FOUND
||
result
==
HA_ERR_END_OF_FILE
)
result
=
0
;
/* There is a result in any case. */
my_afree
(
tmp_key_buff
);
}
}
...
...
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