summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2017-08-11 10:58:23 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2017-08-11 10:58:23 +0400
commit1a9e13d622382285d979e75774bdd1dde1660e2d (patch)
treeb0da321b46551da1a75b2a6aa0c7b89afa5ce0d0 /sql
parent837aa57fb2dcb2f487494181c43dbcfeb61af64f (diff)
parent79d28533549d15e848b342cf518ae4b409ba3e64 (diff)
downloadmariadb-git-1a9e13d622382285d979e75774bdd1dde1660e2d.tar.gz
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Conflicts: sql/item_cmpfunc.cc storage/innobase/buf/buf0flu.cc storage/innobase/include/ut0stage.h storage/innobase/row/row0upd.cc
Diffstat (limited to 'sql')
-rw-r--r--sql/item_cmpfunc.cc5
-rw-r--r--sql/sql_acl.cc5
-rw-r--r--sql/sql_cache.cc10
-rw-r--r--sql/sql_cache.h1
-rw-r--r--sql/sql_derived.cc7
5 files changed, 19 insertions, 9 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 4bcb7397e52..fc076b766c2 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -550,14 +550,14 @@ bool Arg_comparator::set_cmp_func_string()
{
func= is_owner_equal_func() ? &Arg_comparator::compare_e_json_str:
&Arg_comparator::compare_json_str;
- return false;
+ return 0;
}
else if ((*b)->type() == Item::FUNC_ITEM &&
((Item_func *) (*b))->functype() == Item_func::JSON_EXTRACT_FUNC)
{
func= is_owner_equal_func() ? &Arg_comparator::compare_e_json_str:
&Arg_comparator::compare_str_json;
- return false;
+ return 0;
}
}
@@ -650,7 +650,6 @@ bool Arg_comparator::set_cmp_func_real()
return false;
}
-
bool Arg_comparator::set_cmp_func_decimal()
{
THD *thd= current_thd;
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index f82c68e1889..41d0e73a84e 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -7630,8 +7630,11 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
/*
It is subquery in the FROM clause. VIEW set t_ref->derived after
table opening, but this function always called before table opening.
+
+ NOTE: is_derived() can't be used here because subquery in this case
+ the FROM clase (derived tables) can be not be marked yet.
*/
- if (!t_ref->referencing_view)
+ if (t_ref->is_anonymous_derived_table() || t_ref->schema_table)
{
/*
If it's a temporary table created for a subquery in the FROM
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 89afef4eaf7..96a64697390 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1413,6 +1413,8 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
flags.client_long_flag= MY_TEST(thd->client_capabilities & CLIENT_LONG_FLAG);
flags.client_protocol_41= MY_TEST(thd->client_capabilities &
CLIENT_PROTOCOL_41);
+ flags.client_depr_eof= MY_TEST(thd->client_capabilities &
+ CLIENT_DEPRECATE_EOF);
/*
Protocol influences result format, so statement results in the binary
protocol (COM_EXECUTE) cannot be served to statements asking for results
@@ -1443,12 +1445,13 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
flags.div_precision_increment= thd->variables.div_precincrement;
flags.default_week_format= thd->variables.default_week_format;
DBUG_PRINT("qcache", ("\
-long %d, 4.1: %d, bin_proto: %d, more results %d, pkt_nr: %d, \
+long %d, 4.1: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \
CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
sql mode: 0x%llx, sort len: %lu, conncat len: %lu, div_precision: %lu, \
def_week_frmt: %lu, in_trans: %d, autocommit: %d",
(int)flags.client_long_flag,
(int)flags.client_protocol_41,
+ (int)flags.client_depr_eof,
(int)flags.protocol_type,
(int)flags.more_results_exists,
flags.pkt_nr,
@@ -1917,6 +1920,8 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length)
flags.client_long_flag= MY_TEST(thd->client_capabilities & CLIENT_LONG_FLAG);
flags.client_protocol_41= MY_TEST(thd->client_capabilities &
CLIENT_PROTOCOL_41);
+ flags.client_depr_eof= MY_TEST(thd->client_capabilities &
+ CLIENT_DEPRECATE_EOF);
flags.protocol_type= (unsigned int) thd->protocol->type();
flags.more_results_exists= MY_TEST(thd->server_status &
SERVER_MORE_RESULTS_EXISTS);
@@ -1938,12 +1943,13 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length)
flags.default_week_format= thd->variables.default_week_format;
flags.lc_time_names= thd->variables.lc_time_names;
DBUG_PRINT("qcache", ("\
-long %d, 4.1: %d, bin_proto: %d, more results %d, pkt_nr: %d, \
+long %d, 4.1: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \
CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
sql mode: 0x%llx, sort len: %lu, conncat len: %lu, div_precision: %lu, \
def_week_frmt: %lu, in_trans: %d, autocommit: %d",
(int)flags.client_long_flag,
(int)flags.client_protocol_41,
+ (int)flags.client_depr_eof,
(int)flags.protocol_type,
(int)flags.more_results_exists,
flags.pkt_nr,
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index 21f9c66dc4f..3230034cf74 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -545,6 +545,7 @@ struct Query_cache_query_flags
{
unsigned int client_long_flag:1;
unsigned int client_protocol_41:1;
+ unsigned int client_depr_eof:1;
unsigned int protocol_type:2;
unsigned int more_results_exists:1;
unsigned int in_trans:1;
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 56909364f2a..c278c5d5aa9 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -823,13 +823,14 @@ exit:
table->derived_select_number= first_select->select_number;
table->s->tmp_table= INTERNAL_TMP_TABLE;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
- if (derived->referencing_view)
+ if (derived->is_view())
table->grant= derived->grant;
else
{
+ DBUG_ASSERT(derived->is_derived());
+ DBUG_ASSERT(derived->is_anonymous_derived_table());
table->grant.privilege= SELECT_ACL;
- if (derived->is_derived())
- derived->grant.privilege= SELECT_ACL;
+ derived->grant.privilege= SELECT_ACL;
}
#endif
/* Add new temporary table to list of open derived tables */