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
7b134ffa
Commit
7b134ffa
authored
Nov 13, 2020
by
Monty
Committed by
Sergei Golubchik
May 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make LEX::can_not_use_merged more general
parent
f2e3f0db
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
8 deletions
+16
-8
sql/sql_lex.cc
sql/sql_lex.cc
+13
-3
sql/sql_lex.h
sql/sql_lex.h
+1
-1
sql/sql_view.cc
sql/sql_view.cc
+1
-1
sql/table.cc
sql/table.cc
+1
-3
No files found.
sql/sql_lex.cc
View file @
7b134ffa
...
...
@@ -4076,6 +4076,10 @@ bool LEX::can_use_merged()
SYNOPSIS
LEX::can_not_use_merged()
@param no_update_or_delete Set to 1 if we can't use merge with multiple-table
updates, like when used from
TALE_LIST::init_derived()
DESCRIPTION
Temporary table algorithm will be used on all SELECT levels for queries
listed here (see also LEX::can_use_merged()).
...
...
@@ -4085,10 +4089,9 @@ bool LEX::can_use_merged()
TRUE - VIEWs with MERGE algorithms can be used
*/
bool
LEX
::
can_not_use_merged
()
bool
LEX
::
can_not_use_merged
(
bool
no_update_or_delete
)
{
switch
(
sql_command
)
{
switch
(
sql_command
)
{
case
SQLCOM_CREATE_VIEW
:
case
SQLCOM_SHOW_CREATE
:
/*
...
...
@@ -4098,6 +4101,13 @@ bool LEX::can_not_use_merged()
*/
case
SQLCOM_SHOW_FIELDS
:
return
TRUE
;
case
SQLCOM_UPDATE_MULTI
:
case
SQLCOM_DELETE_MULTI
:
if
(
no_update_or_delete
)
return
TRUE
;
/* Fall through */
default:
return
FALSE
;
}
...
...
sql/sql_lex.h
View file @
7b134ffa
...
...
@@ -3641,7 +3641,7 @@ struct LEX: public Query_tables_list
bool
can_be_merged
();
bool
can_use_merged
();
bool
can_not_use_merged
();
bool
can_not_use_merged
(
bool
no_update_or_delete
);
bool
only_view_structure
();
bool
need_correct_ident
();
uint8
get_effective_with_check
(
TABLE_LIST
*
view
);
...
...
sql/sql_view.cc
View file @
7b134ffa
...
...
@@ -1687,7 +1687,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
if
(
view_is_mergeable
&&
(
table
->
select_lex
->
master_unit
()
!=
&
old_lex
->
unit
||
old_lex
->
can_use_merged
())
&&
!
old_lex
->
can_not_use_merged
())
!
old_lex
->
can_not_use_merged
(
0
))
{
/* lex should contain at least one table */
DBUG_ASSERT
(
view_main_select_tables
!=
0
);
...
...
sql/table.cc
View file @
7b134ffa
...
...
@@ -9341,9 +9341,7 @@ bool TABLE_LIST::init_derived(THD *thd, bool init_view)
/* A subquery might be forced to be materialized due to a side-effect. */
if
(
!
is_materialized_derived
()
&&
first_select
->
is_mergeable
()
&&
optimizer_flag
(
thd
,
OPTIMIZER_SWITCH_DERIVED_MERGE
)
&&
!
thd
->
lex
->
can_not_use_merged
()
&&
!
(
thd
->
lex
->
sql_command
==
SQLCOM_UPDATE_MULTI
||
thd
->
lex
->
sql_command
==
SQLCOM_DELETE_MULTI
)
&&
!
thd
->
lex
->
can_not_use_merged
(
1
)
&&
!
is_recursive_with_table
())
set_merged_derived
();
else
...
...
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