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
02655a91
Commit
02655a91
authored
Jun 26, 2017
by
Igor Babaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the bug mdev-13166.
This patch corrects the fix for mdev-12845.
parent
6d0aed42
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
3 deletions
+56
-3
mysql-test/r/derived_cond_pushdown.result
mysql-test/r/derived_cond_pushdown.result
+37
-0
mysql-test/t/derived_cond_pushdown.test
mysql-test/t/derived_cond_pushdown.test
+17
-0
sql/item.cc
sql/item.cc
+2
-3
No files found.
mysql-test/r/derived_cond_pushdown.result
View file @
02655a91
...
...
@@ -8672,3 +8672,40 @@ EXPLAIN
}
drop view v1,v2,v3;
drop table t1,t2;
#
# MDEV-13166: pushdown from merged derived
#
CREATE TABLE t1 (i int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT MAX(i) AS f FROM t1;
SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0;
f
2
explain format=json SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "v1.f > 0",
"materialized": {
"query_block": {
"select_id": 3,
"having_condition": "f > 0",
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100
}
}
}
}
}
}
DROP VIEW v1;
DROP TABLE t1;
mysql-test/t/derived_cond_pushdown.test
View file @
02655a91
...
...
@@ -1509,3 +1509,20 @@ eval explain format=json $q4;
drop
view
v1
,
v2
,
v3
;
drop
table
t1
,
t2
;
--
echo
#
--
echo
# MDEV-13166: pushdown from merged derived
--
echo
#
CREATE
TABLE
t1
(
i
int
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
1
),(
2
);
CREATE
VIEW
v1
AS
SELECT
MAX
(
i
)
AS
f
FROM
t1
;
let
$q
=
SELECT
*
FROM
(
SELECT
*
FROM
v1
)
AS
sq
WHERE
f
>
0
;
eval
$q
;
eval
explain
format
=
json
$q
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
sql/item.cc
View file @
02655a91
...
...
@@ -7173,9 +7173,8 @@ Item *Item_direct_view_ref::derived_field_transformer_for_having(THD *thd,
{
st_select_lex
*
sel
=
(
st_select_lex
*
)
arg
;
table_map
tab_map
=
sel
->
master_unit
()
->
derived
->
table
->
map
;
if
(
item_equal
&&
!
(
item_equal
->
used_tables
()
&
tab_map
))
return
this
;
if
(
!
item_equal
&&
used_tables
()
!=
tab_map
)
if
((
item_equal
&&
!
(
item_equal
->
used_tables
()
&
tab_map
))
||
!
item_equal
)
return
this
;
return
get_field_item_for_having
(
thd
,
this
,
sel
);
}
...
...
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