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
d54cd335
Commit
d54cd335
authored
Aug 09, 2011
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge fix for BUG#822134
parents
85ecb1f7
db05c145
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
7 deletions
+36
-7
sql/sql_select.cc
sql/sql_select.cc
+36
-7
No files found.
sql/sql_select.cc
View file @
d54cd335
...
...
@@ -7189,6 +7189,32 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
DBUG_RETURN
(
FALSE
);
}
/*
Check if a set of tables specified by used_tables can be accessed when
we're doing scan on join_tab jtab.
*/
static
bool
are_tables_local
(
JOIN_TAB
*
jtab
,
table_map
used_tables
)
{
if
(
jtab
->
bush_root_tab
)
{
/*
jtab is inside execution join nest. We may not refer to outside tables,
except the const tables.
*/
table_map
local_tables
=
jtab
->
emb_sj_nest
->
nested_join
->
used_tables
|
jtab
->
join
->
const_table_map
;
return
!
test
(
used_tables
&
~
local_tables
);
}
/*
If we got here then jtab is at top level.
- all other tables at top level are accessible,
- tables in join nests are accessible too, because all their columns that
are needed at top level will be unpacked when scanning the
materialization table.
*/
return
TRUE
;
}
static
bool
create_ref_for_key
(
JOIN
*
join
,
JOIN_TAB
*
j
,
KEYUSE
*
org_keyuse
,
table_map
used_tables
)
...
...
@@ -7234,14 +7260,17 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
{
if
(
!
(
~
used_tables
&
keyuse
->
used_tables
))
{
if
((
is_hash_join_key_no
(
key
)
&&
(
keyparts
==
0
||
keyuse
->
keypart
!=
(
keyuse
-
1
)
->
keypart
))
||
(
!
is_hash_join_key_no
(
key
)
&&
keyparts
==
keyuse
->
keypart
&&
!
(
found_part_ref_or_null
&
keyuse
->
optimize
)))
if
(
are_tables_local
(
j
,
keyuse
->
val
->
used_tables
()))
{
length
+=
keyinfo
->
key_part
[
keyparts
].
store_length
;
keyparts
++
;
found_part_ref_or_null
|=
keyuse
->
optimize
&
~
KEY_OPTIMIZE_EQ
;
if
((
is_hash_join_key_no
(
key
)
&&
(
keyparts
==
0
||
keyuse
->
keypart
!=
(
keyuse
-
1
)
->
keypart
))
||
(
!
is_hash_join_key_no
(
key
)
&&
keyparts
==
keyuse
->
keypart
&&
!
(
found_part_ref_or_null
&
keyuse
->
optimize
)))
{
length
+=
keyinfo
->
key_part
[
keyparts
].
store_length
;
keyparts
++
;
found_part_ref_or_null
|=
keyuse
->
optimize
&
~
KEY_OPTIMIZE_EQ
;
}
}
}
keyuse
++
;
...
...
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