diff options
author | Alexander Barkov <bar@mariadb.org> | 2017-05-26 19:32:28 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2017-05-26 19:32:28 +0400 |
commit | 9bc32256427373e5bfa78f17c5854ac4e6a2fc31 (patch) | |
tree | 748fd55866bcbc4de5eee1c078ac8d2cad5b6fd7 /mysql-test/t | |
parent | 77b2f55f61a4e3ba642049a01651c92bfb0a7d9d (diff) | |
parent | ca7cf69cb13285585922722063af888b957580ee (diff) | |
download | mariadb-git-9bc32256427373e5bfa78f17c5854ac4e6a2fc31.tar.gz |
Merge tag 'mariadb-10.2.6' into bb-10.2-ext
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/events_2.test | 2 | ||||
-rw-r--r-- | mysql-test/t/gis.test | 15 | ||||
-rw-r--r-- | mysql-test/t/join_cache.test | 12 | ||||
-rw-r--r-- | mysql-test/t/limit_rows_examined.test | 1 | ||||
-rw-r--r-- | mysql-test/t/loaddata.test | 2 | ||||
-rw-r--r-- | mysql-test/t/loadxml.test | 4 | ||||
-rw-r--r-- | mysql-test/t/log_tables-big.test | 16 | ||||
-rw-r--r-- | mysql-test/t/mysql_plugin.test | 368 | ||||
-rw-r--r-- | mysql-test/t/mysqldump.test | 52 | ||||
-rw-r--r-- | mysql-test/t/mysqltest.test | 28 | ||||
-rw-r--r-- | mysql-test/t/openssl_1.test | 2 | ||||
-rw-r--r-- | mysql-test/t/openssl_6975.test | 16 | ||||
-rw-r--r-- | mysql-test/t/query_cache_innodb.test | 85 | ||||
-rw-r--r-- | mysql-test/t/ssl_7937.combinations | 5 | ||||
-rw-r--r-- | mysql-test/t/ssl_7937.test | 2 | ||||
-rw-r--r-- | mysql-test/t/ssl_8k_key.test | 4 | ||||
-rw-r--r-- | mysql-test/t/stat_tables_par.test | 2 | ||||
-rw-r--r-- | mysql-test/t/subselect_exists2in.test | 28 | ||||
-rw-r--r-- | mysql-test/t/subselect_innodb.test | 21 | ||||
-rw-r--r-- | mysql-test/t/subselect_mat_cost_bugs.test | 39 | ||||
-rw-r--r-- | mysql-test/t/subselect_sj_mat.test | 93 | ||||
-rw-r--r-- | mysql-test/t/symlink.test | 16 |
22 files changed, 406 insertions, 407 deletions
diff --git a/mysql-test/t/events_2.test b/mysql-test/t/events_2.test index 20f17966b29..12ce9210b0a 100644 --- a/mysql-test/t/events_2.test +++ b/mysql-test/t/events_2.test @@ -15,7 +15,7 @@ use events_test; # mysql.event intact checking end # -create event e_26 on schedule at '2027-01-01 00:00:00' disable do set @a = 5; +create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5; select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event; drop event e_26; --error ER_WRONG_VALUE diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index b38e68fe5e7..05ec751e686 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -1455,7 +1455,20 @@ SHOW CREATE VIEW v1; SELECT ASTEXT(p) FROM v1; DROP VIEW v1; ---echo End of 5.5 tests +# --echo End of 5.5 tests + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-12495 Conditional jump depends on uninitialised value for: SELECT NULL UNION geom_expression +--echo # +SELECT AsText(g) FROM (SELECT NULL AS g UNION SELECT Point(1,1)) AS t1; + +--echo # +--echo # End 10.0 tests +--echo # SHOW CREATE TABLE information_schema.geometry_columns; SHOW CREATE TABLE information_schema.spatial_ref_sys; diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test index 009e72c1c14..611f5ab8942 100644 --- a/mysql-test/t/join_cache.test +++ b/mysql-test/t/join_cache.test @@ -3900,6 +3900,18 @@ SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired = set join_cache_level=default; +# +# MDEV-12580 Wrong query result in join when using an index (Version > "10.2.3") +# +create table t1 (c1 date not null, key (c1)) engine=innodb; +insert t1 values ('2017-12-27'); +create table t2 (pk int, f1 int, f2 int); +insert t2 values (4,1,1), (6,1,1); +set join_buffer_size = 222222208; +select f2 from t2,t1 where f2 = 0; +drop table t1, t2; +set join_buffer_size = default; + # The following command must be the last one the file # this must be the last command in the file set @@optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/t/limit_rows_examined.test b/mysql-test/t/limit_rows_examined.test index 29b3b411602..815394aec5c 100644 --- a/mysql-test/t/limit_rows_examined.test +++ b/mysql-test/t/limit_rows_examined.test @@ -489,7 +489,6 @@ GROUP BY field1, field2, field3, field4, field5 LIMIT ROWS EXAMINED 120; FLUSH STATUS; ---error 1028 SELECT a AS field1, alias2.d AS field2, alias2.f AS field3, alias2.e AS field4, b AS field5 FROM t1, t2 AS alias2, t2 AS alias3 WHERE alias3.c IN ( SELECT 1 UNION SELECT 6 ) diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 88c4a363a57..4e355e5c3a7 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -294,7 +294,7 @@ SELECT * FROM v2; DELETE FROM t1; --echo ---error ER_LOAD_DATA_INVALID_COLUMN +--error ER_NONUPDATEABLE_COLUMN LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2 FIELDS ESCAPED BY '\\' TERMINATED BY ',' diff --git a/mysql-test/t/loadxml.test b/mysql-test/t/loadxml.test index b26a2eacc00..0bd97a81649 100644 --- a/mysql-test/t/loadxml.test +++ b/mysql-test/t/loadxml.test @@ -137,9 +137,9 @@ DROP TABLE t1; CREATE TABLE t1 (c1 TEXT); CREATE VIEW v1 AS SELECT CONCAT(c1,'') AS c1, NULL AS c2 FROM t1; ---error ER_LOAD_DATA_INVALID_COLUMN +--error ER_NONUPDATEABLE_COLUMN LOAD XML INFILE '../../std_data/loaddata/mdev12696.xml' INTO TABLE v1 (c1); ---error ER_LOAD_DATA_INVALID_COLUMN, +--error ER_NONUPDATEABLE_COLUMN LOAD XML INFILE '../../std_data/loaddata/mdev12696.xml' INTO TABLE v1 (c2); DROP VIEW v1; DROP TABLE t1; diff --git a/mysql-test/t/log_tables-big.test b/mysql-test/t/log_tables-big.test index 8c956fa6f55..8936a163d73 100644 --- a/mysql-test/t/log_tables-big.test +++ b/mysql-test/t/log_tables-big.test @@ -7,6 +7,8 @@ # check that CSV engine was compiled in --source include/have_csv.inc +set @@global.log_output = 'TABLE'; + connect (con1,localhost,root,,); connect (con2,localhost,root,,); @@ -18,18 +20,20 @@ set session long_query_time=10; select get_lock('bug27638', 1); connection con2; set session long_query_time=1; -truncate table mysql.slow_log; select get_lock('bug27638', 2); -select if (query_time between '00:00:01' and '00:00:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log; -truncate table mysql.slow_log; +select if (query_time >= '00:00:01', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log + where sql_text = 'select get_lock(\'bug27638\', 2)'; select get_lock('bug27638', 60); -select if (query_time between '00:00:59' and '00:01:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log; -truncate table mysql.slow_log; +select if (query_time >= '00:00:59', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log + where sql_text = 'select get_lock(\'bug27638\', 60)'; select get_lock('bug27638', 101); -select if (query_time between '00:01:40' and '00:01:50', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log; +select if (query_time >= '00:01:40', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log + where sql_text = 'select get_lock(\'bug27638\', 101)'; connection con1; select release_lock('bug27638'); connection default; disconnect con1; disconnect con2; + +set @@global.log_output=default; diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test deleted file mode 100644 index 10bc03e0f06..00000000000 --- a/mysql-test/t/mysql_plugin.test +++ /dev/null @@ -1,368 +0,0 @@ -# -# Test mysql_plugin tool -# -# This test contains test cases for testing the mysql_plugin client with -# the daemon_example plugin. Test cases include tests for: -# -# - successful enable/disable -# - incorrect paths -# - missing paths/options -# -# Implementation Notes -# -# The mysql_plugin tool now accepts --mysqld the path to mysqld server. The -# mysqld path is extracted from MYSQLD_BOOTSTRAP_CMD line. We also extract -# the path of MYSQLD_BASEDIR (where mysql exists) and use it for the errmsg -# file. The directories differ between Windows and Unix but the Perl script -# included below will pick as per platform. -# -# The test is also designed to issue the --skip directive if the location of -# the mysqld, my_print_defaults, or daemon_example.ini files cannot be found. -# - ---source include/not_embedded.inc - -# Add the datadir, basedir, plugin_dir to the bootstrap command -let $MYSQLD_DATADIR= `select @@datadir`; -let $MYSQL_BASEDIR= `select @@basedir`; -let $MYSQL_ERRMSG_BASEDIR=`select @@lc_messages_dir`; -let $PLUGIN_DIR=`select @@plugin_dir`; - ---disable_abort_on_error - -# Perl script to extract the location of the basedir from environment -# variables. This is needed to ensure the test will run on the PB machines -# designed to test release as well as debug builds. It also checks for the -# location of the my_print_defaults and daemon_example.ini files. - -perl; -use File::Basename; - my ($mysqld)= split " ", $ENV{MYSQLD_BOOTSTRAP_CMD}; - my $mysqld_basedir=dirname($mysqld); - my $my_print_defaults= $ENV{MYSQL_MY_PRINT_DEFAULTS}; - my $my_print_defaults_basedir=dirname($my_print_defaults); - my $daemonexample_ini= "$ENV{DAEMONEXAMPLE_DIR}/daemon_example.ini"; - my $plugindir_ini= "$ENV{PLUGIN_DIR}/daemon_example.ini"; - my $notfound= ""; - open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/mysqld.inc") or die; - print FILE "let \$MYSQLD_BASEDIR= $mysqld_basedir;\n"; - print FILE "let \$MYSQL_MY_PRINT_DEFAULTS_BASEDIR= $my_print_defaults_basedir;\n"; - if ((!-e $daemonexample_ini) || (!-r $daemonexample_ini)) - { - print FILE "let \$DAEMONEXAMPLE_DIR= $not_found;\n"; - } - if ((!-e $plugindir_ini) || (!-r $plugindir_ini)) - { - print FILE "let \$PLUGIN_DIR= $not_found;\n"; - } - close FILE; -EOF - - -source $MYSQL_TMP_DIR/mysqld.inc; -remove_file $MYSQL_TMP_DIR/mysqld.inc; - -# The mysql_plugin tool expects a directory structure like in the installed -# mysql version, so errmsg.sys will be copied to "basedir/share", we create -# and remove this structure. - ---mkdir $MYSQLD_BASEDIR/share ---mkdir $MYSQLD_BASEDIR/share/mysql ---copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_BASEDIR/share/errmsg.sys ---copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_BASEDIR/share/mysql/errmsg.sys - -# The mysql_plugin tool now accepts --my-print-defaults which points to the -# executable my_print_defaults.exe we can get this path from the variable -# $MYSQL_MY_PRINT_DEFAULTS. - -# Check for my_print_defaults location. Skip if not found. -if ($MYSQL_MY_PRINT_DEFAULTS_BASEDIR == '') -{ - --skip Test requires known location of my_print_defaults executable. -} - -# Check for mysqld location. Skip if not found. -if ($MYSQLD == '') -{ - --skip Test requires known location of mysqld executable. -} - -# Check for daemon_example.ini location. Skip if not found in either -# the plugin_dir path or the daemon_example_dir path. -if ($PLUGIN_DIR == '') -{ - if ($DAEMONEXAMPLE_DIR == '') - { - --skip Test requires known location of daemon_example.ini file. - } - let $PLUGIN_DIR = $DAEMONEXAMPLE_DIR; -} - -# Build client command for reuse. - -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; - ---echo # ---echo # Ensure the plugin isn't loaded. ---echo # -SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name; - ---echo # ---echo # Enable the plugin... ---echo # - ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---shutdown_server 10 ---source include/wait_until_disconnected.inc - -# -# Enable the plugin -# ---exec $MYSQL_PLUGIN_CMD ENABLE daemon_example - -# -# Ensure enabling an enabled plugin doesn't fail ---exec $MYSQL_PLUGIN_CMD ENABLE daemon_example - -# -# Restart the server -# - ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---enable_reconnect ---source include/wait_until_connected_again.inc - ---echo # ---echo # Simulate loading a plugin libary with multiple entry points. ---echo # This will test the DISABLE to ensure all rows are removed. ---echo # ---replace_regex /\.dll/.so/ -eval INSERT INTO mysql.plugin VALUES ('wicky', '$DAEMONEXAMPLE'); ---replace_regex /\.dll/.so/ -eval INSERT INTO mysql.plugin VALUES ('wacky', '$DAEMONEXAMPLE'); ---replace_regex /\.dll/.so/ -eval INSERT INTO mysql.plugin VALUES ('wonky', '$DAEMONEXAMPLE'); - ---echo # ---echo # Ensure the plugin is now loaded. ---echo # ---replace_regex /\.dll/.so/ -SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name; - ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---shutdown_server 10 ---source include/wait_until_disconnected.inc - -# -# Disable the plugin - to remove winky, wonky entries -# ---exec $MYSQL_PLUGIN_CMD DISABLE daemon_example - -# -# Enable the plugin again -# ---exec $MYSQL_PLUGIN_CMD ENABLE daemon_example - -# -# Restart the server -# ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---enable_reconnect ---source include/wait_until_connected_again.inc - ---echo # ---echo # Ensure the plugin is loaded. ---echo # ---replace_regex /\.dll/.so/ -SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name; - ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---shutdown_server 10 ---source include/wait_until_disconnected.inc - -# To test the case where the same plugin is reloaded with a different soname, -# we must copy the example daemon to a new location renaming it. - -let $DAEMON_RELOAD = lib$DAEMONEXAMPLE; ---copy_file $PLUGIN_DIR/$DAEMONEXAMPLE $PLUGIN_DIR/$DAEMON_RELOAD ---copy_file include/libdaemon_example.ini $PLUGIN_DIR/libdaemon_example.ini - -# Now reload it and see that it is a different name. ---exec $MYSQL_PLUGIN_CMD ENABLE libdaemon_example - -# -# Restart the server -# ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---enable_reconnect ---source include/wait_until_connected_again.inc - ---echo # ---echo # Ensure the plugin is replaced. ---echo # ---replace_regex /\.dll/.so/ -SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name; - ---echo # ---echo # Disable the plugin... ---echo # - ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---shutdown_server 10 ---source include/wait_until_disconnected.inc - -# -# Disable the plugin -# ---exec $MYSQL_PLUGIN_CMD DISABLE libdaemon_example - -# Remove files for last test case. - ---remove_file $PLUGIN_DIR/$DAEMON_RELOAD ---remove_file $DAEMONEXAMPLE_DIR/libdaemon_example.ini - -# -# Restart the server -# ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---enable_reconnect ---source include/wait_until_connected_again.inc - ---echo # ---echo # Ensure the plugin isn't loaded. ---echo # -SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name; - -# -# Stop the server for error conditions -# - ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---shutdown_server 10 ---source include/wait_until_disconnected.inc - ---echo # ---echo # Attempt to load non-existant plugin ---echo # ---error 1,2,256 ---exec $MYSQL_PLUGIN_CMD DISABLE NOT_THERE_AT_ALL 2>&1 - ---echo # ---echo # Attempt to use non-existant plugin.ini file ---echo # ---error 1,2,7,256 ---exec $MYSQL_PLUGIN_CMD DISABLE daemon_example --plugin-ini=/NOT/THERE/pi.ini 2>&1 - ---echo # ---echo # Attempt to omit the plugin ---echo # ---error 1,2,256 ---exec $MYSQL_PLUGIN_CMD DISABLE 2>&1 - ---echo # ---echo # Attempt to omit DISABLE|ENABLE ---echo # ---error 1,2,256 ---exec $MYSQL_PLUGIN_CMD daemon_example 2>&1 - ---echo # ---echo # Attempt to use bad paths - datadir ---echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=/data_not_there/ --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; ---error 1,2,256 ---exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 - ---echo # ---echo # Attempt to use bad paths - basedir ---echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=/basedir_not_there/ --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; -replace_result "/basedir_not_there//" "/basedir_not_there/"; ---error 1,2,256 ---exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 - ---echo # ---echo # Attempt to use bad paths - plugin_dir ---echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=/plugin_not_there/ --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; ---error 1,2,256 ---exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 - ---echo # ---echo # Attempt to use bad paths - mysqld ---echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=/mysqld_not_there/ --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; ---error 1,2,256 ---exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 - ---echo # ---echo # Attempt to use bad paths - my_print_defaults ---echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=/my_print_defaults_not_there/; ---error 1,2,256 ---exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 - - ---echo # ---echo # Missing library ---echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_soname.ini --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; ---error 1,2,256 ---exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 - ---echo # ---echo # Bad format for config file ---echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_format.ini --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; ---error 1,2,256 ---exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 - ---echo # ---echo # Missing base_dir option ---echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; ---error 1,2,139,256 ---exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 - ---echo # ---echo # Missing data_dir option ---echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; ---error 1,2,139,256 ---exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 - ---echo # ---echo # Missing plugin_dir option ---echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQL_DATADIR --basedir=$MYSQL_BASEDIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; ---error 1,2,139,256 ---exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 - ---echo # ---echo # Show the help. ---echo # -replace_result $MYSQL_PLUGIN mysql_plugin; ---replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ /XX-m[0-9]+/XX/ /XX[a-z]/XX/ ---exec $MYSQL_PLUGIN --help - -replace_result $MYSQL_PLUGIN mysql_plugin; ---replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ /XX-m[0-9]+/XX/ /XX[a-z]/XX/ ---exec $MYSQL_PLUGIN --version - -# -# Restart the server -# ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---enable_reconnect ---source include/wait_until_connected_again.inc - -# -# Cleanup - ---remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect - -# Cleanup the share folder in the binary path. ---remove_file $MYSQLD_BASEDIR/share/errmsg.sys ---rmdir $MYSQLD_BASEDIR/share/mysql ---rmdir $MYSQLD_BASEDIR/share - ---enable_abort_on_error diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 6d4e0e3f2b9..9f74f4ad9c0 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -2490,6 +2490,58 @@ DROP TABLE t2; DROP DATABASE db_20772273; USE test; +--echo # +--echo # Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY +--echo # + + +CREATE DATABASE bug25717383; +use bug25717383; + +CREATE TABLE `tab +one` (a int); +CREATE VIEW `view +one` as SELECT * FROM `tab +one`; + +CREATE PROCEDURE `proc +one`() SELECT * from `tab +one`; + +CREATE TEMPORARY TABLE `temp +one` (id INT); + +CREATE TRIGGER `trig +one` BEFORE INSERT ON `tab +one` FOR EACH ROW SET NEW.a = 1; + +CREATE EVENT `event +one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5; + +SHOW TABLES FROM bug25717383; +--replace_column 6 # +SHOW TRIGGERS FROM bug25717383; +--replace_column 6 # +SHOW EVENTS FROM bug25717383; + +SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES + WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE' + ORDER BY ROUTINE_NAME; + +--exec $MYSQL_DUMP --triggers --events --routines --add-drop-database --databases bug25717383 > $MYSQLTEST_VARDIR/tmp/bug25717383.sql + +SHOW TABLES FROM bug25717383; +--replace_column 6 # +SHOW TRIGGERS FROM bug25717383; +--replace_column 6 # +SHOW EVENTS FROM bug25717383; + +SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES + WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE' + ORDER BY ROUTINE_NAME; + +DROP DATABASE bug25717383; + # # MDEV-6091 mysqldump goes in a loop and segfaults if --dump-slave is specified and it cannot connect to the server # diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index b2706a8459f..2f1296560d0 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -406,7 +406,7 @@ select 3 from t1 ; --disable_abort_on_error ONCE garbage; --disable_abort_on_error ONCE ---remove_file DoesNotExist +--remove_file $MYSQLTEST_VARDIR/DoesNotExist --disable_result_log select 2; @@ -1939,8 +1939,6 @@ remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.result; remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.reject; --error 0,1 remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.log; ---error 0,1 -remove_file $MYSQL_TEST_DIR/r/zero_length_file.reject; --enable_warnings # @@ -2083,9 +2081,11 @@ drop table t1; --let $patt= /a /b / /less/more/ --replace_regex $patt select "a is a and less is more" as txt; +--replace_regex $patt /and /or / +select "a is a and less is more" as txt2; --let $patt= --replace_regex $patt -select "a is a and less is more" as txt; +select "a is a and less is more" as txt3; --enable_query_log # @@ -2193,7 +2193,7 @@ drop table t1; --exec echo "remove_file ;" | $MYSQL_TEST 2>&1 --error 1 -remove_file non_existing_file; +remove_file $MYSQLTEST_VARDIR/non_existing_file; --enable_warnings # ---------------------------------------------------------------------------- @@ -2204,10 +2204,10 @@ remove_file non_existing_file; --exec echo "remove_files_wildcard ;" | $MYSQL_TEST 2>&1 --error 1 -remove_files_wildcard non_existing_dir; +remove_files_wildcard $MYSQLTEST_VARDIR/non_existing_dir; --error 1 -remove_files_wildcard non_existing_dir non_existing_file; +remove_files_wildcard $MYSQLTEST_VARDIR/non_existing_dir non_existing_file; # ---------------------------------------------------------------------------- # test for write_file @@ -2216,7 +2216,7 @@ remove_files_wildcard non_existing_dir non_existing_file; --exec echo "write_file ;" | $MYSQL_TEST 2>&1 --error 1 ---exec echo "write_file filename ;" | $MYSQL_TEST 2>&1 +--exec echo "write_file $MYSQLTEST_VARDIR/filename ;" | $MYSQL_TEST 2>&1 # Comment out this test as it confuses cmd.exe with unmatched " #--error 1 @@ -2462,19 +2462,19 @@ remove_file $MYSQLTEST_VARDIR/tmp/file1.tmp; --exec echo "chmod ;" | $MYSQL_TEST 2>&1 --error 1 ---exec echo "chmod 0 from_file;" | $MYSQL_TEST 2>&1 +--exec echo "chmod 0 $MYSQLTEST_VARDIR/from_file;" | $MYSQL_TEST 2>&1 --error 1 ---exec echo "chmod 08 from_file;" | $MYSQL_TEST 2>&1 +--exec echo "chmod 08 $MYSQLTEST_VARDIR/from_file;" | $MYSQL_TEST 2>&1 --error 1 ---exec echo "chmod from_file;" | $MYSQL_TEST 2>&1 +--exec echo "chmod $MYSQLTEST_VARDIR/from_file;" | $MYSQL_TEST 2>&1 --error 1 ---exec echo "chmod ABZD from_file;" | $MYSQL_TEST 2>&1 +--exec echo "chmod ABZD $MYSQLTEST_VARDIR/from_file;" | $MYSQL_TEST 2>&1 --error 1 ---exec echo "chmod 06789 from_file;" | $MYSQL_TEST 2>&1 +--exec echo "chmod 06789 $MYSQLTEST_VARDIR/from_file;" | $MYSQL_TEST 2>&1 # ---------------------------------------------------------------------------- @@ -2875,8 +2875,6 @@ list_files_append_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt $MYSQLTEST_VARDIR list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt $MYSQLTEST_VARDIR/tmp/testdir file?.txt; list_files_append_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt $MYSQLTEST_VARDIR/tmp/testdir file*.txt; diff_files $MYSQLTEST_VARDIR/tmp/testdir/file2.txt $MYSQLTEST_VARDIR/tmp/testdir/file3.txt; ---error 1 -rmdir $MYSQLTEST_VARDIR/tmp/testdir; cat_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt; diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 8e2d9133359..35bb7aca085 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -225,7 +225,7 @@ DROP TABLE t1; # Common ciphers to openssl and yassl --exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES256-SHA ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=DES-CBC3-SHA +--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES128-SHA --disable_query_log --disable_result_log diff --git a/mysql-test/t/openssl_6975.test b/mysql-test/t/openssl_6975.test index 6e8e03a0a89..6a82d013fb6 100644 --- a/mysql-test/t/openssl_6975.test +++ b/mysql-test/t/openssl_6975.test @@ -4,11 +4,13 @@ # test SSLv3 and TLSv1.2 ciphers when OpenSSL is restricted to SSLv3 or TLSv1.2 # source include/have_ssl_communication.inc; +source include/require_openssl_client.inc; # this is OpenSSL test. create user ssl_sslv3@localhost; -grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA"; +# grant select on test.* to ssl_sslv3@localhost require cipher "AES128-SHA"; +grant select on test.* to ssl_sslv3@localhost require cipher "AES128-SHA"; create user ssl_tls12@localhost; grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256"; @@ -17,9 +19,9 @@ let $mysql=$MYSQL --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$ disable_abort_on_error; echo TLS1.2 ciphers: user is ok with any cipher; exec $mysql --ssl-cipher=AES128-SHA256; ---replace_result DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-GCM-SHA384 +--replace_result DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-GCM-SHA384 ECDHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-GCM-SHA384 exec $mysql --ssl-cipher=TLSv1.2; -echo TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA; +echo TLS1.2 ciphers: user requires SSLv3 cipher AES128-SHA; exec $mysql --user ssl_sslv3 --ssl-cipher=AES128-SHA256; exec $mysql --user ssl_sslv3 --ssl-cipher=TLSv1.2; echo TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256; @@ -27,13 +29,13 @@ exec $mysql --user ssl_tls12 --ssl-cipher=AES128-SHA256; exec $mysql --user ssl_tls12 --ssl-cipher=TLSv1.2; echo SSLv3 ciphers: user is ok with any cipher; -exec $mysql --ssl-cipher=RC4-SHA; +exec $mysql --ssl-cipher=AES256-SHA; exec $mysql --ssl-cipher=SSLv3; -echo SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA; -exec $mysql --user ssl_sslv3 --ssl-cipher=RC4-SHA; +echo SSLv3 ciphers: user requires SSLv3 cipher AES128-SHA; +exec $mysql --user ssl_sslv3 --ssl-cipher=AES128-SHA; exec $mysql --user ssl_sslv3 --ssl-cipher=SSLv3; echo SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256; -exec $mysql --user ssl_tls12 --ssl-cipher=RC4-SHA; +exec $mysql --user ssl_tls12 --ssl-cipher=AES128-SHA; exec $mysql --user ssl_tls12 --ssl-cipher=SSLv3; drop user ssl_sslv3@localhost; diff --git a/mysql-test/t/query_cache_innodb.test b/mysql-test/t/query_cache_innodb.test new file mode 100644 index 00000000000..ba62ec36c16 --- /dev/null +++ b/mysql-test/t/query_cache_innodb.test @@ -0,0 +1,85 @@ +--source include/have_innodb.inc +--source include/have_query_cache.inc +--source include/not_embedded.inc + +--echo # +--echo # MDEV-12485: foreign key on delete cascade stale entries with +--echo # query cache enabled +--echo # + +SET NAMES utf8; +set global query_cache_type=1; +set global query_cache_size=1024*1024; +set query_cache_type=1; + +create table t1 ( id int unsigned auto_increment, primary key(id) ) engine=innodb; + +create table t2 ( t2id int unsigned, id int unsigned, primary key(t2id, id), foreign key (`id`) references t1(`id`) on delete cascade ) engine=innodb; + +insert into t1 values (1); +insert into t2 values (1,1); +select * from t2; +show status like "Qcache_queries_in_cache"; + +delete from t1; +show status like "Qcache_queries_in_cache"; +select * from t2; + +optimize table t2; +select * from t2; +drop table t2; +drop table t1; + +create database `testdatabase$ї`; +use `testdatabase$ї`; +create table `t1$ї` ( id int unsigned auto_increment, primary key(id) ) engine=innodb; + +create table `t2$ї` ( t2id int unsigned, id int unsigned, primary key(t2id, id), foreign key (`id`) references `t1$ї`(`id`) on delete cascade ) engine=innodb; + +insert into `t1$ї` values (1); +insert into `t2$ї`values (1,1); +select * from `t2$ї`; +show status like "Qcache_queries_in_cache"; + +delete from `t1$ї`; +show status like "Qcache_queries_in_cache"; +select * from `t2$ї`; + +optimize table `t2$ї`; +select * from `t2$ї`; + +use test; +drop database `testdatabase$ї`; +SET NAMES default; + +create database `#mysql50#-`; +use `#mysql50#-`; +create table `#mysql50#t-1` ( id int unsigned auto_increment, primary key(id) ) engine=innodb; + +create table `#mysql50#t-2` ( t2id int unsigned, id int unsigned, primary key(t2id, id), foreign key (`id`) references `#mysql50#t-1`(`id`) on delete cascade ) engine=innodb; + +insert into `#mysql50#t-1` values (1); +insert into `#mysql50#t-2`values (1,1); +select * from `#mysql50#t-2`; +show status like "Qcache_queries_in_cache"; + +delete from `#mysql50#t-1`; +show status like "Qcache_queries_in_cache"; +select * from `#mysql50#t-2`; + +optimize table `#mysql50#t-2`; +select * from `#mysql50#t-2`; + +use test; +drop database `#mysql50#-`; +SET NAMES default; +--disable_query_log +call mtr.add_suppression("\\[ERROR\\] Invalid \\(old\\?\\) table or database name 't?-[12]?\\'"); +--enable_query_log +--let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let SEARCH_PATTERN=\\[ERROR\\] Invalid \\(old\\?\\) table or database name +--source include/search_pattern_in_file.inc + +set global query_cache_type=DEFAULT; +set global query_cache_size=DEFAULT; +--echo End of 10.2 tests diff --git a/mysql-test/t/ssl_7937.combinations b/mysql-test/t/ssl_7937.combinations index 46a45686a9b..71b134e229a 100644 --- a/mysql-test/t/ssl_7937.combinations +++ b/mysql-test/t/ssl_7937.combinations @@ -1,3 +1,8 @@ +[x509v3] +--loose-enable-ssl +--loose-ssl-cert=$MYSQL_TEST_DIR/std_data/serversan-cert.pem +--loose-ssl-key=$MYSQL_TEST_DIR/std_data/serversan-key.pem + [ssl] --loose-enable-ssl diff --git a/mysql-test/t/ssl_7937.test b/mysql-test/t/ssl_7937.test index 8e9d1901907..aa8cd225d7b 100644 --- a/mysql-test/t/ssl_7937.test +++ b/mysql-test/t/ssl_7937.test @@ -26,7 +26,7 @@ create procedure have_ssl() # we fake the test result for yassl let yassl=`select variable_value='Unknown' from information_schema.session_status where variable_name='Ssl_session_cache_mode'`; if (!$yassl) { - --replace_result "self signed certificate in certificate chain" "Failed to verify the server certificate" + --replace_result "self signed certificate in certificate chain" "Failed to verify the server certificate" "Error in the certificate." "Failed to verify the server certificate" --exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1 } if ($yassl) { diff --git a/mysql-test/t/ssl_8k_key.test b/mysql-test/t/ssl_8k_key.test index 23267a3c611..edfead46658 100644 --- a/mysql-test/t/ssl_8k_key.test +++ b/mysql-test/t/ssl_8k_key.test @@ -1,5 +1,5 @@ -# This test should work in embedded server after we fix mysqltest --- source include/not_embedded.inc +# schannel does not support keys longer than 4k +-- source include/not_windows.inc -- source include/have_ssl_communication.inc # diff --git a/mysql-test/t/stat_tables_par.test b/mysql-test/t/stat_tables_par.test index 1866eb71d3b..9d4038911ff 100644 --- a/mysql-test/t/stat_tables_par.test +++ b/mysql-test/t/stat_tables_par.test @@ -209,7 +209,7 @@ connect (con2, localhost, root,,); connection con1; set debug_sync='statistics_update_start SIGNAL parker WAIT_FOR go1 EXECUTE 1'; -set debug_sync='thr_multi_lock_after_thr_lock SIGNAL go2 EXECUTE 2'; +set debug_sync='thr_multi_lock_before_thr_lock SIGNAL go2 EXECUTE 3'; use dbt3_s001; --send analyze table lineitem persistent for all diff --git a/mysql-test/t/subselect_exists2in.test b/mysql-test/t/subselect_exists2in.test index 9450ef71494..a4fdbe5c50b 100644 --- a/mysql-test/t/subselect_exists2in.test +++ b/mysql-test/t/subselect_exists2in.test @@ -758,6 +758,34 @@ deallocate prepare stmt; drop view v1; drop table t1,t2; +--echo # +--echo #MDEV-10053: EXIST to IN transformation turned down +--echo # + +CREATE TABLE t1 ( + pk INT, f1 INT NOT NULL, f2 VARCHAR(3), f3 INT NULL, PRIMARY KEY(pk)) +ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,1,'foo',8), (2,5,'bar',7); + +let $q= +SELECT STRAIGHT_JOIN sq1.f2 + FROM ( SELECT * FROM t1 ) AS sq1 + WHERE EXISTS ( SELECT * FROM t1 AS sq2 + WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 ); + +set @optimizer_switch_save=@@optimizer_switch; + +set optimizer_switch='exists_to_in=off'; +eval explain extended $q; +eval $q; +set optimizer_switch='exists_to_in=on'; +eval explain extended $q; +eval $q; + +set optimizer_switch= @optimizer_switch_save; + +DROP TABLE t1; + --echo # End of 10.0 tests #restore defaults diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test index b26c5036f3f..2451bc60fee 100644 --- a/mysql-test/t/subselect_innodb.test +++ b/mysql-test/t/subselect_innodb.test @@ -503,6 +503,27 @@ drop view v1; drop table t1,t2; --echo # +--echo # MDEV-10693: cost-based choice between materialization and in-to-exists +--echo # for a subquery from the expression used in ref access +--echo # + +--source include/have_innodb.inc + +CREATE TABLE t1 (i1 INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (i2 INT) ENGINE=InnoDB; + +CREATE TABLE t3 (i3 INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t3 VALUES (3); + +SELECT * FROM t1 + WHERE NULL IN ( SELECT i2 FROM t2 + WHERE i1 IN ( i2 IN ( SELECT i3 FROM t3 ) ) AND i2 = 2 ); + +DROP TABLE t1,t2,t3; + +--echo # --echo # MDEV-6041: ORDER BY+subqueries: subquery_table.key=outer_table.col is not recongized as binding --echo # create table t1(a int) engine=innodb; diff --git a/mysql-test/t/subselect_mat_cost_bugs.test b/mysql-test/t/subselect_mat_cost_bugs.test index 8205e94b203..316ac707bef 100644 --- a/mysql-test/t/subselect_mat_cost_bugs.test +++ b/mysql-test/t/subselect_mat_cost_bugs.test @@ -424,3 +424,42 @@ explain select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2); select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2); drop table t1, t2; + +--echo # +--echo # MDEV-12673: cost-based choice between materialization and in-to-exists +--echo # + +CREATE TABLE t1 ( + pk1 int, a1 varchar(3), b1 varchar(3), PRIMARY KEY (pk1), KEY(a1), KEY(b1) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,'foo','bar'),(2,'bar','foo'); + +CREATE TABLE t2 (pk2 INT PRIMARY KEY, a2 VARCHAR(3), KEY(a2)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,'abc'),(2,'xyz'),(3,'foo'); + +SELECT 'qux' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ); +SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ); +EXPLAIN +SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i1 INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1); + +CREATE TABLE t2 (i2 int, c2 varchar(3), KEY(i2,c2)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,'abc'),(2,'foo'); + +CREATE TABLE t3 (pk3 int PRIMARY KEY, c3 varchar(3)) ENGINE=MyISAM; +INSERT INTO t3 VALUES (1,'foo'),(2,'bar'); + +SELECT * FROM t1 WHERE i1 NOT IN ( + SELECT i2 FROM t2 RIGHT JOIN t3 ON (c3 = c2) WHERE pk3 = i1 +); + +EXPLAIN +SELECT * FROM t1 WHERE i1 NOT IN ( + SELECT i2 FROM t2 RIGHT JOIN t3 ON (c3 = c2) WHERE pk3 = i1 +); + +DROP TABLE t1,t2,t3; diff --git a/mysql-test/t/subselect_sj_mat.test b/mysql-test/t/subselect_sj_mat.test index e20291cfa67..b3c603728ee 100644 --- a/mysql-test/t/subselect_sj_mat.test +++ b/mysql-test/t/subselect_sj_mat.test @@ -1857,6 +1857,99 @@ execute stmt; drop table t1; +--echo # +--echo # MDEV-12429: IN subquery used in WHERE of EXISTS subquery +--echo # + +CREATE TABLE t1 ( + pk INT, f1 INT NOT NULL, f2 VARCHAR(3), f3 INT NULL, PRIMARY KEY(pk)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,1,'foo',8), (2,5,'bar',7); + +SELECT sq1.f2 FROM t1 AS sq1 + WHERE EXISTS ( SELECT * FROM t1 AS sq2 + WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 ); + +set @save_optimizer_switch= @@optimizer_switch; + +set optimizer_switch='exists_to_in=off'; +EXPLAIN +SELECT sq1.f2 FROM t1 AS sq1 + WHERE EXISTS ( SELECT * FROM t1 AS sq2 + WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 ); + +--echo # this checks the result set above +set optimizer_switch= 'materialization=off,semijoin=off'; +SELECT sq1.f2 FROM t1 AS sq1 + WHERE EXISTS ( SELECT * FROM t1 AS sq2 + WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 ); + +set optimizer_switch= @save_optimizer_switch; + +DROP TABLE t1; + +--echo # +--echo # MDEV-12145: IN subquery used in WHERE of EXISTS subquery +--echo # + +CREATE TABLE t1 (f1 INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (4),(6); + +CREATE TABLE t2 (i2 INT, KEY(i2)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (8),(7),(1); + +CREATE TABLE t3 (f3 INT, i3 INT, KEY(i3)) ENGINE=MyISAM; +INSERT INTO t3 VALUES (8,0),(6,3),(2,8),(3,8),(1,6),(0,0),(1,0),(1,5); + +set @save_optimizer_switch= @@optimizer_switch; + +set optimizer_switch='exists_to_in=off'; +SELECT * FROM t1 + WHERE EXISTS ( SELECT * FROM t2, t3 + WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) ); +EXPLAIN EXTENDED +SELECT * FROM t1 + WHERE EXISTS ( SELECT * FROM t2, t3 + WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) ); + +--echo # this checks the result set above +set optimizer_switch= 'materialization=off,semijoin=off'; +SELECT * FROM t1 + WHERE EXISTS ( SELECT * FROM t2, t3 + WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) ); + +set optimizer_switch= @save_optimizer_switch; + +DROP TABLE t1,t2,t3; + +--echo # +--echo # MDEV-9686: IN subquery used in WHERE of a subquery from select list +--echo # + +CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT); +INSERT INTO t1 VALUES (1, 4),(2, 3),(3, 3),(4, 6),(5, 3); + +CREATE TABLE t2 (f2 INT); +INSERT INTO t2 VALUES (1),(2),(3),(4),(5); + +--echo # t1.pk is always IN ( SELECT f2 FROM t2 ), +--echo # so the IN condition should be true for every row, +--echo # and thus COUNT(*) should always return 5 + +SELECT pk, f1, ( SELECT COUNT(*) FROM t2 + WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1; +EXPLAIN EXTENDED +SELECT pk, f1, ( SELECT COUNT(*) FROM t2 + WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1; + +--echo # this checks the result set above +set @save_optimizer_switch= @@optimizer_switch; +set optimizer_switch= 'materialization=off,semijoin=off'; +SELECT pk, f1, ( SELECT COUNT(*) FROM t2 + WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1; +set optimizer_switch= @save_optimizer_switch; + +DROP TABLE t1,t2; + --echo # End of 5.5 tests --echo # --echo # MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index 065be302237..e17ea07ca3c 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -300,3 +300,19 @@ select create_options from information_schema.tables where table_name='t1'; create table t2 like t1; show create table t2; drop tables t1, t2; + +--echo # +--echo # Test for bug #25514146 DB_NAME IS IGNORED WHEN CREATING TABLE +--echo # WITH DATA DIRECTORY +--echo # + +--echo # Make sure we have no current database +CREATE DATABASE x; +USE x; +DROP DATABASE x; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval CREATE TABLE test.t1(id INT(11)) ENGINE MYISAM +DATA DIRECTORY "$MYSQLTEST_VARDIR/tmp"; + +DROP TABLE test.t1; |