summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/main/ctype_utf16_def.result5
-rw-r--r--mysql-test/main/ctype_utf16_def.test7
-rw-r--r--mysql-test/main/ctype_utf32_def.opt1
-rw-r--r--mysql-test/main/ctype_utf32_def.result6
-rw-r--r--mysql-test/main/ctype_utf32_def.test9
-rw-r--r--mysql-test/main/default.result9
-rw-r--r--mysql-test/main/default.test9
-rw-r--r--mysql-test/main/delayed_blob.opt1
-rw-r--r--mysql-test/main/delayed_blob.result17
-rw-r--r--mysql-test/main/delayed_blob.test21
-rw-r--r--mysql-test/main/func_str.result12
-rw-r--r--mysql-test/main/func_str.test16
-rw-r--r--mysql-test/main/invisible_field.result17
-rw-r--r--mysql-test/main/invisible_field.test13
-rw-r--r--mysql-test/main/multi_update.result10
-rw-r--r--mysql-test/main/multi_update.test11
-rw-r--r--mysql-test/main/mysql_binary_zero_insert.result54
-rw-r--r--mysql-test/main/mysql_binary_zero_insert.test170
-rw-r--r--mysql-test/suite/innodb/r/mdev-14846.result52
-rw-r--r--mysql-test/suite/innodb/t/mdev-14846.opt1
-rw-r--r--mysql-test/suite/innodb/t/mdev-14846.test70
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_send.result20
-rw-r--r--mysql-test/suite/plugins/t/feedback_plugin_send.test2
-rw-r--r--mysql-test/suite/versioning/r/alter.result19
-rw-r--r--mysql-test/suite/versioning/t/alter.test22
25 files changed, 570 insertions, 4 deletions
diff --git a/mysql-test/main/ctype_utf16_def.result b/mysql-test/main/ctype_utf16_def.result
index 98b6f7d913d..b5827d45619 100644
--- a/mysql-test/main/ctype_utf16_def.result
+++ b/mysql-test/main/ctype_utf16_def.result
@@ -8,3 +8,8 @@ character_set_server utf16
SHOW VARIABLES LIKE 'ft_stopword_file';
Variable_name Value
ft_stopword_file (built-in)
+#
+# MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
+#
+SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
+SET GLOBAL ft_boolean_syntax=DEFAULT;
diff --git a/mysql-test/main/ctype_utf16_def.test b/mysql-test/main/ctype_utf16_def.test
index 0829cd53285..c6de842f618 100644
--- a/mysql-test/main/ctype_utf16_def.test
+++ b/mysql-test/main/ctype_utf16_def.test
@@ -7,3 +7,10 @@ call mtr.add_suppression("'utf16' can not be used as client character set");
SHOW VARIABLES LIKE 'collation_server';
SHOW VARIABLES LIKE 'character_set_server';
SHOW VARIABLES LIKE 'ft_stopword_file';
+
+--echo #
+--echo # MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
+--echo #
+
+SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
+SET GLOBAL ft_boolean_syntax=DEFAULT;
diff --git a/mysql-test/main/ctype_utf32_def.opt b/mysql-test/main/ctype_utf32_def.opt
new file mode 100644
index 00000000000..3b0880cbff3
--- /dev/null
+++ b/mysql-test/main/ctype_utf32_def.opt
@@ -0,0 +1 @@
+--character-set-server=utf32,latin1 --collation-server=utf32_general_ci
diff --git a/mysql-test/main/ctype_utf32_def.result b/mysql-test/main/ctype_utf32_def.result
new file mode 100644
index 00000000000..611072eb75b
--- /dev/null
+++ b/mysql-test/main/ctype_utf32_def.result
@@ -0,0 +1,6 @@
+call mtr.add_suppression("'utf32' can not be used as client character set");
+#
+# MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
+#
+SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
+SET GLOBAL ft_boolean_syntax=DEFAULT;
diff --git a/mysql-test/main/ctype_utf32_def.test b/mysql-test/main/ctype_utf32_def.test
new file mode 100644
index 00000000000..e23f96052d3
--- /dev/null
+++ b/mysql-test/main/ctype_utf32_def.test
@@ -0,0 +1,9 @@
+--source include/have_utf32.inc
+call mtr.add_suppression("'utf32' can not be used as client character set");
+
+--echo #
+--echo # MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax
+--echo #
+
+SET GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
+SET GLOBAL ft_boolean_syntax=DEFAULT;
diff --git a/mysql-test/main/default.result b/mysql-test/main/default.result
index 0d2c2e6acbc..e8f5bd8e48a 100644
--- a/mysql-test/main/default.result
+++ b/mysql-test/main/default.result
@@ -3387,6 +3387,14 @@ CREATE OR REPLACE TABLE t1(i int);
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
ERROR 42S22: Unknown column 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' in 'DEFAULT'
DROP TABLE t1;
+#
+# MDEV-18278 Misleading error message in error log upon failed table creation
+#
+create table t1 (a int as (a));
+ERROR 01000: Expression for field `a` is referring to uninitialized field `a`
+show warnings;
+Level Code Message
+Error 4029 Expression for field `a` is referring to uninitialized field `a`
# end of 10.2 test
#
# MDEV-22703 DEFAULT() on a BLOB column can overwrite the default
@@ -3403,3 +3411,4 @@ length(DEFAULT(h))
25
INSERT INTO t1 () VALUES ();
drop table t1;
+# end of 10.3 test
diff --git a/mysql-test/main/default.test b/mysql-test/main/default.test
index c0561deac67..bcd6ef7a9fb 100644
--- a/mysql-test/main/default.test
+++ b/mysql-test/main/default.test
@@ -2109,6 +2109,13 @@ CREATE OR REPLACE TABLE t1(i int);
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
DROP TABLE t1;
+--echo #
+--echo # MDEV-18278 Misleading error message in error log upon failed table creation
+--echo #
+--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
+create table t1 (a int as (a));
+show warnings;
+
--echo # end of 10.2 test
--echo #
@@ -2126,3 +2133,5 @@ SELECT DEFAULT(h) FROM t1;
SELECT length(DEFAULT(h)) FROM t1;
INSERT INTO t1 () VALUES ();
drop table t1;
+
+--echo # end of 10.3 test
diff --git a/mysql-test/main/delayed_blob.opt b/mysql-test/main/delayed_blob.opt
new file mode 100644
index 00000000000..e442a822046
--- /dev/null
+++ b/mysql-test/main/delayed_blob.opt
@@ -0,0 +1 @@
+--init_connect="set @a='something unique to have MTR start a dedicated mariadbd for this test and shutdown it after the test'"
diff --git a/mysql-test/main/delayed_blob.result b/mysql-test/main/delayed_blob.result
new file mode 100644
index 00000000000..caa2e3ae5fe
--- /dev/null
+++ b/mysql-test/main/delayed_blob.result
@@ -0,0 +1,17 @@
+#
+# MDEV-25925 Warning: Memory not freed: 32 on INSERT DELAYED
+#
+SET sql_mode='TRADITIONAL';
+CREATE TABLE t1 (c BLOB) ENGINE=MyISAM;
+INSERT DELAYED INTO t1 VALUES (''||'');
+ERROR 22007: Truncated incorrect DOUBLE value: ''
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+#
+# MDEV-24467 Memory not freed after failed INSERT DELAYED
+#
+CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
+ALTER TABLE t1 ADD b BLOB DEFAULT 'x';
+INSERT DELAYED INTO t1 (a) VALUES ('foo');
+ERROR 22001: Data too long for column 'a' at row 1
+DROP TABLE t1;
diff --git a/mysql-test/main/delayed_blob.test b/mysql-test/main/delayed_blob.test
new file mode 100644
index 00000000000..bf3e01a8825
--- /dev/null
+++ b/mysql-test/main/delayed_blob.test
@@ -0,0 +1,21 @@
+--echo #
+--echo # MDEV-25925 Warning: Memory not freed: 32 on INSERT DELAYED
+--echo #
+
+SET sql_mode='TRADITIONAL';
+CREATE TABLE t1 (c BLOB) ENGINE=MyISAM;
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT DELAYED INTO t1 VALUES (''||'');
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+
+
+--echo #
+--echo # MDEV-24467 Memory not freed after failed INSERT DELAYED
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
+ALTER TABLE t1 ADD b BLOB DEFAULT 'x';
+--error ER_DATA_TOO_LONG
+INSERT DELAYED INTO t1 (a) VALUES ('foo');
+DROP TABLE t1;
diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result
index a1522c473d3..d50a77544f3 100644
--- a/mysql-test/main/func_str.result
+++ b/mysql-test/main/func_str.result
@@ -5014,6 +5014,18 @@ DROP TABLE t1;
# End of 10.1 tests
#
#
+# Start of 10.2 tests
+#
+#
+# MDEV-24742 Server crashes in Charset::numchars / String::numchars
+#
+SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux');
+NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux')
+NULL
+#
+# End of 10.2 tests
+#
+#
# Start of 10.3 tests
#
#
diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test
index efde77f21eb..6a9fbc71371 100644
--- a/mysql-test/main/func_str.test
+++ b/mysql-test/main/func_str.test
@@ -1988,6 +1988,22 @@ DROP TABLE t1;
--echo #
+--echo # Start of 10.2 tests
+--echo #
+
+--echo #
+--echo # MDEV-24742 Server crashes in Charset::numchars / String::numchars
+--echo #
+
+SELECT NULL IN (RIGHT(AES_ENCRYPT('foo','bar'), LAST_INSERT_ID()), 'qux');
+
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
+
+
+--echo #
--echo # Start of 10.3 tests
--echo #
diff --git a/mysql-test/main/invisible_field.result b/mysql-test/main/invisible_field.result
index 9b42b043ec6..081c1ada1ee 100644
--- a/mysql-test/main/invisible_field.result
+++ b/mysql-test/main/invisible_field.result
@@ -538,7 +538,7 @@ a b
insert into t2 values(1);
select a,b from t2;
a b
-NULL 1
+12 1
drop table t1,t2;
create table t1 (a int invisible, b int, c int);
create table t2 (a int, b int, d int);
@@ -627,3 +627,18 @@ drop table t1;
create table t1 (a int, b int invisible);
insert delayed into t1 values (1);
drop table t1;
+#
+# MDEV-25891 Computed default for INVISIBLE column is ignored in INSERT
+#
+create table t1(
+a int,
+x int default (a),
+y int default (a) invisible,
+z int default (33) invisible);
+insert into t1 values (1, default);
+insert into t1 (a) values (2);
+select a, x, y, z from t1;
+a x y z
+1 1 1 33
+2 2 2 33
+drop table t1;
diff --git a/mysql-test/main/invisible_field.test b/mysql-test/main/invisible_field.test
index 7a48347ec29..558ca7aa3a2 100644
--- a/mysql-test/main/invisible_field.test
+++ b/mysql-test/main/invisible_field.test
@@ -279,3 +279,16 @@ create table t1 (a int, b int invisible);
insert delayed into t1 values (1);
# cleanup
drop table t1;
+
+--echo #
+--echo # MDEV-25891 Computed default for INVISIBLE column is ignored in INSERT
+--echo #
+create table t1(
+ a int,
+ x int default (a),
+ y int default (a) invisible,
+ z int default (33) invisible);
+insert into t1 values (1, default);
+insert into t1 (a) values (2);
+select a, x, y, z from t1;
+drop table t1;
diff --git a/mysql-test/main/multi_update.result b/mysql-test/main/multi_update.result
index 4001a47ecd4..3ec9ea0caa5 100644
--- a/mysql-test/main/multi_update.result
+++ b/mysql-test/main/multi_update.result
@@ -1151,3 +1151,13 @@ b
1
3
drop tables t1, t2;
+#
+# MDEV-22464 Server crash on UPDATE with nested subquery
+#
+create table t1 (a int) ;
+insert into t1 (a) values (1),(2),(3) ;
+select a from t1 where a= (select 2 from t1 having (a = 3));
+ERROR 21000: Subquery returns more than 1 row
+update t1 set a= (select 2 from t1 having (a = 3));
+ERROR 21000: Subquery returns more than 1 row
+drop tables t1;
diff --git a/mysql-test/main/multi_update.test b/mysql-test/main/multi_update.test
index 84f06a7c165..3ee36f97fc5 100644
--- a/mysql-test/main/multi_update.test
+++ b/mysql-test/main/multi_update.test
@@ -1087,3 +1087,14 @@ update t1 left join t2 on a = b set b= 3 order by b;
select * from t2;
drop tables t1, t2;
+
+--echo #
+--echo # MDEV-22464 Server crash on UPDATE with nested subquery
+--echo #
+create table t1 (a int) ;
+insert into t1 (a) values (1),(2),(3) ;
+--error ER_SUBQUERY_NO_1_ROW
+select a from t1 where a= (select 2 from t1 having (a = 3));
+--error ER_SUBQUERY_NO_1_ROW
+update t1 set a= (select 2 from t1 having (a = 3));
+drop tables t1;
diff --git a/mysql-test/main/mysql_binary_zero_insert.result b/mysql-test/main/mysql_binary_zero_insert.result
new file mode 100644
index 00000000000..0bed7487b3e
--- /dev/null
+++ b/mysql-test/main/mysql_binary_zero_insert.result
@@ -0,0 +1,54 @@
+# Note: This test assumes NO_BACKSLASH_ESCAPES is not set in SQL_MODE.
+##############################
+# Setup
+##############################
+#
+# Saving old state
+#
+set @old_sql_mode= @@global.SQL_MODE;
+set @@global.SQL_MODE= "";
+#
+# Create table for data entry
+#
+CREATE TABLE tb (`id` int(11) NOT NULL AUTO_INCREMENT,`cb` longblob DEFAULT NULL, PRIMARY KEY (`id`)) AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
+RESET MASTER;
+##############################
+# Test Case
+##############################
+#
+# \0 (0x5c00 in binary) should be allowed in data strings if
+# --binary-mode is enabled.
+#
+FOUND 10 /\x5c\x00/ in binary_zero_inserts.sql
+# MYSQL --binary-mode test < MYSQL_TMP_DIR/binary_zero_inserts.sql
+#
+# Ensure a row exists from each insert statement with a \0
+#
+SELECT COUNT(*)=8 from tb;
+COUNT(*)=8
+1
+#
+# Ensure that the binary zero was parsed and exists in the row data
+# Note: We only look for 00 because the 5c only served as an escape
+# in parsing.
+#
+# MYSQL_DUMP test tb --hex-blob | grep INSERT > MYSQL_TMP_DIR/dump.sql
+FOUND 10 /00/ in dump.sql
+#
+# Ensure data consistency on mysqlbinlog replay
+#
+FLUSH LOGS;
+# MYSQL_BINLOG MYSQLD_DATADIR/binlog_file > MYSQL_TMP_DIR/binlog_zeros.sql
+FOUND 10 /\x5c\x00/ in binlog_zeros.sql
+# MYSQL --binary-mode test < MYSQL_TMP_DIR/binlog_zeros.sql
+# Table checksum is equivalent before and after binlog replay
+#
+# A \0 should still be treated as end-of-query in binary mode.
+#
+# MYSQL --binary-mode -B test < MYSQL_TMP_DIR/binary_zero_eoq.sql
+##############################
+# Cleanup
+##############################
+SET @@global.sql_mode= @old_sql_mode;
+drop table tb;
+RESET MASTER;
diff --git a/mysql-test/main/mysql_binary_zero_insert.test b/mysql-test/main/mysql_binary_zero_insert.test
new file mode 100644
index 00000000000..b327c8a4d1e
--- /dev/null
+++ b/mysql-test/main/mysql_binary_zero_insert.test
@@ -0,0 +1,170 @@
+#
+# Purpose:
+# This test ensures that the mysql client is able to properly handle the
+# binary data sequence 0x5c00, i.e. the null-terminating character \0, in a
+# string when --binary-mode is enabled. Specifically, this sequence is valid to
+# appear anywhere within a binary data string, and it should not end the string
+# or SQL command. Additionally, \0 outside of a string should still end the
+# query.
+#
+# Methodology:
+# This test initially inserts data with binary strings containing \0. To
+# ensure the mysql client is able to process this data correctly, perl is used
+# to create a SQL file that contains \0 in strings, and this file is used as
+# input into the client. The row data is then validated by searching for binary
+# zeros in mysqldump output.
+#
+#
+# References:
+# MDEV-25444: mysql --binary-mode is not able to replay some mysqlbinlog
+# outputs
+
+--echo # Note: This test assumes NO_BACKSLASH_ESCAPES is not set in SQL_MODE.
+
+--source include/have_log_bin.inc
+
+--echo ##############################
+--echo # Setup
+--echo ##############################
+
+--echo #
+--echo # Saving old state
+--echo #
+set @old_sql_mode= @@global.SQL_MODE;
+set @@global.SQL_MODE= "";
+
+--echo #
+--echo # Create table for data entry
+--echo #
+CREATE TABLE tb (`id` int(11) NOT NULL AUTO_INCREMENT,`cb` longblob DEFAULT NULL, PRIMARY KEY (`id`)) AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
+
+# Will replay binlog later and we don't want to recreate the table
+RESET MASTER;
+
+
+--echo ##############################
+--echo # Test Case
+--echo ##############################
+
+--echo #
+--echo # \0 (0x5c00 in binary) should be allowed in data strings if
+--echo # --binary-mode is enabled.
+--echo #
+--perl
+ my $dir= $ENV{'MYSQL_TMP_DIR'};
+ open (my $FILE, '>', "$dir/binary_zero_inserts.sql") or die "open(): $!";
+
+ print $FILE "TRUNCATE TABLE tb;\n";
+
+ # INSERT INTO tb(cb) VALUES(_binary '\0');
+ print $FILE "INSERT INTO tb(cb) VALUES (_binary '";
+ print $FILE pack "H*","5c00";
+ print $FILE "');\n";
+
+ # INSERT INTO tb(cb) VALUES(_binary '\0A');
+ print $FILE "INSERT INTO tb(cb) VALUES (_binary '";
+ print $FILE pack "H*","5c0041";
+ print $FILE "');\n";
+
+ # INSERT INTO tb(cb) VALUES(_binary 'A\0');
+ print $FILE "INSERT INTO tb(cb) VALUES (_binary '";
+ print $FILE pack "H*","415c00";
+ print $FILE "');\n";
+
+ # INSERT INTO tb(cb) VALUES(_binary 'A\0B');
+ print $FILE "INSERT INTO tb(cb) VALUES (_binary '";
+ print $FILE pack "H*","415c0042";
+ print $FILE "');\n";
+
+ # INSERT INTO tb(cb) VALUES(_binary '\0A\0');
+ print $FILE "INSERT INTO tb(cb) VALUES (_binary '";
+ print $FILE pack "H*","5c00415c00";
+ print $FILE "');\n";
+
+ # INSERT INTO tb(cb) VALUES(_binary '\\\0');
+ print $FILE "INSERT INTO tb(cb) VALUES (_binary '";
+ print $FILE pack "H*","5c5c5c00";
+ print $FILE "');\n";
+
+ # INSERT INTO tb(cb) VALUES(_binary '\0\0');
+ print $FILE "INSERT INTO tb(cb) VALUES (_binary '";
+ print $FILE pack "H*","5c005c00";
+ print $FILE "');\n";
+
+ # INSERT INTO tb(cb) VALUES(_binary '\\0');
+ print $FILE "INSERT INTO tb(cb) VALUES (_binary '";
+ print $FILE pack "H*","5c5c00";
+ print $FILE "');\n";
+
+ close ($FILE);
+EOF
+--let SEARCH_PATTERN= \x5c\x00
+--let SEARCH_FILE= $MYSQL_TMP_DIR/binary_zero_inserts.sql
+--source include/search_pattern_in_file.inc
+--echo # MYSQL --binary-mode test < MYSQL_TMP_DIR/binary_zero_inserts.sql
+--exec $MYSQL --binary-mode test < $MYSQL_TMP_DIR/binary_zero_inserts.sql
+
+--echo #
+--echo # Ensure a row exists from each insert statement with a \0
+--echo #
+SELECT COUNT(*)=8 from tb;
+
+--echo #
+--echo # Ensure that the binary zero was parsed and exists in the row data
+--echo # Note: We only look for 00 because the 5c only served as an escape
+--echo # in parsing.
+--echo #
+--echo # MYSQL_DUMP test tb --hex-blob | grep INSERT > MYSQL_TMP_DIR/dump.sql
+--exec $MYSQL_DUMP test tb --hex-blob | grep INSERT > $MYSQL_TMP_DIR/dump.sql
+--let SEARCH_PATTERN= 00
+--let SEARCH_FILE= $MYSQL_TMP_DIR/dump.sql
+--source include/search_pattern_in_file.inc
+
+--echo #
+--echo # Ensure data consistency on mysqlbinlog replay
+--echo #
+--let $good_checksum= `CHECKSUM TABLE tb`
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+FLUSH LOGS;
+--echo # MYSQL_BINLOG MYSQLD_DATADIR/binlog_file > MYSQL_TMP_DIR/binlog_zeros.sql
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file > $MYSQL_TMP_DIR/binlog_zeros.sql
+--let SEARCH_PATTERN= \x5c\x00
+--let SEARCH_FILE= $MYSQL_TMP_DIR/binlog_zeros.sql
+--source include/search_pattern_in_file.inc
+--echo # MYSQL --binary-mode test < MYSQL_TMP_DIR/binlog_zeros.sql
+--exec $MYSQL --binary-mode test < $MYSQL_TMP_DIR/binlog_zeros.sql
+if ($good_checksum != `CHECKSUM TABLE tb`)
+{
+ die "Blob with binary zero data changed after binary log replay";
+}
+--echo # Table checksum is equivalent before and after binlog replay
+
+--echo #
+--echo # A \0 should still be treated as end-of-query in binary mode.
+--echo #
+--perl
+ my $dir= $ENV{'MYSQL_TMP_DIR'};
+ open (my $FILE, '>', "$dir/binary_zero_eoq.sql") or die "open(): $!";
+
+ # INSERT INTO tb(cb) VALUES(_binary 'text')\0
+ print $FILE "INSERT INTO tb(cb) VALUES (_binary 'text')";
+ print $FILE pack "H*","5c00";
+
+ close ($FILE);
+EOF
+--echo # MYSQL --binary-mode -B test < MYSQL_TMP_DIR/binary_zero_eoq.sql
+--exec $MYSQL --binary-mode -B test < $MYSQL_TMP_DIR/binary_zero_eoq.sql
+
+
+--echo ##############################
+--echo # Cleanup
+--echo ##############################
+
+--remove_file $MYSQL_TMP_DIR/binary_zero_inserts.sql
+--remove_file $MYSQL_TMP_DIR/binary_zero_eoq.sql
+--remove_file $MYSQL_TMP_DIR/binlog_zeros.sql
+--remove_file $MYSQL_TMP_DIR/dump.sql
+SET @@global.sql_mode= @old_sql_mode;
+drop table tb;
+RESET MASTER;
diff --git a/mysql-test/suite/innodb/r/mdev-14846.result b/mysql-test/suite/innodb/r/mdev-14846.result
new file mode 100644
index 00000000000..219bd718feb
--- /dev/null
+++ b/mysql-test/suite/innodb/r/mdev-14846.result
@@ -0,0 +1,52 @@
+CREATE TABLE t1 (
+pk INT,
+f1 VARCHAR(10) NOT NULL,
+f2 VARCHAR(10) NULL,
+f3 INT UNSIGNED NULL,
+KEY (f1),
+PRIMARY KEY (pk)
+) ENGINE=InnoDB;
+CREATE OR REPLACE ALGORITHM=MERGE VIEW v4 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1,'k','g',6),(2,'y','r',0),(3,'t','q',1),(4,'a','r',NULL),(5,'z','t',NULL);
+CREATE TABLE t2 (f VARCHAR(10) NULL) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (NULL),('g'),('e'),('g');
+CREATE TABLE t3 (
+f1 VARCHAR(10) NOT NULL,
+f2 VARCHAR(10) NULL,
+f3 INT UNSIGNED NULL
+) ENGINE=InnoDB;
+INSERT INTO t3 VALUES ('k','n',9),('y','b',8),('m','w',6);
+CREATE TABLE t4 (f INT NULL) ENGINE=InnoDB;
+INSERT INTO t4 VALUES (8),(9);
+UPDATE t1 SET t1.pk = -109 WHERE t1.f1 IN ( SELECT 'a' FROM t4 WHERE f >= 1 );
+SET DEBUG_SYNC='now SIGNAL con1_dml';
+connect con1,localhost,root,,test;
+SET DEBUG_SYNC='now WAIT_FOR con1_dml';
+begin;
+SELECT * FROM t1 for update;
+pk f1 f2 f3
+-109 a r NULL
+1 k g 6
+2 y r 0
+3 t q 1
+5 z t NULL
+SET DEBUG_SYNC='now SIGNAL default_dml';
+connection default;
+SET DEBUG_SYNC='now WAIT_FOR default_dml';
+UPDATE t3 AS alias1 LEFT JOIN t3 AS alias2 ON ( alias1.f1 <> alias1.f2 ) SET alias1.f3 = 59 WHERE ( EXISTS ( SELECT t1.f3 FROM t1 WHERE t1.f1 = alias1.f1 ) ) OR alias2.f1 = 'h';
+connect con2,localhost,root,,test;
+set debug_sync='now WAIT_FOR default_dml';
+SET DEBUG_SYNC='now SIGNAL con1_dml2';
+disconnect con2;
+connection con1;
+SET DEBUG_SYNC='now WAIT_FOR con1_dml2';
+UPDATE v4, t1 SET t1.pk = 76 WHERE t1.f2 IN ( SELECT t2.f FROM t2 INNER JOIN t3 );
+connection default;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection con1;
+COMMIT;
+disconnect con1;
+connection default;
+DROP VIEW v4;
+DROP TABLE t1, t2, t3, t4;
+set debug_sync= reset;
diff --git a/mysql-test/suite/innodb/t/mdev-14846.opt b/mysql-test/suite/innodb/t/mdev-14846.opt
new file mode 100644
index 00000000000..c8fe0561390
--- /dev/null
+++ b/mysql-test/suite/innodb/t/mdev-14846.opt
@@ -0,0 +1 @@
+--loose-innodb_lock_waits
diff --git a/mysql-test/suite/innodb/t/mdev-14846.test b/mysql-test/suite/innodb/t/mdev-14846.test
new file mode 100644
index 00000000000..adcefecd52f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/mdev-14846.test
@@ -0,0 +1,70 @@
+--source include/have_innodb.inc
+--source include/count_sessions.inc
+--source include/have_debug_sync.inc
+
+CREATE TABLE t1 (
+ pk INT,
+ f1 VARCHAR(10) NOT NULL,
+ f2 VARCHAR(10) NULL,
+ f3 INT UNSIGNED NULL,
+ KEY (f1),
+ PRIMARY KEY (pk)
+) ENGINE=InnoDB;
+
+CREATE OR REPLACE ALGORITHM=MERGE VIEW v4 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1,'k','g',6),(2,'y','r',0),(3,'t','q',1),(4,'a','r',NULL),(5,'z','t',NULL);
+
+CREATE TABLE t2 (f VARCHAR(10) NULL) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (NULL),('g'),('e'),('g');
+
+CREATE TABLE t3 (
+ f1 VARCHAR(10) NOT NULL,
+ f2 VARCHAR(10) NULL,
+ f3 INT UNSIGNED NULL
+) ENGINE=InnoDB;
+
+INSERT INTO t3 VALUES ('k','n',9),('y','b',8),('m','w',6);
+
+CREATE TABLE t4 (f INT NULL) ENGINE=InnoDB;
+INSERT INTO t4 VALUES (8),(9);
+UPDATE t1 SET t1.pk = -109 WHERE t1.f1 IN ( SELECT 'a' FROM t4 WHERE f >= 1 );
+SET DEBUG_SYNC='now SIGNAL con1_dml';
+
+--connect (con1,localhost,root,,test)
+SET DEBUG_SYNC='now WAIT_FOR con1_dml';
+begin;
+SELECT * FROM t1 for update; # Holds x lock of all records in the table t1
+SET DEBUG_SYNC='now SIGNAL default_dml';
+
+--connection default
+SET DEBUG_SYNC='now WAIT_FOR default_dml';
+--send UPDATE t3 AS alias1 LEFT JOIN t3 AS alias2 ON ( alias1.f1 <> alias1.f2 ) SET alias1.f3 = 59 WHERE ( EXISTS ( SELECT t1.f3 FROM t1 WHERE t1.f1 = alias1.f1 ) ) OR alias2.f1 = 'h'
+# It holds the lock of all record in t3 and tries to acquire record lock for the table t1.
+
+--connect (con2,localhost,root,,test)
+set debug_sync='now WAIT_FOR default_dml';
+let $wait_condition=
+select count(*) > 0 from information_schema.innodb_lock_waits;
+--source include/wait_condition.inc
+SET DEBUG_SYNC='now SIGNAL con1_dml2';
+disconnect con2;
+
+# Cleanup
+--connection con1
+SET DEBUG_SYNC='now WAIT_FOR con1_dml2';
+UPDATE v4, t1 SET t1.pk = 76 WHERE t1.f2 IN ( SELECT t2.f FROM t2 INNER JOIN t3 );
+# It holds the record lock on table t1 and tries to acquire record lock on t3.
+# leads to deadlock (con1 trx is waiting for default trx and vice versa)
+
+--connection default
+--error ER_LOCK_DEADLOCK
+--reap
+
+connection con1;
+COMMIT;
+disconnect con1;
+
+--connection default
+DROP VIEW v4;
+DROP TABLE t1, t2, t3, t4;
+set debug_sync= reset;
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_send.result b/mysql-test/suite/plugins/r/feedback_plugin_send.result
index 5a48c703ec4..69046e16dd9 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_send.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_send.result
@@ -24,7 +24,23 @@ VARIABLE_VALUE>0 VARIABLE_NAME
1 Collation used utf8mb4_bin
1 Collation used utf8_bin
1 Collation used utf8_general_ci
+prepare stmt from "SELECT VARIABLE_VALUE>0, VARIABLE_NAME FROM INFORMATION_SCHEMA.FEEDBACK WHERE VARIABLE_NAME LIKE 'Collation used %' ORDER BY VARIABLE_NAME";
+execute stmt;
+VARIABLE_VALUE>0 VARIABLE_NAME
+1 Collation used binary
+1 Collation used latin1_swedish_ci
+1 Collation used utf8mb4_bin
+1 Collation used utf8_bin
+1 Collation used utf8_general_ci
+execute stmt;
+VARIABLE_VALUE>0 VARIABLE_NAME
+1 Collation used binary
+1 Collation used latin1_swedish_ci
+1 Collation used utf8mb4_bin
+1 Collation used utf8_bin
+1 Collation used utf8_general_ci
+deallocate prepare stmt;
set global sql_mode=ONLY_FULL_GROUP_BY;
# restart
-6: feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
-6: feedback plugin: server replied 'ok'
+feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
+feedback plugin: server replied 'ok'
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_send.test b/mysql-test/suite/plugins/t/feedback_plugin_send.test
index b28f9d4cb38..0ea1814ec29 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_send.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_send.test
@@ -38,6 +38,6 @@ perl;
while ($_=<LOG>) {
$logg{$&}++ if /feedback plugin:.*/;
}
- print "$logg{$_}: $_\n" for sort keys %logg;
+ print "$_\n" for sort keys %logg;
close LOG;
EOF
diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result
index b2dbbba7027..c3feab166c9 100644
--- a/mysql-test/suite/versioning/r/alter.result
+++ b/mysql-test/suite/versioning/r/alter.result
@@ -762,3 +762,22 @@ delete from t1;
set system_versioning_alter_history= keep;
alter ignore table t1 drop pk;
drop table t1;
+#
+# MDEV-22660 SIGSEGV on adding system versioning and modifying system column
+#
+create or replace table t1 (a int);
+alter table t1
+add row_start timestamp(6) as row start,
+add row_end timestamp(6) as row end,
+add period for system_time(row_start, row_end),
+with system versioning,
+modify row_end varchar(8);
+ERROR HY000: PERIOD FOR SYSTEM_TIME must use columns `row_start` and `row_end`
+alter table t1
+add row_start timestamp(6) as row start,
+add row_end timestamp(6) as row end,
+add period for system_time(row_start, row_end),
+with system versioning,
+modify row_start varchar(8);
+ERROR HY000: PERIOD FOR SYSTEM_TIME must use columns `row_start` and `row_end`
+drop table t1;
diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test
index 16f391b1454..f826ba470f1 100644
--- a/mysql-test/suite/versioning/t/alter.test
+++ b/mysql-test/suite/versioning/t/alter.test
@@ -653,3 +653,25 @@ set system_versioning_alter_history= keep;
alter ignore table t1 drop pk;
# cleanup
drop table t1;
+
+
+--echo #
+--echo # MDEV-22660 SIGSEGV on adding system versioning and modifying system column
+--echo #
+create or replace table t1 (a int);
+--error ER_VERS_PERIOD_COLUMNS
+alter table t1
+ add row_start timestamp(6) as row start,
+ add row_end timestamp(6) as row end,
+ add period for system_time(row_start, row_end),
+ with system versioning,
+ modify row_end varchar(8);
+--error ER_VERS_PERIOD_COLUMNS
+alter table t1
+ add row_start timestamp(6) as row start,
+ add row_end timestamp(6) as row end,
+ add period for system_time(row_start, row_end),
+ with system versioning,
+ modify row_start varchar(8);
+# cleanup
+drop table t1;