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
0168d1ed
Commit
0168d1ed
authored
Sep 15, 2021
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-25766 Unused CTE lead to a crash in find_field_in_tables/find_order_in_list
Do not assume that subquery Item always present.
parent
ad1fb069
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
3 deletions
+73
-3
mysql-test/r/cte_nonrecursive.result
mysql-test/r/cte_nonrecursive.result
+33
-0
mysql-test/t/cte_nonrecursive.test
mysql-test/t/cte_nonrecursive.test
+36
-0
sql/sql_base.cc
sql/sql_base.cc
+4
-3
No files found.
mysql-test/r/cte_nonrecursive.result
View file @
0168d1ed
...
...
@@ -2184,4 +2184,37 @@ select * from t1;
a
7
drop table t1,t2;
#
# MDEV-25766: Unused CTE lead to a crash in
# find_field_in_tables/find_order_in_list
#
create table t1 (f1 INTEGER);
create view v1 as
select
subq_0.c4 as c2,
subq_0.c4 as c4
from
(select
ref_0.f1 as c4
from
t1 as ref_0
where (select 1)
) as subq_0
order by c2, c4 desc;
WITH
unused_with AS (select
subq_0.c4 as c6
from
(select
11 as c4
from
v1 as ref_0
) as subq_0,
v1 as ref_2
)
select 1 ;
1
1
drop view v1;
drop table t1;
# End of 10.2 tests
mysql-test/t/cte_nonrecursive.test
View file @
0168d1ed
...
...
@@ -1624,4 +1624,40 @@ select * from t1;
drop
table
t1
,
t2
;
--
echo
#
--
echo
# MDEV-25766: Unused CTE lead to a crash in
--
echo
# find_field_in_tables/find_order_in_list
--
echo
#
create
table
t1
(
f1
INTEGER
);
create
view
v1
as
select
subq_0
.
c4
as
c2
,
subq_0
.
c4
as
c4
from
(
select
ref_0
.
f1
as
c4
from
t1
as
ref_0
where
(
select
1
)
)
as
subq_0
order
by
c2
,
c4
desc
;
WITH
unused_with
AS
(
select
subq_0
.
c4
as
c6
from
(
select
11
as
c4
from
v1
as
ref_0
)
as
subq_0
,
v1
as
ref_2
)
select
1
;
drop
view
v1
;
drop
table
t1
;
--
echo
# End of 10.2 tests
sql/sql_base.cc
View file @
0168d1ed
...
...
@@ -6011,9 +6011,10 @@ find_field_in_tables(THD *thd, Item_ident *item,
sl
=
sl
->
outer_select
())
{
Item
*
subs
=
sl
->
master_unit
()
->
item
;
if
(
subs
->
type
()
==
Item
::
SUBSELECT_ITEM
&&
((
Item_subselect
*
)
subs
)
->
substype
()
==
Item_subselect
::
IN_SUBS
&&
((
Item_in_subselect
*
)
subs
)
->
test_strategy
(
SUBS_SEMI_JOIN
))
if
(
!
subs
||
(
subs
->
type
()
==
Item
::
SUBSELECT_ITEM
&&
((
Item_subselect
*
)
subs
)
->
substype
()
==
Item_subselect
::
IN_SUBS
&&
((
Item_in_subselect
*
)
subs
)
->
test_strategy
(
SUBS_SEMI_JOIN
)))
{
continue
;
}
...
...
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