Commit 49a22c58 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

Merge branch '10.9' into 10.10

parents 8e6a6419 ebf21215
Branches unavailable
Tags unavailable
No related merge requests found
......@@ -7090,7 +7090,12 @@ int main(int argc, char **argv)
if (flush_logs || opt_delete_master_logs)
{
if (mysql_refresh(mysql, REFRESH_LOG))
{
fprintf(stderr,
"Flush logs or delete master logs failure in server \n");
first_error= EX_MYSQLERR;
goto err;
}
verbose_msg("-- main : logs flushed successfully!\n");
}
......
#!/usr/bin/make -f
# Enable Debian Hardening
# https://wiki.debian.org/Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DH_VERBOSE=1
export DEB_BUILD_HARDENING=1
# enable Debian Hardening
# see: https://wiki.debian.org/Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto
DPKG_EXPORT_BUILDFLAGS = 1
# Include all defaults, including buildflags.mk
include /usr/share/dpkg/default.mk
......
......@@ -640,7 +640,7 @@ mariadb.org-10.5 to mariadb upgrade:
- *test-prepare-container
- apt install -y curl
- curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc
- echo "deb https://deb.mariadb.org/10.5/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list
- echo "deb https://archive.mariadb.org/mariadb-10.5/repo/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list
- apt-get update
- apt-get install -y mariadb-server-10.5
- *test-verify-initial
......@@ -670,7 +670,7 @@ mariadb.org-10.4 to mariadb upgrade:
- *test-prepare-container
- apt install -y curl systemctl # systemctl shim needed on platforms that don't have systemd
- curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc
- echo "deb https://deb.mariadb.org/10.4/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list
- echo "deb https://archive.mariadb.org/mariadb-10.4/repo/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list
- apt-get update
- *test-install-readline-in-sid-for-backwards-compat
- apt-get install -y mariadb-server-10.4
......@@ -703,7 +703,7 @@ mariadb.org-10.3 to mariadb upgrade:
- *test-prepare-container
- apt install -y curl
- curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc
- echo "deb https://deb.mariadb.org/10.3/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list
- echo "deb https://archive.mariadb.org/mariadb-10.3/repo/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list
- apt-get update
- *test-install-readline-in-sid-for-backwards-compat
- apt-get install -y mariadb-server-10.3
......@@ -734,7 +734,7 @@ mariadb.org-10.2 to mariadb upgrade:
- *test-prepare-container
- apt install -y curl
- curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc
- echo "deb https://deb.mariadb.org/10.2/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list
- echo "deb https://archive.mariadb.org/mariadb-10.2/repo/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list
- apt-get update
- *test-install-readline-in-sid-for-backwards-compat
- apt-get install -y mariadb-server-10.2
......
......@@ -1015,8 +1015,10 @@ enum options_xtrabackup
OPT_INNODB_BUFFER_POOL_FILENAME,
OPT_INNODB_LOCK_WAIT_TIMEOUT,
OPT_INNODB_LOG_BUFFER_SIZE,
#if defined __linux__ || defined _WIN32
OPT_INNODB_LOG_FILE_BUFFERING,
#endif
OPT_INNODB_LOG_FILE_SIZE,
OPT_INNODB_LOG_FILES_IN_GROUP,
OPT_INNODB_OPEN_FILES,
OPT_XTRA_DEBUG_SYNC,
OPT_INNODB_CHECKSUM_ALGORITHM,
......@@ -1577,6 +1579,13 @@ struct my_option xb_server_options[] =
(G_PTR*) &log_sys.buf_size, (G_PTR*) &log_sys.buf_size, 0,
IF_WIN(GET_ULL,GET_ULONG), REQUIRED_ARG, 2U << 20,
2U << 20, SIZE_T_MAX, 0, 4096, 0},
#if defined __linux__ || defined _WIN32
{"innodb_log_file_buffering", OPT_INNODB_LOG_FILE_BUFFERING,
"Whether the file system cache for ib_logfile0 is enabled during --backup",
(G_PTR*) &log_sys.log_buffered,
(G_PTR*) &log_sys.log_buffered, 0, GET_BOOL, NO_ARG,
TRUE, 0, 0, 0, 0, 0},
#endif
{"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE,
"Ignored for mysqld option compatibility",
(G_PTR*) &srv_log_file_size, (G_PTR*) &srv_log_file_size, 0,
......@@ -1894,10 +1903,6 @@ xb_get_one_option(const struct my_option *opt,
ADD_PRINT_PARAM_OPT(srv_log_group_home_dir);
break;
case OPT_INNODB_LOG_FILES_IN_GROUP:
case OPT_INNODB_LOG_FILE_SIZE:
break;
case OPT_INNODB_FLUSH_METHOD:
ut_a(srv_file_flush_method
<= IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_O_DIRECT_NO_FSYNC));
......
......@@ -278,8 +278,8 @@ enum ha_base_keytype {
#define HA_GENERATED_KEY 8192U /* Automatically generated key */
/* The combination of the above can be used for key type comparison. */
#define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \
HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \
#define HA_KEYFLAG_MASK (HA_NOSAME | HA_AUTO_KEY | \
HA_FULLTEXT | HA_UNIQUE_CHECK | \
HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY)
/*
......
......@@ -34,12 +34,13 @@ extern "C" {
#ifndef __cplusplus
#define inline __inline
#endif
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
#include <stdlib.h>
#else
#include <stdlib.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#endif
#endif
/* returned from encryption_key_get_latest_version() */
#define ENCRYPTION_KEY_VERSION_INVALID (~(unsigned int)0)
......
Subproject commit 380ee32375bb36b68796c1c3eb09285f03fea5f5
Subproject commit 72b40bfaa869f3fe84242471dda989d13983d84c
#
# Start of 10.4 tests
#
#
# MDEV-29481 mariadb-upgrade prints confusing statement
#
SET @debug_key_flags=NULL;
SET default_storage_engine=ARIA;
CREATE PROCEDURE debug_show_key_flags()
BEGIN
IF @debug_key_flags IS TRUE
THEN
FLUSH TABLES;
-- Wrap SET into EXECUTE IMMEDIATE to avoid
-- parse time "Unknown system variable" errors in release builds.
EXECUTE IMMEDIATE "SET debug_dbug='+d,key'";
SELECT * FROM t1 LIMIT 0;
EXECUTE IMMEDIATE "SET debug_dbug=''";
END IF;
END;
$$
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d` double(18,7) DEFAULT NULL,
KEY `d` (`d`)
) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
CHECK TABLE t1 FOR UPGRADE;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CALL debug_show_key_flags();
ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=INSTANT;
CALL debug_show_key_flags();
DROP TABLE t1;
CALL debug_show_key_flags();
ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=NOCOPY;
CALL debug_show_key_flags();
DROP TABLE t1;
CALL debug_show_key_flags();
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
CALL debug_show_key_flags();
DROP TABLE t1;
CALL debug_show_key_flags();
ALTER TABLE t1 FORCE;
CALL debug_show_key_flags();
DROP TABLE t1;
DROP PROCEDURE debug_show_key_flags;
#
# End of 10.4 tests
#
--source include/have_aria.inc
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-29481 mariadb-upgrade prints confusing statement
--echo #
let $table= std_data/mysql_upgrade/mdev29481_100104_aria;
let $EXT_DAT= MAD;
let $EXT_IDX= MAI;
SET @debug_key_flags=NULL;
SET default_storage_engine=ARIA;
--source alter_table_upgrade_mdev29481_myisam_aria.inc
--echo #
--echo # End of 10.4 tests
--echo #
let $datadir=`select @@datadir`;
DELIMITER $$;
CREATE PROCEDURE debug_show_key_flags()
BEGIN
IF @debug_key_flags IS TRUE
THEN
FLUSH TABLES;
-- Wrap SET into EXECUTE IMMEDIATE to avoid
-- parse time "Unknown system variable" errors in release builds.
EXECUTE IMMEDIATE "SET debug_dbug='+d,key'";
SELECT * FROM t1 LIMIT 0;
EXECUTE IMMEDIATE "SET debug_dbug=''";
END IF;
END;
$$
DELIMITER ;$$
copy_file $table.frm $datadir/test/t1.frm;
copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT;
copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX;
SHOW CREATE TABLE t1;
CHECK TABLE t1 FOR UPGRADE;
DROP TABLE t1;
copy_file $table.frm $datadir/test/t1.frm;
copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT;
copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX;
CALL debug_show_key_flags();
ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=INSTANT;
CALL debug_show_key_flags();
DROP TABLE t1;
copy_file $table.frm $datadir/test/t1.frm;
copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT;
copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX;
CALL debug_show_key_flags();
ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=NOCOPY;
CALL debug_show_key_flags();
DROP TABLE t1;
copy_file $table.frm $datadir/test/t1.frm;
copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT;
copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX;
CALL debug_show_key_flags();
REPAIR TABLE t1;
CALL debug_show_key_flags();
DROP TABLE t1;
copy_file $table.frm $datadir/test/t1.frm;
copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT;
copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX;
CALL debug_show_key_flags();
ALTER TABLE t1 FORCE;
CALL debug_show_key_flags();
DROP TABLE t1;
DROP PROCEDURE debug_show_key_flags;
#
# Start of 10.4 tests
#
#
# MDEV-29481 mariadb-upgrade prints confusing statement
#
SET @debug_key_flags=NULL;
CREATE PROCEDURE debug_show_key_flags()
BEGIN
IF @debug_key_flags IS TRUE
THEN
FLUSH TABLES;
-- Wrap SET into EXECUTE IMMEDIATE to avoid
-- parse time "Unknown system variable" errors in release builds.
EXECUTE IMMEDIATE "SET debug_dbug='+d,key'";
SELECT * FROM t1 LIMIT 0;
EXECUTE IMMEDIATE "SET debug_dbug=''";
END IF;
END;
$$
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d` double(18,7) DEFAULT NULL,
KEY `d` (`d`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CHECK TABLE t1 FOR UPGRADE;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CALL debug_show_key_flags();
ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=INSTANT;
CALL debug_show_key_flags();
DROP TABLE t1;
CALL debug_show_key_flags();
ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=NOCOPY;
CALL debug_show_key_flags();
DROP TABLE t1;
CALL debug_show_key_flags();
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
CALL debug_show_key_flags();
DROP TABLE t1;
CALL debug_show_key_flags();
ALTER TABLE t1 FORCE;
CALL debug_show_key_flags();
DROP TABLE t1;
DROP PROCEDURE debug_show_key_flags;
#
# End of 10.4 tests
#
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-29481 mariadb-upgrade prints confusing statement
--echo #
let $table= std_data/mysql_upgrade/mdev29481_100104_myisam;
let $EXT_DAT= MYD;
let $EXT_IDX= MYI;
SET @debug_key_flags=NULL;
--source alter_table_upgrade_mdev29481_myisam_aria.inc
--echo #
--echo # End of 10.4 tests
--echo #
#
# Start of 10.4 tests
#
#
# MDEV-29481 mariadb-upgrade prints confusing statement
#
SET @debug_key_flags=TRUE;
CREATE PROCEDURE debug_show_key_flags()
BEGIN
IF @debug_key_flags IS TRUE
THEN
FLUSH TABLES;
-- Wrap SET into EXECUTE IMMEDIATE to avoid
-- parse time "Unknown system variable" errors in release builds.
EXECUTE IMMEDIATE "SET debug_dbug='+d,key'";
SELECT * FROM t1 LIMIT 0;
EXECUTE IMMEDIATE "SET debug_dbug=''";
END IF;
END;
$$
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d` double(18,7) DEFAULT NULL,
KEY `d` (`d`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CHECK TABLE t1 FOR UPGRADE;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CALL debug_show_key_flags();
d
Warnings:
Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY)
Note 1105 DBUG: seg[0].type=6 DOUBLE
Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART)
ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=INSTANT;
CALL debug_show_key_flags();
d
Warnings:
Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY)
Note 1105 DBUG: seg[0].type=6 DOUBLE
Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART)
DROP TABLE t1;
CALL debug_show_key_flags();
d
Warnings:
Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY)
Note 1105 DBUG: seg[0].type=6 DOUBLE
Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART)
ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=NOCOPY;
CALL debug_show_key_flags();
d
Warnings:
Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY)
Note 1105 DBUG: seg[0].type=6 DOUBLE
Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART)
DROP TABLE t1;
CALL debug_show_key_flags();
d
Warnings:
Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY)
Note 1105 DBUG: seg[0].type=6 DOUBLE
Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART)
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
CALL debug_show_key_flags();
d
Warnings:
Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY)
Note 1105 DBUG: seg[0].type=6 DOUBLE
Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART)
DROP TABLE t1;
CALL debug_show_key_flags();
d
Warnings:
Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY)
Note 1105 DBUG: seg[0].type=6 DOUBLE
Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART)
ALTER TABLE t1 FORCE;
CALL debug_show_key_flags();
d
Warnings:
Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000048 (HA_NULL_PART_KEY|HA_VAR_LENGTH_KEY)
Note 1105 DBUG: seg[0].type=6 DOUBLE
Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART)
DROP TABLE t1;
DROP PROCEDURE debug_show_key_flags;
#
# End of 10.4 tests
#
--source include/have_debug.inc
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-29481 mariadb-upgrade prints confusing statement
--echo #
let $table= std_data/mysql_upgrade/mdev29481_100104_myisam;
let $EXT_DAT= MYD;
let $EXT_IDX= MYI;
SET @debug_key_flags=TRUE;
--source alter_table_upgrade_mdev29481_myisam_aria.inc
--echo #
--echo # End of 10.4 tests
--echo #
......@@ -5,5 +5,5 @@
--echo # Bug#47671 - wrong character-set after upgrade from 5.1.34 to 5.1.39
--echo #
--echo # Extract only charset information from 'status' command output using regex
--replace_regex /.*mysql.*// /Connection.*// /Current.*// /SSL.*// /Using.*// /Server version.*// /Protocol.*// /UNIX.*// /Uptime.*// /Threads.*// /TCP.*//
--replace_regex /.*mariadb.*// /Connection.*// /Current.*// /SSL.*// /Using.*// /Server version.*// /Protocol.*// /UNIX.*// /Uptime.*// /Threads.*// /TCP.*//
--exec $MYSQL -e "status";
......@@ -6398,6 +6398,17 @@ DEALLOCATE PREPARE stmt;
# End of 10.2 tests
#
#
# Start of 10.3 tests
#
#
# MDEV-14983 Wrong error message with SET sql_mode=sha2(ucs2_value)
#
SET sql_mode=sha2(CONVERT('a' USING ucs2),0);
ERROR 42000: Variable 'sql_mode' can't be set to the value of '022a6979e6dab7aa5ae4c3e5e45f7e977112a7e63593820dbec1ec738a24f93c'
#
# End of 10.3 tests
#
#
# Start of 10.4 tests
#
#
......
......@@ -1099,6 +1099,21 @@ DEALLOCATE PREPARE stmt;
--echo # End of 10.2 tests
--echo #
--echo #
--echo # Start of 10.3 tests
--echo #
--echo #
--echo # MDEV-14983 Wrong error message with SET sql_mode=sha2(ucs2_value)
--echo #
--error ER_WRONG_VALUE_FOR_VAR
SET sql_mode=sha2(CONVERT('a' USING ucs2),0);
--echo #
--echo # End of 10.3 tests
--echo #
--echo #
--echo # Start of 10.4 tests
--echo #
......
......@@ -1316,3 +1316,19 @@ a a
4 4
6 6
drop table t1,t2,t3;
#
# MDEV-16549: Server crashes in Item_field::fix_fields on query with
# view and subquery, Assertion `context' failed, Assertion `field' failed
#
CREATE TABLE t1 (a DECIMAL, b INT);
INSERT INTO t1 VALUES (1,1),(2,2);
CREATE VIEW v1 AS SELECT * FROM ( SELECT * FROM t1 WHERE a <> RAND() ) sq;
SELECT * FROM v1 WHERE b > 0;
a b
1 1
2 2
DROP VIEW v1;
DROP TABLE t1;
#
# End of 10.3 tests
#
......@@ -1126,3 +1126,23 @@ analyze select * from t1 , ( (select t2.a from t2 order by c) union all (select
select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a;
drop table t1,t2,t3;
--echo #
--echo # MDEV-16549: Server crashes in Item_field::fix_fields on query with
--echo # view and subquery, Assertion `context' failed, Assertion `field' failed
--echo #
CREATE TABLE t1 (a DECIMAL, b INT);
INSERT INTO t1 VALUES (1,1),(2,2); # optional
CREATE VIEW v1 AS SELECT * FROM ( SELECT * FROM t1 WHERE a <> RAND() ) sq;
SELECT * FROM v1 WHERE b > 0;
# Cleanup
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # End of 10.3 tests
--echo #
......@@ -413,3 +413,48 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t1 system NULL NULL NULL NULL 1
drop table t1, t2;
# End of 10.1 tests
#
# End of 10.2 test
#
#
# MDEV-25564: Server crashed on running some EXPLAIN statements
#
EXPLAIN (SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
#
# MDEV-23160: SIGSEGV in Explain_node::print_explain_for_children on UNION SELECT
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
EXPLAIN
SELECT *
FROM t1
WHERE
a IN (SELECT a FROM t1
UNION
SELECT a FROM t1 ORDER BY (SELECT a))
UNION
SELECT * FROM t1 ORDER BY (SELECT a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 3 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
5 UNION t1 ALL NULL NULL NULL NULL 3
NULL UNION RESULT <union1,5> ALL NULL NULL NULL NULL NULL Using filesort
6 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
drop table t1;
explain
VALUES ( (VALUES (2))) UNION VALUES ( (SELECT 3));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
5 SUBQUERY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1249 Select 4 was reduced during optimization
......@@ -339,3 +339,36 @@ explain replace into t2 select 100, (select a from t1);
drop table t1, t2;
--echo # End of 10.1 tests
--echo #
--echo # End of 10.2 test
--echo #
--echo #
--echo # MDEV-25564: Server crashed on running some EXPLAIN statements
--echo #
EXPLAIN (SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2);
--echo #
--echo # MDEV-23160: SIGSEGV in Explain_node::print_explain_for_children on UNION SELECT
--echo #
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
EXPLAIN
SELECT *
FROM t1
WHERE
a IN (SELECT a FROM t1
UNION
SELECT a FROM t1 ORDER BY (SELECT a))
UNION
SELECT * FROM t1 ORDER BY (SELECT a);
drop table t1;
--disable_ps_protocol
explain
VALUES ( (VALUES (2))) UNION VALUES ( (SELECT 3));
--enable_ps_protocol
......@@ -2549,5 +2549,9 @@ Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x'
DROP TABLE t1;
#
# MDEV-29678 Valgrind/MSAN uninitialised value errors upon PS with ALTER under ONLY_FULL_GROUP_BY
#
SET STATEMENT sql_mode=ONLY_FULL_GROUP_BY FOR EXECUTE IMMEDIATE 'ALTER TABLE mysql.time_zone_transition ORDER BY Time_zone_id, Transition_time';
#
# End of 10.3 tests
#
......@@ -1790,6 +1790,12 @@ CREATE TABLE t1 (a BIGINT) AS SELECT 1 AS v3 UNION SELECT FALSE ;
SELECT DISTINCT a IN ( COLLATION (AVG ('x'))) FROM t1 ;
DROP TABLE t1;
--echo #
--echo # MDEV-29678 Valgrind/MSAN uninitialised value errors upon PS with ALTER under ONLY_FULL_GROUP_BY
--echo #
SET STATEMENT sql_mode=ONLY_FULL_GROUP_BY FOR EXECUTE IMMEDIATE 'ALTER TABLE mysql.time_zone_transition ORDER BY Time_zone_id, Transition_time';
--echo #
--echo # End of 10.3 tests
--echo #
drop table if exists t1, t2;
select 1 in (1,2,3);
1 in (1,2,3)
1
......@@ -553,7 +552,7 @@ Warning 1292 Truncated incorrect DECIMAL value: 'a'
Warning 1292 Truncated incorrect DECIMAL value: 'b'
explain select f2 from t2 where f2 in ('a','b');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range t2f2 t2f2 5 NULL 1 Using where; Using index
1 SIMPLE t2 ref t2f2 t2f2 5 const 1 Using index
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'a'
Warning 1292 Truncated incorrect DECIMAL value: 'b'
......@@ -935,3 +934,228 @@ Warning 1292 Truncated incorrect DECIMAL value: '0x'
#
# End of 10.4 tests
#
#
# MDEV-29662 same values in `IN` set vs equal comparison produces
# the different performance
#
CREATE TABLE t1 (a INT, PRIMARY KEY(a));
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1 WHERE a IN (1,1);
a
1
# 'const' access since 'a IN (1,1)' is converted to equality 'a=1'
EXPLAIN SELECT * FROM t1 WHERE a IN (1,1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
EXPLAIN SELECT * FROM t1 WHERE a = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
SELECT * FROM t1 WHERE a IN (1,1,2);
a
1
2
# Conversion to equality is impossible due to different values
EXPLAIN SELECT * FROM t1 WHERE a IN (1,1,2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
SELECT * FROM t1 WHERE a IN (1,NULL,1);
a
1
# Conversion to equality is impossible due to NULL in the IN list
EXPLAIN SELECT * FROM t1 WHERE a IN (1,NULL,1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where; Using index
SELECT * FROM t1 WHERE a NOT IN (2,2,2,2,2,2);
a
1
3
EXPLAIN SELECT * FROM t1 WHERE a NOT IN (2,2,2,2,2,2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index
EXPLAIN SELECT * FROM t1 WHERE a != 3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index
SELECT * FROM t1 WHERE a NOT IN (3,3,1,1);
a
2
EXPLAIN SELECT * FROM t1 WHERE a NOT IN (3,3,1,1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index
SELECT * FROM t1 WHERE a NOT IN (1,2,NULL,NULL);
a
# No conversion is possible since elements are not constant
SELECT * FROM t1 WHERE a IN ((SELECT MAX(a) FROM t1), (SELECT MAX(a) FROM t1));
a
3
EXPLAIN SELECT * FROM t1 WHERE a IN
((SELECT MAX(a) FROM t1), (SELECT MAX(a) FROM t1));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 1 Using where; Using index
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
# There must be no conversion here:
SELECT * FROM t1 WHERE a IN (3,2,3,3,1,2,3);
a
1
2
3
# Prepared statement
PREPARE stmt FROM "SELECT * FROM t1 WHERE a IN (3,3,3)";
EXECUTE stmt;
a
3
EXECUTE stmt;
a
3
DEALLOCATE PREPARE stmt;
# Conversion to equality since SELECT 2 is evaluated as const
SELECT * FROM t1 WHERE a IN ((SELECT 2), (SELECT 2));
a
2
EXPLAIN SELECT * FROM t1 WHERE a IN ((SELECT 2), (SELECT 2));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
CREATE TABLE t2 (a INT, b VARCHAR(10), PRIMARY KEY(a,b));
INSERT INTO t2 VALUES (1,'abc'),(2,'def'),(3,'ghi');
SELECT * FROM t2 WHERE (a,b) IN ((1,'abc'),(1,'abc'));
a b
1 abc
# 'const' access due to conversion to equality
EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((1,'abc'),(1,'abc'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const PRIMARY PRIMARY 16 const,const 1 Using index
SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,'XYZ'));
a b
2 def
# No conversion due to different values
EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,'XYZ'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range PRIMARY PRIMARY 16 NULL 2 Using where; Using index
SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,NULL));
a b
2 def
# No conversion due to NULL
EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,NULL));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range PRIMARY PRIMARY 16 NULL 1 Using where; Using index
SELECT * FROM t2 WHERE (a,b) NOT IN ((2,'def'),(2,'def'),(2,NULL));
a b
1 abc
3 ghi
SELECT * FROM t2 WHERE a IN (1,1,1,1);
a b
1 abc
EXPLAIN SELECT * FROM t2 WHERE a IN (1,1,1,1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using index
EXPLAIN SELECT * FROM t2 WHERE a = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using index
SELECT * FROM t2 WHERE b NOT IN ('abc','abc');
a b
2 def
3 ghi
EXPLAIN SELECT * FROM t2 WHERE b NOT IN ('abc','abc');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL PRIMARY 16 NULL 3 Using where; Using index
EXPLAIN SELECT * FROM t2 WHERE b != 'abc';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL PRIMARY 16 NULL 3 Using where; Using index
# Prepared statements
PREPARE stmt FROM "EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((1,'abc'),(1,'abc'))";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const PRIMARY PRIMARY 16 const,const 1 Using index
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const PRIMARY PRIMARY 16 const,const 1 Using index
DEALLOCATE PREPARE stmt;
CREATE TABLE t3(a INT, PRIMARY KEY(a));
INSERT INTO t3 VALUES (1),(2),(3);
PREPARE stmt FROM "EXPLAIN SELECT * FROM t3 WHERE a IN (?,?,?)";
EXECUTE stmt USING 1,1,1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 Using index
EXECUTE stmt USING 2,3,4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index
DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2, t3;
# Nested joins
CREATE TABLE t1 (a INT, b VARCHAR(10), PRIMARY KEY(a));
INSERT INTO t1 VALUES (1,'abc'),(2,'def'),(3,'ghi');
CREATE TABLE t2 (a INT, b VARCHAR(20), PRIMARY KEY(a));
INSERT INTO t2 (a) VALUES (2),(3);
CREATE TABLE t3 (a INT, PRIMARY KEY(a));
INSERT INTO t3 VALUES (1),(2),(3),(4);
CREATE TABLE t4 (a INT);
INSERT INTO t4 VALUES (2),(3);
# Conversion to equalities
EXPLAIN SELECT * FROM (t1,t2) LEFT JOIN (t3,t4) ON t1.a IN (2,2,2)
AND t3.a IN (1,1,1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 Using where; Using index
1 SIMPLE t4 ALL NULL NULL NULL NULL 2
# No conversion to equalities due to different values in IN()
EXPLAIN SELECT * FROM (t1,t2) LEFT JOIN (t3,t4) ON t1.a IN (2,3)
AND t3.a IN (1,2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index; Using join buffer (incremental, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join)
# Conversion to equalities
EXPLAIN SELECT * FROM t1 LEFT JOIN ((t2, t3) LEFT JOIN t4 ON t2.a = t4.a)
ON t1.a = t2.a WHERE t1.a IN (2,2,2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t3 index NULL PRIMARY 4 NULL 4 Using index
# No conversion to equalities due to different values in IN()
EXPLAIN SELECT * FROM t1 LEFT JOIN ((t2, t3) LEFT JOIN t4 ON t2.a = t4.a)
ON t1.a = t2.a WHERE t1.a IN (1,3);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t3 index NULL PRIMARY 4 NULL 4 Using index
# View
CREATE VIEW v1 AS SELECT t1.*, t2.b AS t2_b FROM t1 LEFT JOIN t2
ON t1.a = t2.a;
EXPLAIN SELECT * FROM v1 WHERE a IN (2,2,2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
EXPLAIN SELECT * FROM v1 WHERE a IN (1,2,3);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using index condition
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1
# Stored procedures
CREATE PROCEDURE p1(pa INT, pb INT)
EXPLAIN SELECT * FROM t1 WHERE a IN (pa, pb);
CALL p1(1,1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
CALL p1(2,1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition
DROP TABLE t1, t2, t3, t4;
DROP VIEW v1;
DROP PROCEDURE p1;
#
# MDEV-29895 prepared view crash server (unit.conc_view)
#
create table t1 (username varchar(12) not null, id int(11) not null);
create view v1 as select username from t1 where id = 0;
prepare stmt from "select username from v1 where username in (?, ?)";
execute stmt using "1", "1";
username
deallocate prepare stmt;
drop view v1;
drop table t1;
#
# End of 10.6 tests
#
# Initialise
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
#
# test of IN (NULL)
#
......@@ -712,8 +708,141 @@ SELECT '0x' IN (0,1);
SELECT ('0x',1) IN ((0,1));
SELECT ('0x',1) IN ((0,1),(1,1));
--echo #
--echo # End of 10.4 tests
--echo #
--echo #
--echo # MDEV-29662 same values in `IN` set vs equal comparison produces
--echo # the different performance
--echo #
CREATE TABLE t1 (a INT, PRIMARY KEY(a));
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1 WHERE a IN (1,1);
--echo # 'const' access since 'a IN (1,1)' is converted to equality 'a=1'
EXPLAIN SELECT * FROM t1 WHERE a IN (1,1);
EXPLAIN SELECT * FROM t1 WHERE a = 1;
SELECT * FROM t1 WHERE a IN (1,1,2);
--echo # Conversion to equality is impossible due to different values
EXPLAIN SELECT * FROM t1 WHERE a IN (1,1,2);
SELECT * FROM t1 WHERE a IN (1,NULL,1);
--echo # Conversion to equality is impossible due to NULL in the IN list
EXPLAIN SELECT * FROM t1 WHERE a IN (1,NULL,1);
SELECT * FROM t1 WHERE a NOT IN (2,2,2,2,2,2);
EXPLAIN SELECT * FROM t1 WHERE a NOT IN (2,2,2,2,2,2);
EXPLAIN SELECT * FROM t1 WHERE a != 3;
SELECT * FROM t1 WHERE a NOT IN (3,3,1,1);
EXPLAIN SELECT * FROM t1 WHERE a NOT IN (3,3,1,1);
SELECT * FROM t1 WHERE a NOT IN (1,2,NULL,NULL);
--echo # No conversion is possible since elements are not constant
SELECT * FROM t1 WHERE a IN ((SELECT MAX(a) FROM t1), (SELECT MAX(a) FROM t1));
EXPLAIN SELECT * FROM t1 WHERE a IN
((SELECT MAX(a) FROM t1), (SELECT MAX(a) FROM t1));
--echo # There must be no conversion here:
SELECT * FROM t1 WHERE a IN (3,2,3,3,1,2,3);
--echo # Prepared statement
PREPARE stmt FROM "SELECT * FROM t1 WHERE a IN (3,3,3)";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
--echo # Conversion to equality since SELECT 2 is evaluated as const
--disable_warnings
SELECT * FROM t1 WHERE a IN ((SELECT 2), (SELECT 2));
EXPLAIN SELECT * FROM t1 WHERE a IN ((SELECT 2), (SELECT 2));
--enable_warnings
CREATE TABLE t2 (a INT, b VARCHAR(10), PRIMARY KEY(a,b));
INSERT INTO t2 VALUES (1,'abc'),(2,'def'),(3,'ghi');
SELECT * FROM t2 WHERE (a,b) IN ((1,'abc'),(1,'abc'));
--echo # 'const' access due to conversion to equality
EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((1,'abc'),(1,'abc'));
SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,'XYZ'));
--echo # No conversion due to different values
EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,'XYZ'));
SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,NULL));
--echo # No conversion due to NULL
EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((2,'def'),(2,'def'),(2,NULL));
SELECT * FROM t2 WHERE (a,b) NOT IN ((2,'def'),(2,'def'),(2,NULL));
SELECT * FROM t2 WHERE a IN (1,1,1,1);
EXPLAIN SELECT * FROM t2 WHERE a IN (1,1,1,1);
EXPLAIN SELECT * FROM t2 WHERE a = 1;
SELECT * FROM t2 WHERE b NOT IN ('abc','abc');
EXPLAIN SELECT * FROM t2 WHERE b NOT IN ('abc','abc');
EXPLAIN SELECT * FROM t2 WHERE b != 'abc';
--echo # Prepared statements
PREPARE stmt FROM "EXPLAIN SELECT * FROM t2 WHERE (a,b) IN ((1,'abc'),(1,'abc'))";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
CREATE TABLE t3(a INT, PRIMARY KEY(a));
INSERT INTO t3 VALUES (1),(2),(3);
PREPARE stmt FROM "EXPLAIN SELECT * FROM t3 WHERE a IN (?,?,?)";
EXECUTE stmt USING 1,1,1;
EXECUTE stmt USING 2,3,4;
DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2, t3;
--echo # Nested joins
CREATE TABLE t1 (a INT, b VARCHAR(10), PRIMARY KEY(a));
INSERT INTO t1 VALUES (1,'abc'),(2,'def'),(3,'ghi');
CREATE TABLE t2 (a INT, b VARCHAR(20), PRIMARY KEY(a));
INSERT INTO t2 (a) VALUES (2),(3);
CREATE TABLE t3 (a INT, PRIMARY KEY(a));
INSERT INTO t3 VALUES (1),(2),(3),(4);
CREATE TABLE t4 (a INT);
INSERT INTO t4 VALUES (2),(3);
--echo # Conversion to equalities
EXPLAIN SELECT * FROM (t1,t2) LEFT JOIN (t3,t4) ON t1.a IN (2,2,2)
AND t3.a IN (1,1,1);
--echo # No conversion to equalities due to different values in IN()
EXPLAIN SELECT * FROM (t1,t2) LEFT JOIN (t3,t4) ON t1.a IN (2,3)
AND t3.a IN (1,2);
--echo # Conversion to equalities
EXPLAIN SELECT * FROM t1 LEFT JOIN ((t2, t3) LEFT JOIN t4 ON t2.a = t4.a)
ON t1.a = t2.a WHERE t1.a IN (2,2,2);
--echo # No conversion to equalities due to different values in IN()
EXPLAIN SELECT * FROM t1 LEFT JOIN ((t2, t3) LEFT JOIN t4 ON t2.a = t4.a)
ON t1.a = t2.a WHERE t1.a IN (1,3);
--echo # View
CREATE VIEW v1 AS SELECT t1.*, t2.b AS t2_b FROM t1 LEFT JOIN t2
ON t1.a = t2.a;
EXPLAIN SELECT * FROM v1 WHERE a IN (2,2,2);
EXPLAIN SELECT * FROM v1 WHERE a IN (1,2,3);
--echo # Stored procedures
CREATE PROCEDURE p1(pa INT, pb INT)
EXPLAIN SELECT * FROM t1 WHERE a IN (pa, pb);
CALL p1(1,1);
CALL p1(2,1);
DROP TABLE t1, t2, t3, t4;
DROP VIEW v1;
DROP PROCEDURE p1;
--echo #
--echo # MDEV-29895 prepared view crash server (unit.conc_view)
--echo #
create table t1 (username varchar(12) not null, id int(11) not null);
create view v1 as select username from t1 where id = 0;
prepare stmt from "select username from v1 where username in (?, ?)";
execute stmt using "1", "1";
deallocate prepare stmt;
drop view v1;
drop table t1;
--echo #
--echo # End of 10.6 tests
--echo #
......@@ -707,6 +707,7 @@ a
#
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
a int(11) YES NULL
SHOW KEYS FROM t3;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
t3 0 PRIMARY 1 a A 0 NULL NULL BTREE NO
......
......@@ -246,6 +246,60 @@ connection default;
disconnect con1;
drop database db1;
drop user foo@localhost;
#
# MDEV-28455: CREATE TEMPORARY TABLES privilege
# is insufficient for SHOW COLUMNS
#
create database db;
create user foo@localhost;
create user bar@localhost;
create user buz@localhost;
grant create temporary tables on db.* to foo@localhost;
grant create temporary tables on db.* to bar@localhost;
connect con1,localhost,foo,,db;
create temporary table tmp (a int, key(a));
show tables;
Tables_in_db
show full tables;
Tables_in_db Table_type
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
show index in tmp;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
tmp 1 a 1 a A NULL NULL NULL YES BTREE NO
show columns in tmp;
Field Type Null Key Default Extra
a int(11) YES MUL NULL
show full columns in tmp;
Field Type Collation Null Key Default Extra Privileges Comment
a int(11) NULL YES MUL NULL select,insert,update,references
# we don't expect to show temporary tables in information_schema.columns
select * from information_schema.columns where table_schema='db';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION
disconnect con1;
connect con1,localhost,bar,,db;
show full columns in tmp;
ERROR 42000: SELECT command denied to user 'bar'@'localhost' for table `db`.`tmp`
disconnect con1;
connection default;
grant select on db.* to bar@localhost;
connect con1,localhost,bar,,db;
show grants for current_user;
Grants for bar@localhost
GRANT USAGE ON *.* TO `bar`@`localhost`
GRANT SELECT, CREATE TEMPORARY TABLES ON `db`.* TO `bar`@`localhost`
show full columns in tmp;
ERROR 42S02: Table 'db.tmp' doesn't exist
disconnect con1;
connect con1,localhost,buz,,;
show columns in db.tmp;
ERROR 42000: SELECT command denied to user 'buz'@'localhost' for table `db`.`tmp`
disconnect con1;
connection default;
drop database db;
drop user foo@localhost;
drop user bar@localhost;
drop user buz@localhost;
# End of 10.3 tests
create user u1@h identified with 'mysql_native_password' using 'pwd';
ERROR HY000: Password hash should be a 41-digit hexadecimal number
......
......@@ -209,6 +209,58 @@ show create view t_v;
--disconnect con1
drop database db1;
drop user foo@localhost;
--echo #
--echo # MDEV-28455: CREATE TEMPORARY TABLES privilege
--echo # is insufficient for SHOW COLUMNS
--echo #
create database db;
create user foo@localhost;
create user bar@localhost;
create user buz@localhost;
grant create temporary tables on db.* to foo@localhost;
grant create temporary tables on db.* to bar@localhost;
--connect (con1,localhost,foo,,db)
create temporary table tmp (a int, key(a));
show tables;
show full tables;
show table status;
show index in tmp;
show columns in tmp;
show full columns in tmp;
--echo # we don't expect to show temporary tables in information_schema.columns
select * from information_schema.columns where table_schema='db';
--disconnect con1
--connect (con1,localhost,bar,,db)
# User doesn't have `select` privilege on table
--error ER_TABLEACCESS_DENIED_ERROR
show full columns in tmp;
--disconnect con1
--connection default
grant select on db.* to bar@localhost;
--connect (con1,localhost,bar,,db)
# Table doesn't exist for this session
show grants for current_user;
--error ER_NO_SUCH_TABLE
show full columns in tmp;
--disconnect con1
--connect (con1,localhost,buz,,)
--error ER_TABLEACCESS_DENIED_ERROR
show columns in db.tmp;
--disconnect con1
--connection default
# Cleanup
drop database db;
drop user foo@localhost;
drop user bar@localhost;
drop user buz@localhost;
--echo # End of 10.3 tests
......
......@@ -2172,44 +2172,6 @@ disconnect con1;
connection default;
drop table mysql.global_priv;
rename table mysql.global_priv_bak to mysql.global_priv;
#
# MDEV-28727 ALTER TABLE ALGORITHM=NOCOPY does not work after upgrade
#
create or replace table pet4 (
build_time double(18, 7) default null,
key idx1 (build_time)
) engine innodb;
check table pet4;
Table Op Msg_type Msg_text
test.pet4 check error Table rebuild required. Please do "ALTER TABLE `pet4` FORCE" or dump/reload to fix it!
check table pet4 for upgrade;
Table Op Msg_type Msg_text
test.pet4 check error Table rebuild required. Please do "ALTER TABLE `pet4` FORCE" or dump/reload to fix it!
alter table pet4 add i1 int, algorithm=nocopy;
ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE
# Running mysqlcheck
test.pet4
error : Table rebuild required. Please do "ALTER TABLE `pet4` FORCE" or dump/reload to fix it!
Repairing tables
check table pet4;
Table Op Msg_type Msg_text
test.pet4 check status OK
alter table pet4 add i1 int, algorithm=nocopy;
create or replace table pet4 (
build_time double(18, 7) default null,
key idx1 (build_time)
) engine innodb;
alter table pet4 add i1 int, algorithm=nocopy;
ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE
# Running mysql_upgrade
test.pet4
error : Table rebuild required. Please do "ALTER TABLE `pet4` FORCE" or dump/reload to fix it!
check table pet4;
Table Op Msg_type Msg_text
test.pet4 check status OK
alter table pet4 add i1 int, algorithm=nocopy;
drop table pet4;
# End of 10.4 tests
#
# Check that mysql_upgrade can be run on mysqldump
......
......@@ -473,47 +473,6 @@ drop table mysql.global_priv;
rename table mysql.global_priv_bak to mysql.global_priv;
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
--echo #
--echo # MDEV-28727 ALTER TABLE ALGORITHM=NOCOPY does not work after upgrade
--echo #
create or replace table pet4 (
build_time double(18, 7) default null,
key idx1 (build_time)
) engine innodb;
--remove_file $MYSQLD_DATADIR/test/pet4.frm
--copy_file std_data/mdev-28727-pet4.frm $MYSQLD_DATADIR/test/pet4.frm
check table pet4;
check table pet4 for upgrade;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table pet4 add i1 int, algorithm=nocopy;
--echo # Running mysqlcheck
--exec $MYSQL_CHECK --auto-repair --databases test 2>&1
check table pet4;
alter table pet4 add i1 int, algorithm=nocopy;
create or replace table pet4 (
build_time double(18, 7) default null,
key idx1 (build_time)
) engine innodb;
--remove_file $MYSQLD_DATADIR/test/pet4.frm
--copy_file std_data/mdev-28727-pet4.frm $MYSQLD_DATADIR/test/pet4.frm
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table pet4 add i1 int, algorithm=nocopy;
--echo # Running mysql_upgrade
--exec $MYSQL_UPGRADE --silent 2>&1
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
check table pet4;
alter table pet4 add i1 int, algorithm=nocopy;
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
drop table pet4;
--echo # End of 10.4 tests
#
......
mysqld is alive
mysqladmin: unknown variable 'database=db1'
Warning: mysqladmin: unknown variable 'loose-database=db2'
mariadb-admin: unknown variable 'database=db1'
Warning: mariadb-admin: unknown variable 'loose-database=db2'
mysqld is alive
#
# Bug#58221 : mysqladmin --sleep=x --count=x keeps looping
......
......@@ -11,13 +11,13 @@
# Bug#10608 mysqladmin breaks on "database" variable in my.cnf
#
--replace_regex /.*mysqladmin.*: unknown/mysqladmin: unknown/
--replace_regex /.*mariadb-admin.*: unknown/mariadb-admin: unknown/
--error 7
--exec $MYSQLADMIN --database=db1 --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
# When mysqladmin finds "loose-database" it shall print
# a warning and continue
--replace_regex /Warning: .*mysqladmin.*: unknown/Warning: mysqladmin: unknown/
--replace_regex /Warning: .*mariadb-admin.*: unknown/Warning: mariadb-admin: unknown/
--exec $MYSQLADMIN --loose-database=db2 --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
--echo #
......
......@@ -886,7 +886,7 @@ Alternatives are: 'NEVER','AUTO','UNSPEC','DECODE-ROWS'
#
# Expect error for incomplete --base64-output argument.
# MYSQL_BINLOG std_data/master-bin.000001 --base64-output 2>&1
mysqlbinlog: option '--base64-output' requires an argument
mariadb-binlog: option '--base64-output' requires an argument
#
# Ensure --base64-output=auto outputs the same result as unspecified
# MYSQL_BINLOG -v MYSQLD_DATADIR/master-bin.000001 > MYSQLTEST_VARDIR/tmp/mysqlbinlog_nob64spec.out
......@@ -1267,7 +1267,7 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
mysqlbinlog Ver VER for OS at ARCH
mariadb-binlog Ver VER for OS at ARCH
#
# Test --rewrite-db
#
......
......@@ -533,7 +533,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn;
--echo # Expect error for incomplete --base64-output argument.
--echo # MYSQL_BINLOG std_data/master-bin.000001 --base64-output 2>&1
# The error produces the absolute path of the mysqlbinlog executable, remove it.
--replace_regex /.*mysqlbinlog.*:/mysqlbinlog:/i
--replace_regex /.*mariadb-binlog.*:/mariadb-binlog:/i
--error 1
--exec $MYSQL_BINLOG std_data/master-bin.000001 --base64-output 2>&1
......@@ -608,7 +608,7 @@ eval SET GLOBAL SERVER_ID = $old_server_id;
#
# MDEV-12372 mysqlbinlog --version output is the same on 10.x as on 5.5.x, and contains not only version
#
replace_regex /.*mysqlbinlog(\.exe)? Ver .* for .* at [-_a-zA-Z0-9]+/mysqlbinlog Ver VER for OS at ARCH/;
replace_regex /.*mariadb-binlog(\.exe)? Ver .* for .* at [-_a-zA-Z0-9]+/mariadb-binlog Ver VER for OS at ARCH/;
exec $MYSQL_BINLOG --version;
--echo #
......
mysqldump: Error: Binlogging on server not active
mariadb-dump: Error: Binlogging on server not active
......@@ -2,6 +2,6 @@
--source include/not_embedded.inc
--replace_regex /MASTER_LOG_POS=[0-9]+/XX/
--replace_result mysqldump.exe mysqldump
--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --compact --master-data=2 test 2>&1
This diff is collapsed.
This diff is collapsed.
......@@ -185,7 +185,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
mysqldump: Got error: 2026: "TLS/SSL error: xxxx
mariadb-dump: Got error: 2026: "TLS/SSL error: xxxx
DROP TABLE t1;
GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509;
FLUSH PRIVILEGES;
......
......@@ -174,7 +174,7 @@ INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-create-options --skip-comments --ssl --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test
# With wrong parameters
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR mysqldump.exe mysqldump
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQL_DUMP mariadb-dump .\exe ''
--replace_regex /TLS\/SSL error.*/TLS\/SSL error: xxxx/
--error 2
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-create-options --skip-comments --ssl --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test 2>&1
......
......@@ -5615,6 +5615,104 @@ a.a a.b
DEALLOCATE PREPARE stmt;
DROP PROCEDURE p1;
#
# MDEV-16128: Server crash in Item_func::print_op on 2nd execution of PS
#
CREATE TABLE t1 (a varchar(10));
CREATE TABLE t2 (b varchar(10) CHARACTER SET utf8 );
CREATE TABLE t3 (c varchar(10) CHARACTER SET utf8);
INSERT INTO t1 VALUES ('b');
INSERT INTO t2 VALUES ('b');
INSERT INTO t3 VALUES ('b');
PREPARE stmt FROM "SELECT t1.* FROM (t1 JOIN t2 ON (t2.b = t1.a)) WHERE (EXISTS (SELECT 1 FROM t3 WHERE t3.c = t1.a))";
EXECUTE stmt;
a
b
# Without the patch second execution of the prepared statement
# would lead to server crash.
EXECUTE stmt;
a
b
# Clean up
DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2, t3;
CREATE TABLE t1 (a varchar(10));
CREATE TABLE t2 (b varchar(10) CHARACTER SET utf8);
INSERT INTO t1 VALUES ('b');
INSERT INTO t2 VALUES ('b');
PREPARE stmt FROM 'SELECT STRAIGHT_JOIN 1 FROM t1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.a)';
EXECUTE stmt;
1
1
# Without the patch second execution of the prepared statement
# would lead to server crash.
EXECUTE stmt;
1
1
# Clean up
DEALLOCATE PREPARE stmt;
# Check that EXECUTE USING is run correctly
PREPARE stmt FROM 'SELECT 300 FROM t1 WHERE EXISTS (SELECT 100 FROM t2 WHERE t2.b = ?)';
EXECUTE stmt USING 'b';
300
300
EXECUTE stmt USING 'b';
300
300
EXECUTE stmt USING 'd';
300
EXECUTE stmt USING 'd';
300
EXECUTE stmt USING _binary 'b';
300
300
EXECUTE stmt USING _binary 'b';
300
300
EXECUTE stmt USING _binary 'B';
300
300
EXECUTE stmt USING 'B';
300
300
EXECUTE stmt USING _binary 'd';
300
EXECUTE stmt USING _binary 'd';
300
EXECUTE stmt USING _ucs2 'b';
300
300
EXECUTE stmt USING _ucs2 'b';
300
300
EXECUTE stmt USING _ucs2 'd';
300
EXECUTE stmt USING _ucs2 'd';
300
EXECUTE stmt USING _latin1 'b';
300
300
EXECUTE stmt USING _latin1 'b';
300
300
EXECUTE stmt USING _latin1 'd';
300
EXECUTE stmt USING _latin1 'd';
300
CREATE TABLE t3 (c VARCHAR(10) CHARACTER SET ucs2);
INSERT INTO t3 VALUES ('b');
PREPARE stmt FROM 'SELECT 300 FROM t1 WHERE EXISTS (SELECT 100 FROM t3 WHERE t3.c = ?)';
EXECUTE stmt USING 'b';
300
300
EXECUTE stmt USING 'b';
300
300
EXECUTE stmt USING 'd';
300
EXECUTE stmt USING 'd';
300
DROP TABLE t1, t2, t3;
#
# MDEV-19263: Server crashes in mysql_handle_single_derived
# upon 2nd execution of PS
#
......
......@@ -5039,6 +5039,77 @@ DEALLOCATE PREPARE stmt;
DROP PROCEDURE p1;
--echo #
--echo # MDEV-16128: Server crash in Item_func::print_op on 2nd execution of PS
--echo #
CREATE TABLE t1 (a varchar(10));
CREATE TABLE t2 (b varchar(10) CHARACTER SET utf8 );
CREATE TABLE t3 (c varchar(10) CHARACTER SET utf8);
INSERT INTO t1 VALUES ('b');
INSERT INTO t2 VALUES ('b');
INSERT INTO t3 VALUES ('b');
PREPARE stmt FROM "SELECT t1.* FROM (t1 JOIN t2 ON (t2.b = t1.a)) WHERE (EXISTS (SELECT 1 FROM t3 WHERE t3.c = t1.a))";
EXECUTE stmt;
--echo # Without the patch second execution of the prepared statement
--echo # would lead to server crash.
EXECUTE stmt;
--echo # Clean up
DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2, t3;
CREATE TABLE t1 (a varchar(10));
CREATE TABLE t2 (b varchar(10) CHARACTER SET utf8);
INSERT INTO t1 VALUES ('b');
INSERT INTO t2 VALUES ('b');
PREPARE stmt FROM 'SELECT STRAIGHT_JOIN 1 FROM t1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.a)';
EXECUTE stmt;
--echo # Without the patch second execution of the prepared statement
--echo # would lead to server crash.
EXECUTE stmt;
--echo # Clean up
DEALLOCATE PREPARE stmt;
--echo # Check that EXECUTE USING is run correctly
PREPARE stmt FROM 'SELECT 300 FROM t1 WHERE EXISTS (SELECT 100 FROM t2 WHERE t2.b = ?)';
EXECUTE stmt USING 'b';
EXECUTE stmt USING 'b';
EXECUTE stmt USING 'd';
EXECUTE stmt USING 'd';
EXECUTE stmt USING _binary 'b';
EXECUTE stmt USING _binary 'b';
EXECUTE stmt USING _binary 'B';
EXECUTE stmt USING 'B';
EXECUTE stmt USING _binary 'd';
EXECUTE stmt USING _binary 'd';
EXECUTE stmt USING _ucs2 'b';
EXECUTE stmt USING _ucs2 'b';
EXECUTE stmt USING _ucs2 'd';
EXECUTE stmt USING _ucs2 'd';
EXECUTE stmt USING _latin1 'b';
EXECUTE stmt USING _latin1 'b';
EXECUTE stmt USING _latin1 'd';
EXECUTE stmt USING _latin1 'd';
CREATE TABLE t3 (c VARCHAR(10) CHARACTER SET ucs2);
INSERT INTO t3 VALUES ('b');
PREPARE stmt FROM 'SELECT 300 FROM t1 WHERE EXISTS (SELECT 100 FROM t3 WHERE t3.c = ?)';
EXECUTE stmt USING 'b';
EXECUTE stmt USING 'b';
EXECUTE stmt USING 'd';
EXECUTE stmt USING 'd';
DROP TABLE t1, t2, t3;
--echo #
--echo # MDEV-19263: Server crashes in mysql_handle_single_derived
--echo # upon 2nd execution of PS
......
......@@ -104,32 +104,11 @@ HANDLER t1 CLOSE;
DROP TABLE t1;
# Test case 10: Check that the statements 'HELP'
# is supported by prepared statements
HELP `ALTER SERVER`;
INSERT INTO mysql.help_topic VALUES (0, 'Tamagotchi', 0, 'This digital pet is not a KB article', 'no example', 'https://tamagotchi.com/');
HELP `Tamagotchi`;
name description example
ALTER SERVER Syntax
------
ALTER SERVER server_name
OPTIONS (option [, option] ...)
Description
-----------
Alters the server information for server_name, adjusting the specified options
as per the CREATE SERVER command. The corresponding fields in the
mysql.servers table are updated accordingly. This statement requires the SUPER
privilege or, from MariaDB 10.5.2, the FEDERATED ADMIN privilege.
ALTER SERVER is not written to the binary log, irrespective of the binary log
format being used. From MariaDB 10.1.13, Galera replicates the CREATE SERVER,
ALTER SERVER and DROP SERVER statements.
Examples
--------
ALTER SERVER s OPTIONS (USER 'sally');
URL: mariadb.com/kb/en/alter-server/
Tamagotchi This digital pet is not a KB article no example
DELETE FROM mysql.help_topic WHERE help_topic_id = 0;
# Test case 11: Check that the statements CREATE/ALTER/DROP PROCEDURE
# are supported by prepared statements
CREATE PROCEDURE p1() SET @a=1;
......
......@@ -128,7 +128,10 @@ DROP TABLE t1;
--echo # Test case 10: Check that the statements 'HELP'
--echo # is supported by prepared statements
HELP `ALTER SERVER`;
# avoid existing articles that may get updated.
INSERT INTO mysql.help_topic VALUES (0, 'Tamagotchi', 0, 'This digital pet is not a KB article', 'no example', 'https://tamagotchi.com/');
HELP `Tamagotchi`;
DELETE FROM mysql.help_topic WHERE help_topic_id = 0;
--echo # Test case 11: Check that the statements CREATE/ALTER/DROP PROCEDURE
--echo # are supported by prepared statements
......
......@@ -6,8 +6,8 @@ ERROR 2026 (HY000): TLS/SSL error: certificate revoked
ERROR 2026 (HY000): TLS/SSL error: certificate revoked
############ Test mysqladmin ##############
# Test mysqladmin connecting to a server with a certificate revoked by -crl
mysqladmin: connect to server at 'localhost' failed
mariadb-admin: connect to server at 'localhost' failed
error: 'TLS/SSL error: certificate revoked'
# Test mysqladmin connecting to a server with a certificate revoked by -crlpath
mysqladmin: connect to server at 'localhost' failed
mariadb-admin: connect to server at 'localhost' failed
error: 'TLS/SSL error: certificate revoked'
......@@ -34,11 +34,11 @@ copy_file $MYSQL_TEST_DIR/std_data/server-cert.crl $MYSQL_TMP_DIR/ed1f42db.r0;
let $admin_suffix = --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping;
--echo # Test mysqladmin connecting to a server with a certificate revoked by -crl
--replace_regex /.*mysqladmin.*:/mysqladmin:/ /TLS\/SSL error: .*CRYPT_E_REVOKED./TLS\/SSL error: certificate revoked/
--replace_regex /.*mariadb-admin.*:/mariadb-admin:/ /TLS\/SSL error: .*CRYPT_E_REVOKED./TLS\/SSL error: certificate revoked/
--error 1
--exec $MYSQLADMIN $ssl_crl $admin_suffix 2>&1
--echo # Test mysqladmin connecting to a server with a certificate revoked by -crlpath
--replace_regex /.*mysqladmin.*:/mysqladmin:/ /TLS\/SSL error: .*CRYPT_E_REVOKED./TLS\/SSL error: certificate revoked/
--replace_regex /.*mariadb-admin.*:/mariadb-admin:/ /TLS\/SSL error: .*CRYPT_E_REVOKED./TLS\/SSL error: certificate revoked/
--error 1
--exec $MYSQLADMIN $ssl_crlpath $admin_suffix 2>&1
......@@ -1854,9 +1854,9 @@ sub executable_setup () {
$exe_patch='patch' if `patch -v`;
# Look for the client binaries
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
$exe_mysql_plugin= mtr_exe_exists("$path_client_bindir/mysql_plugin");
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mariadb-admin");
$exe_mysql= mtr_exe_exists("$path_client_bindir/mariadb");
$exe_mysql_plugin= mtr_exe_exists("$path_client_bindir/mariadb-plugin");
$exe_mariadb_conv= mtr_exe_exists("$path_client_bindir/mariadb-conv");
$exe_mysql_embedded= mtr_exe_maybe_exists("$bindir/libmysqld/examples/mysql_embedded");
......@@ -1879,7 +1879,7 @@ sub executable_setup () {
}
else
{
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mariadb-test");
}
}
......@@ -1890,7 +1890,7 @@ sub client_debug_arg($$) {
my ($args, $client_name)= @_;
# Workaround for Bug #50627: drop any debug opt
return if $client_name =~ /^mysqlbinlog/;
return if $client_name =~ /^mariadb-binlog/;
if ( $opt_debug ) {
mtr_add_arg($args,
......@@ -1921,7 +1921,7 @@ sub client_arguments ($;$) {
sub mysqlbinlog_arguments () {
my $exe= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
my $exe= mtr_exe_exists("$path_client_bindir/mariadb-binlog");
my $args;
mtr_init_args(\$args);
......@@ -1933,14 +1933,14 @@ sub mysqlbinlog_arguments () {
sub mysqlslap_arguments () {
my $exe= mtr_exe_maybe_exists("$path_client_bindir/mysqlslap");
my $exe= mtr_exe_maybe_exists("$path_client_bindir/mariadb-slap");
if ( $exe eq "" ) {
# mysqlap was not found
if (defined $mysql_version_id and $mysql_version_id >= 50100 ) {
mtr_error("Could not find the mysqlslap binary");
mtr_error("Could not find the mariadb-slap binary");
}
return ""; # Don't care about mysqlslap
return ""; # Don't care about mariadb-slap
}
my $args;
......@@ -1953,7 +1953,7 @@ sub mysqlslap_arguments () {
sub mysqldump_arguments ($) {
my($group_suffix) = @_;
my $exe= mtr_exe_exists("$path_client_bindir/mysqldump");
my $exe= mtr_exe_exists("$path_client_bindir/mariadb-dump");
my $args;
mtr_init_args(\$args);
......@@ -2128,17 +2128,17 @@ sub environment_setup {
# ----------------------------------------------------
# mysql clients
# ----------------------------------------------------
$ENV{'MYSQL_CHECK'}= client_arguments("mysqlcheck");
$ENV{'MYSQL_CHECK'}= client_arguments("mariadb-check");
$ENV{'MYSQL_DUMP'}= mysqldump_arguments(".1");
$ENV{'MYSQL_DUMP_SLAVE'}= mysqldump_arguments(".2");
$ENV{'MYSQL_SLAP'}= mysqlslap_arguments();
$ENV{'MYSQL_IMPORT'}= client_arguments("mysqlimport");
$ENV{'MYSQL_SHOW'}= client_arguments("mysqlshow");
$ENV{'MYSQL_IMPORT'}= client_arguments("mariadb-import");
$ENV{'MYSQL_SHOW'}= client_arguments("mariadb-show");
$ENV{'MYSQL_BINLOG'}= mysqlbinlog_arguments();
$ENV{'MYSQL'}= client_arguments("mysql");
$ENV{'MYSQL_SLAVE'}= client_arguments("mysql", ".2");
$ENV{'MYSQL_UPGRADE'}= client_arguments("mysql_upgrade");
$ENV{'MYSQLADMIN'}= client_arguments("mysqladmin");
$ENV{'MYSQL'}= client_arguments("mariadb");
$ENV{'MYSQL_SLAVE'}= client_arguments("mariadb", ".2");
$ENV{'MYSQL_UPGRADE'}= client_arguments("mariadb-upgrade");
$ENV{'MYSQLADMIN'}= client_arguments("mariadb-admin");
$ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
$ENV{'EXE_MYSQL'}= $exe_mysql;
$ENV{'MYSQL_PLUGIN'}= $exe_mysql_plugin;
......@@ -2146,8 +2146,8 @@ sub environment_setup {
$ENV{'MARIADB_CONV'}= "$exe_mariadb_conv --character-sets-dir=$path_charsetsdir";
if(IS_WINDOWS)
{
$ENV{'MYSQL_INSTALL_DB_EXE'}= mtr_exe_exists("$bindir/sql$multiconfig/mysql_install_db",
"$bindir/bin/mysql_install_db");
$ENV{'MYSQL_INSTALL_DB_EXE'}= mtr_exe_exists("$bindir/sql$multiconfig/mariadb-install-db",
"$bindir/bin/mariadb-install-db");
}
my $client_config_exe=
......@@ -2230,9 +2230,9 @@ sub environment_setup {
# ----------------------------------------------------
# mysql_tzinfo_to_sql
# ----------------------------------------------------
my $exe_mysql_tzinfo_to_sql= mtr_exe_exists("$basedir/sql$multiconfig/mysql_tzinfo_to_sql",
"$path_client_bindir/mysql_tzinfo_to_sql",
"$bindir/sql$multiconfig/mysql_tzinfo_to_sql");
my $exe_mysql_tzinfo_to_sql= mtr_exe_exists("$basedir/sql$multiconfig/mariadb-tzinfo-to-sql",
"$path_client_bindir/mariadb-tzinfo-to-sql",
"$bindir/sql$multiconfig/mariadb-tzinfo-to-sql");
$ENV{'MYSQL_TZINFO_TO_SQL'}= native_path($exe_mysql_tzinfo_to_sql);
# ----------------------------------------------------
......
File added
File added
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `encrypted`=yes `encryption_key_id`=1
insert t1 values (12345, repeat('1234567890', 20));
alter table t1 encryption_key_id=2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `encrypted`=yes `encryption_key_id`=2
drop table t1;
# Test checks if opening an too large secret does not crash the server.
call mtr.add_suppression("the filekey is too long");
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
FOUND 1 /the filekey is too long/ in mysqld.1.err
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
select plugin_status from information_schema.plugins
where plugin_name = 'file_key_management';
plugin_status
# Test checks if opening an too large secret does not crash the server.
secretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecret
secretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecret
secretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecret
Salted__40-6L sK?p\am8N?q n<*g( |F/!
kok6y7t67D#g洄ʗԣiyu*i#ƈ82#6 .C8۝;7Bԣ
0 /
w0w"xԱQu04xkj{W΢3C5՜ ᔪP$=Ҳ
\ No newline at end of file
c9518399cbec2b5edf773e06d1b934b90ec0f46ae455b8f1e001b5629ef31a513b83e676bf654c08ba98659461410e5e040e46237a7d50b40bd9bb90576f841275506e61523e5e9a0beb7641127ed2d946395b6fee7ff5263a9019cbe71bd907bf1ac6365940fa391086830a4e6c1d2972b99505467ef31cfb46d0cb7ab8f4f1
--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/t/filekeys_secret_openssl_rand_128bits.key
--loose-file-key-management-filename=$MTR_SUITE_DIR/t/filekeys_secret_openssl_rand_128bits.enc
-- source include/have_innodb.inc
-- source filekeys_plugin.inc
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
show create table t1;
insert t1 values (12345, repeat('1234567890', 20));
alter table t1 encryption_key_id=2;
show create table t1;
drop table t1;
--echo # Test checks if opening an too large secret does not crash the server.
--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/t/filekeys-data-too-long.key
--loose-file-key-management-filename=$MTR_SUITE_DIR/t/filekeys-data.enc
let SEARCH_PATTERN=the filekey is too long;
source filekeys_badtest.inc;
--echo # Test checks if opening an too large secret does not crash the server.
......@@ -24,7 +24,7 @@ COMMIT;
UPDATE t1 SET a=1;
connection default;
InnoDB 0 transactions not purged
CHECK TABLE t1;
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT b1 FROM t1;
......@@ -123,7 +123,7 @@ COMMIT;
disconnect con1;
connection default;
InnoDB 0 transactions not purged
CHECK TABLE t1;
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT b1 FROM t1;
......@@ -134,7 +134,7 @@ SELECT * FROM t1;
a b b1 a1 a4 b3
100 10 10 100 90 100
100 10 10 100 90 100
CHECK TABLE t2;
CHECK TABLE t2 EXTENDED;
Table Op Msg_type Msg_text
test.t2 check status OK
DROP TABLE t2, t1, t0;
......
......@@ -38,7 +38,7 @@ UPDATE t1 SET a=1;
connection default;
--source ../../innodb/include/wait_all_purged.inc
CHECK TABLE t1;
CHECK TABLE t1 EXTENDED;
SELECT b1 FROM t1;
......@@ -123,11 +123,11 @@ disconnect con1;
connection default;
--source ../../innodb/include/wait_all_purged.inc
CHECK TABLE t1;
CHECK TABLE t1 EXTENDED;
SELECT b1 FROM t1;
SELECT * FROM t1;
CHECK TABLE t2;
CHECK TABLE t2 EXTENDED;
DROP TABLE t2, t1, t0;
CREATE TABLE t1 (a VARCHAR(30), b INT, a2 VARCHAR(30) GENERATED ALWAYS AS (a) VIRTUAL);
......
#
# Start of 10.4 tests
#
#
# MDEV-29481 mariadb-upgrade prints confusing statement
#
CREATE TABLE pet4 (
build_time double(18,7) DEFAULT NULL,
KEY idx1 (build_time)) ENGINE=InnoDB;
FLUSH TABLES;
SHOW CREATE TABLE pet4;
Table Create Table
pet4 CREATE TABLE `pet4` (
`build_time` double(18,7) DEFAULT NULL,
KEY `idx1` (`build_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
CHECK TABLE pet4 FOR UPGRADE;
Table Op Msg_type Msg_text
test.pet4 check status OK
ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=INSTANT;
DROP TABLE pet4;
CREATE TABLE pet4 (
build_time double(18,7) DEFAULT NULL,
KEY idx1 (build_time)) ENGINE=InnoDB;
FLUSH TABLES;
SHOW CREATE TABLE pet4;
Table Create Table
pet4 CREATE TABLE `pet4` (
`build_time` double(18,7) DEFAULT NULL,
KEY `idx1` (`build_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=NOCOPY;
DROP TABLE pet4;
#
# End of 10.4 tests
#
CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB STATS_PERSISTENT=0;
CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB STATS_PERSISTENT=0;
INSERT INTO t VALUES (10, 10), (20, 20), (30, 30);
INSERT INTO t2 VALUES (10), (20), (30);
BEGIN;
UPDATE t2 SET a = a + 100;
SELECT * FROM t WHERE a = 20 FOR UPDATE;
a b
20 20
connect con_2,localhost,root,,;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SET DEBUG_SYNC = 'lock_trx_handle_wait_before_unlocked_wait_lock_check SIGNAL upd_locked WAIT_FOR upd_cont';
UPDATE t SET b = 100;
connection default;
SET DEBUG_SYNC="now WAIT_FOR upd_locked";
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL upd_cont";
SELECT * FROM t WHERE a = 10 FOR UPDATE;
connection con_2;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
disconnect con_2;
connection default;
a b
10 10
SET DEBUG_SYNC = 'RESET';
DROP TABLE t;
DROP TABLE t2;
CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB STATS_PERSISTENT=0;
CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB STATS_PERSISTENT=0;
INSERT INTO t VALUES (10, 10), (20, 20), (30, 30);
INSERT INTO t2 VALUES (10), (20), (30);
BEGIN;
UPDATE t2 SET a = a + 100;
SELECT * FROM t WHERE a = 20 FOR UPDATE;
a b
20 20
connect con_2,localhost,root,,;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET DEBUG_SYNC = 'lock_trx_handle_wait_enter SIGNAL upd_locked WAIT_FOR upd_cont';
SET DEBUG_SYNC = 'trx_t_release_locks_enter SIGNAL sel_cont WAIT_FOR upd_cont_2';
BEGIN;
UPDATE t SET b = 100;
connection default;
SET DEBUG_SYNC="now WAIT_FOR upd_locked";
SET DEBUG_SYNC="deadlock_report_before_lock_releasing SIGNAL upd_cont WAIT_FOR sel_cont";
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL sel_before_suspend";
SELECT * FROM t WHERE a = 10 FOR UPDATE;;
connect con_3,localhost,root,,;
SET DEBUG_SYNC="now WAIT_FOR sel_before_suspend";
SET DEBUG_SYNC="now SIGNAL upd_cont_2";
disconnect con_3;
connection con_2;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
disconnect con_2;
connection default;
a b
10 10
SET DEBUG_SYNC = 'RESET';
DROP TABLE t;
DROP TABLE t2;
......@@ -2190,7 +2190,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 ref c3,c2 c3 5 const 2 Using where; Using filesort
2 DERIVED t1 ref c3,c2 c3 5 const 2 Using where
DROP TABLE t1;
CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3))
ENGINE=InnoDB;
......@@ -2204,7 +2204,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 ref c3,c2 c3 9 const 2 Using where; Using filesort
2 DERIVED t1 ref c3,c2 c3 9 const 2 Using where
DROP TABLE t1;
CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2),
KEY (c3), KEY (c2, c3))
......@@ -2219,7 +2219,7 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 ref c3,c2 c3 7 const 2 Using where; Using filesort
2 DERIVED t1 ref c3,c2 c3 7 const 2 Using where
DROP TABLE t1;
End of 5.1 tests
#
......
......@@ -183,6 +183,17 @@ INSERT INTO t VALUES (0);
INSERT INTO t VALUES (1),(0),(1);
DROP TABLE t;
#
# MDEV-28327 InnoDB persistent statistics fail to update
# after bulk insert
#
CREATE TABLE t1 (a INT PRIMARY KEY)ENGINE=InnoDB;
INSERT INTO t1 SELECT * FROM seq_1_to_4096;
# Wait till statistics update after bulk insert operation
SELECT n_rows FROM mysql.innodb_table_stats WHERE TABLE_NAME="t1";
n_rows
4096
DROP TABLE t1;
#
# MDEV-26947 UNIQUE column checks fail in InnoDB resulting
# in table corruption
#
......@@ -314,3 +325,45 @@ PARTITION pn VALUES LESS THAN (20));
INSERT INTO t1 VALUES (1),(21);
ERROR HY000: Table has no partition for value 21
DROP TABLE t1;
#
# MDEV-29761 Bulk insert fails to rollback
# during insert..select
#
CREATE TABLE t1 (f1 INT)ENGINE=InnoDB;
CREATE TABLE t2 (f1 INT, UNIQUE INDEX(f1)) ENGINE=InnoDB;
CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(1);
BEGIN;
INSERT t1 SELECT 1 FROM seq_1_to_2;
COMMIT;
SELECT * FROM t1;
f1
SELECT * FROM t2;
f1
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
CHECK TABLE t2;
Table Op Msg_type Msg_text
test.t2 check status OK
DROP TABLE t1, t2;
#
# MDEV-29801 Inconsistent ER_TOO_BIG_ROWSIZE during bulk
# insert operation
#
call mtr.add_suppression("InnoDB: Cannot add field `c11` in table");
SET @format= @@innodb_default_row_format;
CREATE TABLE t1 (pk int primary key, c01 text, c02 text, c03 text,
c04 text, c05 text, c06 text, c07 text, c08 text,
c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB;
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT;
ALTER TABLE t1 FORCE;
Warnings:
Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
INSERT IGNORE INTO t1 VALUES
(1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)),
(2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107));
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= @format;
CREATE TABLE t (
`a` INT NOT NULL,
`b` INT NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB;
SET GLOBAL innodb_limit_optimistic_insert_debug = 3;
INSERT INTO t VALUES(10, 0);
INSERT INTO t VALUES(20, 0);
INSERT INTO t VALUES(30, 0);
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
XA START '1';
REPLACE INTO t VALUES(10, 1);
REPLACE INTO t VALUES(20, 1);
SET DEBUG_SYNC= 'ib_after_row_insert SIGNAL inserted WAIT_FOR cont';
REPLACE INTO t VALUES(30, 1);
connect con1,localhost,root;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
XA START '2';
SET DEBUG_SYNC= 'now WAIT_FOR inserted';
INSERT INTO t VALUES(40, 2);
SET DEBUG_SYNC= 'now SIGNAL cont';
connection default;
XA END '1';
XA PREPARE '1';
connection default;
XA COMMIT '1';
connection con1;
XA END '2';
XA PREPARE '2';
XA COMMIT '2';
disconnect con1;
connection default;
SET DEBUG_SYNC= "RESET";
DROP TABLE t;
......@@ -775,3 +775,18 @@ INSERT INTO t VALUES (1);
START TRANSACTION READ ONLY;
UPDATE t SET a = NULL;
ROLLBACK;
DROP TABLE t;
#
# MDEV-29886 Assertion !index->table->is_temporary() failed
# in trx_undo_prev_version_build upon CHECK
#
CREATE TEMPORARY TABLE t (a INT, KEY(a)) ENGINE=InnoDB SELECT 1;
UPDATE t SET a=2;
CHECK TABLE t;
Table Op Msg_type Msg_text
test.t check status OK
CHECK TABLE t EXTENDED;
Table Op Msg_type Msg_text
test.t check status OK
DROP TEMPORARY TABLE t;
# End of 10.6 tests
......@@ -6,13 +6,9 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
CREATE TABLE t1(a INT) row_format=redundant engine=innoDB;
INSERT INTO t1 VALUES(1);
InnoDB 0 transactions not purged
NOT FOUND /\[Warning\] InnoDB: A transaction id in a record of table `test`\.`t1` is newer than the system-wide maximum/ in mysqld.1.err
call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum");
SET @save_count = @@max_error_count;
SET max_error_count = 1;
call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption");
call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it");
SELECT * FROM t1;
a
Warnings:
Warning 1642 InnoDB: Transaction id in a record of table `test`.`t1` is newer than system-wide maximum.
SET max_error_count = @save_count;
ERROR HY000: Index for table 't1' is corrupt; try to repair it
DROP TABLE t1;
--source include/have_innodb.inc
let $datadir=`select @@datadir`;
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-29481 mariadb-upgrade prints confusing statement
--echo #
CREATE TABLE pet4 (
build_time double(18,7) DEFAULT NULL,
KEY idx1 (build_time)) ENGINE=InnoDB;
FLUSH TABLES;
remove_file $datadir/test/pet4.frm;
copy_file std_data/mysql_upgrade/mdev29481_100104_innodb.frm $datadir/test/pet4.frm;
SHOW CREATE TABLE pet4;
CHECK TABLE pet4 FOR UPGRADE;
ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=INSTANT;
DROP TABLE pet4;
CREATE TABLE pet4 (
build_time double(18,7) DEFAULT NULL,
KEY idx1 (build_time)) ENGINE=InnoDB;
FLUSH TABLES;
remove_file $datadir/test/pet4.frm;
copy_file std_data/mysql_upgrade/mdev29481_100104_innodb.frm $datadir/test/pet4.frm;
SHOW CREATE TABLE pet4;
ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=NOCOPY;
DROP TABLE pet4;
--echo #
--echo # End of 10.4 tests
--echo #
--innodb-force-recovery=2
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc
# Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx
# ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point
# lock_trx_handle_wait_enter, waiting for upd_cont signal, which must be
# emitted after the last SELECT in this test. The last SELECT will hang waiting
# for purge RW_X_LATCH releasing, and trx 2 will be rolled back by timeout.
# There is deadlock_report_before_lock_releasing sync point in
# Deadlock::report(), which is waiting for sel_cont signal under
# lock_sys_t lock. The signal must be issued after "UPDATE t SET b = 100"
# rollback, and that rollback is executing undo record, which is blocked on
# dict_sys latch request. dict_sys is locked by the thread of statistics
# update(dict_stats_save()), and during that update lock_sys lock is requested,
# and can't be acquired as Deadlock::report() holds it. We have to disable
# statistics update to make the test stable.
CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB STATS_PERSISTENT=0;
CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB STATS_PERSISTENT=0;
INSERT INTO t VALUES (10, 10), (20, 20), (30, 30);
INSERT INTO t2 VALUES (10), (20), (30);
BEGIN; # trx 1
# The following update is necessary to increase the transaction weight, which is
# calculated as the number of locks + the number of undo records during deadlock
# report. Victim's transaction should have minimum weight. We need trx 2 to be
# choosen as victim, that's why we need to increase the current transaction
# weight.
UPDATE t2 SET a = a + 100;
SELECT * FROM t WHERE a = 20 FOR UPDATE;
--connect(con_2,localhost,root,,)
# RC is necessary to do semi-consistent read
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN; # trx 2
# The first time it will be hit on trying to lock (20,20), the second hit
# will be on (30,30).
SET DEBUG_SYNC = 'lock_trx_handle_wait_before_unlocked_wait_lock_check SIGNAL upd_locked WAIT_FOR upd_cont';
# We must not modify primary key fields to cause rr_sequential() read record
# function choosing in mysql_update(), i.e. both query_plan.using_filesort and
# query_plan.using_io_buffer must be false during init_read_record() call.
--send UPDATE t SET b = 100
--connection default
SET DEBUG_SYNC="now WAIT_FOR upd_locked";
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL upd_cont";
--send SELECT * FROM t WHERE a = 10 FOR UPDATE
--connection con_2
# If the bug is not fixed, lock_trx_handle_wait() wrongly returns DB_SUCCESS
# instead of DB_DEADLOCK, row_search_mvcc() of trx 2 behaves so as if (20,20)
# was locked. Some debug assertion must crash the server. If the bug is fixed,
# trx 2 must just be rolled back by deadlock detector.
--error ER_LOCK_DEADLOCK
--reap
--disconnect con_2
--connection default
--reap
SET DEBUG_SYNC = 'RESET';
DROP TABLE t;
DROP TABLE t2;
--source include/wait_until_count_sessions.inc
--innodb-force-recovery=2
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc
# Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx
# ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point
# lock_trx_handle_wait_enter, waiting for upd_cont signal, which must be
# emitted after the last SELECT in this test. The last SELECT will hang waiting
# for purge RW_X_LATCH releasing, and trx 2 will be rolled back by timeout.
# There is deadlock_report_before_lock_releasing sync point in
# Deadlock::report(), which is waiting for sel_cont signal under
# lock_sys_t lock. The signal must be issued after "UPDATE t SET b = 100"
# rollback, and that rollback is executing undo record, which is blocked on
# dict_sys latch request. dict_sys is locked by the thread of statistics
# update(dict_stats_save()), and during that update lock_sys lock is requested,
# and can't be acquired as Deadlock::report() holds it. We have to disable
# statistics update to make the test stable.
CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB STATS_PERSISTENT=0;
CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB STATS_PERSISTENT=0;
INSERT INTO t VALUES (10, 10), (20, 20), (30, 30);
INSERT INTO t2 VALUES (10), (20), (30);
BEGIN; # trx 1
# The following update is necessary to increase the transaction weight, which is
# calculated as the number of locks + the number of undo records during deadlock
# report. Victim's transaction should have minimum weight. We need trx 2 to be
# choosen as victim, that's why we need to increase the current transaction
# weight.
UPDATE t2 SET a = a + 100;
SELECT * FROM t WHERE a = 20 FOR UPDATE;
--connect(con_2,localhost,root,,)
# RC is necessary to do semi-consistent read
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
# It will be hit on trying to lock (20,20).
SET DEBUG_SYNC = 'lock_trx_handle_wait_enter SIGNAL upd_locked WAIT_FOR upd_cont';
SET DEBUG_SYNC = 'trx_t_release_locks_enter SIGNAL sel_cont WAIT_FOR upd_cont_2';
BEGIN; # trx 2
# We must not modify primary key fields to cause rr_sequential() read record
# function choosing in mysql_update(), i.e. both query_plan.using_filesort and
# query_plan.using_io_buffer must be false during init_read_record() call.
# The following UPDATE will be chosen as deadlock victim and rolled back.
--send UPDATE t SET b = 100
--connection default
SET DEBUG_SYNC="now WAIT_FOR upd_locked";
SET DEBUG_SYNC="deadlock_report_before_lock_releasing SIGNAL upd_cont WAIT_FOR sel_cont";
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL sel_before_suspend";
# If the bug is not fixed, the following SELECT will crash, as the above UPDATE
# will reset trx->lock.wait_thr during rollback
--send SELECT * FROM t WHERE a = 10 FOR UPDATE;
--connect(con_3,localhost,root,,)
SET DEBUG_SYNC="now WAIT_FOR sel_before_suspend";
SET DEBUG_SYNC="now SIGNAL upd_cont_2";
--disconnect con_3
--connection con_2
--error ER_LOCK_DEADLOCK
--reap
--disconnect con_2
--connection default
--reap
SET DEBUG_SYNC = 'RESET';
DROP TABLE t;
DROP TABLE t2;
--source include/wait_until_count_sessions.inc
......@@ -195,6 +195,19 @@ INSERT INTO t VALUES (0);
INSERT INTO t VALUES (1),(0),(1);
DROP TABLE t;
--echo #
--echo # MDEV-28327 InnoDB persistent statistics fail to update
--echo # after bulk insert
--echo #
CREATE TABLE t1 (a INT PRIMARY KEY)ENGINE=InnoDB;
INSERT INTO t1 SELECT * FROM seq_1_to_4096;
--echo # Wait till statistics update after bulk insert operation
let $wait_condition= select n_rows > 100 from mysql.innodb_table_stats
where table_name="t1";
source include/wait_condition.inc;
SELECT n_rows FROM mysql.innodb_table_stats WHERE TABLE_NAME="t1";
DROP TABLE t1;
--echo #
--echo # MDEV-26947 UNIQUE column checks fail in InnoDB resulting
--echo # in table corruption
......@@ -327,3 +340,38 @@ CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB
INSERT INTO t1 VALUES (1),(21);
# Cleanup
DROP TABLE t1;
--echo #
--echo # MDEV-29761 Bulk insert fails to rollback
--echo # during insert..select
--echo #
CREATE TABLE t1 (f1 INT)ENGINE=InnoDB;
CREATE TABLE t2 (f1 INT, UNIQUE INDEX(f1)) ENGINE=InnoDB;
CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(1);
BEGIN;
INSERT t1 SELECT 1 FROM seq_1_to_2;
COMMIT;
SELECT * FROM t1;
SELECT * FROM t2;
CHECK TABLE t1;
CHECK TABLE t2;
DROP TABLE t1, t2;
--echo #
--echo # MDEV-29801 Inconsistent ER_TOO_BIG_ROWSIZE during bulk
--echo # insert operation
--echo #
call mtr.add_suppression("InnoDB: Cannot add field `c11` in table");
SET @format= @@innodb_default_row_format;
CREATE TABLE t1 (pk int primary key, c01 text, c02 text, c03 text,
c04 text, c05 text, c06 text, c07 text, c08 text,
c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB;
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT;
ALTER TABLE t1 FORCE;
INSERT IGNORE INTO t1 VALUES
(1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)),
(2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107));
CHECK TABLE t1;
DROP TABLE t1;
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= @format;
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/count_sessions.inc
CREATE TABLE t (
`a` INT NOT NULL,
`b` INT NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB;
--disable_query_log
SET @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
--enable_query_log
SET GLOBAL innodb_limit_optimistic_insert_debug = 3;
INSERT INTO t VALUES(10, 0);
INSERT INTO t VALUES(20, 0);
INSERT INTO t VALUES(30, 0);
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
XA START '1';
REPLACE INTO t VALUES(10, 1);
REPLACE INTO t VALUES(20, 1);
# We need the following sync point because mysql_insert() resets
# trx->duplicates with the following condition:
#
# if (duplic == DUP_REPLACE &&
# (!table->triggers || !table->triggers->has_delete_triggers()))
# table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
#
# and ha_innobase::extra() resets trx_t::duplicates, but we need
# lock_update_split_right() to be invoked when trx->duplicates is set to
# repeat the bug. So the transaction will hang just after
# row_insert_for_mysql() call until another transaction inserts new row and
# splits the page.
SET DEBUG_SYNC= 'ib_after_row_insert SIGNAL inserted WAIT_FOR cont';
--send REPLACE INTO t VALUES(30, 1)
connect (con1,localhost,root);
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
XA START '2';
SET DEBUG_SYNC= 'now WAIT_FOR inserted';
# The following statement will cause page split and (20, ...) will be split
# record. As the previous REPLACE set non-gap X-lock on it,
# lock_update_split_right() and lock_rec_inherit_to_gap() will 'inherit' the
# lock from the very first (20, ...) new right page record to the supremum of
# the old left page, what should not be for READ COMMITTED isolation level
INSERT INTO t VALUES(40, 2);
SET DEBUG_SYNC= 'now SIGNAL cont';
--connection default
--reap
XA END '1';
# This will cause the assertion failure, because the supremum of the left page
# has X-lock.
XA PREPARE '1';
--connection default
XA COMMIT '1';
--connection con1
XA END '2';
XA PREPARE '2';
XA COMMIT '2';
--disconnect con1
--connection default
SET DEBUG_SYNC= "RESET";
DROP TABLE t;
--disable_query_log
SET GLOBAL innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
--enable_query_log
--source include/wait_until_count_sessions.inc
......@@ -613,3 +613,15 @@ INSERT INTO t VALUES (1);
START TRANSACTION READ ONLY;
UPDATE t SET a = NULL;
ROLLBACK;
DROP TABLE t;
--echo #
--echo # MDEV-29886 Assertion !index->table->is_temporary() failed
--echo # in trx_undo_prev_version_build upon CHECK
--echo #
CREATE TEMPORARY TABLE t (a INT, KEY(a)) ENGINE=InnoDB SELECT 1;
UPDATE t SET a=2;
CHECK TABLE t;
CHECK TABLE t EXTENDED;
DROP TEMPORARY TABLE t;
--echo # End of 10.6 tests
......@@ -57,19 +57,11 @@ syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
close(FILE) || die "Unable to close $file";
EOF
# Debug assertions would fail due to the injected corruption.
--let $restart_parameters= --loose-skip-debug-assert
--source include/start_mysqld.inc
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN= \[Warning\] InnoDB: A transaction id in a record of table `test`\.`t1` is newer than the system-wide maximum;
--source include/search_pattern_in_file.inc
call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum");
call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption");
call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it");
# A debug assertion would cause a duplicated message to be output.
SET @save_count = @@max_error_count;
SET max_error_count = 1;
--error ER_NOT_KEYFILE
SELECT * FROM t1;
SET max_error_count = @save_count;
DROP TABLE t1;
......@@ -772,4 +772,15 @@ UNLOCK TABLES;
ALTER TABLE t1 DISCARD TABLESPACE;
ALTER TABLE t2 IMPORT TABLESPACE;
DROP TABLE t2, t1;
#
# MDEV-29778 Having Unique index interference with MATCH
# from a FULLTEXT
#
CREATE TABLE t1(f1 VARCHAR(100), FULLTEXT(f1),
UNIQUE INDEX(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES("test");
SELECT f1, MATCH(f1) AGAINST ("test" IN BOOLEAN MODE) FROM t1;
f1 MATCH(f1) AGAINST ("test" IN BOOLEAN MODE)
test 0.000000001885928302414186
DROP TABLE t1;
# End of 10.3 tests
......@@ -792,4 +792,14 @@ ALTER TABLE t2 IMPORT TABLESPACE;
--enable_warnings
DROP TABLE t2, t1;
--echo #
--echo # MDEV-29778 Having Unique index interference with MATCH
--echo # from a FULLTEXT
--echo #
CREATE TABLE t1(f1 VARCHAR(100), FULLTEXT(f1),
UNIQUE INDEX(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES("test");
SELECT f1, MATCH(f1) AGAINST ("test" IN BOOLEAN MODE) FROM t1;
DROP TABLE t1;
--echo # End of 10.3 tests
......@@ -153,7 +153,9 @@ select * from t1 where a like "abc%";
select * from t1 where a like "test%";
select * from t1 where a like "te_t";
# InnoDB_FTS: we don't support the postfix "+0"
select * from t1 where match a against ("te*" in boolean mode)+0;
# Work around MDEV-29871 (FIXME: remove this)
--echo select * from t1 where match a against ("te*" in boolean mode)+0;
--echo a
drop table t1;
......
......@@ -281,6 +281,10 @@ Last_SQL_Errno = '0'
#
START SLAVE for channel 'master1';
include/wait_for_slave_to_start.inc
connection master1;
create table foo (a int);
drop table foo;
connection slave;
show slave status for channel 'master1'
Master_Port = 'MYPORT_1'
......
......@@ -328,6 +328,15 @@ STOP SLAVE for channel 'master1';
START SLAVE for channel 'master1';
--source include/wait_for_slave_to_start.inc
# Force some data into the relay log to ensure that we get a new relay log
--connection master1
create table foo (a int);
drop table foo;
--save_master_pos
--connection slave
--sync_with_master 0,'master1'
--source include/wait_for_sql_thread_read_all.inc
--echo
--echo show slave status for channel 'master1'
--let $status_items= Master_Port, Relay_Log_File, Slave_IO_Running, Slave_SQL_Running, Last_Errno, Last_SQL_Errno
......
--source include/not_embedded.inc
--source include/have_perfschema.inc
# This test fails very frequently on a Windows builder.
--source include/not_windows.inc
UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
......
......@@ -7,7 +7,7 @@
CREATE DATABASE db;
USE db;
--let $psi_select = SELECT STATEMENT_NAME, SQL_TEXT, COUNT_REPREPARE, COUNT_EXECUTE, SUM_ROWS_SENT, SUM_SELECT_SCAN, SUM_NO_INDEX_USED FROM performance_schema.prepared_statements_instances
--let $psi_select = SELECT STATEMENT_NAME, SQL_TEXT, COUNT_REPREPARE, COUNT_EXECUTE, SUM_ROWS_SENT, SUM_SELECT_SCAN, SUM_NO_INDEX_USED FROM performance_schema.prepared_statements_instances ORDER BY STATEMENT_NAME, SQL_TEXT
--let $psi_truncate = TRUNCATE TABLE performance_schema.prepared_statements_instances
--let $eshl_select = SELECT EVENT_NAME, SQL_TEXT, OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME FROM performance_schema.events_statements_history_long WHERE CURRENT_SCHEMA='db'
--let $eshl_truncate = TRUNCATE TABLE performance_schema.events_statements_history_long
......
# Work around MDEV-29508
--source include/not_valgrind.inc
# Tests for PERFORMANCE_SCHEMA
# Check server start for short server start options
......
#
# MDEV-29458 Role grant commands do not propagate all grants
#
create user foo;
create database some_db;
create table some_db.t1 (a int, b int, secret int);
......@@ -134,3 +137,31 @@ grant select(user) on mysql.user to test_role2;
drop role test_role1, test_role2;
create role test_role1;
drop role test_role1;
#
# MDEV-29851 Cached role privileges are not invalidated when needed
#
create role admin;
create role student;
create database crm;
grant create on crm.* to admin;
grant select on crm.* to student;
create user intern@localhost;
grant student to intern@localhost;
set default role student for intern@localhost;
connect con1, localhost, intern;
use crm;
disconnect con1;
connection default;
grant admin to student;
connect con1, localhost, intern;
use crm;
create table t1 (a int);
disconnect con1;
connection default;
drop user intern@localhost;
drop role student;
drop role admin;
drop database crm;
#
# End of 10.3 tests
#
--source include/not_embedded.inc
--echo #
--echo # MDEV-29458 Role grant commands do not propagate all grants
--echo #
create user foo;
create database some_db;
create table some_db.t1 (a int, b int, secret int);
......@@ -161,3 +165,37 @@ drop role test_role1, test_role2;
create role test_role1;
drop role test_role1;
--echo #
--echo # MDEV-29851 Cached role privileges are not invalidated when needed
--echo #
create role admin;
create role student;
create database crm;
grant create on crm.* to admin;
grant select on crm.* to student;
create user intern@localhost;
grant student to intern@localhost;
set default role student for intern@localhost;
connect con1, localhost, intern;
use crm;
disconnect con1;
connection default;
grant admin to student;
connect con1, localhost, intern;
use crm;
create table t1 (a int);
disconnect con1;
connection default;
drop user intern@localhost;
drop role student;
drop role admin;
drop database crm;
--echo #
--echo # End of 10.3 tests
--echo #
......@@ -7,6 +7,7 @@
--source include/have_innodb.inc
--source include/master-slave.inc
--source include/have_debug.inc
--source include/no_valgrind_without_big.inc
--connection slave
--source include/stop_slave.inc
......
......@@ -193,3 +193,105 @@ INSERT INTO t1 () values ();
EXECUTE stmt;
DROP TABLE t1;
DROP SEQUENCE s;
#
# MDEV-29540 Incorrect sequence values in INSERT SELECT
#
CREATE SEQUENCE s1;
CREATE TABLE t1 (
a BIGINT UNSIGNED NOT NULL PRIMARY KEY
DEFAULT (NEXT VALUE FOR s1),
b CHAR(1) NOT NULL
);
INSERT INTO t1 (b) VALUES ('a');
INSERT INTO t1 (b) VALUES ('b'), ('c');
INSERT INTO t1 (b) VALUES ('d');
INSERT INTO t1 (b) SELECT c FROM (
SELECT 'e' as c
UNION
SELECT 'f'
UNION
SELECT 'g'
) der;
SELECT a, b FROM t1;
a b
1 a
2 b
3 c
4 d
5 e
6 f
7 g
ALTER SEQUENCE s1 RESTART;
INSERT INTO t1 (b) SELECT c FROM (
SELECT 'a' as c
UNION
SELECT 'b'
UNION
SELECT 'c'
UNION
SELECT 'd'
UNION
SELECT 'e'
UNION
SELECT 'f'
UNION
SELECT 'g'
) der;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
ALTER SEQUENCE s1 RESTART;
INSERT IGNORE INTO t1 (b) SELECT c FROM (
SELECT 'a' as c
UNION
SELECT 'b'
UNION
SELECT 'c'
UNION
SELECT 'd'
UNION
SELECT 'e'
UNION
SELECT 'f'
UNION
SELECT 'g'
) der;
Warnings:
Warning 1062 Duplicate entry '1' for key 'PRIMARY'
Warning 1062 Duplicate entry '2' for key 'PRIMARY'
Warning 1062 Duplicate entry '3' for key 'PRIMARY'
Warning 1062 Duplicate entry '4' for key 'PRIMARY'
Warning 1062 Duplicate entry '5' for key 'PRIMARY'
Warning 1062 Duplicate entry '6' for key 'PRIMARY'
Warning 1062 Duplicate entry '7' for key 'PRIMARY'
SELECT a, b FROM t1;
a b
1 a
2 b
3 c
4 d
5 e
6 f
7 g
INSERT IGNORE INTO t1 (b) SELECT c FROM (
SELECT 'h' as c
UNION
SELECT 'i'
UNION
SELECT 'j'
) der;
SELECT a, b FROM t1;
a b
1 a
2 b
3 c
4 d
5 e
6 f
7 g
8 h
9 i
10 j
DROP TABLE t1;
DROP SEQUENCE s1;
#
# End of 10.3 tests
#
......@@ -135,3 +135,83 @@ EXECUTE stmt;
# Cleanup
DROP TABLE t1;
DROP SEQUENCE s;
--echo #
--echo # MDEV-29540 Incorrect sequence values in INSERT SELECT
--echo #
CREATE SEQUENCE s1;
CREATE TABLE t1 (
a BIGINT UNSIGNED NOT NULL PRIMARY KEY
DEFAULT (NEXT VALUE FOR s1),
b CHAR(1) NOT NULL
);
INSERT INTO t1 (b) VALUES ('a');
INSERT INTO t1 (b) VALUES ('b'), ('c');
INSERT INTO t1 (b) VALUES ('d');
INSERT INTO t1 (b) SELECT c FROM (
SELECT 'e' as c
UNION
SELECT 'f'
UNION
SELECT 'g'
) der;
SELECT a, b FROM t1;
ALTER SEQUENCE s1 RESTART;
--error ER_DUP_ENTRY
INSERT INTO t1 (b) SELECT c FROM (
SELECT 'a' as c
UNION
SELECT 'b'
UNION
SELECT 'c'
UNION
SELECT 'd'
UNION
SELECT 'e'
UNION
SELECT 'f'
UNION
SELECT 'g'
) der;
ALTER SEQUENCE s1 RESTART;
INSERT IGNORE INTO t1 (b) SELECT c FROM (
SELECT 'a' as c
UNION
SELECT 'b'
UNION
SELECT 'c'
UNION
SELECT 'd'
UNION
SELECT 'e'
UNION
SELECT 'f'
UNION
SELECT 'g'
) der;
SELECT a, b FROM t1;
INSERT IGNORE INTO t1 (b) SELECT c FROM (
SELECT 'h' as c
UNION
SELECT 'i'
UNION
SELECT 'j'
) der;
SELECT a, b FROM t1;
DROP TABLE t1;
DROP SEQUENCE s1;
--echo #
--echo # End of 10.3 tests
--echo #
......@@ -55,5 +55,5 @@ INSERT INTO `t1` VALUES
(2),
(3);
#MYSQL_DUMP --compact --as-of="1990-08-04 00:00' where 'abc" test 2>&1
mysqldump: Incorrect DATETIME value: '1990-08-04 00:00' where 'abc'
mariadb-dump: Incorrect DATETIME value: '1990-08-04 00:00' where 'abc'
drop tables t1;
set time_zone='+00:00';
#
# MDEV-29750 triggers can modify history
#
set sql_mode='', timestamp=unix_timestamp('2010-10-10 10:10:10');
create table t (a int, b int as (a+1), s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
insert into t values (1,1, '2022-01-01','2023-01-01'),(2,2, '2022-02-02','2023-02-02');
Warnings:
Warning 1906 The value specified for generated column 'b' in table 't' has been ignored
Warning 1906 The value specified for generated column 's' in table 't' has been ignored
Warning 1906 The value specified for generated column 'e' in table 't' has been ignored
Warning 1906 The value specified for generated column 'b' in table 't' has been ignored
Warning 1906 The value specified for generated column 's' in table 't' has been ignored
Warning 1906 The value specified for generated column 'e' in table 't' has been ignored
create trigger tr before insert on t for each row set new.b=1, new.s = '2022-03-03', new.e = '2023-03-03';
insert into t (a) values (3),(4);
select * from t for system_time all;
a b s e
1 2 2010-10-10 10:10:10.000000 2038-01-19 03:14:07.999999
2 3 2010-10-10 10:10:10.000000 2038-01-19 03:14:07.999999
3 4 2010-10-10 10:10:10.000000 2038-01-19 03:14:07.999999
4 5 2010-10-10 10:10:10.000000 2038-01-19 03:14:07.999999
drop table t;
set sql_mode=default, timestamp=default;
#
# End of 10.3 tests
#
......@@ -1579,6 +1579,108 @@ create trigger tr before insert on t for each row update tcount set c = c + 1;
insert into t select * from t;
drop table tcount, t;
#
# MDEV-19569 Assertion `table_list->table' failed in find_field_in_table_ref and Assertion `table_ref->table || table_ref->view' in Field_iterator_table_ref::set_field_iterator
#
set timestamp=unix_timestamp('2000-01-01 00:00:00');
create table t1 (i int);
create table t2 (i int);
alter table t1 partition by system_time
interval (select i from t2) day (partition p1 history, partition pn current);
ERROR 42000: INTERVAL does not support subqueries or stored functions
drop table t1;
create table t1 (id int) with system versioning
partition by system_time
interval (select i from t2) day (partition p1 history, partition pn current);
ERROR 42000: INTERVAL does not support subqueries or stored functions
create table t1 (id int) with system versioning
partition by system_time
interval "hello" day (partition p1 history, partition pn current);
ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'INTERVAL'
create table t1 (id int) with system versioning
partition by system_time
interval 3.893 day (partition p1 history, partition pn current);
drop table t1, t2;
create table t1 (id int) with system versioning
partition by system_time interval "3-11" year_month (partition p1 history, partition pn current);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME INTERVAL '3-11' YEAR_MONTH STARTS TIMESTAMP'2000-01-01 00:00:00'
(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
drop table t1;
create table t1 (id int) with system versioning
partition by system_time interval "3 11" day_hour (partition p1 history, partition pn current);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME INTERVAL '3 11' DAY_HOUR STARTS TIMESTAMP'2000-01-01 00:00:00'
(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
drop table t1;
create table t1 (id int) with system versioning
partition by system_time interval "3 11:12" day_minute (partition p1 history, partition pn current);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME INTERVAL '3 11:12' DAY_MINUTE STARTS TIMESTAMP'2000-01-01 00:00:00'
(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
drop table t1;
create table t1 (id int) with system versioning
partition by system_time interval "3 11:12:13" day_second (partition p1 history, partition pn current);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME INTERVAL '3 11:12:13' DAY_SECOND STARTS TIMESTAMP'2000-01-01 00:00:00'
(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
drop table t1;
create table t1 (id int) with system versioning
partition by system_time interval "11:12" hour_minute (partition p1 history, partition pn current);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME INTERVAL '11:12' HOUR_MINUTE STARTS TIMESTAMP'2000-01-01 00:00:00'
(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
drop table t1;
create table t1 (id int) with system versioning
partition by system_time interval "11:12:13" hour_second (partition p1 history, partition pn current);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME INTERVAL '11:12:13' HOUR_SECOND STARTS TIMESTAMP'2000-01-01 00:00:00'
(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
drop table t1;
create table t1 (id int) with system versioning
partition by system_time interval "12:13" minute_second (partition p1 history, partition pn current);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME INTERVAL '12:13' MINUTE_SECOND STARTS TIMESTAMP'2000-01-01 00:00:00'
(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
drop table t1;
create table t1 (id int) with system versioning
partition by system_time interval "12:13.123" minute_microsecond (partition p1 history, partition pn current);
ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'INTERVAL'
#
# End of 10.3 tests
#
#
......
......@@ -23,7 +23,7 @@ set timestamp=default;
--exec $MYSQL_DUMP --compact --as-of="1990-08-04 00:00" test t1
## Forged query protection
--echo #MYSQL_DUMP --compact --as-of="1990-08-04 00:00' where 'abc" test 2>&1
--replace_result mysqldump.exe mysqldump
--replace_result mariadb-dump.exe mariadb-dump
--error 1
--exec $MYSQL_DUMP --compact --as-of="1990-08-04 00:00' where 'abc" test 2>&1
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment