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
7e8ddb6b
Commit
7e8ddb6b
authored
Dec 08, 2010
by
Georgi Kodinov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport of the 5.1 fix for bug #55826 to 5.0
parent
5df7f9bc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
1 deletion
+42
-1
mysql-test/r/innodb_mysql.result
mysql-test/r/innodb_mysql.result
+12
-0
mysql-test/t/innodb_mysql.test
mysql-test/t/innodb_mysql.test
+15
-0
sql/item_func.cc
sql/item_func.cc
+15
-1
No files found.
mysql-test/r/innodb_mysql.result
View file @
7e8ddb6b
...
...
@@ -1315,4 +1315,16 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1
DROP TABLE t1,t2;
#
# Bug#55826: create table .. select crashes with when KILL_BAD_DATA
# is returned
#
CREATE TABLE t1(a INT) ENGINE=innodb;
INSERT INTO t1 VALUES (0);
SET SQL_MODE='STRICT_ALL_TABLES';
CREATE TABLE t2
SELECT LEAST((SELECT '' FROM t1),NOW()) FROM `t1`;
ERROR 22007: Truncated incorrect datetime value: ''
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
End of 5.0 tests
mysql-test/t/innodb_mysql.test
View file @
7e8ddb6b
...
...
@@ -1073,4 +1073,19 @@ explain
select
b
from
t1
where
a
not
in
(
select
b
from
t1
,
t2
group
by
a
)
group
by
a
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# Bug#55826: create table .. select crashes with when KILL_BAD_DATA
--
echo
# is returned
--
echo
#
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
innodb
;
INSERT
INTO
t1
VALUES
(
0
);
SET
SQL_MODE
=
'STRICT_ALL_TABLES'
;
--
error
ER_TRUNCATED_WRONG_VALUE
CREATE
TABLE
t2
SELECT
LEAST
((
SELECT
''
FROM
t1
),
NOW
())
FROM
`t1`
;
DROP
TABLE
t1
;
SET
SQL_MODE
=
DEFAULT
;
--
echo
End
of
5.0
tests
sql/item_func.cc
View file @
7e8ddb6b
...
...
@@ -2270,7 +2270,7 @@ void Item_func_min_max::fix_length_and_dec()
stored to the value pointer, if latter is provided.
RETURN
0 If one of arguments is NULL
0 If one of arguments is NULL
or there was a execution error
# index of the least/greatest argument
*/
...
...
@@ -2284,6 +2284,14 @@ uint Item_func_min_max::cmp_datetimes(ulonglong *value)
Item
**
arg
=
args
+
i
;
bool
is_null
;
longlong
res
=
get_datetime_value
(
thd
,
&
arg
,
0
,
datetime_item
,
&
is_null
);
/* Check if we need to stop (because of error or KILL) and stop the loop */
if
(
thd
->
net
.
report_error
)
{
null_value
=
1
;
return
0
;
}
if
((
null_value
=
args
[
i
]
->
null_value
))
return
0
;
if
(
i
==
0
||
(
res
<
min_max
?
cmp_sign
:
-
cmp_sign
)
>
0
)
...
...
@@ -2312,6 +2320,12 @@ String *Item_func_min_max::val_str(String *str)
if
(
null_value
)
return
0
;
str_res
=
args
[
min_max_idx
]
->
val_str
(
str
);
if
(
args
[
min_max_idx
]
->
null_value
)
{
// check if the call to val_str() above returns a NULL value
null_value
=
1
;
return
NULL
;
}
str_res
->
set_charset
(
collation
.
collation
);
return
str_res
;
}
...
...
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