summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-11-08 09:50:56 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-11-08 10:19:55 +0200
commitc761b43451d54eeeecdf3c102906fcce88d4e9d9 (patch)
treec00b07bf4b36108f1ecbfc3015b5594899e0e248
parent07e4853c232726a639b30d4718bef9914ea42d24 (diff)
parentbac2ec3a5b28ed590826b20a4cf27fd788903bbd (diff)
downloadmariadb-git-c761b43451d54eeeecdf3c102906fcce88d4e9d9.tar.gz
Merge 10.3 into 10.4mariadb-10.4.0
-rw-r--r--client/mysqltest.cc2
-rwxr-xr-xdebian/autobake-deb.sh2
-rw-r--r--include/my_global.h1
-rw-r--r--mysql-test/include/mtr_warnings.sql2
-rwxr-xr-xmysql-test/lib/v1/mysql-test-run.pl2
-rw-r--r--mysql-test/main/auto_increment_ranges_innodb.result14
-rw-r--r--mysql-test/main/auto_increment_ranges_innodb.test13
-rw-r--r--mysql-test/main/cte_recursive.result159
-rw-r--r--mysql-test/main/cte_recursive.test55
-rw-r--r--mysql-test/main/mysqld--help.result5
-rw-r--r--mysql-test/main/parser.result21
-rw-r--r--mysql-test/main/parser.test17
-rw-r--r--mysql-test/main/sql_safe_updates.opt1
-rw-r--r--mysql-test/main/sql_safe_updates.result3
-rw-r--r--mysql-test/main/sql_safe_updates.test4
-rwxr-xr-xmysql-test/mysql-test-run.pl2
-rw-r--r--mysql-test/suite/encryption/r/innodb-encryption-alter.result37
-rw-r--r--mysql-test/suite/encryption/t/innodb-encryption-alter.test24
-rw-r--r--mysql-test/suite/innodb/include/alter_nocopy.inc33
-rw-r--r--mysql-test/suite/innodb/include/alter_nocopy_fail.inc51
-rw-r--r--mysql-test/suite/innodb/include/alter_not_null.inc94
-rw-r--r--mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff63
-rw-r--r--mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff63
-rw-r--r--mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff63
-rw-r--r--mysql-test/suite/innodb/r/alter_algorithm.result54
-rw-r--r--mysql-test/suite/innodb/r/alter_instant,COPY.rdiff61
-rw-r--r--mysql-test/suite/innodb/r/alter_instant,INPLACE.rdiff11
-rw-r--r--mysql-test/suite/innodb/r/alter_instant,INSTANT.rdiff11
-rw-r--r--mysql-test/suite/innodb/r/alter_instant.result50
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result2
-rw-r--r--mysql-test/suite/innodb/t/alter_algorithm.test127
-rw-r--r--mysql-test/suite/innodb/t/alter_instant.test45
-rw-r--r--mysql-test/suite/innodb/t/alter_not_null.test94
-rw-r--r--mysql-test/suite/rpl/r/rpl_old_master.result3
-rw-r--r--mysql-test/suite/rpl/t/rpl_old_master.test8
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result2
-rw-r--r--mysys/mf_iocache.c4
-rw-r--r--mysys/my_pread.c26
-rw-r--r--sql/item_subselect.cc3
-rw-r--r--sql/item_sum.cc24
-rw-r--r--sql/slave.cc13
-rw-r--r--sql/sql_base.cc3
-rw-r--r--sql/sql_const.h2
-rw-r--r--sql/sql_cte.cc2
-rw-r--r--sql/sql_delete.cc2
-rw-r--r--sql/sql_lex.cc4
-rw-r--r--sql/sql_lex.h4
-rw-r--r--sql/sql_partition.cc2
-rw-r--r--sql/sql_prepare.cc2
-rw-r--r--sql/sql_select.cc12
-rw-r--r--sql/sql_update.cc2
-rw-r--r--sql/sql_yacc.yy1
-rw-r--r--sql/sql_yacc_ora.yy14
-rw-r--r--sql/sys_vars.cc2
-rw-r--r--sql/table.cc2
-rw-r--r--storage/innobase/handler/ha_innodb.cc35
-rw-r--r--storage/innobase/handler/ha_innodb.h7
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/disabled.def1
-rw-r--r--vio/viossl.c10
59 files changed, 913 insertions, 463 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 38e89236896..f8c4f84a385 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -20,7 +20,7 @@
Tool used for executing a .test file
See the "MySQL Test framework manual" for more information
- http://dev.mysql.com/doc/mysqltest/en/index.html
+ https://mariadb.com/kb/en/library/mysqltest/
Please keep the test framework tools identical in all versions!
diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh
index acf0e4244da..1c72ad28a3d 100755
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@ -102,7 +102,7 @@ fi
# AWS SDK also requires the build machine to have network access and git, so
# it cannot be part of the base version included in Linux distros, but a pure
# custom built plugin.
-if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && ping -c 1 github.com
+if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && wget --timeout 15 --tries 1 --quiet --output-document /dev/null https://github.com/
then
cat <<EOF >> debian/control
diff --git a/include/my_global.h b/include/my_global.h
index d620d4e790b..ea438e7171f 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -981,7 +981,6 @@ typedef unsigned long my_off_t;
TODO Convert these to use Bitmap class.
*/
typedef ulonglong table_map; /* Used for table bits in join */
-typedef ulong nesting_map; /* Used for flags of nesting constructs */
/* often used type names - opaque declarations */
typedef const struct charset_info_st CHARSET_INFO;
diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql
index b7b2a316dfb..524ea0f4859 100644
--- a/mysql-test/include/mtr_warnings.sql
+++ b/mysql-test/include/mtr_warnings.sql
@@ -242,7 +242,7 @@ BEGIN
DECLARE `pos` bigint unsigned;
-- Don't write these queries to binlog
- SET SQL_LOG_BIN=0;
+ SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0;
--
-- Remove mark from lines that are suppressed by global suppressions
diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl
index 386b50b2723..9c9bc0e02fb 100755
--- a/mysql-test/lib/v1/mysql-test-run.pl
+++ b/mysql-test/lib/v1/mysql-test-run.pl
@@ -23,7 +23,7 @@
# Tool used for executing a suite of .test file
#
# See the "MySQL Test framework manual" for more information
-# http://dev.mysql.com/doc/mysqltest/en/index.html
+# https://mariadb.com/kb/en/library/mysqltest/
#
# Please keep the test framework tools identical in all versions!
#
diff --git a/mysql-test/main/auto_increment_ranges_innodb.result b/mysql-test/main/auto_increment_ranges_innodb.result
index 1d827a5a166..0471a5a33ba 100644
--- a/mysql-test/main/auto_increment_ranges_innodb.result
+++ b/mysql-test/main/auto_increment_ranges_innodb.result
@@ -264,3 +264,17 @@ delete from t1 where a=32767;
insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1
drop table t1;
+create table t1 (pk int auto_increment primary key, f varchar(20));
+insert t1 (f) values ('a'), ('b'), ('c'), ('d');
+select null, f into outfile 'load.data' from t1 limit 1;
+load data infile 'load.data' into table t1;
+insert t1 (f) values ('<===');
+select * from t1;
+pk f
+1 a
+2 b
+3 c
+4 d
+5 a
+6 <===
+drop table t1;
diff --git a/mysql-test/main/auto_increment_ranges_innodb.test b/mysql-test/main/auto_increment_ranges_innodb.test
index c2afee7ac66..016ca16bd91 100644
--- a/mysql-test/main/auto_increment_ranges_innodb.test
+++ b/mysql-test/main/auto_increment_ranges_innodb.test
@@ -5,3 +5,16 @@
--source include/have_innodb.inc
set default_storage_engine=innodb;
--source auto_increment_ranges.inc
+
+#
+# MDEV-17377 invalid gap in auto-increment values after LOAD DATA
+#
+create table t1 (pk int auto_increment primary key, f varchar(20));
+insert t1 (f) values ('a'), ('b'), ('c'), ('d');
+select null, f into outfile 'load.data' from t1 limit 1;
+load data infile 'load.data' into table t1;
+insert t1 (f) values ('<===');
+select * from t1;
+drop table t1;
+--let $datadir=`select @@datadir`
+--remove_file $datadir/test/load.data
diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result
index 32c8ea95abf..9e934b19efc 100644
--- a/mysql-test/main/cte_recursive.result
+++ b/mysql-test/main/cte_recursive.result
@@ -3447,6 +3447,165 @@ expired_date purchase_date quantity p_id purchase_processed unresolved
2014-11-08 NULL 0 2 5 1
2014-11-08 2014-11-03 1 2 4 0
DROP TABLE purchases, expired;
+#
+# MDEV-17635: Two recursive CTEs, the second using the first
+#
+WITH RECURSIVE
+x AS (SELECT 0 as k UNION ALL SELECT k + 1 FROM x WHERE k < 1),
+z AS
+( SELECT k1 AS cx, k2 AS cy, k1, k2
+FROM (SELECT k AS k1 FROM x) x1 JOIN (SELECT k AS k2 FROM x) y1
+UNION
+SELECT 1,1,1,1 FROM z)
+SELECT * FROM z;
+cx cy k1 k2
+0 0 0 0
+1 0 1 0
+0 1 0 1
+1 1 1 1
+# https://wiki.postgresql.org/wiki/Mandelbrot_set:
+WITH RECURSIVE x(i) AS (
+SELECT CAST(0 AS DECIMAL(13, 10))
+UNION ALL
+SELECT i + 1
+FROM x
+WHERE i < 101
+),
+Z(Ix, Iy, Cx, Cy, X, Y, I) AS (
+SELECT Ix, Iy, X, Y, X, Y, 0
+FROM (SELECT CAST(-2.2 + 0.031 * i AS DECIMAL(13, 10)) AS X,
+i AS Ix FROM x) AS xgen
+CROSS JOIN (
+SELECT CAST(-1.5 + 0.031 * i AS DECIMAL(13, 10)) AS Y,
+i AS iY FROM x
+) AS ygen
+UNION ALL
+SELECT Ix, Iy, Cx, Cy,
+CAST(X * X - Y * Y + Cx AS DECIMAL(13, 10)) AS X,
+CAST(Y * X * 2 + Cy AS DECIMAL(13, 10)), I + 1
+FROM Z
+WHERE X * X + Y * Y < 16.0
+AND I < 27
+),
+Zt (Ix, Iy, I) AS (
+SELECT Ix, Iy, MAX(I) AS I
+FROM Z
+GROUP BY Iy, Ix
+ORDER BY Iy, Ix
+)
+SELECT GROUP_CONCAT(
+SUBSTRING(
+' .,,,-----++++%%%%@@@@#### ',
+GREATEST(I, 1),
+1
+) ORDER BY Ix SEPARATOR ''
+ ) AS 'Mandelbrot Set'
+ FROM Zt
+GROUP BY Iy
+ORDER BY Iy;
+Mandelbrot Set
+ ....................................................................................
+ .......................................................................................
+ .........................................................................................
+ ...........................................................................................
+ ....................................................,,,,,,,,,.................................
+ ................................................,,,,,,,,,,,,,,,,,,.............................
+ ..............................................,,,,,,,,,,,,,,,,,,,,,,,,..........................
+ ............................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,........................
+ ..........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,......................
+ .........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....................
+ ........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...................
+ .......................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.................
+ .......................................,,,,,,,,,,,,,,,,,,,,,,,,--,,,,,,,,,,,,,,,,,,,,................
+......................................,,,,,,,,,,,,,,,,,,,,,,,,,,-+--,,,,,,,,,,,,,,,,,,,...............
+....................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----,,,,,,,,,,,,,,,,,,,..............
+...................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,--- -----,,,,,,,,,,,,,,,,,.............
+.................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---++--++,,,,,,,,,,,,,,,,,,............
+................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----%++---,,,,,,,,,,,,,,,,,............
+..............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+%----,,,,,,,,,,,,,,,,,,...........
+.............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----- %%+----,,,,,,,,,,,,,,,,,,..........
+...........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---%-+% ----,,,,,,,,,,,,,,,,,,,.........
+..........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+ +## %+%---,,,,,,,,,,,,,,,,,,.........
+........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----# # +---,,,,,,,,,,,,,,,,,,........
+.......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------% %-----,,,,,,,,,,,,,,,,,........
+.....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------+ ------,,,,,,,,,,,,,,,,,.......
+....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----------+@ +-----------,,,,,,,,,,,,.......
+..................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----@-------++ ++-----------,,,,,,,,,,,,......
+.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--+@% ---+ +@%%@ %%+@+@%------+-,,,,,,,,,,,......
+................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---- # ++% % @-----++--,,,,,,,,,,,.....
+..............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----+ % %%++ %+%@-,,,,,,,,,,,.....
+.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+# #% ++-,,,,,,,,,,,,....
+............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,------+ @---,,,,,,,,,,,,....
+..........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------++% ---,,,,,,,,,,,,....
+.........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------+ + %+---,,,,,,,,,,,,,...
+........,,,,,,,,,,,,,,,,,,,,,--------------------@ +----,,,,,,,,,,,,...
+.......,,,,,,,,,,,,,,,,,,,,,,- +-----------------+ ----,,,,,,,,,,,,...
+.......,,,,,,,,,,,,,,,,,,,,,--++------+---------+% +++--,,,,,,,,,,,,..
+......,,,,,,,,,,,,,,,,,,,,,,--%+-----++--------- #+-,,,,,,,,,,,,..
+.....,,,,,,,,,,,,,,,,,,,,,,----#%++--+@ -+-----+% --,,,,,,,,,,,,..
+.....,,,,,,,,,,,,,,,,,,,,,,-----+## ++@ + +----% +--,,,,,,,,,,,,,..
+....,,,,,,,,,,,,,,,,,,,,,,------+@ @ @@++++# +--,,,,,,,,,,,,,..
+....,,,,,,,,,,,,,,,,,,,,,-------% #++% -,,,,,,,,,,,,,..
+...,,,,,,,,,,,,,,,,,,,,,------++%# %%@ %-,,,,,,,,,,,,,,.
+...,,,,,,,,,,,,,,,,,,,--------+ % +--,,,,,,,,,,,,,,.
+...,,,,,,,,,,,,,,,,,,-----+--++@ # --,,,,,,,,,,,,,,.
+..,,,,,,,,,,,,,,,,,-------%+++% @--,,,,,,,,,,,,,,,.
+..,,,,,,,,,,,-------------+ @#@ ---,,,,,,,,,,,,,,,.
+..,,,,,,,,,---@--------@-+% +---,,,,,,,,,,,,,,,.
+..,,,,,------- +-++++-+%%% +----,,,,,,,,,,,,,,,.
+..,,,,,,------%--------++% +----,,,,,,,,,,,,,,,.
+..,,,,,,,,,,--+----------++# ---,,,,,,,,,,,,,,,.
+..,,,,,,,,,,,,------------+@@@% +--,,,,,,,,,,,,,,,.
+..,,,,,,,,,,,,,,,,,------- +++% %--,,,,,,,,,,,,,,,.
+...,,,,,,,,,,,,,,,,,,---------+@ @ --,,,,,,,,,,,,,,.
+...,,,,,,,,,,,,,,,,,,,,------- # %@ +--,,,,,,,,,,,,,,.
+...,,,,,,,,,,,,,,,,,,,,,-------++@ %+ %-,,,,,,,,,,,,,,.
+....,,,,,,,,,,,,,,,,,,,,,------- %++% %-,,,,,,,,,,,,,..
+....,,,,,,,,,,,,,,,,,,,,,,------+# %# #@ ++++ +--,,,,,,,,,,,,,..
+.....,,,,,,,,,,,,,,,,,,,,,,-----+ %%++% +@+----+ +--,,,,,,,,,,,,,..
+.....,,,,,,,,,,,,,,,,,,,,,,,---%+++--+#+--------% #--,,,,,,,,,,,,..
+......,,,,,,,,,,,,,,,,,,,,,,--++-----%%--------- @#--,,,,,,,,,,,,..
+.......,,,,,,,,,,,,,,,,,,,,,---------------------+@ +-++,,,,,,,,,,,,...
+........,,,,,,,,,,,,,,,,,,,,,--------------------+ ----,,,,,,,,,,,,...
+.........,,,,,,,,,,,,,,,,,,,,----,,,------------- #+----,,,,,,,,,,,,...
+..........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------+ + +---,,,,,,,,,,,,,...
+...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------+%# #---,,,,,,,,,,,,....
+............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,------+# @ @---,,,,,,,,,,,,....
+.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+# + @--,,,,,,,,,,,,....
+..............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+% %+@ %+-+ +++%-,,,,,,,,,,,.....
+................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----% %@++ # % -----++-,,,,,,,,,,,,.....
+.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-- ++ ---+ + +%@ %++++++------%-,,,,,,,,,,,......
+...................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---- -------++ +------------,,,,,,,,,,,,......
+....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----------+% +--------,,,,,,,,,,,,,,,.......
+......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------+# -----,,,,,,,,,,,,,,,,,,.......
+.......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------+ #----,,,,,,,,,,,,,,,,,,........
+.........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----+% %#---,,,,,,,,,,,,,,,,,,,........
+..........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+%+%@ %+%%--,,,,,,,,,,,,,,,,,,.........
+............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+-+% %----,,,,,,,,,,,,,,,,,,..........
+.............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+%@+---,,,,,,,,,,,,,,,,,,,..........
+...............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+%----,,,,,,,,,,,,,,,,,,...........
+................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----%+ +--,,,,,,,,,,,,,,,,,............
+..................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---++----,,,,,,,,,,,,,,,,,.............
+...................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,---@-----,,,,,,,,,,,,,,,,,.............
+.....................................,,,,,,,,,,,,,,,,,,,,,,,,,,,-----,,,,,,,,,,,,,,,,,,,..............
+ .....................................,,,,,,,,,,,,,,,,,,,,,,,,,,--%,,,,,,,,,,,,,,,,,,,,...............
+ .......................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.................
+ ........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,..................
+ ........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...................
+ .........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....................
+ ..........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,......................
+ ............................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,........................
+ .............................................,,,,,,,,,,,,,,,,,,,,,,,,..........................
+ ................................................,,,,,,,,,,,,,,,,,.............................
+ .....................................................,,,,....................................
+ ...........................................................................................
+ .........................................................................................
+ ......................................................................................
+ ....................................................................................
+ .................................................................................
+ ..............................................................................
+ ...........................................................................
+ ........................................................................
# End of 10.2 tests
#
# MDEV-14217 [db crash] Recursive CTE when SELECT includes new field
diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test
index 2e95296ef57..79809044c00 100644
--- a/mysql-test/main/cte_recursive.test
+++ b/mysql-test/main/cte_recursive.test
@@ -2441,6 +2441,61 @@ SELECT * FROM expired_map;
DROP TABLE purchases, expired;
+--echo #
+--echo # MDEV-17635: Two recursive CTEs, the second using the first
+--echo #
+
+WITH RECURSIVE
+x AS (SELECT 0 as k UNION ALL SELECT k + 1 FROM x WHERE k < 1),
+z AS
+ ( SELECT k1 AS cx, k2 AS cy, k1, k2
+ FROM (SELECT k AS k1 FROM x) x1 JOIN (SELECT k AS k2 FROM x) y1
+ UNION
+ SELECT 1,1,1,1 FROM z)
+SELECT * FROM z;
+
+--echo # https://wiki.postgresql.org/wiki/Mandelbrot_set:
+
+WITH RECURSIVE x(i) AS (
+ SELECT CAST(0 AS DECIMAL(13, 10))
+ UNION ALL
+ SELECT i + 1
+ FROM x
+ WHERE i < 101
+),
+Z(Ix, Iy, Cx, Cy, X, Y, I) AS (
+ SELECT Ix, Iy, X, Y, X, Y, 0
+ FROM (SELECT CAST(-2.2 + 0.031 * i AS DECIMAL(13, 10)) AS X,
+ i AS Ix FROM x) AS xgen
+ CROSS JOIN (
+ SELECT CAST(-1.5 + 0.031 * i AS DECIMAL(13, 10)) AS Y,
+ i AS iY FROM x
+ ) AS ygen
+ UNION ALL
+ SELECT Ix, Iy, Cx, Cy,
+ CAST(X * X - Y * Y + Cx AS DECIMAL(13, 10)) AS X,
+ CAST(Y * X * 2 + Cy AS DECIMAL(13, 10)), I + 1
+ FROM Z
+ WHERE X * X + Y * Y < 16.0
+ AND I < 27
+),
+Zt (Ix, Iy, I) AS (
+ SELECT Ix, Iy, MAX(I) AS I
+ FROM Z
+ GROUP BY Iy, Ix
+ ORDER BY Iy, Ix
+)
+SELECT GROUP_CONCAT(
+ SUBSTRING(
+ ' .,,,-----++++%%%%@@@@#### ',
+ GREATEST(I, 1),
+ 1
+ ) ORDER BY Ix SEPARATOR ''
+ ) AS 'Mandelbrot Set'
+ FROM Zt
+GROUP BY Iy
+ORDER BY Iy;
+
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result
index 8032702ffbb..5ee85eee7de 100644
--- a/mysql-test/main/mysqld--help.result
+++ b/mysql-test/main/mysqld--help.result
@@ -1210,6 +1210,10 @@ The following specify which files/extra groups are read (specified before remain
NO_AUTO_CREATE_USER, HIGH_NOT_PRECEDENCE,
NO_ENGINE_SUBSTITUTION, PAD_CHAR_TO_FULL_LENGTH,
EMPTY_STRING_IS_NULL, SIMULTANEOUS_ASSIGNMENT
+ --sql-safe-updates If set to 1, UPDATEs and DELETEs need either a key in the
+ WHERE clause, or a LIMIT clause, or else they will
+ aborted. Prevents the common mistake of accidentally
+ deleting or updating every row in a table.
--stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.)
--standard-compliant-cte
@@ -1668,6 +1672,7 @@ slow-launch-time 2
slow-query-log FALSE
sort-buffer-size 2097152
sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+sql-safe-updates FALSE
stack-trace TRUE
standard-compliant-cte TRUE
stored-program-cache 256
diff --git a/mysql-test/main/parser.result b/mysql-test/main/parser.result
index 69207f7ca23..4a3a9ed2380 100644
--- a/mysql-test/main/parser.result
+++ b/mysql-test/main/parser.result
@@ -1684,3 +1684,24 @@ SELECT without VERSIONING FROM t1
SELECT without WITHOUT FROM t1
DROP PROCEDURE p2;
DROP PROCEDURE p1;
+#
+# MDEV-16697: Fix difference between 32bit/windows and 64bit
+# systems in allowed select nest level
+#
+SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+1
+)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT
+1
+End of 10.3 tests
diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test
index 33316d42b95..1806816ca5d 100644
--- a/mysql-test/main/parser.test
+++ b/mysql-test/main/parser.test
@@ -1446,3 +1446,20 @@ CALL p2('without');
DROP PROCEDURE p2;
DROP PROCEDURE p1;
+
+
+--echo #
+--echo # MDEV-16697: Fix difference between 32bit/windows and 64bit
+--echo # systems in allowed select nest level
+--echo #
+ SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
+1
+)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));
+--echo End of 10.3 tests
diff --git a/mysql-test/main/sql_safe_updates.opt b/mysql-test/main/sql_safe_updates.opt
new file mode 100644
index 00000000000..7ffaa462d01
--- /dev/null
+++ b/mysql-test/main/sql_safe_updates.opt
@@ -0,0 +1 @@
+--enable-sql-safe-updates
diff --git a/mysql-test/main/sql_safe_updates.result b/mysql-test/main/sql_safe_updates.result
new file mode 100644
index 00000000000..356cd36bad9
--- /dev/null
+++ b/mysql-test/main/sql_safe_updates.result
@@ -0,0 +1,3 @@
+select @@sql_safe_updates;
+@@sql_safe_updates
+1
diff --git a/mysql-test/main/sql_safe_updates.test b/mysql-test/main/sql_safe_updates.test
new file mode 100644
index 00000000000..18decd0ff2c
--- /dev/null
+++ b/mysql-test/main/sql_safe_updates.test
@@ -0,0 +1,4 @@
+#
+# MDEV-14429 sql_safe_updates in my.cnf not work
+#
+select @@sql_safe_updates;
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 28792d2ad01..361724e5c57 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -25,7 +25,7 @@
# Tool used for executing a suite of .test files
#
# See the "MySQL Test framework manual" for more information
-# http://dev.mysql.com/doc/mysqltest/en/index.html
+# https://mariadb.com/kb/en/library/mysqltest/
#
#
##############################################################################
diff --git a/mysql-test/suite/encryption/r/innodb-encryption-alter.result b/mysql-test/suite/encryption/r/innodb-encryption-alter.result
index fcc87493976..1d5b88bc750 100644
--- a/mysql-test/suite/encryption/r/innodb-encryption-alter.result
+++ b/mysql-test/suite/encryption/r/innodb-encryption-alter.result
@@ -48,3 +48,40 @@ Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available
Error 1478 Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
set innodb_default_encryption_key_id = 1;
drop table t1,t2;
+SET GLOBAL innodb_encrypt_tables=OFF;
+CREATE TABLE t1 (a int not null primary key) engine=innodb;
+ALTER TABLE t1 ENCRYPTION_KEY_ID=4;
+ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
+SHOW WARNINGS;
+Level Code Message
+Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1
+Error 1478 Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t2 (a int not null primary key) engine=innodb;
+ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY;
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
+SHOW WARNINGS;
+Level Code Message
+Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
+ERROR HY000: Can't create table `test`.`t3` (errno: 140 "Wrong create options")
+SHOW WARNINGS;
+Level Code Message
+Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1
+Error 1005 Can't create table `test`.`t3` (errno: 140 "Wrong create options")
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
diff --git a/mysql-test/suite/encryption/t/innodb-encryption-alter.test b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
index af1c749d8a9..e8391d97d6c 100644
--- a/mysql-test/suite/encryption/t/innodb-encryption-alter.test
+++ b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
@@ -81,6 +81,30 @@ connection default;
drop table t1,t2;
+#
+# MDEV-17230: encryption_key_id from alter is ignored by encryption threads
+#
+SET GLOBAL innodb_encrypt_tables=OFF;
+CREATE TABLE t1 (a int not null primary key) engine=innodb;
+--error ER_ILLEGAL_HA_CREATE_OPTION
+ALTER TABLE t1 ENCRYPTION_KEY_ID=4;
+SHOW WARNINGS;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t2 (a int not null primary key) engine=innodb;
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY;
+--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+SHOW WARNINGS;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
+SHOW WARNINGS;
+
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_encrypt_tables = $encrypt_tables;
diff --git a/mysql-test/suite/innodb/include/alter_nocopy.inc b/mysql-test/suite/innodb/include/alter_nocopy.inc
deleted file mode 100644
index 00cab8c47e5..00000000000
--- a/mysql-test/suite/innodb/include/alter_nocopy.inc
+++ /dev/null
@@ -1,33 +0,0 @@
-CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
- f3 INT AS (f2 * f2) VIRTUAL,
- f4 INT NOT NULL UNIQUE,
- f5 INT NOT NULL,
- INDEX`idx`(f2))ENGINE=INNODB;
-
-CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
- INDEX(f1),
- FOREIGN KEY `fidx` (f1) REFERENCES t1(f1))ENGINE=INNODB;
-
-INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
-
-SELECT @@alter_algorithm;
-
---enable_info
---error $error_code
---eval ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1
-
---error $error_code
---eval ALTER TABLE t1 DROP INDEX idx, page_compression_level=5
-
---error $error_code
---eval ALTER TABLE t1 ADD UNIQUE INDEX u1(f2)
-
---error $error_code
---eval ALTER TABLE t1 DROP INDEX f4, page_compression_level=9
-
-SET foreign_key_checks = 0;
---error $error_code
---eval ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1)
-
-DROP TABLE t2, t1;
---disable_info
diff --git a/mysql-test/suite/innodb/include/alter_nocopy_fail.inc b/mysql-test/suite/innodb/include/alter_nocopy_fail.inc
deleted file mode 100644
index a075cf96e3c..00000000000
--- a/mysql-test/suite/innodb/include/alter_nocopy_fail.inc
+++ /dev/null
@@ -1,51 +0,0 @@
-CREATE TABLE t1(f1 INT NOT NULL,
- f2 INT NOT NULL,
- f3 INT NULL,
- f4 INT as (f2) STORED,
- f5 INT as (f3) STORED,
- PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB;
-INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
-
-SELECT @@alter_algorithm;
-
---enable_info
---echo # All the following cases needs table rebuild
-
---echo # Add and Drop primary key
---error $error_code
---eval ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1)
-
---echo # Make existing column NULLABLE
---error $error_code
---eval ALTER TABLE t1 MODIFY f2 INT
-
---echo # Make existing column NON-NULLABLE
---error $error_code
---eval ALTER TABLE t1 MODIFY f3 INT NOT NULL
-
---echo # Drop Stored Column
---error $error_code
---eval ALTER TABLE t1 DROP COLUMN f5
-
---echo # Add base non-generated column as a last column in the compressed table
---error $error_code
---eval ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL
-
---echo # Add base non-generated column but not in the last position
---error $error_code
---eval ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3
-
---echo # Force the table to rebuild
---error $error_code
---eval ALTER TABLE t1 FORCE
-
---echo # Row format changes
---error $error_code
---eval ALTER TABLE t1 ROW_FORMAT=COMPRESSED
-
---echo # Engine table
---error $error_code
---eval ALTER TABLE t1 ENGINE=INNODB
-
-DROP TABLE t1;
---disable_info
diff --git a/mysql-test/suite/innodb/include/alter_not_null.inc b/mysql-test/suite/innodb/include/alter_not_null.inc
deleted file mode 100644
index 109fad38d16..00000000000
--- a/mysql-test/suite/innodb/include/alter_not_null.inc
+++ /dev/null
@@ -1,94 +0,0 @@
---source include/have_innodb.inc
-
-CREATE TABLE t1(f1 INT)ENGINE=INNODB;
-INSERT INTO t1 VALUES(NULL);
-SELECT * FROM t1;
---enable_info
---error $error_code
-ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL;
---disable_info
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB;
-INSERT INTO t1 VALUES(NULL);
-SELECT * FROM t1;
---enable_info
---error $error_code
-ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL;
---disable_info
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB;
-INSERT INTO t1 VALUES(NULL);
-SELECT * FROM t1;
---enable_info
---error $error_code
-ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL;
---disable_info
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(f1 TEXT)ENGINE=INNODB;
-INSERT INTO t1 VALUES(NULL);
-SELECT * FROM t1;
---enable_info
---error $error_code
-ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc';
---disable_info
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB;
-INSERT INTO t1 VALUES(2, 2, NULL);
-SELECT * FROM t1;
---enable_info
---error $error_code
-ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2);
---disable_info
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB;
-INSERT INTO t1 VALUES(10, NULL);
-SELECT * FROM t1;
---enable_info
---error $error_code
-ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0);
---disable_info
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB;
---enable_info
-ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL;
---disable_info
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB;
---enable_info
-ALTER TABLE t1 FORCE;
---disable_info
-DROP TABLE t1;
-
-# Alter ignore should work irrespective of sql mode
-
-CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB;
-INSERT INTO t1 VALUES(1, NULL);
---enable_info
-ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2;
---disable_info
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-16126 Crash or ASAN heap-buffer-overflow in
---echo # mach_read_from_n_little_endian upon ALTER TABLE with blob
---echo #
-
-CREATE TABLE t1(a INT, v INT AS (a), b INT, c BLOB) ENGINE=InnoDB;
---enable_info
-ALTER TABLE t1 ADD PRIMARY KEY(b);
---disable_info
-DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff
index 8178e9ea58e..a1fa20c2ba1 100644
--- a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff
+++ b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff
@@ -64,12 +64,9 @@
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
-@@ -58,23 +58,23 @@
+@@ -57,22 +57,22 @@
+ FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
- SELECT @@alter_algorithm;
- @@alter_algorithm
--COPY
-+INPLACE
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
@@ -99,3 +96,59 @@
+info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t2, t1;
affected rows: 0
+ CREATE TABLE t1(f1 INT NOT NULL,
+@@ -85,27 +85,27 @@
+ INSERT INTO t1(f1, f2) VALUES(1, 1);
+ # Add column at the end of the table
+ ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Change virtual column expression
+ ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Add virtual column
+ ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Rename Column
+ ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Rename table
+ ALTER TABLE t1 RENAME t3;
+ affected rows: 0
+ # Drop Virtual Column
+ ALTER TABLE t3 DROP COLUMN vcol;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Column length varies
+ ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
+ affected rows: 0
+@@ -113,12 +113,12 @@
+ SET foreign_key_checks = 0;
+ affected rows: 0
+ ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ SET foreign_key_checks = 1;
+ affected rows: 0
+ ALTER TABLE t3 DROP FOREIGN KEY fidx;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ DROP TABLE t3, t2;
+ affected rows: 0
diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff
index ce2e240bb35..879bba43932 100644
--- a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff
+++ b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff
@@ -55,12 +55,9 @@
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
-@@ -58,23 +49,18 @@
+@@ -57,22 +48,17 @@
+ FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
- SELECT @@alter_algorithm;
- @@alter_algorithm
--COPY
-+INSTANT
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
@@ -85,3 +82,59 @@
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY
DROP TABLE t2, t1;
affected rows: 0
+ CREATE TABLE t1(f1 INT NOT NULL,
+@@ -85,27 +71,27 @@
+ INSERT INTO t1(f1, f2) VALUES(1, 1);
+ # Add column at the end of the table
+ ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Change virtual column expression
+ ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Add virtual column
+ ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Rename Column
+ ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Rename table
+ ALTER TABLE t1 RENAME t3;
+ affected rows: 0
+ # Drop Virtual Column
+ ALTER TABLE t3 DROP COLUMN vcol;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Column length varies
+ ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
+ affected rows: 0
+@@ -113,12 +99,12 @@
+ SET foreign_key_checks = 0;
+ affected rows: 0
+ ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ SET foreign_key_checks = 1;
+ affected rows: 0
+ ALTER TABLE t3 DROP FOREIGN KEY fidx;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ DROP TABLE t3, t2;
+ affected rows: 0
diff --git a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff
index 5d462e0012d..6db0f2af347 100644
--- a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff
+++ b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff
@@ -55,12 +55,9 @@
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
-@@ -58,23 +49,23 @@
+@@ -57,22 +48,22 @@
+ FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
- SELECT @@alter_algorithm;
- @@alter_algorithm
--COPY
-+NOCOPY
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
@@ -90,3 +87,59 @@
+info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t2, t1;
affected rows: 0
+ CREATE TABLE t1(f1 INT NOT NULL,
+@@ -85,27 +76,27 @@
+ INSERT INTO t1(f1, f2) VALUES(1, 1);
+ # Add column at the end of the table
+ ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Change virtual column expression
+ ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Add virtual column
+ ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Rename Column
+ ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Rename table
+ ALTER TABLE t1 RENAME t3;
+ affected rows: 0
+ # Drop Virtual Column
+ ALTER TABLE t3 DROP COLUMN vcol;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ # Column length varies
+ ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
+ affected rows: 0
+@@ -113,12 +104,12 @@
+ SET foreign_key_checks = 0;
+ affected rows: 0
+ ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ SET foreign_key_checks = 1;
+ affected rows: 0
+ ALTER TABLE t3 DROP FOREIGN KEY fidx;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
+ DROP TABLE t3, t2;
+ affected rows: 0
diff --git a/mysql-test/suite/innodb/r/alter_algorithm.result b/mysql-test/suite/innodb/r/alter_algorithm.result
index cbefcad5986..3d3a7e85444 100644
--- a/mysql-test/suite/innodb/r/alter_algorithm.result
+++ b/mysql-test/suite/innodb/r/alter_algorithm.result
@@ -51,14 +51,11 @@ CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
f3 INT AS (f2 * f2) VIRTUAL,
f4 INT NOT NULL UNIQUE,
f5 INT NOT NULL,
-INDEX`idx`(f2))ENGINE=INNODB;
+INDEX idx(f2))ENGINE=INNODB;
CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
INDEX(f1),
-FOREIGN KEY `fidx` (f1) REFERENCES t1(f1))ENGINE=INNODB;
+FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
-SELECT @@alter_algorithm;
-@@alter_algorithm
-COPY
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
@@ -78,3 +75,50 @@ affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
DROP TABLE t2, t1;
affected rows: 0
+CREATE TABLE t1(f1 INT NOT NULL,
+f2 INT NOT NULL,
+f3 INT AS (f2 * f2) VIRTUAL,
+INDEX idx (f2))engine=innodb;
+CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
+f3 VARCHAR(10),
+INDEX(f1))ENGINE=INNODB;
+INSERT INTO t1(f1, f2) VALUES(1, 1);
+# Add column at the end of the table
+ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 0
+# Change virtual column expression
+ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL;
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 0
+# Add virtual column
+ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL;
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 0
+# Rename Column
+ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL;
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 0
+# Rename table
+ALTER TABLE t1 RENAME t3;
+affected rows: 0
+# Drop Virtual Column
+ALTER TABLE t3 DROP COLUMN vcol;
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 0
+# Column length varies
+ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+SET foreign_key_checks = 0;
+affected rows: 0
+ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 0
+SET foreign_key_checks = 1;
+affected rows: 0
+ALTER TABLE t3 DROP FOREIGN KEY fidx;
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 0
+DROP TABLE t3, t2;
+affected rows: 0
diff --git a/mysql-test/suite/innodb/r/alter_instant,COPY.rdiff b/mysql-test/suite/innodb/r/alter_instant,COPY.rdiff
deleted file mode 100644
index cb4a72614b9..00000000000
--- a/mysql-test/suite/innodb/r/alter_instant,COPY.rdiff
+++ /dev/null
@@ -1,61 +0,0 @@
---- alter_instant.result 2018-04-10 11:19:46.299868465 +0530
-+++ alter_instant.reject 2018-04-10 11:21:19.648918489 +0530
-@@ -8,30 +8,30 @@
- INSERT INTO t1(f1, f2) VALUES(1, 1);
- select @@alter_algorithm;
- @@alter_algorithm
--NOCOPY
-+COPY
- # Add column at the end of the table
- ALTER TABLE t1 ADD COLUMN f4 char(100) default "BIG WALL";
--affected rows: 0
--info: Records: 0 Duplicates: 0 Warnings: 0
-+affected rows: 1
-+info: Records: 1 Duplicates: 0 Warnings: 0
- # Change virtual column expression
- ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL;
--affected rows: 0
--info: Records: 0 Duplicates: 0 Warnings: 0
-+affected rows: 1
-+info: Records: 1 Duplicates: 0 Warnings: 0
- # Add virtual column
- ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL;
--affected rows: 0
--info: Records: 0 Duplicates: 0 Warnings: 0
-+affected rows: 1
-+info: Records: 1 Duplicates: 0 Warnings: 0
- # Rename Column
- ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL;
--affected rows: 0
--info: Records: 0 Duplicates: 0 Warnings: 0
-+affected rows: 1
-+info: Records: 1 Duplicates: 0 Warnings: 0
- # Rename table
- ALTER TABLE t1 RENAME t3;
- affected rows: 0
- # Drop Virtual Column
- ALTER TABLE t3 DROP COLUMN vcol;
--affected rows: 0
--info: Records: 0 Duplicates: 0 Warnings: 0
-+affected rows: 1
-+info: Records: 1 Duplicates: 0 Warnings: 0
- # Column length varies
- ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
- affected rows: 0
-@@ -39,12 +39,12 @@
- SET foreign_key_checks = 0;
- affected rows: 0
- ALTER TABLE t3 ADD FOREIGN KEY `fidx`(f2) REFERENCES t2(f1);
--affected rows: 0
--info: Records: 0 Duplicates: 0 Warnings: 0
-+affected rows: 1
-+info: Records: 1 Duplicates: 0 Warnings: 0
- SET foreign_key_checks = 1;
- affected rows: 0
- ALTER TABLE t3 DROP FOREIGN KEY `fidx`;
--affected rows: 0
--info: Records: 0 Duplicates: 0 Warnings: 0
-+affected rows: 1
-+info: Records: 1 Duplicates: 0 Warnings: 0
- DROP TABLE t3, t2;
- affected rows: 0
diff --git a/mysql-test/suite/innodb/r/alter_instant,INPLACE.rdiff b/mysql-test/suite/innodb/r/alter_instant,INPLACE.rdiff
deleted file mode 100644
index ec80e1d8ef0..00000000000
--- a/mysql-test/suite/innodb/r/alter_instant,INPLACE.rdiff
+++ /dev/null
@@ -1,11 +0,0 @@
---- alter_instant.result 2018-04-10 11:19:46.299868465 +0530
-+++ alter_instant.reject 2018-04-10 11:22:19.433617807 +0530
-@@ -8,7 +8,7 @@
- INSERT INTO t1(f1, f2) VALUES(1, 1);
- select @@alter_algorithm;
- @@alter_algorithm
--NOCOPY
-+INPLACE
- # Add column at the end of the table
- ALTER TABLE t1 ADD COLUMN f4 char(100) default "BIG WALL";
- affected rows: 0
diff --git a/mysql-test/suite/innodb/r/alter_instant,INSTANT.rdiff b/mysql-test/suite/innodb/r/alter_instant,INSTANT.rdiff
deleted file mode 100644
index cf2f8a2d719..00000000000
--- a/mysql-test/suite/innodb/r/alter_instant,INSTANT.rdiff
+++ /dev/null
@@ -1,11 +0,0 @@
---- alter_instant.result 2018-04-10 11:19:46.299868465 +0530
-+++ alter_instant.reject 2018-04-10 11:22:47.281949905 +0530
-@@ -8,7 +8,7 @@
- INSERT INTO t1(f1, f2) VALUES(1, 1);
- select @@alter_algorithm;
- @@alter_algorithm
--NOCOPY
-+INSTANT
- # Add column at the end of the table
- ALTER TABLE t1 ADD COLUMN f4 char(100) default "BIG WALL";
- affected rows: 0
diff --git a/mysql-test/suite/innodb/r/alter_instant.result b/mysql-test/suite/innodb/r/alter_instant.result
deleted file mode 100644
index ec64e41cd01..00000000000
--- a/mysql-test/suite/innodb/r/alter_instant.result
+++ /dev/null
@@ -1,50 +0,0 @@
-CREATE TABLE t1(f1 INT NOT NULL,
-f2 INT NOT NULL,
-f3 INT AS (f2 * f2) VIRTUAL,
-INDEX idx (f2))engine=innodb;
-CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
-f3 VARCHAR(10),
-INDEX(f1))ENGINE=INNODB;
-INSERT INTO t1(f1, f2) VALUES(1, 1);
-select @@alter_algorithm;
-@@alter_algorithm
-NOCOPY
-# Add column at the end of the table
-ALTER TABLE t1 ADD COLUMN f4 char(100) default "BIG WALL";
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
-# Change virtual column expression
-ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
-# Add virtual column
-ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
-# Rename Column
-ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
-# Rename table
-ALTER TABLE t1 RENAME t3;
-affected rows: 0
-# Drop Virtual Column
-ALTER TABLE t3 DROP COLUMN vcol;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
-# Column length varies
-ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
-SET foreign_key_checks = 0;
-affected rows: 0
-ALTER TABLE t3 ADD FOREIGN KEY `fidx`(f2) REFERENCES t2(f1);
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
-SET foreign_key_checks = 1;
-affected rows: 0
-ALTER TABLE t3 DROP FOREIGN KEY `fidx`;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
-DROP TABLE t3, t2;
-affected rows: 0
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index 3663c18ea44..b4e0f090e5d 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -3126,7 +3126,7 @@ INSERT INTO t1 VALUES (0);
SET SQL_MODE='STRICT_ALL_TABLES';
CREATE TABLE t2
SELECT LEAST((SELECT '' FROM t1),NOW()) FROM `t1`;
-ERROR 22007: Incorrect datetime value: ''
+ERROR 22007: Truncated incorrect datetime value: ''
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
#
diff --git a/mysql-test/suite/innodb/t/alter_algorithm.test b/mysql-test/suite/innodb/t/alter_algorithm.test
index 23cddd46225..7cb706e865a 100644
--- a/mysql-test/suite/innodb/t/alter_algorithm.test
+++ b/mysql-test/suite/innodb/t/alter_algorithm.test
@@ -10,7 +10,57 @@ if ($algorithm == "INSTANT") {
let $error_code = ER_ALTER_OPERATION_NOT_SUPPORTED, ER_ALTER_OPERATION_NOT_SUPPORTED_REASON;
}
---source include/alter_nocopy_fail.inc
+CREATE TABLE t1(f1 INT NOT NULL,
+ f2 INT NOT NULL,
+ f3 INT NULL,
+ f4 INT as (f2) STORED,
+ f5 INT as (f3) STORED,
+ PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB;
+INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
+
+SELECT @@alter_algorithm;
+
+--enable_info
+--echo # All the following cases needs table rebuild
+
+--echo # Add and Drop primary key
+--error $error_code
+ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1);
+
+--echo # Make existing column NULLABLE
+--error $error_code
+ALTER TABLE t1 MODIFY f2 INT;
+
+--echo # Make existing column NON-NULLABLE
+--error $error_code
+ALTER TABLE t1 MODIFY f3 INT NOT NULL;
+
+--echo # Drop Stored Column
+--error $error_code
+ALTER TABLE t1 DROP COLUMN f5;
+
+--echo # Add base non-generated column as a last column in the compressed table
+--error $error_code
+ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL;
+
+--echo # Add base non-generated column but not in the last position
+--error $error_code
+ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3;
+
+--echo # Force the table to rebuild
+--error $error_code
+ALTER TABLE t1 FORCE;
+
+--echo # Row format changes
+--error $error_code
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+
+--echo # Engine table
+--error $error_code
+ALTER TABLE t1 ENGINE=INNODB;
+
+DROP TABLE t1;
+--disable_info
if ($algorithm == "NOCOPY") {
let $error_code = 0;
@@ -19,4 +69,77 @@ if ($algorithm == "NOCOPY") {
if ($algorithm == "INSTANT") {
let $error_code = ER_ALTER_OPERATION_NOT_SUPPORTED_REASON;
}
---source include/alter_nocopy.inc
+
+CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
+ f3 INT AS (f2 * f2) VIRTUAL,
+ f4 INT NOT NULL UNIQUE,
+ f5 INT NOT NULL,
+ INDEX idx(f2))ENGINE=INNODB;
+
+CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
+ INDEX(f1),
+ FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
+
+INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
+
+--enable_info
+--error $error_code
+ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
+
+--error $error_code
+ALTER TABLE t1 DROP INDEX idx, page_compression_level=5;
+
+--error $error_code
+ALTER TABLE t1 ADD UNIQUE INDEX u1(f2);
+
+--error $error_code
+ALTER TABLE t1 DROP INDEX f4, page_compression_level=9;
+
+SET foreign_key_checks = 0;
+--error $error_code
+ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1);
+
+DROP TABLE t2, t1;
+--disable_info
+
+CREATE TABLE t1(f1 INT NOT NULL,
+ f2 INT NOT NULL,
+ f3 INT AS (f2 * f2) VIRTUAL,
+ INDEX idx (f2))engine=innodb;
+
+CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
+ f3 VARCHAR(10),
+ INDEX(f1))ENGINE=INNODB;
+
+INSERT INTO t1(f1, f2) VALUES(1, 1);
+
+--enable_info
+--echo # Add column at the end of the table
+ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
+
+--echo # Change virtual column expression
+ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL;
+
+--echo # Add virtual column
+ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL;
+
+--echo # Rename Column
+ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL;
+
+--echo # Rename table
+ALTER TABLE t1 RENAME t3;
+
+--echo # Drop Virtual Column
+ALTER TABLE t3 DROP COLUMN vcol;
+
+--echo # Column length varies
+ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
+
+SET foreign_key_checks = 0;
+ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
+
+SET foreign_key_checks = 1;
+ALTER TABLE t3 DROP FOREIGN KEY fidx;
+
+DROP TABLE t3, t2;
+--disable_info
diff --git a/mysql-test/suite/innodb/t/alter_instant.test b/mysql-test/suite/innodb/t/alter_instant.test
deleted file mode 100644
index dddb7b8ce27..00000000000
--- a/mysql-test/suite/innodb/t/alter_instant.test
+++ /dev/null
@@ -1,45 +0,0 @@
---source alter_algorithm.inc
-
-CREATE TABLE t1(f1 INT NOT NULL,
- f2 INT NOT NULL,
- f3 INT AS (f2 * f2) VIRTUAL,
- INDEX idx (f2))engine=innodb;
-
-CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
- f3 VARCHAR(10),
- INDEX(f1))ENGINE=INNODB;
-
-INSERT INTO t1(f1, f2) VALUES(1, 1);
-
-select @@alter_algorithm;
-
---enable_info
---echo # Add column at the end of the table
---eval ALTER TABLE t1 ADD COLUMN f4 char(100) default "BIG WALL"
-
---echo # Change virtual column expression
---eval ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL
-
---echo # Add virtual column
---eval ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL
-
---echo # Rename Column
---eval ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL
-
---echo # Rename table
---eval ALTER TABLE t1 RENAME t3
-
---echo # Drop Virtual Column
---eval ALTER TABLE t3 DROP COLUMN vcol
-
---echo # Column length varies
---eval ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20)
-
-SET foreign_key_checks = 0;
---eval ALTER TABLE t3 ADD FOREIGN KEY `fidx`(f2) REFERENCES t2(f1)
-
-SET foreign_key_checks = 1;
---eval ALTER TABLE t3 DROP FOREIGN KEY `fidx`
-
-DROP TABLE t3, t2;
---disable_info
diff --git a/mysql-test/suite/innodb/t/alter_not_null.test b/mysql-test/suite/innodb/t/alter_not_null.test
index 839d7f18a5e..646838593e2 100644
--- a/mysql-test/suite/innodb/t/alter_not_null.test
+++ b/mysql-test/suite/innodb/t/alter_not_null.test
@@ -1,3 +1,4 @@
+--source include/have_innodb.inc
--source alter_sql_mode.inc
let $sql_mode = `SELECT @@SQL_MODE`;
@@ -7,4 +8,95 @@ if ($sql_mode == "STRICT_TRANS_TABLES") {
let $error_code = WARN_DATA_TRUNCATED;
}
---source include/alter_not_null.inc
+CREATE TABLE t1(f1 INT)ENGINE=INNODB;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+--enable_info
+--error $error_code
+ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL;
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+--enable_info
+--error $error_code
+ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL;
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+--enable_info
+--error $error_code
+ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL;
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 TEXT)ENGINE=INNODB;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+--enable_info
+--error $error_code
+ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc';
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB;
+INSERT INTO t1 VALUES(2, 2, NULL);
+SELECT * FROM t1;
+--enable_info
+--error $error_code
+ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2);
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB;
+INSERT INTO t1 VALUES(10, NULL);
+SELECT * FROM t1;
+--enable_info
+--error $error_code
+ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0);
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB;
+--enable_info
+ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL;
+--disable_info
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB;
+--enable_info
+ALTER TABLE t1 FORCE;
+--disable_info
+DROP TABLE t1;
+
+# Alter ignore should work irrespective of sql mode
+
+CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1, NULL);
+--enable_info
+ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2;
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-16126 Crash or ASAN heap-buffer-overflow in
+--echo # mach_read_from_n_little_endian upon ALTER TABLE with blob
+--echo #
+
+CREATE TABLE t1(a INT, v INT AS (a), b INT, c BLOB) ENGINE=InnoDB;
+--enable_info
+ALTER TABLE t1 ADD PRIMARY KEY(b);
+--disable_info
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_old_master.result b/mysql-test/suite/rpl/r/rpl_old_master.result
index dd3de4d327b..f985bee6832 100644
--- a/mysql-test/suite/rpl/r/rpl_old_master.result
+++ b/mysql-test/suite/rpl/r/rpl_old_master.result
@@ -9,7 +9,10 @@ connection slave;
SET @old_parallel= @@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+FLUSH TABLES WITH READ LOCK;
include/start_slave.inc
+include/wait_for_slave_param.inc [Seconds_Behind_Master]
+UNLOCK TABLES;
connection master;
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1);
diff --git a/mysql-test/suite/rpl/t/rpl_old_master.test b/mysql-test/suite/rpl/t/rpl_old_master.test
index 8f61d6979cd..6ddc227fc14 100644
--- a/mysql-test/suite/rpl/t/rpl_old_master.test
+++ b/mysql-test/suite/rpl/t/rpl_old_master.test
@@ -27,7 +27,15 @@ SET @old_parallel= @@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=10;
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+
+# Block execution yet when the blocked query timestamp has been already accounted
+FLUSH TABLES WITH READ LOCK;
--source include/start_slave.inc
+--let $slave_param = Seconds_Behind_Master
+--let $slave_param_value = 1
+--let $slave_param_comparison= >=
+--source include/wait_for_slave_param.inc
+UNLOCK TABLES;
--connection master
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
index 08214e3e888..26acbfad9c6 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -4799,7 +4799,7 @@ NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
-COMMAND_LINE_ARGUMENT NULL
+COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME SQL_SELECT_LIMIT
SESSION_VALUE 18446744073709551615
GLOBAL_VALUE 18446744073709551615
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 0f93b2303b3..6150473c2f0 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -297,6 +297,10 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
}
info->inited=info->aio_result.pending=0;
#endif
+ if (type == READ_CACHE || type == WRITE_CACHE || type == SEQ_READ_APPEND)
+ info->myflags|= MY_FULL_IO;
+ else
+ info->myflags&= ~MY_FULL_IO;
DBUG_RETURN(0);
} /* init_io_cache */
diff --git a/mysys/my_pread.c b/mysys/my_pread.c
index edf7fb56918..2b7ce4bc0d6 100644
--- a/mysys/my_pread.c
+++ b/mysys/my_pread.c
@@ -47,8 +47,7 @@
size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
myf MyFlags)
{
- size_t readbytes;
- int error= 0;
+ size_t readbytes, save_count= 0;
DBUG_ENTER("my_pread");
@@ -66,11 +65,10 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
#else
readbytes= pread(Filedes, Buffer, Count, offset);
#endif
- error = (readbytes != Count);
- if (error)
+ if (readbytes != Count)
{
- my_errno= errno ? errno : -1;
+ my_errno= errno;
if (errno == 0 || (readbytes != (size_t) -1 &&
(MyFlags & (MY_NABP | MY_FNABP))))
my_errno= HA_ERR_FILE_TOO_SHORT;
@@ -82,6 +80,18 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
(int) readbytes));
continue; /* Interrupted */
}
+
+ /* Do a read retry if we didn't get enough data on first read */
+ if (readbytes != (size_t) -1 && readbytes != 0 &&
+ (MyFlags & MY_FULL_IO))
+ {
+ Buffer+= readbytes;
+ Count-= readbytes;
+ save_count+= readbytes;
+ offset+= readbytes;
+ continue;
+ }
+
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
if (readbytes == (size_t) -1)
@@ -97,8 +107,10 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
}
if (MyFlags & (MY_NABP | MY_FNABP))
- DBUG_RETURN(0); /* Read went ok; Return 0 */
- DBUG_RETURN(readbytes); /* purecov: inspected */
+ readbytes= 0; /* Read went ok; Return 0 */
+ else
+ readbytes+= save_count;
+ DBUG_RETURN(readbytes);
}
} /* my_pread */
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 9298c9998a8..7408dc378ef 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1991,8 +1991,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
print_where(item, "rewrite with MIN/MAX", QT_ORDINARY););
save_allow_sum_func= thd->lex->allow_sum_func;
- thd->lex->allow_sum_func|=
- (nesting_map)1 << thd->lex->current_select->nest_level;
+ thd->lex->allow_sum_func.set_bit(thd->lex->current_select->nest_level);
/*
Item_sum_(max|min) can't substitute other item => we can use 0 as
reference, also Item_sum_(max|min) can't be fixed after creation, so
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index d1865c7e771..0e52b2988a3 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -72,14 +72,15 @@ size_t Item_sum::ram_limitation(THD *thd)
bool Item_sum::init_sum_func_check(THD *thd)
{
SELECT_LEX *curr_sel= thd->lex->current_select;
- if (curr_sel && !curr_sel->name_visibility_map)
+ if (curr_sel && curr_sel->name_visibility_map.is_clear_all())
{
for (SELECT_LEX *sl= curr_sel; sl; sl= sl->context.outer_select())
{
- curr_sel->name_visibility_map|= (1 << sl-> nest_level);
+ curr_sel->name_visibility_map.set_bit(sl->nest_level);
}
}
- if (!curr_sel || !(thd->lex->allow_sum_func & curr_sel->name_visibility_map))
+ if (!curr_sel ||
+ !(thd->lex->allow_sum_func.is_overlapping(curr_sel->name_visibility_map)))
{
my_message(ER_INVALID_GROUP_FUNC_USE, ER_THD(thd, ER_INVALID_GROUP_FUNC_USE),
MYF(0));
@@ -155,10 +156,11 @@ bool Item_sum::init_sum_func_check(THD *thd)
bool Item_sum::check_sum_func(THD *thd, Item **ref)
{
SELECT_LEX *curr_sel= thd->lex->current_select;
- nesting_map allow_sum_func= (thd->lex->allow_sum_func &
- curr_sel->name_visibility_map);
+ nesting_map allow_sum_func(thd->lex->allow_sum_func);
+ allow_sum_func.intersect(curr_sel->name_visibility_map);
bool invalid= FALSE;
- DBUG_ASSERT(curr_sel->name_visibility_map); // should be set already
+ // should be set already
+ DBUG_ASSERT(!curr_sel->name_visibility_map.is_clear_all());
/*
Window functions can not be used as arguments to sum functions.
@@ -189,10 +191,10 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
If it is there under a construct where it is not allowed
we report an error.
*/
- invalid= !(allow_sum_func & ((nesting_map)1 << max_arg_level));
+ invalid= !(allow_sum_func.is_set(max_arg_level));
}
else if (max_arg_level >= 0 ||
- !(allow_sum_func & ((nesting_map)1 << nest_level)))
+ !(allow_sum_func.is_set(nest_level)))
{
/*
The set function can be aggregated only in outer subqueries.
@@ -202,7 +204,7 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
if (register_sum_func(thd, ref))
return TRUE;
invalid= aggr_level < 0 &&
- !(allow_sum_func & ((nesting_map)1 << nest_level));
+ !(allow_sum_func.is_set(nest_level));
if (!invalid && thd->variables.sql_mode & MODE_ANSI)
invalid= aggr_level < 0 && max_arg_level < nest_level;
}
@@ -354,14 +356,14 @@ bool Item_sum::register_sum_func(THD *thd, Item **ref)
sl= sl->context.outer_select())
{
if (aggr_level < 0 &&
- (allow_sum_func & ((nesting_map)1 << sl->nest_level)))
+ (allow_sum_func.is_set(sl->nest_level)))
{
/* Found the most nested subquery where the function can be aggregated */
aggr_level= sl->nest_level;
aggr_sel= sl;
}
}
- if (sl && (allow_sum_func & ((nesting_map)1 << sl->nest_level)))
+ if (sl && (allow_sum_func.is_set(sl->nest_level)))
{
/*
We reached the subquery of level max_arg_level and checked
diff --git a/sql/slave.cc b/sql/slave.cc
index bb1300d36e6..16fa890d86c 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -4304,6 +4304,19 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
This is the case for pre-10.0 events without GTID, and for handling
slave_skip_counter.
*/
+ if (!(ev->is_artificial_event() || ev->is_relay_log_event() || (ev->when == 0)))
+ {
+ /*
+ Ignore FD's timestamp as it does not reflect the slave execution
+ state but likely to reflect a deep past. Consequently when the first
+ data modification event execution last long all this time
+ Seconds_Behind_Master is zero.
+ */
+ if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT)
+ rli->last_master_timestamp= ev->when + (time_t) ev->exec_time;
+
+ DBUG_ASSERT(rli->last_master_timestamp >= 0);
+ }
}
if (typ == GTID_EVENT)
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 7b466bc9c74..fc8a20404a3 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -7360,8 +7360,7 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array,
thd->column_usage= column_usage;
DBUG_PRINT("info", ("thd->column_usage: %d", thd->column_usage));
if (allow_sum_func)
- thd->lex->allow_sum_func|=
- (nesting_map)1 << thd->lex->current_select->nest_level;
+ thd->lex->allow_sum_func.set_bit(thd->lex->current_select->nest_level);
thd->where= THD::DEFAULT_WHERE;
save_is_item_list_lookup= thd->lex->current_select->is_item_list_lookup;
thd->lex->current_select->is_item_list_lookup= 0;
diff --git a/sql/sql_const.h b/sql/sql_const.h
index e28a0649f04..be26de872df 100644
--- a/sql/sql_const.h
+++ b/sql/sql_const.h
@@ -84,7 +84,7 @@
#define MAX_FIELDS 4096 /* Limit in the .frm file */
#define MAX_PARTITIONS 8192
-#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
+#define MAX_SELECT_NESTING (SELECT_NESTING_MAP_SIZE - 1)
#define MAX_SORT_MEMORY 2048*1024
#define MIN_SORT_MEMORY 1024
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index a1af2b6ebbb..c89f49aaefc 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -1286,7 +1286,7 @@ bool With_element::check_unrestricted_recursive(st_select_lex *sel,
With_element *with_elem= unit->with_element;
if (encountered & with_elem->get_elem_map())
unrestricted|= with_elem->mutually_recursive;
- else
+ else if (with_elem ==this)
encountered|= with_elem->get_elem_map();
}
}
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 3ae113a4595..148c2371a6b 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -936,7 +936,7 @@ int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list,
List<Item> all_fields;
*delete_while_scanning= true;
- thd->lex->allow_sum_func= 0;
+ thd->lex->allow_sum_func.clear_all();
if (setup_tables_and_check_access(thd,
&thd->lex->first_select_lex()->context,
&thd->lex->first_select_lex()->
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index c79cb1a294c..2f5a845d18c 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -745,7 +745,7 @@ void LEX::start(THD *thd_arg)
profile_options= PROFILE_NONE;
nest_level= 0;
builtin_select.nest_level_base= &unit;
- allow_sum_func= 0;
+ allow_sum_func.clear_all();
in_sum_func= NULL;
used_tables= 0;
@@ -2389,7 +2389,7 @@ void st_select_lex::init_select()
m_non_agg_field_used= false;
m_agg_func_used= false;
m_custom_agg_func_used= false;
- name_visibility_map= 0;
+ name_visibility_map.clear_all();
with_dep= 0;
join= 0;
lock_type= TL_READ_DEFAULT;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 618214dbb9c..8dab2a06973 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -33,6 +33,10 @@
#include "sql_tvc.h"
#include "item.h"
+/* Used for flags of nesting constructs */
+#define SELECT_NESTING_MAP_SIZE 64
+typedef Bitmap<SELECT_NESTING_MAP_SIZE> nesting_map;
+
/* YACC and LEX Definitions */
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 95d14d9ab0d..96e07b19dd8 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -853,7 +853,7 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
const bool save_agg_field= thd->lex->current_select->non_agg_field_used();
const bool save_agg_func= thd->lex->current_select->agg_func_used();
const nesting_map saved_allow_sum_func= thd->lex->allow_sum_func;
- thd->lex->allow_sum_func= 0;
+ thd->lex->allow_sum_func.clear_all();
if (likely(!(error= func_expr->fix_fields_if_needed(thd, (Item**)&func_expr))))
func_expr->walk(&Item::post_fix_fields_part_expr_processor, 0, NULL);
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 09d31470a00..6def798b1c7 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -3043,7 +3043,7 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
lex->result->cleanup();
lex->result->set_thd(thd);
}
- lex->allow_sum_func= 0;
+ lex->allow_sum_func.clear_all();
lex->in_sum_func= NULL;
DBUG_VOID_RETURN;
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 1780df61e56..7ae4e7aaa27 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -645,7 +645,7 @@ setup_without_group(THD *thd, Ref_ptr_array ref_pointer_array,
const bool saved_non_agg_field_used= select->non_agg_field_used();
DBUG_ENTER("setup_without_group");
- thd->lex->allow_sum_func&= ~((nesting_map)1 << select->nest_level);
+ thd->lex->allow_sum_func.clear_bit(select->nest_level);
res= setup_conds(thd, tables, leaves, conds);
if (thd->lex->current_select->first_cond_optimization)
{
@@ -658,18 +658,18 @@ setup_without_group(THD *thd, Ref_ptr_array ref_pointer_array,
/* it's not wrong to have non-aggregated columns in a WHERE */
select->set_non_agg_field_used(saved_non_agg_field_used);
- thd->lex->allow_sum_func|= (nesting_map)1 << select->nest_level;
+ thd->lex->allow_sum_func.set_bit(select->nest_level);
save_place= thd->lex->current_select->context_analysis_place;
thd->lex->current_select->context_analysis_place= IN_ORDER_BY;
res= res || setup_order(thd, ref_pointer_array, tables, fields, all_fields,
order);
- thd->lex->allow_sum_func&= ~((nesting_map)1 << select->nest_level);
+ thd->lex->allow_sum_func.clear_bit(select->nest_level);
thd->lex->current_select->context_analysis_place= IN_GROUP_BY;
res= res || setup_group(thd, ref_pointer_array, tables, fields, all_fields,
group, hidden_group_fields);
thd->lex->current_select->context_analysis_place= save_place;
- thd->lex->allow_sum_func|= (nesting_map)1 << select->nest_level;
+ thd->lex->allow_sum_func.set_bit(select->nest_level);
res= res || setup_windows(thd, ref_pointer_array, tables, fields, all_fields,
win_specs, win_funcs);
thd->lex->allow_sum_func= save_allow_sum_func;
@@ -1117,7 +1117,7 @@ JOIN::prepare(TABLE_LIST *tables_init,
select_lex->master_unit()->global_parameters())
{
nesting_map save_allow_sum_func= thd->lex->allow_sum_func;
- thd->lex->allow_sum_func|= (nesting_map)1 << select_lex->nest_level;
+ thd->lex->allow_sum_func.set_bit(select_lex->nest_level);
thd->where= "order clause";
for (ORDER *order= select_lex->order_list.first; order; order= order->next)
{
@@ -1135,7 +1135,7 @@ JOIN::prepare(TABLE_LIST *tables_init,
{
nesting_map save_allow_sum_func= thd->lex->allow_sum_func;
thd->where="having clause";
- thd->lex->allow_sum_func|= (nesting_map)1 << select_lex_arg->nest_level;
+ thd->lex->allow_sum_func.set_bit(select_lex_arg->nest_level);
select_lex->having_fix_field= 1;
/*
Wrap alone field in HAVING clause in case it will be outer field
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 27bd6f04670..63240c1547d 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1255,7 +1255,7 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
table_list->register_want_access(SELECT_ACL);
#endif
- thd->lex->allow_sum_func= 0;
+ thd->lex->allow_sum_func.clear_all();
/*
We do not call DT_MERGE_FOR_INSERT because it has no sense for simple
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 40caafb32e1..9a19a5b9c8c 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -14509,6 +14509,7 @@ load:
lex->field_list.empty();
lex->update_list.empty();
lex->value_list.empty();
+ lex->many_values.empty();
}
opt_load_data_charset
{ Lex->exchange->cs= $15; }
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index 6d8f992760b..5a6914c89c7 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -14554,9 +14554,18 @@ delete_domain_id_list:
;
delete_domain_id:
- ulong_num
+ ulonglong_num
{
- insert_dynamic(&Lex->delete_gtid_domain, (uchar*) &($1));
+ uint32 value= (uint32) $1;
+ if ($1 > UINT_MAX32)
+ {
+ my_printf_error(ER_BINLOG_CANT_DELETE_GTID_DOMAIN,
+ "The value of gtid domain being deleted ('%llu') "
+ "exceeds its maximum size "
+ "of 32 bit unsigned integer", MYF(0), $1);
+ MYSQL_YYABORT;
+ }
+ insert_dynamic(&Lex->delete_gtid_domain, (uchar*) &value);
}
;
@@ -14733,6 +14742,7 @@ load:
lex->field_list.empty();
lex->update_list.empty();
lex->value_list.empty();
+ lex->many_values.empty();
}
opt_load_data_charset
{ Lex->exchange->cs= $15; }
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 6d2dbbf646e..92c7d329bb9 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -4116,7 +4116,7 @@ static Sys_var_bit Sys_safe_updates(
"sql_safe_updates", "If set to 1, UPDATEs and DELETEs need either a key in "
"the WHERE clause, or a LIMIT clause, or else they will aborted. Prevents "
"the common mistake of accidentally deleting or updating every row in a table.",
- SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_SAFE_UPDATES,
+ SESSION_VAR(option_bits), CMD_LINE(OPT_ARG), OPTION_SAFE_UPDATES,
DEFAULT(FALSE));
static Sys_var_bit Sys_buffer_results(
diff --git a/sql/table.cc b/sql/table.cc
index 6c3e350f07d..6fed129f7e8 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -2474,7 +2474,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
if (!(key_part->key_part_flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART |
HA_BIT_PART)) &&
key_part->type != HA_KEYTYPE_FLOAT &&
- key_part->type == HA_KEYTYPE_DOUBLE)
+ key_part->type != HA_KEYTYPE_DOUBLE)
key_part->key_part_flag|= HA_CAN_MEMCMP;
}
keyinfo->usable_key_parts= usable_parts; // Filesort
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index f43cfcefb14..6dedef20c05 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -10109,16 +10109,6 @@ next_record:
return(HA_ERR_END_OF_FILE);
}
-/*************************************************************************
-*/
-
-void
-ha_innobase::ft_end()
-{
- ib::info() << "ft_end()";
-
- rnd_end();
-}
#ifdef WITH_WSREP
extern dict_index_t*
wsrep_dict_foreign_find_index(
@@ -11599,21 +11589,18 @@ create_table_info_t::check_table_options()
options->encryption_key_id = FIL_DEFAULT_ENCRYPTION_KEY;
}
- /* If default encryption is used make sure that used kay is found
- from key file. */
- if (encrypt == FIL_ENCRYPTION_DEFAULT &&
- !srv_encrypt_tables &&
- options->encryption_key_id != FIL_DEFAULT_ENCRYPTION_KEY) {
- if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) {
- push_warning_printf(
- m_thd, Sql_condition::WARN_LEVEL_WARN,
- HA_WRONG_CREATE_OPTION,
- "InnoDB: ENCRYPTION_KEY_ID %u not available",
- (uint)options->encryption_key_id
+ /* If default encryption is used and encryption is disabled, you may
+ not use nondefault encryption_key_id as it is not stored anywhere. */
+ if (encrypt == FIL_ENCRYPTION_DEFAULT
+ && !srv_encrypt_tables
+ && options->encryption_key_id != FIL_DEFAULT_ENCRYPTION_KEY) {
+ compile_time_assert(FIL_DEFAULT_ENCRYPTION_KEY == 1);
+ push_warning_printf(
+ m_thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_WRONG_CREATE_OPTION,
+ "InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1"
);
- return "ENCRYPTION_KEY_ID";
-
- }
+ return "ENCRYPTION_KEY_ID";
}
return NULL;
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index a5f9b8c8d7b..7bec858b5af 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -155,11 +155,8 @@ public:
int rnd_pos(uchar * buf, uchar *pos);
int ft_init();
-
- void ft_end();
-
- FT_INFO* ft_init_ext(uint flags, uint inx, String* key);
-
+ void ft_end() { rnd_end(); }
+ FT_INFO *ft_init_ext(uint flags, uint inx, String* key);
int ft_read(uchar* buf);
void position(const uchar *record);
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def
index a9877ed9e64..9fbc0ace0d2 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def
+++ b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def
@@ -24,6 +24,7 @@ select_for_update_skip_locked_nowait: MDEV-11481
create_no_primary_key_table: MariaDB doesn't have --block_create_no_primary_key
explicit_snapshot: MariaDB doesn't support Shared/Explicit snapshots
percona_nonflushing_analyze_debug : Requires Percona Server's Non-flushing ANALYZE feature
+com_rpc_tx : Requires connection attributes and detached sessions
##
## Tests that do not fit MariaDB's test environment. Upstream seems to test
diff --git a/vio/viossl.c b/vio/viossl.c
index b3e2bca6676..e0708ca0a12 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -124,6 +124,9 @@ static my_bool ssl_should_retry(Vio *vio, int ret, enum enum_vio_io_event *event
default:
should_retry= FALSE;
ssl_set_sys_error(ssl_error);
+#ifndef HAVE_YASSL
+ ERR_clear_error();
+#endif
break;
}
@@ -315,21 +318,16 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
{
int r;
SSL *ssl;
- my_bool unused;
- my_bool was_blocking;
my_socket sd= mysql_socket_getfd(vio->mysql_socket);
DBUG_ENTER("ssl_do");
DBUG_PRINT("enter", ("ptr: %p, sd: %d ctx: %p",
ptr, (int)sd, ptr->ssl_context));
- /* Set socket to blocking if not already set */
- vio_blocking(vio, 1, &was_blocking);
if (!(ssl= SSL_new(ptr->ssl_context)))
{
DBUG_PRINT("error", ("SSL_new failure"));
*errptr= ERR_get_error();
- vio_blocking(vio, was_blocking, &unused);
DBUG_RETURN(1);
}
DBUG_PRINT("info", ("ssl: %p timeout: %ld", ssl, timeout));
@@ -360,7 +358,6 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
DBUG_PRINT("error", ("SSL_connect/accept failure"));
*errptr= SSL_errno(ssl, r);
SSL_free(ssl);
- vio_blocking(vio, was_blocking, &unused);
DBUG_RETURN(1);
}
@@ -371,7 +368,6 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
*/
if (vio_reset(vio, VIO_TYPE_SSL, SSL_get_fd(ssl), ssl, 0))
{
- vio_blocking(vio, was_blocking, &unused);
DBUG_RETURN(1);
}