Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä 2019-09-06 17:16:40 +03:00
commit 4081b7b27a
750 changed files with 13510 additions and 14412 deletions

2
debian/rules vendored
View File

@ -157,7 +157,7 @@ override_dh_systemd_enable:
# Start mysql at sequence number 19 before 20 where apache, proftpd etc gets
# started which might depend on a running database server.
override_dh_installinit-arch:
dh_installinit --name=mysql -- defaults 19 21
#dh_installinit --name=mysql -- defaults 19 21
dh_systemd_start --restart-after-upgrade
override_dh_installcron-arch:

@ -1 +1 @@
Subproject commit 7de639518ffe56a99ac805654381d17f42796be2
Subproject commit 544b6f1d12f0e5b2a141129075ff2d64feb0e4c9

View File

@ -113,6 +113,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_analyze_stmt.cc ../sql/sql_analyze_stmt.h
../sql/compat56.cc
../sql/sql_type.cc ../sql/sql_type.h
../sql/sql_mode.cc
../sql/sql_type_json.cc
../sql/sql_type_geom.cc
../sql/table_cache.cc ../sql/mf_iocache_encr.cc

View File

@ -44,12 +44,13 @@ extern unsigned int mysql_server_last_errno;
extern char mysql_server_last_error[MYSQL_ERRMSG_SIZE];
static my_bool emb_read_query_result(MYSQL *mysql);
static void emb_free_embedded_thd(MYSQL *mysql);
static bool embedded_print_errors= 0;
extern "C" void unireg_clear(int exit_code)
{
DBUG_ENTER("unireg_clear");
clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */
embedded_print_errors= 0;
clean_up(!opt_help && !exit_code); /* purecov: inspected */
clean_up_mutexes();
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
DBUG_VOID_RETURN;
@ -520,7 +521,7 @@ int init_embedded_server(int argc, char **argv, char **groups)
my_bool acl_error;
DBUG_ASSERT(mysql_embedded_init == 0);
embedded_print_errors= 1;
if (my_thread_init())
return 1;
@ -1381,8 +1382,17 @@ int vprint_msg_to_log(enum loglevel level __attribute__((unused)),
const char *format, va_list argsi)
{
vsnprintf(mysql_server_last_error, sizeof(mysql_server_last_error),
format, argsi);
format, argsi);
mysql_server_last_errno= CR_UNKNOWN_ERROR;
if (embedded_print_errors && level == ERROR_LEVEL)
{
/* The following is for testing when someone removes the above test */
const char *tag= (level == ERROR_LEVEL ? "ERROR" :
level == WARNING_LEVEL ? "Warning" :
"Note");
fprintf(stderr,"Got %s: \"%s\" errno: %d\n",
tag, mysql_server_last_error, mysql_server_last_errno);
}
return 0;
}

View File

@ -2,6 +2,8 @@
--echo # mdev-539: fast build of unique/primary indexes for MyISAM/Aria
--echo #
--source include/default_charset.inc
call mtr.add_suppression("Can't find record in '.*'");
--disable_warnings
@ -62,6 +64,6 @@ insert into customer values
alter ignore table customer add primary key (c_custkey);
show create table customer;
select * from customer where c_custkey=3;
--source include/restore_charset.inc
DROP DATABASE dbt3_s001;

View File

@ -1537,8 +1537,10 @@ select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 25
# Test of left join.
#
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET @local_optimizer_switch=@@optimizer_switch;
set @local_join_cache_level=@@join_cache_level;
set @@join_cache_level=2;
set optimizer_switch='outer_join_with_cache=off,join_cache_hashed=off';
insert into t2 (fld1, companynr) values (999999,99);
@ -1572,7 +1574,7 @@ explain select companynr,companyname from t4 left join t2 using (companynr) wher
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0;
explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0;
SET optimizer_switch=@save_optimizer_switch;
SET @@optimizer_switch=@local_optimizer_switch;
#
# Joins with forms.
@ -1581,6 +1583,8 @@ SET optimizer_switch=@save_optimizer_switch;
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
SET @@join_cache_level=@local_join_cache_level;
#
# Search using 'or' with the same referens group.
# An interval search will be done first with the first table and after that

View File

@ -1,6 +1,7 @@
#
# Tests with the utf8mb4 character set
#
--source include/default_optimizer_switch.inc
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
@ -1244,7 +1245,9 @@ drop table t1;
#
SET CHARACTER SET utf8mb4;
--source include/default_charset.inc
SHOW VARIABLES LIKE 'character\_set\_%';
SET @@character_set_server=@save_character_set_server;
CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
USE crashtest;
eval CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8mb4 ENGINE $engine;

View File

@ -0,0 +1,15 @@
# This file sets the default character set that most test expects.
# In most cases the variables should match the community server defaults.
# The values should be changed if the default character set for the server
# changes and all tests have been updated to supported the new character set
# The purpose if this file is to allow users to change these defaults
# without having to update all tests.
--disable_query_log
SET @save_character_set_server= @@character_set_server;
SET @save_collation_server= @@collation_server;
set @@character_set_server="latin1";
set @@collation_server="latin1_swedish_ci";
--enable_query_log

View File

@ -0,0 +1,11 @@
# Define the order that mtr will save groups in the generated my.cnf files
# The --debug-gdb option is just here to force mtr to remember the group order
[mysqld]
#debug-gdb=
[mariadb]
#debug-gdb=
[embedded]
#debug-gdb=
[server]
#debug-gdb=

View File

@ -15,6 +15,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
# Use default setting for mysqld processes
!include default_group_order.cnf
!include default_mysqld.cnf
!include default_client.cnf

View File

@ -128,4 +128,3 @@ local-infile
# tables. Let's enable it in the [server] group, because this group
# is read after [mysqld] and [embedded]
loose-aria

View File

@ -0,0 +1,18 @@
# This file sets the default optimizer flags and optimizer variables that
# most test expects. In most cases the variables should match the community
# server defaults.
# The purpose if this file is to allow users to change these defaults
# without having to update all tests.
--disable_query_log
set @save_optimizer_switch=@@optimizer_switch;
set @save_join_cache_level=@@join_cache_level;
set optimizer_switch="index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on";
set optimizer_use_condition_selectivity=4;
set optimizer_search_depth=62;
set join_buffer_space_limit=2097152;
set join_cache_level=2;
set join_buffer_size=262144;
--enable_query_log

View File

@ -37,8 +37,13 @@
--source include/add_anonymous_users.inc
set @save_query_cache_size=@@global.query_cache_size;
set @save_sql_mode=@@global.sql_mode;
set @save_query_cache_type=@@global.query_cache_type;
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
#
--disable_warnings
drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
@ -208,10 +213,10 @@ flush privileges;
drop table test.t1,mysqltest.t1,mysqltest.t2;
drop database mysqltest;
set GLOBAL query_cache_size=default;
set GLOBAL query_cache_type=ON;
set LOCAL query_cache_type=ON;
--source include/delete_anonymous_users.inc
set GLOBAL sql_mode=default;
set GLOBAL query_cache_type=default;
set GLOBAL query_cache_size=@save_query_cache_size;
set GLOBAL sql_mode=@save_sql_mode;
set GLOBAL query_cache_type=@save_query_cache_type;

View File

@ -0,0 +1,6 @@
# Ensure that host_cache is enabled
if (`SELECT @@skip_name_resolve != "OFF"`)
{
skip No hostname_cache;
}

View File

@ -0,0 +1,13 @@
# This file sets the default character set that most test expects.
# In most cases the variables should match the community server defaults.
# The values should be changed if the default character set for the server
# changes and all tests have been updated to supported the new character set
# The purpose if this file is to allow users to change these defaults
# without having to update all tests.
--disable_query_log
SET @@character_set_server=@save_character_set_server;
SET @@collation_server=@save_collation_server;
--enable_query_log

View File

@ -1,5 +1,6 @@
drop table if exists t1,t2;
drop database if exists mysqltest;
set @save_max_allowed_packet=@@global.max_allowed_packet;
create table t1 (
col1 int not null auto_increment primary key,
col2 varchar(30) not null,
@ -1464,7 +1465,7 @@ disconnect con1;
connection default;
DROP TABLE t1, t2, t3;
SET SQL_MODE=default;
SET GLOBAL max_allowed_packet=default;
SET GLOBAL max_allowed_packet=@save_max_allowed_packet;
CREATE TABLE t1 (
id INT(11) NOT NULL,
x_param INT(11) DEFAULT NULL,

View File

@ -6,6 +6,7 @@
drop table if exists t1,t2;
drop database if exists mysqltest;
--enable_warnings
set @save_max_allowed_packet=@@global.max_allowed_packet;
create table t1 (
col1 int not null auto_increment primary key,
@ -1340,7 +1341,7 @@ SELECT LENGTH(my_t3_fld1) FROM t3;
DROP TABLE t1, t2, t3;
SET SQL_MODE=default;
SET GLOBAL max_allowed_packet=default;
SET GLOBAL max_allowed_packet=@save_max_allowed_packet;
#
# Test of ALTER TABLE IF [NOT] EXISTS

View File

@ -13,6 +13,8 @@
# before calling mi_state_info_write
#
--source include/default_optimizer_switch.inc
create table t1 (a bigint);
lock tables t1 write;
insert into t1 values(0);

View File

@ -5,6 +5,8 @@
drop table if exists t0,t1,t2,t3;
--enable_warnings
--source include/default_optimizer_switch.inc
create table t0 (a int);
INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

View File

@ -1,3 +1,4 @@
set join_cache_level=2;
drop table if exists t0,t1,t2,t3;
create table t0 (a int) engine=myisam;
INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

View File

@ -1,6 +1,10 @@
#
# Tests for "ANALYZE $statement" feature
#
# Fix that analyze delete with join doesn't add extra WHERE clause.
set join_cache_level=2;
--disable_warnings
drop table if exists t0,t1,t2,t3;
--enable_warnings

View File

@ -1,5 +1,6 @@
--source include/have_innodb.inc
--source include/default_optimizer_switch.inc
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

View File

@ -1,4 +1,4 @@
################################################################################
###############################################################################
# The test ensures that permission checks are applied correctly to
# ANALYZE INSERT/REPLACE/UPDATE/DELETE/SELECT (I/R/U/D/S further in the test)
# when it's executed on a table or on a view.
@ -18,7 +18,8 @@
# Search for 'MDEV' to find all of them.
################################################################################
-- source include/not_embedded.inc
--source include/not_embedded.inc
--source include/default_optimizer_switch.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
@ -44,6 +45,7 @@ INSERT INTO privtest_db.t2 VALUES (1,'foo'), (2,'bar'), (3,'qux');
GRANT SELECT ON privtest_db.t2 TO 'privtest'@'localhost';
connect(con1,localhost,privtest,,privtest_db);
--source include/default_optimizer_switch.inc
--echo
--echo #########################################################################

View File

@ -38,7 +38,7 @@ drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql;
#
# Bootstrap with a query larger than 2*thd->net.max_packet
# Bootstrap with a large thd->net.max_packet
#
--disable_query_log
create table t1 select 2 as a, concat(repeat('MySQL', @@max_allowed_packet/10), ';') as b;

View File

@ -2,6 +2,9 @@
--echo # Bug#13633383 63183: SMALL SORT_BUFFER_SIZE CRASH IN MERGE_BUFFERS
--echo #
# Avoid warnings from join_buffer
--source include/default_optimizer_switch.inc
CREATE TABLE t1 (
`a` int(11) DEFAULT NULL,
`col432` bit(8) DEFAULT NULL,

View File

@ -718,6 +718,7 @@ DROP TABLE t1;
#
# Bug #11765023: 57934: DOS POSSIBLE SINCE BINARY CASTING
# DOESN'T ADHERE TO MAX_ALLOWED_PACKET
set @save_max_allowed_packet=@@global.max_allowed_packet;
SET @@GLOBAL.max_allowed_packet=2048;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
@ -739,7 +740,7 @@ Warnings:
Warning 1301 Result of cast_as_char() was larger than max_allowed_packet (2048) - truncated
connection default;
disconnect newconn;
SET @@GLOBAL.max_allowed_packet=default;
SET @@GLOBAL.max_allowed_packet=@save_max_allowed_packet;
#
# Bug#13519724 63793: CRASH IN DTCOLLATION::SET(DTCOLLATION &SET)
#

View File

@ -393,6 +393,7 @@ DROP TABLE t1;
--echo # Bug #11765023: 57934: DOS POSSIBLE SINCE BINARY CASTING
--echo # DOESN'T ADHERE TO MAX_ALLOWED_PACKET
set @save_max_allowed_packet=@@global.max_allowed_packet;
SET @@GLOBAL.max_allowed_packet=2048;
# reconnect to make the new max packet size take effect
--connect (newconn, localhost, root,,)
@ -403,7 +404,7 @@ SELECT length(CONVERT(repeat('a',2048), CHAR(2049)));
connection default;
disconnect newconn;
SET @@GLOBAL.max_allowed_packet=default;
SET @@GLOBAL.max_allowed_packet=@save_max_allowed_packet;
--echo #
--echo # Bug#13519724 63793: CRASH IN DTCOLLATION::SET(DTCOLLATION &SET)

View File

@ -154,6 +154,7 @@ master-bin.000001 # Query # # use `test`; insert t1 values( NAME_CONST('a',4)+3)
master-bin.000001 # Query # # COMMIT
drop function fn|
drop table t1|
set @@sql_mode="STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION";
begin not atomic select @@sql_mode; end|
@@sql_mode
STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

View File

@ -145,6 +145,8 @@ drop table t1|
# MDEV-6606 Server crashes in String::append on selecting sql_mode inside anonymous block
# MDEV-6609 SQL inside an anonymous block is executed with wrong SQL_MODE
#
set @@sql_mode="STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION";
begin not atomic select @@sql_mode; end|
create table t1 (a int)|
select a from t1 having a > 1|

View File

@ -1354,8 +1354,10 @@ fld1 fld1
250503 250505
250504 250505
250505 250505
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET @local_optimizer_switch=@@optimizer_switch;
set @local_join_cache_level=@@join_cache_level;
set @@join_cache_level=2;
set optimizer_switch='outer_join_with_cache=off,join_cache_hashed=off';
insert into t2 (fld1, companynr) values (999999,99);
select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
companynr companyname
@ -1431,7 +1433,7 @@ explain select companynr,companyname from t4 left join t2 using (companynr) wher
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
SET optimizer_switch=@save_optimizer_switch;
SET @@optimizer_switch=@local_optimizer_switch;
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
companynr companynr
37 36
@ -1440,6 +1442,7 @@ explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join)
SET @@join_cache_level=@local_join_cache_level;
select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
fld1 companynr fld3 period
038008 37 reporters 1008

View File

@ -250,7 +250,7 @@ mysqltest_u1
root
# -- Resetting variables...
SET GLOBAL max_connections = 151;
SET GLOBAL max_connections = #max_connections#;
# -- Stopping Event Scheduler...
SET GLOBAL event_scheduler = OFF;

View File

@ -217,6 +217,7 @@ SELECT user FROM information_schema.processlist ORDER BY id;
--echo
--echo # -- Resetting variables...
--replace_result $saved_max_connections #max_connections#
--eval SET GLOBAL max_connections = $saved_max_connections
--echo

View File

@ -1,3 +1,5 @@
--source include/default_charset.inc
call mtr.add_suppression("table or database name 't-1'");
#
# Check some special create statements.

View File

@ -1,3 +1,5 @@
--source include/default_optimizer_switch.inc
create table t1 (a int, b varchar(32));
insert into t1 values
(4,'aaaa' ), (7,'bb'), (1,'ccc'), (4,'dd');

View File

@ -1,3 +1,5 @@
--source include/default_optimizer_switch.inc
create table t1 (a int, b varchar(32));
insert into t1 values
(4,'aaaa' ), (7,'bb'), (1,'ccc'), (4,'dd');

View File

@ -2504,6 +2504,8 @@ Warning 1977 Cannot convert 'ujis' character 0x8FABF8 to 'ucs2'
DROP TABLE IF EXISTS t1, t2;
DROP PROCEDURE IF EXISTS sp1;
set names ujis;
SET @save_character_set_server= @@character_set_server;
SET @save_character_set_database= @@character_set_database;
set character_set_database = ujis;
set character_set_server = ujis;
CREATE TABLE t1(c1 char(2)) default charset = ujis;
@ -2539,8 +2541,8 @@ Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'a'
Warning 1292 Truncated incorrect INTEGER value: 'a'
set names default;
set character_set_database=default;
set character_set_server=default;
set character_set_database=@save_character_set_server;
set character_set_server=@save_character_set_database;
End of 5.1 tests
#
# Start of 5.5 tests

View File

@ -1178,6 +1178,8 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
set names ujis;
SET @save_character_set_server= @@character_set_server;
SET @save_character_set_database= @@character_set_database;
set character_set_database = ujis;
set character_set_server = ujis;
@ -1219,8 +1221,8 @@ SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis);
set names default;
set character_set_database=default;
set character_set_server=default;
set character_set_database=@save_character_set_server;
set character_set_server=@save_character_set_database;
--echo End of 5.1 tests

View File

@ -1567,7 +1567,7 @@ SELECT space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second));
space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second))
NULL
Warnings:
Warning 1301 Result of space() was larger than max_allowed_packet (16777216) - truncated
Warning 1301 Result of space() was larger than max_allowed_packet (XXX) - truncated
#
# Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
#

View File

@ -765,9 +765,10 @@ DROP TABLE t1;
--echo # DATE_ADD/DATE_SUB WITH INTERVAL CRASHES IN GET_INTERVAL_VALUE()
--echo #
let $max_packet=`select @@max_allowed_packet`;
--replace_result $max_packet XXX
SELECT space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second));
--echo #
--echo # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
--echo #

View File

@ -1 +1 @@
--character-set-server=utf16,latin1
--character-set-server=utf16,latin1 --collation-server=utf16_general_ci

View File

@ -7,6 +7,8 @@ let collation=utf8_unicode_ci;
SET TIME_ZONE='+03:00';
--source include/have_innodb.inc
--source include/default_optimizer_switch.inc
--source include/default_charset.inc
--disable_warnings
drop table if exists t1,t2,t3,t4;

View File

@ -1850,6 +1850,7 @@ character_set_filesystem binary
character_set_results utf8mb4
character_set_server latin1
character_set_system utf8
SET @@character_set_server=@save_character_set_server;
CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
USE crashtest;
CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8mb4;

View File

@ -5,6 +5,7 @@
#
--source include/have_innodb.inc
--source include/default_optimizer_switch.inc
--disable_warnings
drop table if exists t1,t2;
@ -1187,7 +1188,9 @@ drop table t1;
#
SET CHARACTER SET utf8mb4;
--source include/default_charset.inc
SHOW VARIABLES LIKE 'character\_set\_%';
SET @@character_set_server=@save_character_set_server;
CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
USE crashtest;
CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8mb4;

View File

@ -1682,6 +1682,7 @@ character_set_filesystem binary
character_set_results utf8mb4
character_set_server latin1
character_set_system utf8
SET @@character_set_server=@save_character_set_server;
CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
USE crashtest;
CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8mb4 ENGINE heap;

View File

@ -1808,6 +1808,7 @@ character_set_filesystem binary
character_set_results utf8mb4
character_set_server latin1
character_set_system utf8
SET @@character_set_server=@save_character_set_server;
CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
USE crashtest;
CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8mb4 ENGINE InnoDB;

View File

@ -1815,6 +1815,7 @@ character_set_filesystem binary
character_set_results utf8mb4
character_set_server latin1
character_set_system utf8
SET @@character_set_server=@save_character_set_server;
CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
USE crashtest;
CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8mb4 ENGINE MyISAM;

View File

@ -1,3 +1,5 @@
--source include/default_optimizer_switch.inc
flush status;
show status like "%custom_aggregate%";
create table t2 (sal int(10));

View File

@ -3355,18 +3355,26 @@ a b
drop table t1;
set sql_mode=default;
create table t1 (a int default b, b int default 4, t text);
insert into t1 (b, t) values (5, '1 column is omitted');
insert into t1 values (default, 5, '2 column gets DEFAULT, keyword');
insert into t1 values (default(a), 5, '3 column gets DEFAULT(a), expression');
insert into t1 values (default(a)+0, 5, '4 also expression DEFAULT(0)+0');
insert into t1 values (b, 5, '5 the value of the DEFAULT(a), that is b');
insert t1 (b, t) values (5, '1 column is omitted');
insert t1 values (default, 5, '2 column gets DEFAULT, keyword');
insert t1 values (default(a), 5, '3 column gets DEFAULT(a), expression');
insert t1 values (default(a)+0, 5, '4 also expression DEFAULT(0)+0');
insert t1 values (b, 5, '5 the value of the DEFAULT(a), that is b');
insert t1 (t,b,a) values ('6 reversed, column gets DEFAULT, keyword', 5, default);
insert t1 (t,b,a) values ('7 reversed, column gets DEFAULT(a), expression', 5, default(a));
insert t1 (t,b,a) values ('8 reversed, also expression DEFAULT(0)+0', 5, default(a)+0);
insert t1 (t,b,a) values ('9 reversed, the value of the DEFAULT(a), that is b', 5, b);
select * from t1 order by t;
a b t
5 5 1 column is omitted
5 5 2 column gets DEFAULT, keyword
4 5 2 column gets DEFAULT, keyword
4 5 3 column gets DEFAULT(a), expression
4 5 4 also expression DEFAULT(0)+0
4 5 5 the value of the DEFAULT(a), that is b
5 5 6 reversed, column gets DEFAULT, keyword
5 5 7 reversed, column gets DEFAULT(a), expression
5 5 8 reversed, also expression DEFAULT(0)+0
5 5 9 reversed, the value of the DEFAULT(a), that is b
drop table t1;
create table t1 (col1 int default(-(default(col1))));
ERROR 01000: Expression for field `col1` is referring to uninitialized field `col1`

View File

@ -2073,11 +2073,16 @@ set sql_mode=default;
# MDEV-10201 Bad results for CREATE TABLE t1 (a INT DEFAULT b, b INT DEFAULT 4)
#
create table t1 (a int default b, b int default 4, t text);
insert into t1 (b, t) values (5, '1 column is omitted');
insert into t1 values (default, 5, '2 column gets DEFAULT, keyword');
insert into t1 values (default(a), 5, '3 column gets DEFAULT(a), expression');
insert into t1 values (default(a)+0, 5, '4 also expression DEFAULT(0)+0');
insert into t1 values (b, 5, '5 the value of the DEFAULT(a), that is b');
insert t1 (b, t) values (5, '1 column is omitted');
insert t1 values (default, 5, '2 column gets DEFAULT, keyword');
insert t1 values (default(a), 5, '3 column gets DEFAULT(a), expression');
insert t1 values (default(a)+0, 5, '4 also expression DEFAULT(0)+0');
insert t1 values (b, 5, '5 the value of the DEFAULT(a), that is b');
# and the same in a different order
insert t1 (t,b,a) values ('6 reversed, column gets DEFAULT, keyword', 5, default);
insert t1 (t,b,a) values ('7 reversed, column gets DEFAULT(a), expression', 5, default(a));
insert t1 (t,b,a) values ('8 reversed, also expression DEFAULT(0)+0', 5, default(a)+0);
insert t1 (t,b,a) values ('9 reversed, the value of the DEFAULT(a), that is b', 5, b);
select * from t1 order by t;
drop table t1;

View File

@ -1,3 +1,4 @@
drop table if exists t1,t2,t3;
set @save_derived_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
select * from (select 2 from DUAL) b;

View File

@ -1,4 +1,9 @@
# Initialize
--source include/default_optimizer_switch.inc
--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings
set @save_derived_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
@ -106,6 +111,7 @@ create user mysqltest_1;
create table t1 select 1 as a;
connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
connection con1;
--source include/default_optimizer_switch.inc
set optimizer_switch='derived_merge=off,derived_with_keys=off';
--error 1046
select 2 as a from (select * from t1) b;

View File

@ -1,3 +1,4 @@
set @@join_buffer_size=256*1024;
create table t1 (a int, b int, c int);
create table t2 (a int, b int, c int, d decimal);
insert into t1 values

View File

@ -1,4 +1,6 @@
--source include/default_optimizer_switch.inc
let $no_pushdown= set statement optimizer_switch='condition_pushdown_for_derived=off' for;
set @@join_buffer_size=256*1024;
create table t1 (a int, b int, c int);
create table t2 (a int, b int, c int, d decimal);

View File

@ -1,4 +1,5 @@
--source include/have_innodb.inc
--source include/default_optimizer_switch.inc
--echo #
--echo # MDEV-16917: do not use splitting for derived with join cache

View File

@ -2,6 +2,7 @@ drop table if exists t1,t2;
drop view if exists v1,v2,v3,v4;
set @exit_optimizer_switch=@@optimizer_switch;
set @exit_join_cache_level=@@join_cache_level;
set @exit_join_buffer_size=@@join_buffer_size;
set optimizer_switch='derived_merge=on,derived_with_keys=on';
set @save_optimizer_switch=@@optimizer_switch;
set join_cache_level=1;
@ -1995,8 +1996,8 @@ e
e
e
e
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_buffer_size = DEFAULT;
SET SESSION join_cache_level = @exit_join_cache_level;
SET SESSION join_buffer_size = @exit_join_buffer_size;
DROP VIEW v3;
DROP TABLE t1,t2,t3,t4,t5;
#
@ -2111,7 +2112,7 @@ a b
8 x
5 r
9 y
SET SESSION join_cache_level = default;
SET SESSION join_cache_level = @exit_join_cache_level;
SET optimizer_switch=@save_optimizer_switch;
DROP VIEW v2;
DROP TABLE t1,t2,t3;

View File

@ -1,3 +1,5 @@
--source include/default_optimizer_switch.inc
--disable_warnings
drop table if exists t1,t2;
drop view if exists v1,v2,v3,v4;
@ -5,6 +7,7 @@ drop view if exists v1,v2,v3,v4;
set @exit_optimizer_switch=@@optimizer_switch;
set @exit_join_cache_level=@@join_cache_level;
set @exit_join_buffer_size=@@join_buffer_size;
set optimizer_switch='derived_merge=on,derived_with_keys=on';
# The 'default' value within the scope of this test:
set @save_optimizer_switch=@@optimizer_switch;
@ -1077,8 +1080,8 @@ EXPLAIN
SELECT t2.d FROM t1,t2,v3 WHERE v3.e = t2.d AND v3.i < 3;
SELECT t2.d FROM t1,t2,v3 WHERE v3.e = t2.d AND v3.i < 3;
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_buffer_size = DEFAULT;
SET SESSION join_cache_level = @exit_join_cache_level;
SET SESSION join_buffer_size = @exit_join_buffer_size;
DROP VIEW v3;
DROP TABLE t1,t2,t3,t4,t5;
@ -1167,7 +1170,7 @@ SELECT * FROM t3
SELECT * FROM t3
WHERE t3.b <> ANY (SELECT t1.b FROM t1 LEFT JOIN v2 ON v2.a = t1.a);
SET SESSION join_cache_level = default;
SET SESSION join_cache_level = @exit_join_cache_level;
SET optimizer_switch=@save_optimizer_switch;

View File

@ -3,6 +3,7 @@
# Bug with group by and not used fields
#
--source include/default_optimizer_switch.inc
--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings

View File

@ -1483,7 +1483,7 @@ hex(column_create("1212", 2, 3, 3))
select hex(column_create("1212", 2, "адын", 1, 3, 3));
hex(column_create("1212", 2, "адын", 1, 3, 3))
0403000D000000000001001000050020003331323132D0B0D0B4D18BD0BD060402
set names default;
set names latin1;
# fetching column test (names)
set names utf8;
select column_get(column_create("адын", 1212), "адын" as int);
@ -1507,7 +1507,7 @@ NULL
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int);
column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int)
NULL
set names default;
set names latin1;
# column existance test (names)
set names utf8;
select column_exists(column_create("адын", 1212), "адын");
@ -1534,7 +1534,7 @@ column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4)
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4");
column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4")
0
set names default;
set names latin1;
# column changing test (names)
select hex(column_add(column_create(1, "AAA"), "b", "BBB"));
hex(column_add(column_create(1, "AAA"), "b", "BBB"))

View File

@ -2,6 +2,8 @@
# Dynamic column function test
#
--source include/default_charset.inc
--echo #
--echo # column create
--echo #
@ -674,7 +676,7 @@ select hex(column_create(1212, 2, "www", 3));
select hex(column_create("1212", 2, "www", 3));
select hex(column_create("1212", 2, 3, 3));
select hex(column_create("1212", 2, "адын", 1, 3, 3));
set names default;
set names latin1;
--echo # fetching column test (names)
set names utf8;
@ -685,7 +687,7 @@ select column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int);
set names default;
set names latin1;
--echo # column existance test (names)
set names utf8;
@ -697,7 +699,7 @@ select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3");
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3);
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4);
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4");
set names default;
set names latin1;
--echo # column changing test (names)
select hex(column_add(column_create(1, "AAA"), "b", "BBB"));

View File

@ -5,6 +5,7 @@
-- source include/not_embedded.inc
set sql_mode="";
--source include/default_charset.inc
call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted");

View File

@ -4,6 +4,7 @@
-- source include/not_embedded.inc
set sql_mode="";
--source include/default_charset.inc
--disable_warnings
drop database if exists events_test;

View File

@ -2,6 +2,7 @@ SET SQL_MODE="";
drop database if exists events_test;
drop database if exists mysqltest_db1;
drop database if exists mysqltest_db2;
set collation_server=latin1_swedish_ci;
create database events_test;
use events_test;
set @concurrent_insert= @@global.concurrent_insert;

View File

@ -139,6 +139,7 @@ drop database if exists events_test;
drop database if exists mysqltest_db1;
drop database if exists mysqltest_db2;
--enable_warnings
set collation_server=latin1_swedish_ci;
create database events_test;
use events_test;
# We use MyISAM tables and must avoid effects (visibility of changes might be

View File

@ -1,5 +1,7 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
--source include/default_charset.inc
CREATE DATABASE IF NOT EXISTS events_test;
use events_test;

View File

@ -1,3 +1,4 @@
set @save_long_query_time=@@long_query_time;
drop database if exists events_test;
create database if not exists events_test;
use events_test;
@ -68,5 +69,5 @@ user_host db sql_text
USER_HOST events_test select 'events_logs_test' as inside_event, sleep(1.5)
drop database events_test;
set global event_scheduler=off;
set @@global.long_query_time=default;
set @@session.long_query_time=default;
set @@global.long_query_time=@save_long_query_time;
set @@session.long_query_time=@save_long_query_time;

View File

@ -1,6 +1,7 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
set @save_long_query_time=@@long_query_time;
--disable_warnings
drop database if exists events_test;
--enable_warnings
@ -78,8 +79,8 @@ select user_host, db, sql_text from mysql.slow_log
drop database events_test;
set global event_scheduler=off;
set @@global.long_query_time=default;
set @@session.long_query_time=default;
set @@global.long_query_time=@save_long_query_time;
set @@session.long_query_time=@save_long_query_time;
#
# Safety

View File

@ -3,6 +3,7 @@
call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted");
let $collation_server=`select @@collation_server`;
#
# Test that when the server is restarted, it checks mysql.event table,
# and disables the scheduler if it's not up to date.
@ -92,6 +93,7 @@ set global event_scheduler=on;
select @@global.event_scheduler;
--sorted_result
--replace_column 6 # 9 # 10 #
--replace_result $collation_server latin1_swedish_ci
show events;
--echo Now let's restart the server again

View File

@ -1,3 +1,4 @@
set @@join_buffer_size=256*1024;
create table t1 (a int, b int) engine=MyISAM;
create table t2 (c int, d int) engine=MyISAM;
insert into t1 values (1,1),(2,2);

View File

@ -1,3 +1,7 @@
# For explain
--source include/default_optimizer_switch.inc
set @@join_buffer_size=256*1024;
create table t1 (a int, b int) engine=MyISAM;
create table t2 (c int, d int) engine=MyISAM;
insert into t1 values (1,1),(2,2);

View File

@ -1,6 +1,8 @@
#
# EXPLAIN FORMAT=JSON tests. These are tests developed for MariaDB.
#
--source include/default_optimizer_switch.inc
--disable_warnings
drop table if exists t0,t1,t2;
--enable_warnings

View File

@ -1,3 +1,4 @@
set @save_expire_logs_days=@@global.expire_logs_days;
flush logs;
set global expire_logs_days = 3;
show variables like 'log_bin%';
@ -10,9 +11,9 @@ log_bin_index
log_bin_trust_function_creators ON
show variables like 'relay_log%';
Variable_name Value
relay_log mysqld-relay-bin
relay_log_basename MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin
relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin.index
relay_log XXX-relay-bin
relay_log_basename MYSQLTEST_VARDIR/mysqld.1/data/XXX-relay-bin
relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/XXX-relay-bin.index
relay_log_info_file relay-log.info
relay_log_purge ON
relay_log_recovery OFF
@ -28,11 +29,11 @@ log_bin_index
log_bin_trust_function_creators ON
show variables like 'relay_log%';
Variable_name Value
relay_log mysqld-relay-bin
relay_log_basename MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin
relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin.index
relay_log XXX-relay-bin
relay_log_basename MYSQLTEST_VARDIR/mysqld.1/data/XXX-relay-bin
relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/XXX-relay-bin.index
relay_log_info_file relay-log.info
relay_log_purge ON
relay_log_recovery OFF
relay_log_space_limit 0
set global expire_logs_days = 0;
set global expire_logs_days=@save_expire_logs_days;

View File

@ -4,13 +4,16 @@
--source include/not_embedded.inc
set @save_expire_logs_days=@@global.expire_logs_days;
flush logs;
set global expire_logs_days = 3;
let $relay_prefix=`select concat(substring_index(@@relay_log,"-",1),"-")`;
show variables like 'log_bin%';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $relay_prefix XXX-
show variables like 'relay_log%';
flush logs;
show variables like 'log_bin%';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $relay_prefix XXX-
show variables like 'relay_log%';
set global expire_logs_days = 0;
set global expire_logs_days=@save_expire_logs_days;

View File

@ -1,3 +1,4 @@
set @save_max_allowed_packet=@@max_allowed_packet;
set global max_allowed_packet=1048576;
connect conn1,localhost,root,,;
connection conn1;
@ -81,7 +82,7 @@ Warning 1292 Truncated incorrect DOUBLE value: XXX
Warning 1292 Truncated incorrect DOUBLE value: XXX
disconnect newconn;
connection default;
set @@global.max_allowed_packet=default;
set @@global.max_allowed_packet=@save_max_allowed_packet;
create table t1(a blob);
insert into t1 values(NULL), (compress('a'));
select uncompress(a), uncompressed_length(a) from t1;
@ -163,7 +164,7 @@ Warnings:
Warning 1259 ZLIB: Input data corrupted
disconnect conn1;
connection default;
set global max_allowed_packet=default;
set global max_allowed_packet=@save_max_allowed_packet;
#
# End of 5.5 tests
#

View File

@ -5,6 +5,7 @@
# Note that this test gives error in the gzip library when running under
# valgrind, but these warnings can be ignored
set @save_max_allowed_packet=@@max_allowed_packet;
set global max_allowed_packet=1048576;
connect (conn1,localhost,root,,);
connection conn1;
@ -56,7 +57,7 @@ eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is n
disconnect newconn;
--source include/wait_until_disconnected.inc
connection default;
set @@global.max_allowed_packet=default;
set @@global.max_allowed_packet=@save_max_allowed_packet;
#
# Bug #18643: problem with null values
@ -116,7 +117,7 @@ DROP TABLE t1;
--echo End of 5.0 tests
--disable_result_log
--disable_query_log
set @@global.max_allowed_packet=default;
set @@global.max_allowed_packet=@save_max_allowed_packet;
--enable_result_log
--enable_query_log
@ -148,7 +149,7 @@ SELECT UNCOMPRESS(CAST(0 AS BINARY(5)));
disconnect conn1;
connection default;
set global max_allowed_packet=default;
set global max_allowed_packet=@save_max_allowed_packet;
--echo #
--echo # End of 5.5 tests
--echo #

View File

@ -1,6 +1,7 @@
#
# test of ISNULL()
#
--source include/default_optimizer_switch.inc
--disable_warnings
drop table if exists t1;

View File

@ -619,6 +619,8 @@ JSON_search( '{"x": "\\""}', "one", '"')
SELECT JSON_search( '{"x": "\\""}', "one", '\\"');
JSON_search( '{"x": "\\""}', "one", '\\"')
"$.x"
set @save_max_allowed_packet=@@max_allowed_packet;
set @save_net_buffer_length=@@net_buffer_length;
set @@global.net_buffer_length=1024;
set @@global.max_allowed_packet=2048;
connect newconn, localhost, root,,;
@ -639,8 +641,8 @@ NULL
Warnings:
Warning 1301 Result of json_object() was larger than max_allowed_packet (2048) - truncated
connection default;
set @@global.max_allowed_packet = default;
set @@global.net_buffer_length = default;
set @@global.max_allowed_packet = @save_max_allowed_packet;
set @@global.net_buffer_length = @save_net_buffer_length;
disconnect newconn;
create table t1(j longtext, p longtext);
insert into t1 values

View File

@ -265,6 +265,9 @@ SELECT JSON_search( '{"x": "\\""}', "one", '\\"');
#
# MDEV-11833 JSON functions don't seem to respect max_allowed_packet.
#
set @save_max_allowed_packet=@@max_allowed_packet;
set @save_net_buffer_length=@@net_buffer_length;
set @@global.net_buffer_length=1024;
set @@global.max_allowed_packet=2048;
--connect (newconn, localhost, root,,)
@ -275,8 +278,8 @@ select json_array(repeat('a',1024),repeat('a',1024));
select json_object("a", repeat('a',1024),"b", repeat('a',1024));
--connection default
set @@global.max_allowed_packet = default;
set @@global.net_buffer_length = default;
set @@global.max_allowed_packet = @save_max_allowed_packet;
set @@global.net_buffer_length = @save_net_buffer_length;
--disconnect newconn

View File

@ -296,7 +296,7 @@ format(t2.f2-t2.f1+1,0)
10,000
10,000
drop table t1, t2;
set names default;
set names latin1;
select cast(-2 as unsigned), 18446744073709551614, -2;
cast(-2 as unsigned) 18446744073709551614 -2
18446744073709551614 18446744073709551614 -2

View File

@ -2,6 +2,8 @@
# Test of math functions
#
--source include/default_charset.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
@ -193,7 +195,7 @@ insert into t2 values (16777216,16787215,1),(33554432,33564431,2);
select format(t2.f2-t2.f1+1,0) from t1,t2
where t1.f2 = t2.f3 order by t1.f1;
drop table t1, t2;
set names default;
set names latin1;
# Bug 24912 -- misc functions have trouble with unsigned

View File

@ -2,6 +2,7 @@
# Testing of misc functions
#
--source include/default_optimizer_switch.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings

View File

@ -1,4 +1,5 @@
drop table if exists t1,t2;
set @save_max_allowed_packet=@@global.max_allowed_packet;
set global max_allowed_packet=1048576;
connect conn1,localhost,root,,;
connection conn1;
@ -4800,7 +4801,7 @@ COLLATION(space(2))
latin2_general_ci
disconnect conn1;
connection default;
set global max_allowed_packet=default;
set global max_allowed_packet=@save_max_allowed_packet;
#
# End of 5.6 tests
#

View File

@ -6,6 +6,7 @@
drop table if exists t1,t2;
--enable_warnings
set @save_max_allowed_packet=@@global.max_allowed_packet;
set global max_allowed_packet=1048576;
connect (conn1,localhost,root,,);
connection conn1;
@ -1848,7 +1849,7 @@ EXECUTE stmt;
disconnect conn1;
connection default;
set global max_allowed_packet=default;
set global max_allowed_packet=@save_max_allowed_packet;
--echo #
--echo # End of 5.6 tests

View File

@ -1,4 +1,5 @@
drop table if exists t1;
set @save_max_allowed_packet=@@max_allowed_packet;
set global max_allowed_packet=1048576;
connect conn1,localhost,root,,;
connection conn1;
@ -95,7 +96,7 @@ Warning 1301 Result of cast_as_binary() was larger than max_allowed_packet (1048
Warning 1301 Result of weight_string() was larger than max_allowed_packet (1048576) - truncated
disconnect conn1;
connection default;
set global max_allowed_packet=default;
set global max_allowed_packet=@save_max_allowed_packet;
#
# Start of 10.1 tests
#

View File

@ -2,7 +2,7 @@
drop table if exists t1;
--enable_warnings
set @save_max_allowed_packet=@@max_allowed_packet;
set global max_allowed_packet=1048576;
connect (conn1,localhost,root,,);
connection conn1;
@ -118,7 +118,7 @@ SELECT HEX(WEIGHT_STRING('ab' AS BINARY(1000000000000000000)));
disconnect conn1;
connection default;
set global max_allowed_packet=default;
set global max_allowed_packet=@save_max_allowed_packet;
--echo #
--echo # Start of 10.1 tests

View File

@ -3093,3 +3093,55 @@ a b
1999-12-01 11:22:33.000000 1999-12-01 11:22:33.000000
2001-09-09 04:46:40.000000 2001-09-09 04:46:40.000000
DROP TABLE t1;
create table t1 (t timestamp, i int, v timestamp as (t) virtual, key(v));
insert t1 (t,i) values ('2006-03-01 23:59:59',1);
update t1 set i = 2;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
create table t1 (t timestamp, i int);
create trigger tr1 before update on t1 for each row set @new:=new.t;
insert t1 (t,i) values ('2006-03-01 23:59:59', 1);
update t1 set i = 2;
select if(@new = t, 'correct', 'wrong') from t1;
if(@new = t, 'correct', 'wrong')
correct
drop table t1;
create table t1 (i int, j int as (i));
create trigger tr1 before update on t1 for each row set @new:=new.j;
insert t1 (i) values (1);
update t1, t1 as t2 set t1.i = 2;
select if(@new = j, 'correct', 'wrong') from t1;
if(@new = j, 'correct', 'wrong')
correct
drop table t1;
create table t1 (a int, b varchar(20) default 'foo');
insert t1 values (1,'bla'),(2, 'bar');
select * from t1;
a b
1 bla
2 bar
update t1 set b=default where a=1;
select * from t1;
a b
1 foo
2 bar
drop table t1;
create table t1 (
a int,
b timestamp default '2010-10-10 10:10:10' on update now(),
c varchar(100) default 'x');
insert t1 (a) values (1),(2);
select * from t1;
a b c
1 2010-10-10 10:10:10 x
2 2010-10-10 10:10:10 x
set timestamp=unix_timestamp('2011-11-11 11-11-11');
update t1 set b=default, c=default(b) where a=1;
select * from t1;
a b c
1 2010-10-10 10:10:10 2010-10-10 10:10:10
2 2010-10-10 10:10:10 x
drop table t1;
set timestamp=default;

View File

@ -19,3 +19,51 @@ let $now=NOW(6);
let $timestamp=TIMESTAMP(6);
let $datetime=DATETIME(6);
source 'include/function_defaults.inc';
#
# MDEV-20403 Assertion `0' or Assertion `btr_validate_index(index, 0)' failed in row_upd_sec_index_entry or error code 126: Index is corrupted upon UPDATE with TIMESTAMP..ON UPDATE
#
# ON UPDATE NOW and indexed virtual columns
create table t1 (t timestamp, i int, v timestamp as (t) virtual, key(v));
insert t1 (t,i) values ('2006-03-01 23:59:59',1);
update t1 set i = 2;
check table t1;
drop table t1;
# ON UPDATE NOW and triggers
create table t1 (t timestamp, i int);
create trigger tr1 before update on t1 for each row set @new:=new.t;
insert t1 (t,i) values ('2006-03-01 23:59:59', 1);
update t1 set i = 2;
select if(@new = t, 'correct', 'wrong') from t1;
drop table t1;
# triggers, virtual columns, multi-update
create table t1 (i int, j int as (i));
create trigger tr1 before update on t1 for each row set @new:=new.j;
insert t1 (i) values (1);
update t1, t1 as t2 set t1.i = 2;
select if(@new = j, 'correct', 'wrong') from t1;
drop table t1;
# SET xxx=DEFAULT
create table t1 (a int, b varchar(20) default 'foo');
insert t1 values (1,'bla'),(2, 'bar');
select * from t1;
update t1 set b=default where a=1;
select * from t1;
drop table t1;
# ON UPDATE NOW and SET xxx=DEFAULT
create table t1 (
a int,
b timestamp default '2010-10-10 10:10:10' on update now(),
c varchar(100) default 'x');
insert t1 (a) values (1),(2);
select * from t1;
set timestamp=unix_timestamp('2011-11-11 11-11-11');
update t1 set b=default, c=default(b) where a=1;
select * from t1;
drop table t1;
set timestamp=default;

View File

@ -0,0 +1 @@
--disable-skip-name-resolve --character_set_server=latin1 --collation_server=latin1_swedish_ci

View File

@ -0,0 +1 @@
--disable-skip-name-resolve --character_set_server=latin1 --collation_server=latin1_swedish_ci

View File

@ -0,0 +1 @@
--disable-skip-name-resolve --character_set_server=latin1 --collation_server=latin1_swedish_ci

View File

@ -1,3 +1,6 @@
set @save_query_cache_size=@@global.query_cache_size;
set @save_sql_mode=@@global.sql_mode;
set @save_query_cache_type=@@global.query_cache_type;
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
@ -242,8 +245,8 @@ delete from mysql.columns_priv where user in ("mysqltest_1","mysqltest_2","mysql
flush privileges;
drop table test.t1,mysqltest.t1,mysqltest.t2;
drop database mysqltest;
set GLOBAL query_cache_size=default;
set GLOBAL query_cache_type=ON;
set LOCAL query_cache_type=ON;
set GLOBAL sql_mode=default;
set GLOBAL query_cache_type=default;
set GLOBAL query_cache_size=@save_query_cache_size;
set GLOBAL sql_mode=@save_sql_mode;
set GLOBAL query_cache_type=@save_query_cache_type;

View File

@ -1,3 +1,6 @@
set @save_query_cache_size=@@global.query_cache_size;
set @save_sql_mode=@@global.sql_mode;
set @save_query_cache_type=@@global.query_cache_type;
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
@ -242,8 +245,8 @@ delete from mysql.columns_priv where user in ("mysqltest_1","mysqltest_2","mysql
flush privileges;
drop table test.t1,mysqltest.t1,mysqltest.t2;
drop database mysqltest;
set GLOBAL query_cache_size=default;
set GLOBAL query_cache_type=ON;
set LOCAL query_cache_type=ON;
set GLOBAL sql_mode=default;
set GLOBAL query_cache_type=default;
set GLOBAL query_cache_size=@save_query_cache_size;
set GLOBAL sql_mode=@save_sql_mode;
set GLOBAL query_cache_type=@save_query_cache_type;

View File

@ -7,6 +7,7 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--source include/default_optimizer_switch.inc
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
@ -22,6 +23,7 @@ GRANT SELECT ON privtest_db.t2 TO 'privtest'@'localhost';
connect(con1,localhost,privtest,,);
connection con1;
--source include/default_optimizer_switch.inc
USE privtest_db;

View File

@ -110,13 +110,7 @@ insert into t7 values (18,2,3,4,5,6);
insert into t7 values (19,2,3,4,5,6);
insert into t7 values (20,2,3,4,5,6);
insert into t7 values (21,2,3,4,5,6);
select @@optimizer_search_depth;
@@optimizer_search_depth
62
select @@optimizer_prune_level;
@@optimizer_prune_level
1
set optimizer_search_depth=63;
set optimizer_search_depth=63, optimizer_prune_level=1;
Warnings:
Warning 1292 Truncated incorrect optimizer_search_depth value: '63'
select @@optimizer_search_depth;

View File

@ -138,11 +138,6 @@ insert into t7 values (21,2,3,4,5,6);
# The actual test begins here
#
# Check the default values for the optimizer parameters
select @@optimizer_search_depth;
select @@optimizer_prune_level;
# This value swithes back to the old implementation of 'find_best()'
# set optimizer_search_depth=63; - old (independent of the optimizer_prune_level)
#
@ -170,7 +165,7 @@ select @@optimizer_prune_level;
# procedure 'find_best'. Notice that 'find_best' does not depend on the
# choice of heuristic.
set optimizer_search_depth=63;
set optimizer_search_depth=63, optimizer_prune_level=1;
select @@optimizer_search_depth;
# 6-table join, chain

View File

@ -523,6 +523,8 @@ NULL 9
b 1
drop table t1;
set big_tables=0;
SET @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity,@save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off',@@optimizer_use_condition_selectivity=4;
create table t1 (a int not null, b int not null);
insert into t1 values (1,1),(1,2),(3,1),(3,2),(2,2),(2,1);
create table t2 (a int not null, b int not null, key(a));
@ -535,10 +537,10 @@ a b
3 1
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
a b
1 3
1 1
3 1
1 3
2 2
3 1
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL a NULL NULL NULL 4 Using temporary; Using filesort
@ -548,6 +550,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL a NULL NULL NULL 4 Using temporary
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
drop table t1,t2;
SET @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity,@@optimizer_switch=@save_optimizer_switch;
create table t1 (a int, b int);
insert into t1 values (1, 4),(10, 40),(1, 4),(10, 43),(1, 4),(10, 41),(1, 4),(10, 43),(1, 4);
select a, MAX(b), INTERVAL (MAX(b), 1,3,10,30,39,40,50,60,100,1000) from t1 group by a;

View File

@ -400,15 +400,20 @@ set big_tables=0;
# Test of GROUP BY ... ORDER BY NULL optimization
#
SET @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity,@save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off',@@optimizer_use_condition_selectivity=4;
create table t1 (a int not null, b int not null);
insert into t1 values (1,1),(1,2),(3,1),(3,2),(2,2),(2,1);
create table t2 (a int not null, b int not null, key(a));
insert into t2 values (1,3),(3,1),(2,2),(1,1);
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
--sorted_result
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
drop table t1,t2;
SET @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity,@@optimizer_switch=@save_optimizer_switch;
#
# group function arguments in some functions

View File

@ -3,6 +3,8 @@
# The queries in this file test query execution via QUICK_GROUP_MIN_MAX_SELECT.
#
--source include/default_optimizer_switch.inc
#
# TODO:
# Add queries with:

View File

@ -0,0 +1 @@
--plugin-maturity=unknown

View File

@ -4,12 +4,7 @@ echo '##'
####################################################################
# Checking default value #
####################################################################
SELECT COUNT(@@GLOBAL.Host_Cache_Size)
1 Expected
set @Default_host_cache_size=279;
select @@global.Host_Cache_Size=@Default_host_cache_size;
@@global.Host_Cache_Size=@Default_host_cache_size
1
select @@global.Host_Cache_Size > 0
1 Expected
'#---------------------WL6372_VAR_6_02----------------------#'
# Restart server with Host_Cache_Size 1

View File

@ -31,13 +31,8 @@ echo '##'
####################################################################
# Checking default value #
####################################################################
SELECT COUNT(@@GLOBAL.Host_Cache_Size);
--echo 1 Expected
#set @Default_host_cache_size=(select if(if(@@global.max_connections<500,128+@@global.max_connections,128+@@global.max_connections+floor((@@global.max_connections-500)/20))>2000,2000,if(@@global.max_connections<500,128+@@global.max_connections,128+@@global.max_connections+floor((@@global.max_connections-500)/20))));
set @Default_host_cache_size=279;
select @@global.Host_Cache_Size=@Default_host_cache_size;
select @@global.Host_Cache_Size > 0;
--echo 1 Expected

Some files were not shown because too many files have changed in this diff Show More