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
8b9e56b7
Commit
8b9e56b7
authored
Jun 24, 2010
by
Alexey Kopytov
Browse files
Options
Browse Files
Download
Plain Diff
Automerge.
parents
e233dc2b
07e95b39
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
0 deletions
+45
-0
mysql-test/r/func_in.result
mysql-test/r/func_in.result
+20
-0
mysql-test/t/func_in.test
mysql-test/t/func_in.test
+15
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+10
-0
No files found.
mysql-test/r/func_in.result
View file @
8b9e56b7
...
...
@@ -750,4 +750,24 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DROP TABLE t1;
#
# Bug#54477: Crash on IN / CASE with NULL arguments
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2);
SELECT 1 IN (NULL, a) FROM t1;
1 IN (NULL, a)
1
NULL
SELECT a IN (a, a) FROM t1 GROUP BY a WITH ROLLUP;
a IN (a, a)
1
1
NULL
SELECT CASE a WHEN a THEN a END FROM t1 GROUP BY a WITH ROLLUP;
CASE a WHEN a THEN a END
1
2
NULL
DROP TABLE t1;
#
End of 5.1 tests
mysql-test/t/func_in.test
View file @
8b9e56b7
...
...
@@ -539,6 +539,21 @@ EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, NULL);
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#54477: Crash on IN / CASE with NULL arguments
--
echo
#
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
1
),
(
2
);
SELECT
1
IN
(
NULL
,
a
)
FROM
t1
;
SELECT
a
IN
(
a
,
a
)
FROM
t1
GROUP
BY
a
WITH
ROLLUP
;
SELECT
CASE
a
WHEN
a
THEN
a
END
FROM
t1
GROUP
BY
a
WITH
ROLLUP
;
DROP
TABLE
t1
;
--
echo
#
--
echo
End
of
5.1
tests
sql/item_cmpfunc.cc
View file @
8b9e56b7
...
...
@@ -2773,6 +2773,8 @@ Item *Item_func_case::find_item(String *str)
/* Compare every WHEN argument with it and return the first match */
for
(
uint
i
=
0
;
i
<
ncases
;
i
+=
2
)
{
if
(
args
[
i
]
->
real_item
()
->
type
()
==
NULL_ITEM
)
continue
;
cmp_type
=
item_cmp_type
(
left_result_type
,
args
[
i
]
->
result_type
());
DBUG_ASSERT
(
cmp_type
!=
ROW_RESULT
);
DBUG_ASSERT
(
cmp_items
[(
uint
)
cmp_type
]);
...
...
@@ -4002,9 +4004,17 @@ longlong Item_func_in::val_int()
return
(
longlong
)
(
!
null_value
&&
tmp
!=
negated
);
}
if
((
null_value
=
args
[
0
]
->
real_item
()
->
type
()
==
NULL_ITEM
))
return
0
;
have_null
=
0
;
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
{
if
(
args
[
i
]
->
real_item
()
->
type
()
==
NULL_ITEM
)
{
have_null
=
TRUE
;
continue
;
}
Item_result
cmp_type
=
item_cmp_type
(
left_result_type
,
args
[
i
]
->
result_type
());
in_item
=
cmp_items
[(
uint
)
cmp_type
];
DBUG_ASSERT
(
in_item
);
...
...
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