[Commits] 1a9e13d: Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext

Alexey Botchkov holyfoot at askmonty.org
Fri Aug 11 09:58:49 EEST 2017


revision-id: 1a9e13d622382285d979e75774bdd1dde1660e2d (mariadb-10.2.2-585-g1a9e13d)
parent(s): 837aa57fb2dcb2f487494181c43dbcfeb61af64f 79d28533549d15e848b342cf518ae4b409ba3e64
committer: Alexey Botchkov
timestamp: 2017-08-11 10:58:23 +0400
message:

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


 mysql-test/r/view.result                          | 19 +++++++++++++
 mysql-test/suite/gcol/r/gcol_bugfixes.result      | 13 +++++++++
 mysql-test/suite/gcol/t/gcol_bugfixes.test        | 13 +++++++++
 mysql-test/suite/innodb/r/rename_table.result     | 20 ++++++++++++++
 mysql-test/suite/innodb/t/rename_table.opt        |  2 ++
 mysql-test/suite/innodb/t/rename_table.test       | 31 +++++++++++++++++++++
 mysql-test/suite/sys_vars/r/sysvars_innodb.result |  2 +-
 mysql-test/t/view.test                            | 25 +++++++++++++++++
 scripts/wsrep_sst_mysqldump.sh                    |  4 +--
 sql/item_cmpfunc.cc                               |  5 ++--
 sql/sql_acl.cc                                    |  5 +++-
 sql/sql_cache.cc                                  | 10 +++++--
 sql/sql_cache.h                                   |  1 +
 sql/sql_derived.cc                                |  7 ++---
 storage/innobase/buf/buf0buf.cc                   |  2 +-
 storage/innobase/buf/buf0flu.cc                   |  5 +---
 storage/innobase/fil/fil0fil.cc                   | 16 ++++++++---
 storage/innobase/handler/ha_innodb.cc             | 12 ++++++---
 storage/innobase/include/fil0fil.h                |  6 ++---
 storage/innobase/include/univ.i                   |  2 +-
 storage/innobase/include/ut0stage.h               |  8 +++---
 storage/innobase/lock/lock0lock.cc                |  2 ++
 storage/innobase/row/row0log.cc                   |  7 +++--
 storage/innobase/row/row0merge.cc                 |  5 ++--
 storage/innobase/row/row0mysql.cc                 | 10 +++++++
 storage/innobase/row/row0sel.cc                   |  6 -----
 storage/innobase/row/row0trunc.cc                 |  2 +-
 storage/innobase/row/row0upd.cc                   | 33 ++++++++++++++++++++++-
 storage/innobase/sync/sync0arr.cc                 |  2 +-
 storage/innobase/ut/ut0rbt.cc                     |  2 ++
 30 files changed, 231 insertions(+), 46 deletions(-)

diff --cc mysql-test/r/view.result
index a09856c,e0bc7b3..721ad05
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@@ -6573,16 -6559,24 +6573,35 @@@ Warnings
  Warning	1356	View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
  DROP VIEW v;
  #
+ # MDEV-13439: Database permissions are not enough to run a subquery
+ # with GROUP BY within a view
+ #
+ create database test_db;
+ use test_db;
+ create table t (i int);
+ create user foo at localhost;
+ grant all on test_db.* to foo at localhost;
+ connect  con1,localhost,foo,,;
+ use test_db;
+ create view v as select * from (select i from t group by i) sq;
+ select * from v;
+ i
+ disconnect con1;
+ connection default;
+ use test;
+ drop database test_db;
+ drop user foo at localhost;
+ #
  # End of 10.2 tests
  #
 +#
 +# Start of 10.3 tests
 +#
 +#
 +# MDEV-13197 Parser refactoring for CREATE VIEW,TRIGGER,SP,UDF,EVENT
 +#
 +ALTER VIEW IF NOT EXISTS v1 AS SELECT 1;
 +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IF NOT EXISTS v1 AS SELECT 1' at line 1
 +#
 +# End of 10.3 tests
 +#
diff --cc mysql-test/t/view.test
index 00a040c,47dc62c..a9d6d9c
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@@ -6275,21 -6269,30 +6275,46 @@@ SHOW CREATE VIEW v
  DROP VIEW v;
  
  --echo #
+ --echo # MDEV-13439: Database permissions are not enough to run a subquery
+ --echo # with GROUP BY within a view
+ --echo #
+ 
+ create database test_db;
+ use test_db;
+ create table t (i int);
+ 
+ create user foo at localhost;
+ grant all on test_db.* to foo at localhost;
+ 
+ --connect (con1,localhost,foo,,)
+ 
+ use test_db;
+ create view v as select * from (select i from t group by i) sq;
+ select * from v;
+ 
+ # Cleanup
+ --disconnect con1
+ --connection default
+ use test;
+ drop database test_db;
+ drop user foo at localhost;
+ 
+ --echo #
  --echo # End of 10.2 tests
  --echo #
 +
 +
 +--echo #
 +--echo # Start of 10.3 tests
 +--echo #
 +
 +--echo #
 +--echo # MDEV-13197 Parser refactoring for CREATE VIEW,TRIGGER,SP,UDF,EVENT
 +--echo #
 +
 +--error ER_PARSE_ERROR
 +ALTER VIEW IF NOT EXISTS v1 AS SELECT 1;
 +
 +--echo #
 +--echo # End of 10.3 tests
 +--echo #
diff --cc sql/item_cmpfunc.cc
index 4bcb739,16452a0..fc076b7
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@@ -630,35 -673,21 +630,34 @@@ bool Arg_comparator::set_cmp_func_real(
  
       Do comparison as decimal rather than float, in order not to lose precision.
      */
 -    m_compare_type= DECIMAL_RESULT;
 +    m_compare_handler= &type_handler_newdecimal;
 +    return set_cmp_func_decimal();
    }
  
 -  if (m_compare_type == INT_RESULT &&
 -      (*a)->field_type() == MYSQL_TYPE_YEAR &&
 -      (*b)->field_type() == MYSQL_TYPE_YEAR)
 -  {
 -    m_compare_type= TIME_RESULT;
 -    func= is_owner_equal_func() ? &Arg_comparator::compare_e_datetime :
 -                                  &Arg_comparator::compare_datetime;
 -  }
 +  THD *thd= current_thd;
 +  func= is_owner_equal_func() ? &Arg_comparator::compare_e_real :
 +                                &Arg_comparator::compare_real;
 +  if ((*a)->decimals < NOT_FIXED_DEC && (*b)->decimals < NOT_FIXED_DEC)
 +  {
 +    precision= 5 / log_10[MY_MAX((*a)->decimals, (*b)->decimals) + 1];
 +    if (func == &Arg_comparator::compare_real)
 +      func= &Arg_comparator::compare_real_fixed;
 +    else if (func == &Arg_comparator::compare_e_real)
 +      func= &Arg_comparator::compare_e_real_fixed;
 +  }
 +  a= cache_converted_constant(thd, a, &a_cache, compare_type_handler());
 +  b= cache_converted_constant(thd, b, &b_cache, compare_type_handler());
 +  return false;
 +}
  
- 
 -  a= cache_converted_constant(thd, a, &a_cache, m_compare_type);
 -  b= cache_converted_constant(thd, b, &b_cache, m_compare_type);
 -  return set_compare_func(owner_arg, m_compare_type);
 +bool Arg_comparator::set_cmp_func_decimal()
 +{
 +  THD *thd= current_thd;
 +  func= is_owner_equal_func() ? &Arg_comparator::compare_e_decimal :
 +                                &Arg_comparator::compare_decimal;
 +  a= cache_converted_constant(thd, a, &a_cache, compare_type_handler());
 +  b= cache_converted_constant(thd, b, &b_cache, compare_type_handler());
 +  return false;
  }
  
  
diff --cc storage/innobase/row/row0upd.cc
index 34995fa,05580ca..63f6c03
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@@ -1,7 -1,7 +1,7 @@@
  /*****************************************************************************
  
- Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+ Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
 -Copyright (c) 2015, 2016, MariaDB Corporation.
 +Copyright (c) 2015, 2017, MariaDB Corporation.
  
  This program is free software; you can redistribute it and/or modify it under
  the terms of the GNU General Public License as published by the Free Software


More information about the commits mailing list