summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2020-01-17 00:46:40 +0300
committerSergei Petrunia <psergey@askmonty.org>2020-01-17 00:46:40 +0300
commite709eb9bf712006d070767629518f827cd2f6bed (patch)
tree103290899cbe2a67f78277e0e33486e51ef01717 /sql
parentd531b4ee3a9bcd89a2fa6b49a2207eaf966f53e3 (diff)
parentb04429434ad1ee7f49d263762a560f4ff31dd111 (diff)
downloadmariadb-git-e709eb9bf712006d070767629518f827cd2f6bed.tar.gz
Merge branch '10.2' into 10.3
# Conflicts: # mysql-test/suite/galera/r/MW-388.result # mysql-test/suite/galera/t/MW-388.test # mysql-test/suite/innodb/r/truncate_inject.result # mysql-test/suite/innodb/t/truncate_inject.test # mysql-test/suite/rpl/r/rpl_stop_slave.result # mysql-test/suite/rpl/t/rpl_stop_slave.test # sql/sp_head.cc # sql/sp_head.h # sql/sql_lex.cc # sql/sql_yacc.yy # storage/xtradb/buf/buf0dblwr.cc
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc3
-rw-r--r--sql/log.cc3
-rw-r--r--sql/sp_head.cc12
-rw-r--r--sql/sp_head.h2
-rw-r--r--sql/sql_select.cc13
5 files changed, 21 insertions, 12 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index bf4909e1846..e7be4211d19 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -123,7 +123,8 @@ Item_args::Item_args(THD *thd, const Item_args *other)
arg_count= 0;
return;
}
- memcpy(args, other->args, sizeof(Item*) * arg_count);
+ if (arg_count)
+ memcpy(args, other->args, sizeof(Item*) * arg_count);
}
diff --git a/sql/log.cc b/sql/log.cc
index 900cc1b8197..0aac2ee61fb 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -484,6 +484,7 @@ private:
void truncate(my_off_t pos, bool reset_cache=0)
{
DBUG_PRINT("info", ("truncating to position %lu", (ulong) pos));
+ cache_log.error=0;
if (pending())
{
delete pending();
@@ -492,7 +493,7 @@ private:
reinit_io_cache(&cache_log, WRITE_CACHE, pos, 0, reset_cache);
cache_log.end_of_file= saved_max_binlog_cache_size;
}
-
+
binlog_cache_data& operator=(const binlog_cache_data& info);
binlog_cache_data(const binlog_cache_data& info);
};
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index af4316085b7..3a113de9dd5 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -473,7 +473,7 @@ check_routine_name(const LEX_CSTRING *ident)
* sp_head
*
*/
-
+
sp_head *sp_head::create(sp_package *parent, const Sp_handler *handler)
{
MEM_ROOT own_root;
@@ -493,14 +493,20 @@ void sp_head::destroy(sp_head *sp)
{
/* Make a copy of main_mem_root as free_root will free the sp */
MEM_ROOT own_root= sp->main_mem_root;
- delete sp;
-
DBUG_PRINT("info", ("mem_root 0x%lx moved to 0x%lx",
(ulong) &sp->mem_root, (ulong) &own_root));
+ delete sp;
+
+
free_root(&own_root, MYF(0));
}
}
+/*
+ *
+ * sp_head
+ *
+ */
sp_head::sp_head(MEM_ROOT *mem_root_arg, sp_package *parent,
const Sp_handler *sph)
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 7e00cf7a0d8..493bb777bdf 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -320,12 +320,10 @@ public:
protected:
sp_head(MEM_ROOT *mem_root, sp_package *parent, const Sp_handler *handler);
virtual ~sp_head();
-
public:
static void destroy(sp_head *sp);
static sp_head *create(sp_package *parent, const Sp_handler *handler);
-
/// Initialize after we have reset mem_root
void
init(LEX *lex);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 76cad16de28..0d47aee9882 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -14543,15 +14543,18 @@ static int compare_fields_by_table_order(Item *field1,
{
int cmp= 0;
bool outer_ref= 0;
- Item_field *f1= (Item_field *) (field1->real_item());
- Item_field *f2= (Item_field *) (field2->real_item());
- if (field1->const_item() || f1->const_item())
+ Item *field1_real= field1->real_item();
+ Item *field2_real= field2->real_item();
+
+ if (field1->const_item() || field1_real->const_item())
return -1;
- if (field2->const_item() || f2->const_item())
+ if (field2->const_item() || field2_real->const_item())
return 1;
+ Item_field *f1= (Item_field *) field1_real;
+ Item_field *f2= (Item_field *) field2_real;
if (f1->used_tables() & OUTER_REF_TABLE_BIT)
{
- outer_ref= 1;
+ outer_ref= -1;
cmp= -1;
}
if (f2->used_tables() & OUTER_REF_TABLE_BIT)