summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in4
-rw-r--r--include/my_pthread.h3
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_id.test2
-rw-r--r--mysql-test/r/alter_table.result18
-rw-r--r--mysql-test/r/explain.result48
-rw-r--r--mysql-test/r/information_schema.result12
-rw-r--r--mysql-test/r/innodb_data_home_dir_basic.result10
-rw-r--r--mysql-test/r/innodb_flush_method_basic.result10
-rw-r--r--mysql-test/r/limit.result3
-rw-r--r--mysql-test/r/log_tables.result38
-rw-r--r--mysql-test/r/merge.result21
-rw-r--r--mysql-test/r/metadata.result17
-rw-r--r--mysql-test/r/order_by.result16
-rw-r--r--mysql-test/r/partition_not_windows.result4
-rw-r--r--mysql-test/r/partition_symlink.result4
-rw-r--r--mysql-test/r/partition_windows.result12
-rw-r--r--mysql-test/r/ps_11bugs.result28
-rw-r--r--mysql-test/r/show_check.result8
-rw-r--r--mysql-test/r/sp.result13
-rw-r--r--mysql-test/r/ssl_capath_basic.result10
-rw-r--r--mysql-test/r/ssl_cipher_basic.result10
-rw-r--r--mysql-test/r/subselect3.result16
-rw-r--r--mysql-test/r/symlink.result10
-rw-r--r--mysql-test/r/thread_cache_size_func.result42
-rw-r--r--mysql-test/r/variables.result2
-rw-r--r--mysql-test/r/windows.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_events.result6
-rw-r--r--mysql-test/suite/funcs_1/r/is_triggers.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_insert_id.result28
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_stop_middle.result26
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_stop_middle.test45
-rw-r--r--mysql-test/t/alter_table.test30
-rw-r--r--mysql-test/t/disabled.def1
-rw-r--r--mysql-test/t/explain.test29
-rw-r--r--mysql-test/t/information_schema.test8
-rw-r--r--mysql-test/t/limit.test8
-rw-r--r--mysql-test/t/log_tables.test51
-rw-r--r--mysql-test/t/merge.test25
-rw-r--r--mysql-test/t/metadata.test17
-rw-r--r--mysql-test/t/order_by.test20
-rw-r--r--mysql-test/t/ps_11bugs.test37
-rw-r--r--mysql-test/t/sp.test22
-rw-r--r--mysql-test/t/subselect3.test22
-rw-r--r--mysql-test/t/thread_cache_size_func.test148
-rwxr-xr-x[-rw-r--r--]mysql-test/t/windows.test1
-rw-r--r--mysql-test/valgrind.supp9
-rw-r--r--mysys/thr_mutex.c27
-rw-r--r--scripts/mysqldumpslow.sh2
-rwxr-xr-xsql/CMakeLists.txt14
-rw-r--r--sql/MSG00001.binbin0 -> 184 bytes
-rw-r--r--sql/Makefile.am6
-rw-r--r--sql/event_scheduler.cc13
-rw-r--r--sql/item.cc53
-rw-r--r--sql/item.h5
-rw-r--r--sql/item_func.cc396
-rw-r--r--sql/item_func.h37
-rw-r--r--sql/item_sum.cc37
-rw-r--r--sql/item_sum.h25
-rw-r--r--sql/log.cc2
-rw-r--r--sql/message.h55
-rw-r--r--sql/message.mc8
-rw-r--r--sql/message.rc2
-rw-r--r--sql/mysqld.cc22
-rw-r--r--sql/opt_range.cc4
-rw-r--r--sql/opt_sum.cc6
-rw-r--r--sql/partition_info.cc10
-rw-r--r--sql/set_var.cc113
-rw-r--r--sql/set_var.h1
-rw-r--r--sql/share/errmsg.txt12
-rw-r--r--sql/sql_base.cc18
-rw-r--r--sql/sql_class.cc2
-rw-r--r--sql/sql_error.cc8
-rw-r--r--sql/sql_insert.cc6
-rw-r--r--sql/sql_lex.cc11
-rw-r--r--sql/sql_parse.cc14
-rw-r--r--sql/sql_plugin.cc8
-rw-r--r--sql/sql_select.cc18
-rw-r--r--sql/sql_show.cc18
-rw-r--r--sql/sql_table.cc12
-rw-r--r--tests/mysql_client_test.c56
81 files changed, 1305 insertions, 639 deletions
diff --git a/configure.in b/configure.in
index 4c98b2b6dc8..0a20bbdc279 100644
--- a/configure.in
+++ b/configure.in
@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
#
# When changing major version number please also check switch statement
# in mysqlbinlog::check_master_version().
-AM_INIT_AUTOMAKE(mysql, 5.1.29)
+AM_INIT_AUTOMAKE(mysql, 5.1.30)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
@@ -2040,7 +2040,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \
pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
- pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
+ pthread_key_delete pthread_rwlock_rdlock pthread_setprio pthread_setschedprio \
pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
realpath rename rint rwlock_init setupterm \
shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 19cfb74c80f..151cb34faff 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -279,6 +279,8 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
#define my_pthread_setprio(A,B) pthread_setprio_np((A),(B))
#elif defined(HAVE_PTHREAD_SETPRIO)
#define my_pthread_setprio(A,B) pthread_setprio((A),(B))
+#elif defined(HAVE_PTHREAD_SETSCHEDPRIO)
+#define my_pthread_setprio(A,B) pthread_setschedprio((A),(B))
#else
extern void my_pthread_setprio(pthread_t thread_id,int prior);
#endif
@@ -519,6 +521,7 @@ typedef struct st_my_pthread_fastmutex_t
{
pthread_mutex_t mutex;
uint spins;
+ uint rng_state;
} my_pthread_fastmutex_t;
void fastmutex_global_init(void);
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id.test b/mysql-test/extra/rpl_tests/rpl_insert_id.test
index d8ea267d62b..bd815d9de02 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_id.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_id.test
@@ -442,8 +442,6 @@ SELECT f1();
INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()),
(NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2());
INSERT INTO t1 VALUES (NULL, f2());
-INSERT INTO t1 VALUES (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID(5)),
- (NULL, @@LAST_INSERT_ID);
# Test replication of substitution "IS NULL" -> "= LAST_INSERT_ID".
INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
UPDATE t1 SET j= -1 WHERE i IS NULL;
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index d6986f4a956..e01f4fa047b 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -1222,4 +1222,22 @@ ALTER TABLE t1 CHANGE d c varchar(10);
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;
+create table t1(f1 int not null, f2 int not null, key (f1), key (f2));
+select index_length into @unpaked_keys_size from
+information_schema.tables where table_name='t1';
+alter table t1 pack_keys=1;
+select index_length into @paked_keys_size from
+information_schema.tables where table_name='t1';
+select (@unpaked_keys_size > @paked_keys_size);
+(@unpaked_keys_size > @paked_keys_size)
+1
+select max_data_length into @orig_max_data_length from
+information_schema.tables where table_name='t1';
+alter table t1 max_rows=100;
+select max_data_length into @changed_max_data_length from
+information_schema.tables where table_name='t1';
+select (@orig_max_data_length > @changed_max_data_length);
+(@orig_max_data_length > @changed_max_data_length)
+1
+drop table t1;
End of 5.1 tests
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index 2ce8b8c384f..742dc5ae49d 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -107,3 +107,51 @@ X X X X X X X X X
X X X X X X X X X Range checked for each record (index map: 0xFFFFFFFFFF)
DROP TABLE t2;
DROP TABLE t1;
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT);
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1),(2);
+EXPLAIN EXTENDED SELECT 1
+FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
+2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
+Warnings:
+Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
+EXPLAIN EXTENDED SELECT 1
+FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
+2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
+Warnings:
+Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
+prepare s1 from
+'EXPLAIN EXTENDED SELECT 1
+ FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
+execute s1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
+2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
+Warnings:
+Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
+prepare s1 from
+'EXPLAIN EXTENDED SELECT 1
+ FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
+execute s1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
+2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
+Warnings:
+Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
+execute s1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
+2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
+Warnings:
+Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index c5c79b15ca6..7da540dd8f6 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -758,7 +758,6 @@ table_schema table_name column_name
information_schema COLUMNS COLUMN_DEFAULT
information_schema COLUMNS COLUMN_TYPE
information_schema EVENTS EVENT_DEFINITION
-information_schema EVENTS SQL_MODE
information_schema PARTITIONS PARTITION_EXPRESSION
information_schema PARTITIONS SUBPARTITION_EXPRESSION
information_schema PARTITIONS PARTITION_DESCRIPTION
@@ -768,8 +767,6 @@ information_schema ROUTINES ROUTINE_DEFINITION
information_schema ROUTINES SQL_MODE
information_schema TRIGGERS ACTION_CONDITION
information_schema TRIGGERS ACTION_STATEMENT
-information_schema TRIGGERS SQL_MODE
-information_schema TRIGGERS DEFINER
information_schema VIEWS VIEW_DEFINITION
select table_name, column_name, data_type from information_schema.columns
where data_type = 'datetime';
@@ -1646,4 +1643,13 @@ drop table t1;
drop function f1;
select * from information_schema.tables where 1=sleep(100000);
select * from information_schema.columns where 1=sleep(100000);
+explain select count(*) from information_schema.tables;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tables ALL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases
+explain select count(*) from information_schema.columns;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE columns ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases
+explain select count(*) from information_schema.views;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE views ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases
End of 5.1 tests.
diff --git a/mysql-test/r/innodb_data_home_dir_basic.result b/mysql-test/r/innodb_data_home_dir_basic.result
index fb9a0b0bca5..e4bdd79b7c3 100644
--- a/mysql-test/r/innodb_data_home_dir_basic.result
+++ b/mysql-test/r/innodb_data_home_dir_basic.result
@@ -1,7 +1,7 @@
'#---------------------BS_STVARS_025_01----------------------#'
SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
COUNT(@@GLOBAL.innodb_data_home_dir)
-0
+1
1 Expected
'#---------------------BS_STVARS_025_02----------------------#'
SET @@GLOBAL.innodb_data_home_dir=1;
@@ -9,7 +9,7 @@ ERROR HY000: Variable 'innodb_data_home_dir' is a read only variable
Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
COUNT(@@GLOBAL.innodb_data_home_dir)
-0
+1
1 Expected
'#---------------------BS_STVARS_025_03----------------------#'
SELECT @@GLOBAL.innodb_data_home_dir = VARIABLE_VALUE
@@ -20,7 +20,7 @@ NULL
1 Expected
SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
COUNT(@@GLOBAL.innodb_data_home_dir)
-0
+1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -36,7 +36,7 @@ NULL
'#---------------------BS_STVARS_025_05----------------------#'
SELECT COUNT(@@innodb_data_home_dir);
COUNT(@@innodb_data_home_dir)
-0
+1
1 Expected
SELECT COUNT(@@local.innodb_data_home_dir);
ERROR HY000: Variable 'innodb_data_home_dir' is a GLOBAL variable
@@ -46,7 +46,7 @@ ERROR HY000: Variable 'innodb_data_home_dir' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
COUNT(@@GLOBAL.innodb_data_home_dir)
-0
+1
1 Expected
SELECT innodb_data_home_dir = @@SESSION.innodb_data_home_dir;
ERROR 42S22: Unknown column 'innodb_data_home_dir' in 'field list'
diff --git a/mysql-test/r/innodb_flush_method_basic.result b/mysql-test/r/innodb_flush_method_basic.result
index 836328c5c9b..8c8924cdd86 100644
--- a/mysql-test/r/innodb_flush_method_basic.result
+++ b/mysql-test/r/innodb_flush_method_basic.result
@@ -1,7 +1,7 @@
'#---------------------BS_STVARS_029_01----------------------#'
SELECT COUNT(@@GLOBAL.innodb_flush_method);
COUNT(@@GLOBAL.innodb_flush_method)
-0
+1
1 Expected
'#---------------------BS_STVARS_029_02----------------------#'
SET @@GLOBAL.innodb_flush_method=1;
@@ -9,7 +9,7 @@ ERROR HY000: Variable 'innodb_flush_method' is a read only variable
Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.innodb_flush_method);
COUNT(@@GLOBAL.innodb_flush_method)
-0
+1
1 Expected
'#---------------------BS_STVARS_029_03----------------------#'
SELECT @@GLOBAL.innodb_flush_method = VARIABLE_VALUE
@@ -20,7 +20,7 @@ NULL
1 Expected
SELECT COUNT(@@GLOBAL.innodb_flush_method);
COUNT(@@GLOBAL.innodb_flush_method)
-0
+1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -36,7 +36,7 @@ NULL
'#---------------------BS_STVARS_029_05----------------------#'
SELECT COUNT(@@innodb_flush_method);
COUNT(@@innodb_flush_method)
-0
+1
1 Expected
SELECT COUNT(@@local.innodb_flush_method);
ERROR HY000: Variable 'innodb_flush_method' is a GLOBAL variable
@@ -46,7 +46,7 @@ ERROR HY000: Variable 'innodb_flush_method' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.innodb_flush_method);
COUNT(@@GLOBAL.innodb_flush_method)
-0
+1
1 Expected
SELECT innodb_flush_method = @@SESSION.innodb_flush_method;
ERROR 42S22: Unknown column 'innodb_flush_method' in 'field list'
diff --git a/mysql-test/r/limit.result b/mysql-test/r/limit.result
index 2acf74162a4..caed588acdb 100644
--- a/mysql-test/r/limit.result
+++ b/mysql-test/r/limit.result
@@ -111,3 +111,6 @@ set @a=-14632475938453979136;
execute s using @a, @a;
ERROR HY000: Incorrect arguments to EXECUTE
End of 5.0 tests
+select 1 as a limit 4294967296,10;
+a
+End of 5.1 tests
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index c5228538788..2f294314b04 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -1,4 +1,11 @@
use mysql;
+SET @saved_long_query_time = @@long_query_time;
+SET @saved_log_output = @@log_output;
+SET @saved_general_log = @@GLOBAL.general_log;
+SET @saved_slow_query_log = @@GLOBAL.slow_query_log;
+SELECT @saved_long_query_time, @saved_log_output, @saved_general_log, @saved_slow_query_log;
+@saved_long_query_time @saved_log_output @saved_general_log @saved_slow_query_log
+10 FILE,TABLE 1 1
truncate table general_log;
select * from general_log;
event_time user_host thread_id server_id command_type argument
@@ -136,6 +143,7 @@ sleep(2)
select * from mysql.slow_log;
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 mysql 0 0 1 select sleep(2)
+set @@session.long_query_time = @saved_long_query_time;
alter table mysql.general_log engine=myisam;
ERROR HY000: You cannot 'ALTER' a log table if logging is enabled
alter table mysql.slow_log engine=myisam;
@@ -213,6 +221,7 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query truncate table mysql.slow_log
TIMESTAMP USER_HOST THREAD_ID 1 Query set session long_query_time=1
TIMESTAMP USER_HOST THREAD_ID 1 Query select sleep(2)
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.slow_log
+TIMESTAMP USER_HOST THREAD_ID 1 Query set @@session.long_query_time = @saved_long_query_time
TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.general_log engine=myisam
TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.slow_log engine=myisam
TIMESTAMP USER_HOST THREAD_ID 1 Query drop table mysql.general_log
@@ -281,6 +290,7 @@ use mysql;
lock tables general_log read local, help_category read local;
ERROR HY000: You can't use locks with log tables.
unlock tables;
+SET SESSION long_query_time = 1000;
drop table if exists mysql.renamed_general_log;
drop table if exists mysql.renamed_slow_log;
drop table if exists mysql.general_log_new;
@@ -330,6 +340,7 @@ set global slow_query_log='ON';
ERROR 42S02: Table 'mysql.slow_log' doesn't exist
RENAME TABLE general_log2 TO general_log;
RENAME TABLE slow_log2 TO slow_log;
+SET SESSION long_query_time = @saved_long_query_time;
set global general_log='ON';
set global slow_query_log='ON';
flush logs;
@@ -390,7 +401,6 @@ SET GLOBAL general_log = 0;
FLUSH LOGS;
ALTER TABLE mysql.general_log DROP COLUMN seq;
ALTER TABLE mysql.general_log ENGINE = CSV;
-SET @old_long_query_time:=@@long_query_time;
SET GLOBAL slow_query_log = 0;
FLUSH LOGS;
TRUNCATE TABLE mysql.slow_log;
@@ -418,10 +428,11 @@ START_TIME USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 SELECT "My own slow quer
START_TIME USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3
START_TIME USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 4
SET GLOBAL slow_query_log = 0;
-SET SESSION long_query_time =@old_long_query_time;
+SET SESSION long_query_time =@saved_long_query_time;
FLUSH LOGS;
ALTER TABLE mysql.slow_log DROP COLUMN seq;
ALTER TABLE mysql.slow_log ENGINE = CSV;
+SET GLOBAL slow_query_log = @saved_slow_query_log;
drop procedure if exists proc25422_truncate_slow;
drop procedure if exists proc25422_truncate_general;
drop procedure if exists proc25422_alter_slow;
@@ -593,8 +604,6 @@ UNTIL done END REPEAT;
CLOSE cur1;
TRUNCATE mysql.general_log;
END //
-SET @old_general_log_state = @@global.general_log;
-SET @old_slow_log_state = @@global.slow_query_log;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
select "put something into general_log";
@@ -614,11 +623,10 @@ DROP TABLE `db_17876.general_log_data`;
DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
DROP DATABASE IF EXISTS `db_17876`;
-SET GLOBAL general_log = @old_general_log_state;
-SET GLOBAL slow_query_log = @old_slow_log_state;
+SET GLOBAL general_log = @saved_general_log;
+SET GLOBAL slow_query_log = @saved_slow_query_log;
select CONNECTION_ID() into @thread_id;
truncate table mysql.general_log;
-set @old_general_log_state = @@global.general_log;
set global general_log = on;
set @lparam = "000 001 002 003 004 005 006 007 008 009"
"010 011 012 013 014 015 016 017 018 019"
@@ -725,6 +733,7 @@ execute long_query using @lparam;
set global general_log = off;
select command_type, argument from mysql.general_log where thread_id = @thread_id;
command_type argument
+Query set global general_log = on
Query set @lparam = "000 001 002 003 004 005 006 007 008 009"
"010 011 012 013 014 015 016 017 018 019"
"020 021 022 023 024 025 026 027 028 029"
@@ -831,13 +840,11 @@ Query execute long_query using @lparam
Execute select '000 001 002 003 004 005 006 007 008 009010 011 012 013 014 015 016 017 018 019020 021 022 023 024 025 026 027 028 029030 031 032 033 034 035 036 037 038 039040 041 042 043 044 045 046 047 048 049050 051 052 053 054 055 056 057 058 059060 061 062 063 064 065 066 067 068 069070 071 072 073 074 075 076 077 078 079080 081 082 083 084 085 086 087 088 089090 091 092 093 094 095 096 097 098 099100 101 102 103 104 105 106 107 108 109110 111 112 113 114 115 116 117 118 119120 121 122 123 124 125 126 127 128 129130 131 132 133 134 135 136 137 138 139140 141 142 143 144 145 146 147 148 149150 151 152 153 154 155 156 157 158 159160 161 162 163 164 165 166 167 168 169170 171 172 173 174 175 176 177 178 179180 181 182 183 184 185 186 187 188 189190 191 192 193 194 195 196 197 198 199200 201 202 203 204 205 206 207 208 209210 211 212 213 214 215 216 217 218 219220 221 222 223 224 225 226 227 228 229230 231 232 233 234 235 236 237 238 239240 241 242 243 244 245 246 247 248 249250 251 252 253 254 255 256 257 258 259260 261 262 263 264 265 266 267 268 269270 271 272 273 274 275 276 277 278 279280 281 282 283 284 285 286 287 288 289290 291 292 293 294 295 296 297 298 299300 301 302 303 304 305 306 307 308 309310 311 312 313 314 315 316 317 318 319320 321 322 323 324 325 326 327 328 329330 331 332 333 334 335 336 337 338 339340 341 342 343 344 345 346 347 348 349350 351 352 353 354 355 356 357 358 359360 361 362 363 364 365 366 367 368 369370 371 372 373 374 375 376 377 378 379380 381 382 383 384 385 386 387 388 389390 391 392 393 394 395 396 397 398 399400 401 402 403 404 405 406 407 408 409410 411 412 413 414 415 416 417 418 419420 421 422 423 424 425 426 427 428 429430 431 432 433 434 435 436 437 438 439440 441 442 443 444 445 446 447 448 449450 451 452 453 454 455 456 457 458 459460 461 462 463 464 465 466 467 468 469470 471 472 473 474 475 476 477 478 479480 481 482 483 484 485 486 487 488 489490 491 492 493 494 495 496 497 498 499500 501 502 503 504 505 506 507 508 509510 511 512 513 514 515 516 517 518 519520 521 522 523 524 525 526 527 528 529530 531 532 533 534 535 536 537 538 539540 541 542 543 544 545 546 547 548 549550 551 552 553 554 555 556 557 558 559560 561 562 563 564 565 566 567 568 569570 571 572 573 574 575 576 577 578 579580 581 582 583 584 585 586 587 588 589590 591 592 593 594 595 596 597 598 599600 601 602 603 604 605 606 607 608 609610 611 612 613 614 615 616 617 618 619620 621 622 623 624 625 626 627 628 629630 631 632 633 634 635 636 637 638 639640 641 642 643 644 645 646 647 648 649650 651 652 653 654 655 656 657 658 659660 661 662 663 664 665 666 667 668 669670 671 672 673 674 675 676 677 678 679680 681 682 683 684 685 686 687 688 689690 691 692 693 694 695 696 697 698 699700 701 702 703 704 705 706 707 708 709710 711 712 713 714 715 716 717 718 719720 721 722 723 724 725 726 727 728 729730 731 732 733 734 735 736 737 738 739740 741 742 743 744 745 746 747 748 749750 751 752 753 754 755 756 757 758 759760 761 762 763 764 765 766 767 768 769770 771 772 773 774 775 776 777 778 779780 781 782 783 784 785 786 787 788 789790 791 792 793 794 795 796 797 798 799800 801 802 803 804 805 806 807 808 809810 811 812 813 814 815 816 817 818 819820 821 822 823 824 825 826 827 828 829830 831 832 833 834 835 836 837 838 839840 841 842 843 844 845 846 847 848 849850 851 852 853 854 855 856 857 858 859860 861 862 863 864 865 866 867 868 869870 871 872 873 874 875 876 877 878 879880 881 882 883 884 885 886 887 888 889890 891 892 893 894 895 896 897 898 899900 901 902 903 904 905 906 907 908 909910 911 912 913 914 915 916 917 918 919920 921 922 923 924 925 926 927 928 929930 931 932 933 934 935 936 937 938 939940 941 942 943 944 945 946 947 948 949950 951 952 953 954 955 956 957 958 959960 961 962 963 964 965 966 967 968 969970 971 972 973 974 975 976 977 978 979980 981 982 983 984 985 986 987 988 989990 991 992 993 994 995 996 997 998 999' as long_query
Query set global general_log = off
deallocate prepare long_query;
-set global general_log = @old_general_log_state;
+set global general_log = @saved_general_log;
DROP TABLE IF EXISTS log_count;
DROP TABLE IF EXISTS slow_log_copy;
DROP TABLE IF EXISTS general_log_copy;
CREATE TABLE log_count (count BIGINT(21));
-SET @old_general_log_state = @@global.general_log;
-SET @old_slow_log_state = @@global.slow_query_log;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
CREATE TABLE slow_log_copy SELECT * FROM mysql.slow_log;
@@ -858,10 +865,9 @@ CREATE TABLE general_log_copy SELECT * FROM mysql.general_log;
INSERT INTO general_log_copy SELECT * FROM mysql.general_log;
INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log));
DROP TABLE general_log_copy;
-SET GLOBAL general_log = @old_general_log_state;
-SET GLOBAL slow_query_log = @old_slow_log_state;
+SET GLOBAL general_log = @saved_general_log;
+SET GLOBAL slow_query_log = @saved_slow_query_log;
DROP TABLE log_count;
-SET @old_slow_log_state = @@global.slow_query_log;
SET SESSION long_query_time = 0;
SET GLOBAL slow_query_log = ON;
FLUSH LOGS;
@@ -887,5 +893,7 @@ TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1
TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2
DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log;
-SET GLOBAL slow_query_log = @old_slow_log_state;
-SET SESSION long_query_time =@old_long_query_time;
+SET GLOBAL slow_query_log = @saved_slow_query_log;
+SET GLOBAL general_log=@saved_general_log;
+SET SESSION long_query_time =@saved_long_query_time;
+SET GLOBAL LOG_OUTPUT = @saved_log_output;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index ef623b343e9..cc05efded02 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -830,7 +830,7 @@ ERROR HY000: Unable to open underlying table which is differently defined or of
DROP TABLE t1, t2;
CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3);
SELECT * FROM t2;
-ERROR 42S02: Table 'test.t3' doesn't exist
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t2;
CREATE TABLE t1(a INT, b TEXT);
CREATE TABLE tm1(a TEXT, b INT) ENGINE=MERGE UNION=(t1);
@@ -895,17 +895,19 @@ drop table t2;
drop table t1;
CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2);
SELECT * FROM tm1;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
CHECK TABLE tm1;
Table Op Msg_type Msg_text
test.tm1 check Error Table 'test.t1' doesn't exist
+test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check error Corrupt
CREATE TABLE t1(a INT);
SELECT * FROM tm1;
-ERROR 42S02: Table 'test.t2' doesn't exist
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
CHECK TABLE tm1;
Table Op Msg_type Msg_text
test.tm1 check Error Table 'test.t2' doesn't exist
+test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check error Corrupt
CREATE TABLE t2(a BLOB);
SELECT * FROM tm1;
@@ -1199,7 +1201,7 @@ c1
3
RENAME TABLE t2 TO t5;
SELECT * FROM t3 ORDER BY c1;
-ERROR 42S02: Table 'test.t2' doesn't exist
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
RENAME TABLE t5 TO t2;
SELECT * FROM t3 ORDER BY c1;
c1
@@ -1233,7 +1235,7 @@ UNLOCK TABLES;
# 4. Alter table rename.
ALTER TABLE t2 RENAME TO t5;
SELECT * FROM t3 ORDER BY c1;
-ERROR 42S02: Table 'test.t2' doesn't exist
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
ALTER TABLE t5 RENAME TO t2;
SELECT * FROM t3 ORDER BY c1;
c1
@@ -1317,7 +1319,7 @@ LOCK TABLES t1 WRITE, t2 WRITE;
INSERT INTO t1 VALUES (1);
DROP TABLE t1;
SELECT * FROM t2;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
SELECT * FROM t1;
ERROR 42S02: Table 'test.t1' doesn't exist
UNLOCK TABLES;
@@ -2006,6 +2008,13 @@ test.t1 optimize status OK
FLUSH TABLES m1, t1;
UNLOCK TABLES;
DROP TABLE t1, m1;
+CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=FIRST;
+SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE
+TABLE_SCHEMA = 'test' and TABLE_NAME='tm1';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT
+NULL test tm1 BASE TABLE NULL NULL NULL # # # # # # # # # # NULL # # Unable to open underlying table which is differently defined or of non-MyISAM ty
+DROP TABLE tm1;
+End of 5.1 tests
CREATE TABLE t1(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
CREATE TABLE t2(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
CREATE TABLE t3(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result
index 4d5a170a55c..6b498e55d85 100644
--- a/mysql-test/r/metadata.result
+++ b/mysql-test/r/metadata.result
@@ -181,4 +181,21 @@ c1 c2
3 3
DROP VIEW v1,v2;
DROP TABLE t1,t2;
+CREATE TABLE t1 (i INT, d DATE);
+INSERT INTO t1 VALUES (1, '2008-01-01'), (2, '2008-01-02'), (3, '2008-01-03');
+SELECT COALESCE(d, d), IFNULL(d, d), IF(i, d, d),
+CASE i WHEN i THEN d ELSE d END, GREATEST(d, d), LEAST(d, d)
+FROM t1 ORDER BY RAND();
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+2008-01-01 2008-01-01 2008-01-01 2008-01-01 2008-01-01 2008-01-01
+2008-01-02 2008-01-02 2008-01-02 2008-01-02 2008-01-02 2008-01-02
+2008-01-03 2008-01-03 2008-01-03 2008-01-03 2008-01-03 2008-01-03
+COALESCE(d, d) IFNULL(d, d) IF(i, d, d) CASE i WHEN i THEN d ELSE d END GREATEST(d, d) LEAST(d, d)
+def CASE i WHEN i THEN d ELSE d END CASE i WHEN i THEN d ELSE d END 10 10 10 Y 128 0 63
+def COALESCE(d, d) COALESCE(d, d) 10 10 10 Y 128 0 63
+def GREATEST(d, d) GREATEST(d, d) 10 10 10 Y 128 0 63
+def IF(i, d, d) IF(i, d, d) 10 10 10 Y 128 0 63
+def IFNULL(d, d) IFNULL(d, d) 10 10 10 Y 128 0 63
+def LEAST(d, d) LEAST(d, d) 10 10 10 Y 128 0 63
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index e70ce75797d..dc29c5ec226 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -1428,6 +1428,22 @@ set session max_sort_length= 2180;
select * from t1 order by b;
ERROR HY001: Out of sort memory; increase server sort buffer size
drop table t1;
+#
+# Bug #39844: Query Crash Mysql Server 5.0.67
+#
+CREATE TABLE t1 (a INT PRIMARY KEY);
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
+CREATE TABLE t3 (c INT);
+INSERT INTO t1 (a) VALUES (1), (2);
+INSERT INTO t2 (a,b) VALUES (1,2), (2,3);
+INSERT INTO t3 (c) VALUES (1), (2);
+SELECT
+(SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a)
+FROM t3;
+(SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a)
+2
+NULL
+DROP TABLE t1, t2, t3;
CREATE TABLE t2 (a varchar(32), b int(11), c float, d double,
UNIQUE KEY a (a,b,c), KEY b (b), KEY c (c));
CREATE TABLE t1 (a varchar(32), b char(3), UNIQUE KEY a (a,b), KEY b (b));
diff --git a/mysql-test/r/partition_not_windows.result b/mysql-test/r/partition_not_windows.result
index 44afdea3855..c0247babb50 100644
--- a/mysql-test/r/partition_not_windows.result
+++ b/mysql-test/r/partition_not_windows.result
@@ -24,8 +24,8 @@ data directory='/not/existing'
index directory='/not/existing'
);
Warnings:
-Warning 0 DATA DIRECTORY option ignored
-Warning 0 INDEX DIRECTORY option ignored
+Warning 1616 <DATA DIRECTORY> option ignored
+Warning 1616 <INDEX DIRECTORY> option ignored
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
diff --git a/mysql-test/r/partition_symlink.result b/mysql-test/r/partition_symlink.result
index 73844e9e70d..00c9f5b3f01 100644
--- a/mysql-test/r/partition_symlink.result
+++ b/mysql-test/r/partition_symlink.result
@@ -101,8 +101,8 @@ data directory='/not/existing'
index directory='/not/existing'
);
Warnings:
-Warning 0 DATA DIRECTORY option ignored
-Warning 0 INDEX DIRECTORY option ignored
+Warning 1616 <DATA DIRECTORY> option ignored
+Warning 1616 <INDEX DIRECTORY> option ignored
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
diff --git a/mysql-test/r/partition_windows.result b/mysql-test/r/partition_windows.result
index c2d4054deeb..87e3a3e970d 100644
--- a/mysql-test/r/partition_windows.result
+++ b/mysql-test/r/partition_windows.result
@@ -15,16 +15,16 @@ DATA DIRECTORY = 'E:/mysqltest/p2Data'
INDEX DIRECTORY = 'F:/mysqltest/p2Index'
);
Warnings:
-Warning 0 DATA DIRECTORY option ignored
-Warning 0 INDEX DIRECTORY option ignored
-Warning 0 DATA DIRECTORY option ignored
-Warning 0 INDEX DIRECTORY option ignored
+Warning 1616 <DATA DIRECTORY> option ignored
+Warning 1616 <INDEX DIRECTORY> option ignored
+Warning 1616 <DATA DIRECTORY> option ignored
+Warning 1616 <INDEX DIRECTORY> option ignored
INSERT INTO t1 VALUES (NULL, "first", 1);
INSERT INTO t1 VALUES (NULL, "second", 2);
INSERT INTO t1 VALUES (NULL, "third", 3);
ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data' INDEX DIRECTORY = 'H:/mysqltest/p3Index');
Warnings:
-Warning 0 DATA DIRECTORY option ignored
-Warning 0 INDEX DIRECTORY option ignored
+Warning 1616 <DATA DIRECTORY> option ignored
+Warning 1616 <INDEX DIRECTORY> option ignored
INSERT INTO t1 VALUES (NULL, "last", 4);
DROP TABLE t1;
diff --git a/mysql-test/r/ps_11bugs.result b/mysql-test/r/ps_11bugs.result
index ebe161f46b3..a298c552806 100644
--- a/mysql-test/r/ps_11bugs.result
+++ b/mysql-test/r/ps_11bugs.result
@@ -162,4 +162,32 @@ a b
12 NULL
drop table t1;
drop table t2;
+CREATE TABLE t1 (a INT);
+PREPARE stmt FROM 'select 1 from `t1` where `a` = any (select (@@tmpdir))';
+EXECUTE stmt;
+1
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+CREATE TABLE t2 (a INT PRIMARY KEY);
+INSERT INTO t2 VALUES (400000), (400001);
+SET @@sort_buffer_size=400000;
+CREATE FUNCTION p1(i INT) RETURNS INT
+BEGIN
+SET @@sort_buffer_size= i;
+RETURN i + 1;
+END|
+SELECT * FROM t2 WHERE a = @@sort_buffer_size AND p1(@@sort_buffer_size + 1) > a - 1;
+a
+400000
+DROP TABLE t2;
+DROP FUNCTION p1;
+SELECT CONCAT(@@sort_buffer_size);
+CONCAT(@@sort_buffer_size)
+400001
+SELECT LEFT("12345", @@ft_boolean_syntax);
+LEFT("12345", @@ft_boolean_syntax)
+
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '+ -><()~*:""&|'
+SET @@sort_buffer_size=DEFAULT;
End of 5.0 tests.
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index dfadfd878e8..b9a5ddbf8ec 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -1001,8 +1001,8 @@ def TRIGGERS EVENT_OBJECT_TABLE Table 253 192 2 N 1 0 33
def TRIGGERS ACTION_STATEMENT Statement 252 589815 10 N 17 0 33
def TRIGGERS ACTION_TIMING Timing 253 18 6 N 1 0 33
def TRIGGERS CREATED Created 12 19 0 Y 128 0 63
-def TRIGGERS SQL_MODE sql_mode 252 589815 0 N 17 0 33
-def TRIGGERS DEFINER Definer 252 589815 14 N 17 0 33
+def TRIGGERS SQL_MODE sql_mode 253 24576 0 N 1 0 33
+def TRIGGERS DEFINER Definer 253 231 14 N 1 0 33
def TRIGGERS CHARACTER_SET_CLIENT character_set_client 253 96 6 N 1 0 33
def TRIGGERS COLLATION_CONNECTION collation_connection 253 96 6 N 1 0 33
def TRIGGERS DATABASE_COLLATION Database Collation 253 96 17 N 1 0 33
@@ -1045,8 +1045,8 @@ def TRIGGERS ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_OLD_TABLE 253 192 0 Y
def TRIGGERS ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_NEW_TABLE 253 192 0 Y 0 0 33
def TRIGGERS ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_OLD_ROW 253 9 3 N 1 0 33
def TRIGGERS ACTION_REFERENCE_NEW_ROW ACTION_REFERENCE_NEW_ROW 253 9 3 N 1 0 33
-def TRIGGERS SQL_MODE SQL_MODE 252 589815 0 N 17 0 33
-def TRIGGERS DEFINER DEFINER 252 589815 14 N 17 0 33
+def TRIGGERS SQL_MODE SQL_MODE 253 24576 0 N 1 0 33
+def TRIGGERS DEFINER DEFINER 253 231 14 N 1 0 33
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW SQL_MODE DEFINER
NULL test t1_bi INSERT NULL test t1 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW root@localhost
----------------------------------------------------------------
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 651f0b235d5..4052cd58c0f 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -6846,6 +6846,19 @@ select substr(`str`, `pos`+ 1 ) into `str`;
end $
call `p2`('s s s s s s');
drop procedure `p2`;
+drop table if exists t1;
+drop procedure if exists p1;
+create procedure p1() begin select * from t1; end$
+call p1$
+ERROR 42S02: Table 'test.t1' doesn't exist
+create table t1 (a integer)$
+call p1$
+a
+alter table t1 add b integer;
+call p1$
+a
+drop table t1;
+drop procedure p1;
# ------------------------------------------------------------------
# -- End of 5.0 tests
# ------------------------------------------------------------------
diff --git a/mysql-test/r/ssl_capath_basic.result b/mysql-test/r/ssl_capath_basic.result
index a2c01aab806..3d161392917 100644
--- a/mysql-test/r/ssl_capath_basic.result
+++ b/mysql-test/r/ssl_capath_basic.result
@@ -1,7 +1,7 @@
'#---------------------BS_STVARS_046_01----------------------#'
SELECT COUNT(@@GLOBAL.ssl_capath);
COUNT(@@GLOBAL.ssl_capath)
-0
+1
1 Expected
'#---------------------BS_STVARS_046_02----------------------#'
SET @@GLOBAL.ssl_capath=1;
@@ -9,7 +9,7 @@ ERROR HY000: Variable 'ssl_capath' is a read only variable
Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.ssl_capath);
COUNT(@@GLOBAL.ssl_capath)
-0
+1
1 Expected
'#---------------------BS_STVARS_046_03----------------------#'
SELECT @@GLOBAL.ssl_capath = VARIABLE_VALUE
@@ -20,7 +20,7 @@ NULL
1 Expected
SELECT COUNT(@@GLOBAL.ssl_capath);
COUNT(@@GLOBAL.ssl_capath)
-0
+1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -36,7 +36,7 @@ NULL
'#---------------------BS_STVARS_046_05----------------------#'
SELECT COUNT(@@ssl_capath);
COUNT(@@ssl_capath)
-0
+1
1 Expected
SELECT COUNT(@@local.ssl_capath);
ERROR HY000: Variable 'ssl_capath' is a GLOBAL variable
@@ -46,7 +46,7 @@ ERROR HY000: Variable 'ssl_capath' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.ssl_capath);
COUNT(@@GLOBAL.ssl_capath)
-0
+1
1 Expected
SELECT ssl_capath = @@SESSION.ssl_capath;
ERROR 42S22: Unknown column 'ssl_capath' in 'field list'
diff --git a/mysql-test/r/ssl_cipher_basic.result b/mysql-test/r/ssl_cipher_basic.result
index 3c7098e1150..df0fc8b5aad 100644
--- a/mysql-test/r/ssl_cipher_basic.result
+++ b/mysql-test/r/ssl_cipher_basic.result
@@ -1,7 +1,7 @@
'#---------------------BS_STVARS_048_01----------------------#'
SELECT COUNT(@@GLOBAL.ssl_cipher);
COUNT(@@GLOBAL.ssl_cipher)
-0
+1
1 Expected
'#---------------------BS_STVARS_048_02----------------------#'
SET @@GLOBAL.ssl_cipher=1;
@@ -9,7 +9,7 @@ ERROR HY000: Variable 'ssl_cipher' is a read only variable
Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.ssl_cipher);
COUNT(@@GLOBAL.ssl_cipher)
-0
+1
1 Expected
'#---------------------BS_STVARS_048_03----------------------#'
SELECT @@GLOBAL.ssl_cipher = VARIABLE_VALUE
@@ -20,7 +20,7 @@ NULL
1 Expected
SELECT COUNT(@@GLOBAL.ssl_cipher);
COUNT(@@GLOBAL.ssl_cipher)
-0
+1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -36,7 +36,7 @@ NULL
'#---------------------BS_STVARS_048_05----------------------#'
SELECT COUNT(@@ssl_cipher);
COUNT(@@ssl_cipher)
-0
+1
1 Expected
SELECT COUNT(@@local.ssl_cipher);
ERROR HY000: Variable 'ssl_cipher' is a GLOBAL variable
@@ -46,7 +46,7 @@ ERROR HY000: Variable 'ssl_cipher' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.ssl_cipher);
COUNT(@@GLOBAL.ssl_cipher)
-0
+1
1 Expected
SELECT ssl_cipher = @@SESSION.ssl_cipher;
ERROR 42S22: Unknown column 'ssl_cipher' in 'field list'
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result
index f4fd041731d..b15ec9dbe4e 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -779,6 +779,22 @@ SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0);
1
1
DROP TABLE t1, t2;
+CREATE TABLE t1 (
+pk INT PRIMARY KEY,
+int_key INT,
+varchar_key VARCHAR(5) UNIQUE,
+varchar_nokey VARCHAR(5)
+);
+INSERT INTO t1 VALUES (9, 7,NULL,NULL), (10,8,'p' ,'p');
+SELECT varchar_nokey
+FROM t1
+WHERE NULL NOT IN (
+SELECT INNR.pk FROM t1 AS INNR2
+LEFT JOIN t1 AS INNR ON ( INNR2.int_key = INNR.int_key )
+WHERE INNR.varchar_key > 'n{'
+);
+varchar_nokey
+DROP TABLE t1;
End of 5.0 tests
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index b8c1660f947..df4aa343f1f 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -79,7 +79,7 @@ drop database mysqltest;
create table t1 (a int not null) engine=myisam;
alter table t1 data directory="MYSQLTEST_VARDIR/tmp";
Warnings:
-Warning 0 DATA DIRECTORY option ignored
+Warning 1616 <DATA DIRECTORY> option ignored
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -88,7 +88,7 @@ t1 CREATE TABLE `t1` (
alter table t1 add b int;
alter table t1 data directory="MYSQLTEST_VARDIR/log";
Warnings:
-Warning 0 DATA DIRECTORY option ignored
+Warning 1616 <DATA DIRECTORY> option ignored
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -97,7 +97,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 index directory="MYSQLTEST_VARDIR/log";
Warnings:
-Warning 0 INDEX DIRECTORY option ignored
+Warning 1616 <INDEX DIRECTORY> option ignored
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -164,8 +164,8 @@ ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errco
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
CREATE TABLE t1(a INT) DATA DIRECTORY='MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='MYSQLTEST_VARDIR/tmp';
Warnings:
-Warning 0 DATA DIRECTORY option ignored
-Warning 0 INDEX DIRECTORY option ignored
+Warning 1616 <DATA DIRECTORY> option ignored
+Warning 1616 <INDEX DIRECTORY> option ignored
DROP TABLE t1;
SET @@SQL_MODE=@OLD_SQL_MODE;
End of 5.1 tests
diff --git a/mysql-test/r/thread_cache_size_func.result b/mysql-test/r/thread_cache_size_func.result
index ccca75bd316..f808e28a512 100644
--- a/mysql-test/r/thread_cache_size_func.result
+++ b/mysql-test/r/thread_cache_size_func.result
@@ -2,67 +2,31 @@ SET @global_thread_cache_size = @@GLOBAL.thread_cache_size;
FLUSH STATUS;
'# Test1#'
SET @@GLOBAL.thread_cache_size=3;
-Saving threads cached, threads created values
SHOW STATUS LIKE 'Threads_cached';
Variable_name Value
Threads_cached 0
0 Expected
-'#Old value for thread_cache'#
** Connecting conn1 using username 'root' **
** Connecting conn2 using username 'root' **
** Connecting conn3 using username 'root' **
** Connecting conn4 using username 'root' **
-Saving threads cached, threads created values
-Threads Created Difference
-4
-4 Expected
+** Connection default **
SHOW STATUS LIKE 'Threads_cached';
Variable_name Value
Threads_cached 0
0 Expected
-** Connection default **
** Disconnecting conn1,conn2,conn3,conn4 **
-'#new values for thread cache after disconnecting'#
-Saving threads cached, threads created values
-Threads Created Difference
-0
-0 Expected
SHOW STATUS LIKE 'Threads_cached';
Variable_name Value
Threads_cached 3
3 Expected
-SET @@GLOBAL.thread_cache_size=1;
-Saving threads cached, threads created values
-Threads Created Difference
-0
-0 Expected
-SHOW STATUS LIKE 'Threads_cached';
-Variable_name Value
-Threads_cached 3
-1 Expected
-Bug: The number of threads cached should have decreased with cache size decrease.
+SET @@GLOBAL.thread_cache_size= 1;
** Connecting conn1 using username 'root' **
** Connecting conn2 using username 'root' **
-Saving threads cached, threads created values
-Threads Created Difference
-0
-1 Expected
-Bug: The number of threads created should have increased because the cache should have 1 thread only
-SHOW STATUS LIKE 'Threads_cached';
-Variable_name Value
-Threads_cached 1
-0 Expected
-Bug: The number of threads created should have decreased because atleast 1 new connection came in
-** Connection default **
+connection default;
** Disconnecting conn1,conn2 **
-'#new status values for thread cache'#
-Saving threads cached, threads created values
-Threads Created Difference
-0
-0 Expected
SHOW STATUS LIKE 'Threads_cached';
Variable_name Value
Threads_cached 1
1 Expected
-Saving threads cached, threads created values
SET @@GLOBAL.thread_cache_size = @global_thread_cache_size;
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 3f66599751d..aee84c98e4f 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -157,7 +157,7 @@ explain extended select @@IDENTITY,last_insert_id(), @@identity;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select 345 AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,345 AS `@@identity`
+Note 1003 select @@IDENTITY AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,@@identity AS `@@identity`
set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF", big_tables="ON";
set global concurrent_insert=2;
show variables like 'concurrent_insert';
diff --git a/mysql-test/r/windows.result b/mysql-test/r/windows.result
index e58a891838a..7ade7b851cc 100644
--- a/mysql-test/r/windows.result
+++ b/mysql-test/r/windows.result
@@ -9,8 +9,8 @@ drop table nu;
drop table if exists t1;
CREATE TABLE t1 ( `ID` int(6) ) data directory 'c:/tmp/' index directory 'c:/tmp/' engine=MyISAM;
Warnings:
-Warning 0 DATA DIRECTORY option ignored
-Warning 0 INDEX DIRECTORY option ignored
+Warning 1616 <DATA DIRECTORY> option ignored
+Warning 1616 <INDEX DIRECTORY> option ignored
drop table t1;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (1,1);
@@ -18,6 +18,7 @@ EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+DROP TABLE t1;
End of 5.0 tests.
drop procedure if exists proc_1;
create procedure proc_1() install plugin my_plug soname '\\root\\some_plugin.dll';
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result
index c1813a1add2..84daef5f8da 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -67,7 +67,7 @@ NULL information_schema EVENTS LAST_ALTERED 18 0000-00-00 00:00:00 NO datetime N
NULL information_schema EVENTS LAST_EXECUTED 19 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
NULL information_schema EVENTS ON_COMPLETION 16 NO varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select
NULL information_schema EVENTS ORIGINATOR 21 0 NO bigint NULL NULL 19 0 NULL NULL bigint(10) select
-NULL information_schema EVENTS SQL_MODE 12 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
+NULL information_schema EVENTS SQL_MODE 12 NO varchar 8192 24576 NULL NULL utf8 utf8_general_ci varchar(8192) select
NULL information_schema EVENTS STARTS 13 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
NULL information_schema EVENTS STATUS 15 NO varchar 18 54 NULL NULL utf8 utf8_general_ci varchar(18) select
NULL information_schema EVENTS TIME_ZONE 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
@@ -277,12 +277,12 @@ NULL information_schema TRIGGERS CHARACTER_SET_CLIENT 20 NO varchar 32 96 NULL
NULL information_schema TRIGGERS COLLATION_CONNECTION 21 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
NULL information_schema TRIGGERS DATABASE_COLLATION 22 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
-NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
+NULL information_schema TRIGGERS DEFINER 19 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select
NULL information_schema TRIGGERS EVENT_MANIPULATION 4 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select
NULL information_schema TRIGGERS EVENT_OBJECT_CATALOG 5 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
+NULL information_schema TRIGGERS SQL_MODE 18 NO varchar 8192 24576 NULL NULL utf8 utf8_general_ci varchar(8192) select
NULL information_schema TRIGGERS TRIGGER_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
NULL information_schema TRIGGERS TRIGGER_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
NULL information_schema TRIGGERS TRIGGER_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
@@ -412,7 +412,7 @@ NULL information_schema COLUMNS NUMERIC_SCALE bigint NULL NULL NULL NULL bigint(
NULL information_schema EVENTS EXECUTE_AT datetime NULL NULL NULL NULL datetime
3.0000 information_schema EVENTS INTERVAL_VALUE varchar 256 768 utf8 utf8_general_ci varchar(256)
3.0000 information_schema EVENTS INTERVAL_FIELD varchar 18 54 utf8 utf8_general_ci varchar(18)
-1.0000 information_schema EVENTS SQL_MODE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
+3.0000 information_schema EVENTS SQL_MODE varchar 8192 24576 utf8 utf8_general_ci varchar(8192)
NULL information_schema EVENTS STARTS datetime NULL NULL NULL NULL datetime
NULL information_schema EVENTS ENDS datetime NULL NULL NULL NULL datetime
3.0000 information_schema EVENTS STATUS varchar 18 54 utf8 utf8_general_ci varchar(18)
@@ -635,8 +635,8 @@ NULL information_schema TRIGGERS ACTION_ORDER bigint NULL NULL NULL NULL bigint(
3.0000 information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW varchar 3 9 utf8 utf8_general_ci varchar(3)
NULL information_schema TRIGGERS CREATED datetime NULL NULL NULL NULL datetime
-1.0000 information_schema TRIGGERS SQL_MODE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
-1.0000 information_schema TRIGGERS DEFINER longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
+3.0000 information_schema TRIGGERS SQL_MODE varchar 8192 24576 utf8 utf8_general_ci varchar(8192)
+3.0000 information_schema TRIGGERS DEFINER varchar 77 231 utf8 utf8_general_ci varchar(77)
3.0000 information_schema TRIGGERS CHARACTER_SET_CLIENT varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema TRIGGERS COLLATION_CONNECTION varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema TRIGGERS DATABASE_COLLATION varchar 32 96 utf8 utf8_general_ci varchar(32)
diff --git a/mysql-test/suite/funcs_1/r/is_events.result b/mysql-test/suite/funcs_1/r/is_events.result
index 52673f1d285..6dfe5899bf4 100644
--- a/mysql-test/suite/funcs_1/r/is_events.result
+++ b/mysql-test/suite/funcs_1/r/is_events.result
@@ -39,7 +39,7 @@ EVENT_TYPE varchar(9) NO
EXECUTE_AT datetime YES NULL
INTERVAL_VALUE varchar(256) YES NULL
INTERVAL_FIELD varchar(18) YES NULL
-SQL_MODE longtext NO NULL
+SQL_MODE varchar(8192) NO
STARTS datetime YES NULL
ENDS datetime YES NULL
STATUS varchar(18) NO
@@ -66,7 +66,7 @@ EVENTS CREATE TEMPORARY TABLE `EVENTS` (
`EXECUTE_AT` datetime DEFAULT NULL,
`INTERVAL_VALUE` varchar(256) DEFAULT NULL,
`INTERVAL_FIELD` varchar(18) DEFAULT NULL,
- `SQL_MODE` longtext NOT NULL,
+ `SQL_MODE` varchar(8192) NOT NULL DEFAULT '',
`STARTS` datetime DEFAULT NULL,
`ENDS` datetime DEFAULT NULL,
`STATUS` varchar(18) NOT NULL DEFAULT '',
@@ -93,7 +93,7 @@ EVENT_TYPE varchar(9) NO
EXECUTE_AT datetime YES NULL
INTERVAL_VALUE varchar(256) YES NULL
INTERVAL_FIELD varchar(18) YES NULL
-SQL_MODE longtext NO NULL
+SQL_MODE varchar(8192) NO
STARTS datetime YES NULL
ENDS datetime YES NULL
STATUS varchar(18) NO
diff --git a/mysql-test/suite/funcs_1/r/is_triggers.result b/mysql-test/suite/funcs_1/r/is_triggers.result
index ca62bd26e80..edf4a9e5032 100644
--- a/mysql-test/suite/funcs_1/r/is_triggers.result
+++ b/mysql-test/suite/funcs_1/r/is_triggers.result
@@ -45,8 +45,8 @@ ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL
ACTION_REFERENCE_OLD_ROW varchar(3) NO
ACTION_REFERENCE_NEW_ROW varchar(3) NO
CREATED datetime YES NULL
-SQL_MODE longtext NO NULL
-DEFINER longtext NO NULL
+SQL_MODE varchar(8192) NO
+DEFINER varchar(77) NO
CHARACTER_SET_CLIENT varchar(32) NO
COLLATION_CONNECTION varchar(32) NO
DATABASE_COLLATION varchar(32) NO
@@ -70,8 +70,8 @@ TRIGGERS CREATE TEMPORARY TABLE `TRIGGERS` (
`ACTION_REFERENCE_OLD_ROW` varchar(3) NOT NULL DEFAULT '',
`ACTION_REFERENCE_NEW_ROW` varchar(3) NOT NULL DEFAULT '',
`CREATED` datetime DEFAULT NULL,
- `SQL_MODE` longtext NOT NULL,
- `DEFINER` longtext NOT NULL,
+ `SQL_MODE` varchar(8192) NOT NULL DEFAULT '',
+ `DEFINER` varchar(77) NOT NULL DEFAULT '',
`CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '',
`COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '',
`DATABASE_COLLATION` varchar(32) NOT NULL DEFAULT ''
@@ -95,8 +95,8 @@ ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL
ACTION_REFERENCE_OLD_ROW varchar(3) NO
ACTION_REFERENCE_NEW_ROW varchar(3) NO
CREATED datetime YES NULL
-SQL_MODE longtext NO NULL
-DEFINER longtext NO NULL
+SQL_MODE varchar(8192) NO
+DEFINER varchar(77) NO
CHARACTER_SET_CLIENT varchar(32) NO
COLLATION_CONNECTION varchar(32) NO
DATABASE_COLLATION varchar(32) NO
diff --git a/mysql-test/suite/rpl/r/rpl_insert_id.result b/mysql-test/suite/rpl/r/rpl_insert_id.result
index 76e405c68de..e171e247b6c 100644
--- a/mysql-test/suite/rpl/r/rpl_insert_id.result
+++ b/mysql-test/suite/rpl/r/rpl_insert_id.result
@@ -398,8 +398,6 @@ f1()
INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()),
(NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2());
INSERT INTO t1 VALUES (NULL, f2());
-INSERT INTO t1 VALUES (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID(5)),
-(NULL, @@LAST_INSERT_ID);
INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
UPDATE t1 SET j= -1 WHERE i IS NULL;
INSERT INTO t1 (i) VALUES (NULL);
@@ -422,20 +420,17 @@ i j
11 3
12 3
13 8
-14 13
-15 5
-16 13
-17 -1
-18 14
-19 0
-20 0
+14 -1
+15 13
+16 0
+17 0
SELECT * FROM t2 ORDER BY i;
i
2
3
5
6
-19
+16
SELECT * FROM t1;
i j
1 -1
@@ -451,20 +446,17 @@ i j
11 3
12 3
13 8
-14 13
-15 5
-16 13
-17 -1
-18 14
-19 0
-20 0
+14 -1
+15 13
+16 0
+17 0
SELECT * FROM t2;
i
2
3
5
6
-19
+16
DROP PROCEDURE p1;
DROP FUNCTION f1;
DROP FUNCTION f2;
diff --git a/mysql-test/suite/rpl/r/rpl_row_stop_middle.result b/mysql-test/suite/rpl/r/rpl_row_stop_middle.result
deleted file mode 100644
index 46ca5748174..00000000000
--- a/mysql-test/suite/rpl/r/rpl_row_stop_middle.result
+++ /dev/null
@@ -1,26 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-create table t1 (a int not null auto_increment primary key, b int, key(b));
-stop slave;
-INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-start slave;
-stop slave;
-drop table t1;
-drop table t1;
diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle.test b/mysql-test/suite/rpl/t/rpl_row_stop_middle.test
deleted file mode 100644
index bc169bebfcd..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_stop_middle.test
+++ /dev/null
@@ -1,45 +0,0 @@
-# Test for BUG#11729: see if, when STOP SLAVE occurs while the slave
-# SQL thread has processed a Table_map_log_event but has not processed
-# the last Rows_log_event associated to it, the slave thread does not
-# forget to close its tables.
-
-# Can be run with statement-based but no interest (and long test)
---source include/have_binlog_format_row.inc
---source include/master-slave.inc
-
-connection master;
-create table t1 (a int not null auto_increment primary key, b int, key(b));
-sync_slave_with_master;
-stop slave;
-connection master;
-INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-INSERT INTO t1 (a) SELECT null FROM t1;
-
-connection slave;
-start slave;
-
-# hope one second is not enough for slave to reach the last
-# Rows_log_event, so that test actually tests something.
-
-let $wait_condition= SELECT COUNT(*) >= 10 FROM t1;
---source include/wait_condition.inc
-stop slave;
-
-# see if slave hangs on DROP TABLE
-
-drop table t1;
-
-connection master; # cleanup
-drop table t1;
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 662f9095810..8502ba3f3d3 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -947,4 +947,34 @@ ALTER TABLE t1 CHANGE d c varchar(10);
--disable_info
DROP TABLE t1;
+#
+# Bug#39372 "Smart" ALTER TABLE not so smart after all.
+#
+create table t1(f1 int not null, f2 int not null, key (f1), key (f2));
+let $count= 50;
+--disable_query_log
+while ($count)
+{
+ EVAL insert into t1 values (1,1),(1,1),(1,1),(1,1),(1,1);
+ EVAL insert into t1 values (2,2),(2,2),(2,2),(2,2),(2,2);
+ dec $count ;
+}
+--enable_query_log
+
+select index_length into @unpaked_keys_size from
+information_schema.tables where table_name='t1';
+alter table t1 pack_keys=1;
+select index_length into @paked_keys_size from
+information_schema.tables where table_name='t1';
+select (@unpaked_keys_size > @paked_keys_size);
+
+select max_data_length into @orig_max_data_length from
+information_schema.tables where table_name='t1';
+alter table t1 max_rows=100;
+select max_data_length into @changed_max_data_length from
+information_schema.tables where table_name='t1';
+select (@orig_max_data_length > @changed_max_data_length);
+
+drop table t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 689f2fe8064..a2c875301f8 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -11,7 +11,6 @@
##############################################################################
federated_transactions : Bug#29523 Transactions do not work
csv_alter_table : Bug#33696 2008-01-21 pcrews no .result file - bug allows NULL columns in CSV tables
-thread_cache_size_func : Bug#36733 main.thread_cache_size_func fails randomly
log_tables.test : Bug #37798: main.log_tables fails randomly on powermacg5 and windows
slow_query_log_func.test : Bug #37962: *_func tests containing sleeps/race conditions
events-bugs.test : Bug #39848, Bug #39863, Bug #39569, Bug #37774
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
index c9ae8aceaf6..0247aca82df 100644
--- a/mysql-test/t/explain.test
+++ b/mysql-test/t/explain.test
@@ -94,4 +94,33 @@ EXPLAIN SELECT 1 FROM
DROP TABLE t2;
DROP TABLE t1;
+#
+# Bug #34773: query with explain extended and derived table / other table
+# crashes server
+#
+
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT);
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1),(2);
+
+EXPLAIN EXTENDED SELECT 1
+ FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
+
+EXPLAIN EXTENDED SELECT 1
+ FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
+
+prepare s1 from
+'EXPLAIN EXTENDED SELECT 1
+ FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
+execute s1;
+
+prepare s1 from
+'EXPLAIN EXTENDED SELECT 1
+ FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
+execute s1;
+execute s1;
+
+DROP TABLE t1,t2;
+
# End of 5.0 tests.
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index bb9cb127d07..4027293da66 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1338,4 +1338,12 @@ where state='User sleep' and
info='select * from information_schema.columns where 1=sleep(100000)';
--source include/wait_condition.inc
+
+#
+# Bug#38918 selecting from information_schema.columns is disproportionately slow
+#
+explain select count(*) from information_schema.tables;
+explain select count(*) from information_schema.columns;
+explain select count(*) from information_schema.views;
+
--echo End of 5.1 tests.
diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test
index 9cccca1adc3..5847b90367a 100644
--- a/mysql-test/t/limit.test
+++ b/mysql-test/t/limit.test
@@ -95,3 +95,11 @@ set @a=-14632475938453979136;
execute s using @a, @a;
--echo End of 5.0 tests
+
+#
+# Bug#37075: offset of limit clause might be truncated to 0 on 32-bits server w/o big tables
+#
+
+select 1 as a limit 4294967296,10;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test
index 34086336fa8..bdd22538c14 100644
--- a/mysql-test/t/log_tables.test
+++ b/mysql-test/t/log_tables.test
@@ -10,6 +10,21 @@
--disable_ps_protocol
use mysql;
+# Capture initial settings of system variables
+# so that we can revert to old state after manipulation for testing
+# NOTE: PLEASE USE THESE VALUES TO 'RESET' SYSTEM VARIABLES
+# Capturing old values within the tests results in loss of values
+# due to people not paying attention to previous tests' changes, captures
+# or improper cleanup
+SET @saved_long_query_time = @@long_query_time;
+SET @saved_log_output = @@log_output;
+SET @saved_general_log = @@GLOBAL.general_log;
+SET @saved_slow_query_log = @@GLOBAL.slow_query_log;
+
+SELECT @saved_long_query_time, @saved_log_output, @saved_general_log, @saved_slow_query_log;
+
+
+
#
# Check that log tables work and we can do basic selects. This also
# tests truncate, which works in a special mode with the log tables
@@ -161,6 +176,7 @@ set session long_query_time=1;
select sleep(2);
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
select * from mysql.slow_log;
+set @@session.long_query_time = @saved_long_query_time;
#
# Bug #18559 log tables cannot change engine, and gets deadlocked when
@@ -305,6 +321,7 @@ unlock tables;
# Bug #21785 Server crashes after rename of the log table
#
+SET SESSION long_query_time = 1000;
--disable_warnings
drop table if exists mysql.renamed_general_log;
drop table if exists mysql.renamed_slow_log;
@@ -365,6 +382,7 @@ set global slow_query_log='ON';
RENAME TABLE general_log2 TO general_log;
RENAME TABLE slow_log2 TO slow_log;
+SET SESSION long_query_time = @saved_long_query_time;
# this should work
set global general_log='ON';
@@ -476,8 +494,6 @@ ALTER TABLE mysql.general_log ENGINE = CSV;
## test the slow query log
-SET @old_long_query_time:=@@long_query_time;
-
SET GLOBAL slow_query_log = 0;
FLUSH LOGS;
@@ -503,12 +519,14 @@ SELECT "My own slow query", sleep(2);
SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3;
SET GLOBAL slow_query_log = 0;
-SET SESSION long_query_time =@old_long_query_time;
+SET SESSION long_query_time =@saved_long_query_time;
FLUSH LOGS;
ALTER TABLE mysql.slow_log DROP COLUMN seq;
ALTER TABLE mysql.slow_log ENGINE = CSV;
+SET GLOBAL slow_query_log = @saved_slow_query_log;
+
#
# Bug#25422 (Hang with log tables)
#
@@ -790,9 +808,6 @@ END //
DELIMITER ;//
-SET @old_general_log_state = @@global.general_log;
-SET @old_slow_log_state = @@global.slow_query_log;
-
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
@@ -814,8 +829,8 @@ DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
DROP DATABASE IF EXISTS `db_17876`;
-SET GLOBAL general_log = @old_general_log_state;
-SET GLOBAL slow_query_log = @old_slow_log_state;
+SET GLOBAL general_log = @saved_general_log;
+SET GLOBAL slow_query_log = @saved_slow_query_log;
#
# Bug#21557 entries in the general query log truncated at 1000 characters.
@@ -823,7 +838,6 @@ SET GLOBAL slow_query_log = @old_slow_log_state;
select CONNECTION_ID() into @thread_id;
truncate table mysql.general_log;
-set @old_general_log_state = @@global.general_log;
set global general_log = on;
--disable_result_log
set @lparam = "000 001 002 003 004 005 006 007 008 009"
@@ -934,7 +948,7 @@ execute long_query using @lparam;
set global general_log = off;
select command_type, argument from mysql.general_log where thread_id = @thread_id;
deallocate prepare long_query;
-set global general_log = @old_general_log_state;
+set global general_log = @saved_general_log;
#
# Bug#34306: Can't make copy of log tables when server binary log is enabled
@@ -948,9 +962,6 @@ DROP TABLE IF EXISTS general_log_copy;
CREATE TABLE log_count (count BIGINT(21));
-SET @old_general_log_state = @@global.general_log;
-SET @old_slow_log_state = @@global.slow_query_log;
-
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
@@ -977,15 +988,14 @@ INSERT INTO general_log_copy SELECT * FROM mysql.general_log;
INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log));
DROP TABLE general_log_copy;
-SET GLOBAL general_log = @old_general_log_state;
-SET GLOBAL slow_query_log = @old_slow_log_state;
+SET GLOBAL general_log = @saved_general_log;
+SET GLOBAL slow_query_log = @saved_slow_query_log;
DROP TABLE log_count;
#
# Bug #31700: thd->examined_row_count not incremented for 'const' type queries
#
-SET @old_slow_log_state = @@global.slow_query_log;
SET SESSION long_query_time = 0;
SET GLOBAL slow_query_log = ON;
@@ -1010,5 +1020,10 @@ DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log;
-SET GLOBAL slow_query_log = @old_slow_log_state;
-SET SESSION long_query_time =@old_long_query_time;
+# RESET altered system variables before exiting the test
+SET GLOBAL slow_query_log = @saved_slow_query_log;
+SET GLOBAL general_log=@saved_general_log;
+SET SESSION long_query_time =@saved_long_query_time;
+SET GLOBAL LOG_OUTPUT = @saved_log_output;
+
+
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index fd1336491aa..dd3e4e28aeb 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -456,7 +456,7 @@ CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t1);
SELECT * FROM t2;
DROP TABLE t1, t2;
CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3);
---error ER_NO_SUCH_TABLE
+--error 1168
SELECT * FROM t2;
DROP TABLE t2;
@@ -548,11 +548,11 @@ drop table t1;
# CREATE TABLE fails
#
CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2);
---error ER_NO_SUCH_TABLE
+--error 1168
SELECT * FROM tm1;
CHECK TABLE tm1;
CREATE TABLE t1(a INT);
---error ER_NO_SUCH_TABLE
+--error 1168
SELECT * FROM tm1;
CHECK TABLE tm1;
CREATE TABLE t2(a BLOB);
@@ -878,7 +878,7 @@ DROP TABLE t4;
--echo # 2. Normal rename.
SELECT * FROM t3 ORDER BY c1;
RENAME TABLE t2 TO t5;
---error ER_NO_SUCH_TABLE
+--error 1168
SELECT * FROM t3 ORDER BY c1;
RENAME TABLE t5 TO t2;
SELECT * FROM t3 ORDER BY c1;
@@ -896,7 +896,7 @@ UNLOCK TABLES;
--echo #
--echo # 4. Alter table rename.
ALTER TABLE t2 RENAME TO t5;
---error ER_NO_SUCH_TABLE
+--error 1168
SELECT * FROM t3 ORDER BY c1;
ALTER TABLE t5 RENAME TO t2;
SELECT * FROM t3 ORDER BY c1;
@@ -956,7 +956,7 @@ CREATE TABLE t2 (c1 INT, INDEX(c1)) ENGINE=MRG_MYISAM UNION=(t1)
LOCK TABLES t1 WRITE, t2 WRITE;
INSERT INTO t1 VALUES (1);
DROP TABLE t1;
---error ER_NO_SUCH_TABLE
+--error 1168
SELECT * FROM t2;
--error ER_NO_SUCH_TABLE
SELECT * FROM t1;
@@ -1395,6 +1395,19 @@ UNLOCK TABLES;
DROP TABLE t1, m1;
#
+# Bug#35068 - Assertion fails when reading from i_s.tables
+# and there is incorrect merge table
+#
+CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=FIRST;
+--replace_column 8 # 9 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 17 # 19 # 20 #
+SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE
+TABLE_SCHEMA = 'test' and TABLE_NAME='tm1';
+
+DROP TABLE tm1;
+
+--echo End of 5.1 tests
+
+#
# Bug#36006 - Optimizer does table scan for select count(*)
#
CREATE TABLE t1(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test
index 65c062399b7..a10767579fb 100644
--- a/mysql-test/t/metadata.test
+++ b/mysql-test/t/metadata.test
@@ -112,4 +112,21 @@ SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1 ORDER BY v2.c2;
DROP VIEW v1,v2;
DROP TABLE t1,t2;
+#
+# Bug #39283: Date returned as VARBINARY to client for queries
+# with COALESCE and JOIN
+#
+
+CREATE TABLE t1 (i INT, d DATE);
+INSERT INTO t1 VALUES (1, '2008-01-01'), (2, '2008-01-02'), (3, '2008-01-03');
+
+--enable_metadata
+--sorted_result
+SELECT COALESCE(d, d), IFNULL(d, d), IF(i, d, d),
+ CASE i WHEN i THEN d ELSE d END, GREATEST(d, d), LEAST(d, d)
+ FROM t1 ORDER BY RAND(); # force filesort
+--disable_metadata
+
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index bf4cc37a80f..f09c1aa7bd4 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -847,6 +847,26 @@ set session max_sort_length= 2180;
select * from t1 order by b;
drop table t1;
+
+--echo #
+--echo # Bug #39844: Query Crash Mysql Server 5.0.67
+--echo #
+
+CREATE TABLE t1 (a INT PRIMARY KEY);
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
+CREATE TABLE t3 (c INT);
+
+INSERT INTO t1 (a) VALUES (1), (2);
+INSERT INTO t2 (a,b) VALUES (1,2), (2,3);
+INSERT INTO t3 (c) VALUES (1), (2);
+
+SELECT
+ (SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a)
+ FROM t3;
+
+DROP TABLE t1, t2, t3;
+
+
#
# Bug #35206: select query result different if the key is indexed or not
#
diff --git a/mysql-test/t/ps_11bugs.test b/mysql-test/t/ps_11bugs.test
index 515bcc03c1a..ccab833e878 100644
--- a/mysql-test/t/ps_11bugs.test
+++ b/mysql-test/t/ps_11bugs.test
@@ -177,4 +177,41 @@ select * from t2;
drop table t1;
drop table t2;
+#
+# Bug #32124: crash if prepared statements refer to variables in the where
+# clause
+#
+
+CREATE TABLE t1 (a INT);
+PREPARE stmt FROM 'select 1 from `t1` where `a` = any (select (@@tmpdir))';
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
+CREATE TABLE t2 (a INT PRIMARY KEY);
+INSERT INTO t2 VALUES (400000), (400001);
+
+SET @@sort_buffer_size=400000;
+
+DELIMITER |;
+
+CREATE FUNCTION p1(i INT) RETURNS INT
+BEGIN
+ SET @@sort_buffer_size= i;
+ RETURN i + 1;
+END|
+
+DELIMITER ;|
+
+SELECT * FROM t2 WHERE a = @@sort_buffer_size AND p1(@@sort_buffer_size + 1) > a - 1;
+
+DROP TABLE t2;
+DROP FUNCTION p1;
+
+
+SELECT CONCAT(@@sort_buffer_size);
+SELECT LEFT("12345", @@ft_boolean_syntax);
+
+SET @@sort_buffer_size=DEFAULT;
+
--echo End of 5.0 tests.
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index c1e8d4b6f6c..632201a9e77 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -8041,6 +8041,28 @@ delimiter ;$
call `p2`('s s s s s s');
drop procedure `p2`;
+#
+# Bug#38823: Invalid memory access when a SP statement does wildcard expansion
+#
+
+--disable_warnings
+drop table if exists t1;
+drop procedure if exists p1;
+--enable_warnings
+
+delimiter $;
+create procedure p1() begin select * from t1; end$
+--error ER_NO_SUCH_TABLE
+call p1$
+create table t1 (a integer)$
+call p1$
+alter table t1 add b integer;
+call p1$
+delimiter ;$
+
+drop table t1;
+drop procedure p1;
+
--echo # ------------------------------------------------------------------
--echo # -- End of 5.0 tests
--echo # ------------------------------------------------------------------
diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test
index ec13f8af705..7c3d5013b8d 100644
--- a/mysql-test/t/subselect3.test
+++ b/mysql-test/t/subselect3.test
@@ -618,6 +618,28 @@ SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0);
DROP TABLE t1, t2;
+#
+# Bug #37894: Assertion in init_read_record_seq in handler.h line 1444
+#
+
+CREATE TABLE t1 (
+ pk INT PRIMARY KEY,
+ int_key INT,
+ varchar_key VARCHAR(5) UNIQUE,
+ varchar_nokey VARCHAR(5)
+);
+INSERT INTO t1 VALUES (9, 7,NULL,NULL), (10,8,'p' ,'p');
+
+SELECT varchar_nokey
+FROM t1
+WHERE NULL NOT IN (
+ SELECT INNR.pk FROM t1 AS INNR2
+ LEFT JOIN t1 AS INNR ON ( INNR2.int_key = INNR.int_key )
+ WHERE INNR.varchar_key > 'n{'
+);
+
+DROP TABLE t1;
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/thread_cache_size_func.test b/mysql-test/t/thread_cache_size_func.test
index 302f66a36c6..fe9f4242c0d 100644
--- a/mysql-test/t/thread_cache_size_func.test
+++ b/mysql-test/t/thread_cache_size_func.test
@@ -1,26 +1,27 @@
-############# mysql-test\t\thread_cache_size_func.test #######################################
-# #
-# Variable Name: thread_cache_size #
-# Scope: SESSION #
-# Access Type: Dynamic #
-# Data Type: Enumeration #
-# Default Value: 0 #
-# Values: 0-16384 #
-# #
-# #
-# Creation Date: 2008-03-02 #
-# Author: Sharique Abdullah #
-# #
-# Description: Test Cases of Dynamic System Variable "thread_cache_size" #
-# that checks behavior of this variable in the following ways #
-# * Functionality based on different values #
-# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
-# option_mysqld_thread_cache_size #
-# #
-#########################################################################################
-
-
+############# mysql-test\t\thread_cache_size_func.test ##########################
+# #
+# Variable Name: thread_cache_size #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: Enumeration #
+# Default Value: 0 #
+# Values: 0-16384 #
+# #
+# #
+# Creation Date: 2008-03-02 #
+# Author: Sharique Abdullah #
+# #
+# Modified: HHunger 2008-08-27 Reduced test to needed function and inserted #
+# wait-loops #
+# #
+# Description: Test Cases of Dynamic System Variable "thread_cache_size" #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+#################################################################################
#
# Setup
@@ -32,41 +33,31 @@ SET @global_thread_cache_size = @@GLOBAL.thread_cache_size;
FLUSH STATUS;
-#
-# Greater than cache threads, setting cache size to 3
-#
-- ECHO '# Test1#'
SET @@GLOBAL.thread_cache_size=3;
-
-let $threadsCreated1 = query_get_value(SHOW STATUS LIKE 'Threads_created', Value, 1);
---echo Saving threads cached, threads created values
-
SHOW STATUS LIKE 'Threads_cached';
--echo 0 Expected
---ECHO '#Old value for thread_cache'#
-
##################################
# Make 4 connections #
##################################
--echo ** Connecting conn1 using username 'root' **
-connect (conn1,localhost,root,,);
+CONNECT (conn1,localhost,root,,);
--echo ** Connecting conn2 using username 'root' **
-connect (conn2,localhost,root,,);
+CONNECT (conn2,localhost,root,,);
--echo ** Connecting conn3 using username 'root' **
-connect (conn3,localhost,root,,);
+CONNECT (conn3,localhost,root,,);
--echo ** Connecting conn4 using username 'root' **
-connect (conn4,localhost,root,,);
+CONNECT (conn4,localhost,root,,);
-let $threadsCreated2 = query_get_value(SHOW STATUS LIKE 'Threads_created', Value, 1);
---echo Saving threads cached, threads created values
+--echo ** Connection default **
+CONNECTION default;
---disable_query_log
-eval SELECT ($threadsCreated2 - $threadsCreated1) AS 'Threads Created Difference';
---enable_query_log
+# Wait until all connections done
+let $wait_condition= SELECT COUNT(*)= 5 FROM INFORMATION_SCHEMA.PROCESSLIST;
+--source include/wait_condition.inc
---echo 4 Expected
SHOW STATUS LIKE 'Threads_cached';
--echo 0 Expected
@@ -74,85 +65,54 @@ SHOW STATUS LIKE 'Threads_cached';
#Disconnecting all the connections #
####################################
---echo ** Connection default **
-connection default;
-
--echo ** Disconnecting conn1,conn2,conn3,conn4 **
-disconnect conn1;
-disconnect conn2;
-disconnect conn3;
-disconnect conn4;
+DISCONNECT conn1;
+DISCONNECT conn2;
+DISCONNECT conn3;
+DISCONNECT conn4;
#
# Checking the status
#
---echo '#new values for thread cache after disconnecting'#
-let $threadsCreated3 = query_get_value(SHOW STATUS LIKE 'Threads_created', Value, 1);
+# Wait until all disconnects ready
+let $wait_condition= SELECT COUNT(*)= 1 FROM INFORMATION_SCHEMA.PROCESSLIST;
+--source include/wait_condition.inc
---echo Saving threads cached, threads created values
---disable_query_log
-eval SELECT ($threadsCreated3 - $threadsCreated2) AS 'Threads Created Difference';
---enable_query_log
---echo 0 Expected
SHOW STATUS LIKE 'Threads_cached';
--echo 3 Expected
-
#
# Decreasing cache size to 1
#
-SET @@GLOBAL.thread_cache_size=1;
-
-connection default;
-
-let $threadsCreated6 = query_get_value(SHOW STATUS LIKE 'Threads_created', Value, 1);
---echo Saving threads cached, threads created values
---disable_query_log
-eval SELECT $threadsCreated6 - $threadsCreated3 AS 'Threads Created Difference';
---enable_query_log
---echo 0 Expected
-SHOW STATUS LIKE 'Threads_cached';
---echo 1 Expected
---echo Bug: The number of threads cached should have decreased with cache size decrease.
+SET @@GLOBAL.thread_cache_size= 1;
--echo ** Connecting conn1 using username 'root' **
CONNECT (conn1,localhost,root,,);
--echo ** Connecting conn2 using username 'root' **
CONNECT (conn2,localhost,root,,);
-let $threadsCreated4 = query_get_value(SHOW STATUS LIKE 'Threads_created', Value, 1);
---echo Saving threads cached, threads created values
---disable_query_log
-eval SELECT $threadsCreated4 - $threadsCreated3 AS 'Threads Created Difference';
---enable_query_log
---echo 1 Expected
---echo Bug: The number of threads created should have increased because the cache should have 1 thread only
-SHOW STATUS LIKE 'Threads_cached';
---echo 0 Expected
---echo Bug: The number of threads created should have decreased because atleast 1 new connection came in
+--echo connection default;
+CONNECTION default;
---echo ** Connection default **
-connection default;
+# Wait until all connects ready
+let $wait_condition= SELECT COUNT(*)= 3 FROM INFORMATION_SCHEMA.PROCESSLIST;
+--source include/wait_condition.inc
--echo ** Disconnecting conn1,conn2 **
-disconnect conn1;
-disconnect conn2;
-
---ECHO '#new status values for thread cache'#
-let $threadsCreated5 = query_get_value(SHOW STATUS LIKE 'Threads_created', Value, 1);
---echo Saving threads cached, threads created values
---disable_query_log
-eval SELECT ($threadsCreated5 - $threadsCreated4) AS 'Threads Created Difference';
---enable_query_log
---echo 0 Expected
+DISCONNECT conn1;
+DISCONNECT conn2;
+
+# Wait until all disconnects ready
+let $wait_condition= SELECT COUNT(*)= 1 FROM INFORMATION_SCHEMA.PROCESSLIST;
+--source include/wait_condition.inc
+
SHOW STATUS LIKE 'Threads_cached';
--echo 1 Expected
---echo Saving threads cached, threads created values
-
#
# Cleanup
#
SET @@GLOBAL.thread_cache_size = @global_thread_cache_size;
+
diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test
index 92ca0c3a3ec..6871caaa756 100644..100755
--- a/mysql-test/t/windows.test
+++ b/mysql-test/t/windows.test
@@ -33,6 +33,7 @@ drop table t1;
#
CREATE TABLE t1 (a int, b int); INSERT INTO t1 VALUES (1,1);
EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
+DROP TABLE t1;
--echo End of 5.0 tests.
diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp
index cb1b07c83b0..64c439314a9 100644
--- a/mysql-test/valgrind.supp
+++ b/mysql-test/valgrind.supp
@@ -444,6 +444,15 @@
fun:_dl_open
}
+{
+ libc pthread_exit 8
+ Memcheck:Leak
+ fun:malloc
+ fun:local_strdup
+ fun:_dl_map_object
+ fun:dl_open_worker
+}
+
#
# This is seen internally in the system libraries on 64-bit RHAS3.
#
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index 49003553f0b..8f9928026ba 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -438,9 +438,33 @@ int my_pthread_fastmutex_init(my_pthread_fastmutex_t *mp,
mp->spins= MY_PTHREAD_FASTMUTEX_SPINS;
else
mp->spins= 0;
+ mp->rng_state= 1;
return pthread_mutex_init(&mp->mutex, attr);
}
+/**
+ Park-Miller random number generator. A simple linear congruential
+ generator that operates in multiplicative group of integers modulo n.
+
+ x_{k+1} = (x_k g) mod n
+
+ Popular pair of parameters: n = 2^32 − 5 = 4294967291 and g = 279470273.
+ The period of the generator is about 2^31.
+ Largest value that can be returned: 2147483646 (RAND_MAX)
+
+ Reference:
+
+ S. K. Park and K. W. Miller
+ "Random number generators: good ones are hard to find"
+ Commun. ACM, October 1988, Volume 31, No 10, pages 1192-1201.
+*/
+
+static double park_rng(my_pthread_fastmutex_t *mp)
+{
+ mp->rng_state= ((my_ulonglong)mp->rng_state * 279470273U) % 4294967291U;
+ return (mp->rng_state / 2147483647.0);
+}
+
int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp)
{
int res;
@@ -458,8 +482,7 @@ int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp)
return res;
mutex_delay(maxdelay);
- maxdelay += ((double) random() / (double) RAND_MAX) *
- MY_PTHREAD_FASTMUTEX_DELAY + 1;
+ maxdelay += park_rng(mp) * MY_PTHREAD_FASTMUTEX_DELAY + 1;
}
return pthread_mutex_lock(&mp->mutex);
}
diff --git a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh
index f05761bb837..60d972e1c8b 100644
--- a/scripts/mysqldumpslow.sh
+++ b/scripts/mysqldumpslow.sh
@@ -83,7 +83,7 @@ while ( defined($_ = shift @pending) or defined($_ = <>) ) {
s/^#? Time: \d{6}\s+\d+:\d+:\d+.*\n//;
my ($user,$host) = s/^#? User\@Host:\s+(\S+)\s+\@\s+(\S+).*\n// ? ($1,$2) : ('','');
- s/^# Query_time: (\d+) Lock_time: (\d+) Rows_sent: (\d+).*\n//;
+ s/^# Query_time: ([0-9.]+)\s+Lock_time: ([0-9.]+)\s+Rows_sent: ([0-9.]+).*\n//;
my ($t, $l, $r) = ($1, $2, $3);
$t -= $l unless $opt{l};
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 5ab29aff69c..cfd049e1864 100755
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -27,9 +27,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/zlib
)
-SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/message.rc
- ${CMAKE_SOURCE_DIR}/sql/message.h
- ${CMAKE_SOURCE_DIR}/sql/sql_yacc.h
+SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/sql_yacc.h
${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc
${CMAKE_SOURCE_DIR}/include/mysql_version.h
${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc
@@ -135,14 +133,6 @@ ADD_CUSTOM_COMMAND(
--output=sql_yacc.cc sql_yacc.yy
DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy)
-IF(WIN32)
- # Windows message file
- ADD_CUSTOM_COMMAND(
- OUTPUT ${PROJECT_SOURCE_DIR}/sql/message.h
-# ${PROJECT_SOURCE_DIR}/sql/message.rc
- COMMAND mc ARGS message.mc
- DEPENDS ${PROJECT_SOURCE_DIR}/sql/message.mc)
-ENDIF(WIN32)
# Gen_lex_hash
ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
@@ -165,7 +155,7 @@ ADD_DEPENDENCIES(mysqld GenServerSource)
# Remove the auto-generated files as part of 'Clean Solution'
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
- "lex_hash.h;message.rc;message.h;sql_yacc.h;sql_yacc.cc")
+ "lex_hash.h;sql_yacc.h;sql_yacc.cc")
ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
ADD_DEPENDENCIES(udf_example strings GenError)
diff --git a/sql/MSG00001.bin b/sql/MSG00001.bin
new file mode 100644
index 00000000000..89f547694f5
--- /dev/null
+++ b/sql/MSG00001.bin
Binary files differ
diff --git a/sql/Makefile.am b/sql/Makefile.am
index b9de9b279a3..e477a6123ec 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -146,8 +146,10 @@ DEFS = -DMYSQL_SERVER \
BUILT_MAINT_SRC = sql_yacc.cc sql_yacc.h
BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h link_sources
EXTRA_DIST = udf_example.c udf_example.def $(BUILT_MAINT_SRC) \
- nt_servc.cc nt_servc.h message.mc CMakeLists.txt \
- udf_example.c udf_example.def
+ nt_servc.cc nt_servc.h \
+ message.mc message.h message.rc MSG00001.bin \
+ CMakeLists.txt
+
CLEANFILES = lex_hash.h sql_yacc.output link_sources
DISTCLEANFILES = $(EXTRA_PROGRAMS)
MAINTAINERCLEANFILES = $(BUILT_MAINT_SRC)
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index 5655a8acc99..d9d010783e8 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -301,12 +301,6 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event)
goto end;
}
- sql_print_information("Event Scheduler: "
- "[%s].[%s.%s] started in thread %lu.",
- job_data.definer.str,
- job_data.dbname.str, job_data.name.str,
- thd->thread_id);
-
thd->enable_slow_log= TRUE;
res= job_data.execute(thd, event->dropped);
@@ -318,13 +312,6 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event)
"[%s].[%s.%s] event execution failed.",
job_data.definer.str,
job_data.dbname.str, job_data.name.str);
- else
- sql_print_information("Event Scheduler: "
- "[%s].[%s.%s] executed successfully in thread %lu.",
- job_data.definer.str,
- job_data.dbname.str, job_data.name.str,
- thd->thread_id);
-
end:
DBUG_PRINT("info", ("Done with Event %s.%s", event->dbname.str,
event->name.str));
diff --git a/sql/item.cc b/sql/item.cc
index 93d00c287ae..7b7c44b4719 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1805,7 +1805,8 @@ Item_field::Item_field(THD *thd, Name_resolution_context *context_arg,
be allocated in the statement memory, not in table memory (the table
structure can go away and pop up again between subsequent executions
of a prepared statement or after the close_tables_for_reopen() call
- in mysql_multi_update_prepare()).
+ in mysql_multi_update_prepare() or due to wildcard expansion in stored
+ procedures).
*/
{
if (db_name)
@@ -2385,17 +2386,15 @@ void Item_string::print(String *str, enum_query_type query_type)
}
-double Item_string::val_real()
+double
+double_from_string_with_check (CHARSET_INFO *cs, const char *cptr, char *end)
{
- DBUG_ASSERT(fixed == 1);
int error;
- char *end, *org_end;
+ char *org_end;
double tmp;
- CHARSET_INFO *cs= str_value.charset();
- org_end= (char*) str_value.ptr() + str_value.length();
- tmp= my_strntod(cs, (char*) str_value.ptr(), str_value.length(), &end,
- &error);
+ org_end= end;
+ tmp= my_strntod(cs, (char*) cptr, end - cptr, &end, &error);
if (error || (end != org_end && !check_if_only_end_space(cs, end, org_end)))
{
/*
@@ -2405,26 +2404,28 @@ double Item_string::val_real()
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), "DOUBLE",
- str_value.ptr());
+ cptr);
}
return tmp;
}
-/**
- @todo
- Give error if we wanted a signed integer and we got an unsigned one
-*/
-longlong Item_string::val_int()
+double Item_string::val_real()
{
DBUG_ASSERT(fixed == 1);
+ return double_from_string_with_check (str_value.charset(), str_value.ptr(),
+ (char *) str_value.ptr() + str_value.length());
+}
+
+
+longlong
+longlong_from_string_with_check (CHARSET_INFO *cs, const char *cptr, char *end)
+{
int err;
longlong tmp;
- char *end= (char*) str_value.ptr()+ str_value.length();
char *org_end= end;
- CHARSET_INFO *cs= str_value.charset();
- tmp= (*(cs->cset->strtoll10))(cs, str_value.ptr(), &end, &err);
+ tmp= (*(cs->cset->strtoll10))(cs, cptr, &end, &err);
/*
TODO: Give error if we wanted a signed integer and we got an unsigned
one
@@ -2435,12 +2436,24 @@ longlong Item_string::val_int()
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER",
- str_value.ptr());
+ cptr);
}
return tmp;
}
+/**
+ @todo
+ Give error if we wanted a signed integer and we got an unsigned one
+*/
+longlong Item_string::val_int()
+{
+ DBUG_ASSERT(fixed == 1);
+ return longlong_from_string_with_check(str_value.charset(), str_value.ptr(),
+ (char *) str_value.ptr()+ str_value.length());
+}
+
+
my_decimal *Item_string::val_decimal(my_decimal *decimal_value)
{
return val_decimal_from_string(decimal_value);
@@ -6942,7 +6955,7 @@ enum_field_types Item_type_holder::get_real_type(Item *item)
*/
Item_sum *item_sum= (Item_sum *) item;
if (item_sum->keep_field_type())
- return get_real_type(item_sum->args[0]);
+ return get_real_type(item_sum->get_arg(0));
break;
}
case FUNC_ITEM:
@@ -7206,7 +7219,7 @@ void Item_type_holder::get_full_info(Item *item)
if (item->type() == Item::SUM_FUNC_ITEM &&
(((Item_sum*)item)->sum_func() == Item_sum::MAX_FUNC ||
((Item_sum*)item)->sum_func() == Item_sum::MIN_FUNC))
- item = ((Item_sum*)item)->args[0];
+ item = ((Item_sum*)item)->get_arg(0);
/*
We can have enum/set type after merging only if we have one enum|set
field (or MIN|MAX(enum|set field)) and number of NULL fields
diff --git a/sql/item.h b/sql/item.h
index 00a2759a739..a3c3cbc78c1 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1981,6 +1981,11 @@ private:
};
+longlong
+longlong_from_string_with_check (CHARSET_INFO *cs, const char *cptr, char *end);
+double
+double_from_string_with_check (CHARSET_INFO *cs, const char *cptr, char *end);
+
class Item_static_string_func :public Item_string
{
const char *func_name;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index d7e6fc1f8f2..185100bf125 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4800,36 +4800,398 @@ Item_func_get_system_var::
Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg,
LEX_STRING *component_arg, const char *name_arg,
size_t name_len_arg)
- :var(var_arg), var_type(var_type_arg), component(*component_arg)
+ :var(var_arg), var_type(var_type_arg), orig_var_type(var_type_arg),
+ component(*component_arg), cache_present(0)
{
/* set_name() will allocate the name */
set_name(name_arg, name_len_arg, system_charset_info);
}
-bool
-Item_func_get_system_var::fix_fields(THD *thd, Item **ref)
+bool Item_func_get_system_var::is_written_to_binlog()
{
- Item *item;
- DBUG_ENTER("Item_func_get_system_var::fix_fields");
+ return var->is_written_to_binlog(var_type);
+}
+
+
+void Item_func_get_system_var::fix_length_and_dec()
+{
+ maybe_null=0;
+
+ if (var->check_type(var_type))
+ {
+ if (var_type != OPT_DEFAULT)
+ {
+ my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0),
+ var->name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
+ return;
+ }
+ /* As there was no local variable, return the global value */
+ var_type= OPT_GLOBAL;
+ }
+
+ switch (var->show_type())
+ {
+ case SHOW_LONG:
+ case SHOW_INT:
+ case SHOW_HA_ROWS:
+ unsigned_flag= TRUE;
+ max_length= MY_INT64_NUM_DECIMAL_DIGITS;
+ decimals=0;
+ break;
+ case SHOW_LONGLONG:
+ unsigned_flag= FALSE;
+ max_length= MY_INT64_NUM_DECIMAL_DIGITS;
+ decimals=0;
+ break;
+ case SHOW_CHAR:
+ case SHOW_CHAR_PTR:
+ collation.set(system_charset_info, DERIVATION_SYSCONST);
+ max_length= MAX_BLOB_WIDTH;
+ decimals=NOT_FIXED_DEC;
+ break;
+ case SHOW_MY_BOOL:
+ unsigned_flag= FALSE;
+ max_length= 1;
+ decimals=0;
+ break;
+ case SHOW_DOUBLE:
+ unsigned_flag= FALSE;
+ decimals= 6;
+ max_length= DBL_DIG + 6;
+ break;
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), var->name);
+ break;
+ }
+}
- /*
- Evaluate the system variable and substitute the result (a basic constant)
- instead of this item. If the variable can not be evaluated,
- the error is reported in sys_var::item().
- */
- if (!(item= var->item(thd, var_type, &component)))
- DBUG_RETURN(1); // Impossible
- item->set_name(name, 0, system_charset_info); // don't allocate a new name
- thd->change_item_tree(ref, item);
- DBUG_RETURN(0);
+void Item_func_get_system_var::print(String *str, enum_query_type query_type)
+{
+ str->append(name, name_length);
}
-bool Item_func_get_system_var::is_written_to_binlog()
+enum Item_result Item_func_get_system_var::result_type() const
{
- return var->is_written_to_binlog(var_type);
+ switch (var->show_type())
+ {
+ case SHOW_MY_BOOL:
+ case SHOW_INT:
+ case SHOW_LONG:
+ case SHOW_LONGLONG:
+ case SHOW_HA_ROWS:
+ return INT_RESULT;
+ case SHOW_CHAR:
+ case SHOW_CHAR_PTR:
+ return STRING_RESULT;
+ case SHOW_DOUBLE:
+ return REAL_RESULT;
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), var->name);
+ return STRING_RESULT; // keep the compiler happy
+ }
+}
+
+
+enum_field_types Item_func_get_system_var::field_type() const
+{
+ switch (var->show_type())
+ {
+ case SHOW_MY_BOOL:
+ case SHOW_INT:
+ case SHOW_LONG:
+ case SHOW_LONGLONG:
+ case SHOW_HA_ROWS:
+ return MYSQL_TYPE_LONGLONG;
+ case SHOW_CHAR:
+ case SHOW_CHAR_PTR:
+ return MYSQL_TYPE_VARCHAR;
+ case SHOW_DOUBLE:
+ return MYSQL_TYPE_DOUBLE;
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), var->name);
+ return MYSQL_TYPE_VARCHAR; // keep the compiler happy
+ }
+}
+
+
+#define get_sys_var_safe(type) \
+do { \
+ type value; \
+ pthread_mutex_lock(&LOCK_global_system_variables); \
+ value= *(type*) var->value_ptr(thd, var_type, &component); \
+ pthread_mutex_unlock(&LOCK_global_system_variables); \
+ cache_present |= GET_SYS_VAR_CACHE_LONG; \
+ used_query_id= thd->query_id; \
+ cached_llval= null_value ? 0 : (longlong) value; \
+ cached_null_value= null_value; \
+ return cached_llval; \
+} while (0)
+
+
+longlong Item_func_get_system_var::val_int()
+{
+ THD *thd= current_thd;
+
+ if (cache_present && thd->query_id == used_query_id)
+ {
+ if (cache_present & GET_SYS_VAR_CACHE_LONG)
+ {
+ null_value= cached_null_value;
+ return cached_llval;
+ }
+ else if (cache_present & GET_SYS_VAR_CACHE_DOUBLE)
+ {
+ null_value= cached_null_value;
+ cached_llval= (longlong) cached_dval;
+ cache_present|= GET_SYS_VAR_CACHE_LONG;
+ return cached_llval;
+ }
+ else if (cache_present & GET_SYS_VAR_CACHE_STRING)
+ {
+ null_value= cached_null_value;
+ if (!null_value)
+ cached_llval= longlong_from_string_with_check (cached_strval.charset(),
+ cached_strval.c_ptr(),
+ cached_strval.c_ptr() +
+ cached_strval.length());
+ else
+ cached_llval= 0;
+ cache_present|= GET_SYS_VAR_CACHE_LONG;
+ return cached_llval;
+ }
+ }
+
+ switch (var->show_type())
+ {
+ case SHOW_INT: get_sys_var_safe (uint);
+ case SHOW_LONG: get_sys_var_safe (ulong);
+ case SHOW_LONGLONG: get_sys_var_safe (longlong);
+ case SHOW_HA_ROWS: get_sys_var_safe (ha_rows);
+ case SHOW_MY_BOOL: get_sys_var_safe (my_bool);
+ case SHOW_DOUBLE:
+ {
+ double dval= val_real();
+
+ used_query_id= thd->query_id;
+ cached_llval= (longlong) dval;
+ cache_present|= GET_SYS_VAR_CACHE_LONG;
+ return cached_llval;
+ }
+ case SHOW_CHAR:
+ case SHOW_CHAR_PTR:
+ {
+ String *str_val= val_str(NULL);
+
+ if (str_val && str_val->length())
+ cached_llval= longlong_from_string_with_check (system_charset_info,
+ str_val->c_ptr(),
+ str_val->c_ptr() +
+ str_val->length());
+ else
+ {
+ null_value= TRUE;
+ cached_llval= 0;
+ }
+
+ cache_present|= GET_SYS_VAR_CACHE_LONG;
+ return cached_llval;
+ }
+
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), var->name);
+ return 0; // keep the compiler happy
+ }
+}
+
+
+String* Item_func_get_system_var::val_str(String* str)
+{
+ THD *thd= current_thd;
+
+ if (cache_present && thd->query_id == used_query_id)
+ {
+ if (cache_present & GET_SYS_VAR_CACHE_STRING)
+ {
+ null_value= cached_null_value;
+ return null_value ? NULL : &cached_strval;
+ }
+ else if (cache_present & GET_SYS_VAR_CACHE_LONG)
+ {
+ null_value= cached_null_value;
+ if (!null_value)
+ cached_strval.set (cached_llval, collation.collation);
+ cache_present|= GET_SYS_VAR_CACHE_STRING;
+ return null_value ? NULL : &cached_strval;
+ }
+ else if (cache_present & GET_SYS_VAR_CACHE_DOUBLE)
+ {
+ null_value= cached_null_value;
+ if (!null_value)
+ cached_strval.set_real (cached_dval, decimals, collation.collation);
+ cache_present|= GET_SYS_VAR_CACHE_STRING;
+ return null_value ? NULL : &cached_strval;
+ }
+ }
+
+ str= &cached_strval;
+ switch (var->show_type())
+ {
+ case SHOW_CHAR:
+ case SHOW_CHAR_PTR:
+ {
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ char *cptr= var->show_type() == SHOW_CHAR_PTR ?
+ *(char**) var->value_ptr(thd, var_type, &component) :
+ (char*) var->value_ptr(thd, var_type, &component);
+ if (cptr)
+ {
+ if (str->copy(cptr, strlen(cptr), collation.collation))
+ {
+ null_value= TRUE;
+ str= NULL;
+ }
+ }
+ else
+ {
+ null_value= TRUE;
+ str= NULL;
+ }
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ break;
+ }
+
+ case SHOW_INT:
+ case SHOW_LONG:
+ case SHOW_LONGLONG:
+ case SHOW_HA_ROWS:
+ case SHOW_MY_BOOL:
+ str->set (val_int(), collation.collation);
+ break;
+ case SHOW_DOUBLE:
+ str->set_real (val_real(), decimals, collation.collation);
+ break;
+
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), var->name);
+ str= NULL;
+ break;
+ }
+
+ cache_present|= GET_SYS_VAR_CACHE_STRING;
+ used_query_id= thd->query_id;
+ cached_null_value= null_value;
+ return str;
+}
+
+
+double Item_func_get_system_var::val_real()
+{
+ THD *thd= current_thd;
+
+ if (cache_present && thd->query_id == used_query_id)
+ {
+ if (cache_present & GET_SYS_VAR_CACHE_DOUBLE)
+ {
+ null_value= cached_null_value;
+ return cached_dval;
+ }
+ else if (cache_present & GET_SYS_VAR_CACHE_LONG)
+ {
+ null_value= cached_null_value;
+ cached_dval= (double)cached_llval;
+ cache_present|= GET_SYS_VAR_CACHE_DOUBLE;
+ return cached_dval;
+ }
+ else if (cache_present & GET_SYS_VAR_CACHE_STRING)
+ {
+ null_value= cached_null_value;
+ if (!null_value)
+ cached_dval= double_from_string_with_check (cached_strval.charset(),
+ cached_strval.c_ptr(),
+ cached_strval.c_ptr() +
+ cached_strval.length());
+ else
+ cached_dval= 0;
+ cache_present|= GET_SYS_VAR_CACHE_DOUBLE;
+ return cached_dval;
+ }
+ }
+
+ switch (var->show_type())
+ {
+ case SHOW_DOUBLE:
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ cached_dval= *(double*) var->value_ptr(thd, var_type, &component);
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ used_query_id= thd->query_id;
+ cached_null_value= null_value;
+ if (null_value)
+ cached_dval= 0;
+ cache_present|= GET_SYS_VAR_CACHE_DOUBLE;
+ return cached_dval;
+ case SHOW_CHAR:
+ case SHOW_CHAR_PTR:
+ {
+ char *cptr;
+
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ cptr= var->show_type() == SHOW_CHAR ?
+ (char*) var->value_ptr(thd, var_type, &component) :
+ *(char**) var->value_ptr(thd, var_type, &component);
+ if (cptr)
+ cached_dval= double_from_string_with_check (system_charset_info,
+ cptr, cptr + strlen (cptr));
+ else
+ {
+ null_value= TRUE;
+ cached_dval= 0;
+ }
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ used_query_id= thd->query_id;
+ cached_null_value= null_value;
+ cache_present|= GET_SYS_VAR_CACHE_DOUBLE;
+ return cached_dval;
+ }
+ case SHOW_INT:
+ case SHOW_LONG:
+ case SHOW_LONGLONG:
+ case SHOW_HA_ROWS:
+ case SHOW_MY_BOOL:
+ cached_dval= (double) val_int();
+ cache_present|= GET_SYS_VAR_CACHE_DOUBLE;
+ used_query_id= thd->query_id;
+ cached_null_value= null_value;
+ return cached_dval;
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), var->name);
+ return 0;
+ }
+}
+
+
+bool Item_func_get_system_var::eq(const Item *item, bool binary_cmp) const
+{
+ /* Assume we don't have rtti */
+ if (this == item)
+ return 1; // Same item is same.
+ /* Check if other type is also a get_user_var() object */
+ if (item->type() != FUNC_ITEM ||
+ ((Item_func*) item)->functype() != functype())
+ return 0;
+ Item_func_get_system_var *other=(Item_func_get_system_var*) item;
+ return (var == other->var && var_type == other->var_type);
+}
+
+
+void Item_func_get_system_var::cleanup()
+{
+ Item_func::cleanup();
+ cache_present= 0;
+ var_type= orig_var_type;
+ cached_strval.free();
}
diff --git a/sql/item_func.h b/sql/item_func.h
index d84abdb6e56..08906ae826e 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -55,7 +55,7 @@ public:
NOW_FUNC, TRIG_COND_FUNC,
SUSERVAR_FUNC, GUSERVAR_FUNC, COLLATE_FUNC,
EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP, UDF_FUNC,
- NEG_FUNC };
+ NEG_FUNC, GSYSVAR_FUNC };
enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL,
OPTIMIZE_EQUAL };
enum Type type() const { return FUNC_ITEM; }
@@ -1426,24 +1426,36 @@ public:
/* A system variable */
+#define GET_SYS_VAR_CACHE_LONG 1
+#define GET_SYS_VAR_CACHE_DOUBLE 2
+#define GET_SYS_VAR_CACHE_STRING 4
+
class Item_func_get_system_var :public Item_func
{
sys_var *var;
- enum_var_type var_type;
+ enum_var_type var_type, orig_var_type;
LEX_STRING component;
+ longlong cached_llval;
+ double cached_dval;
+ String cached_strval;
+ my_bool cached_null_value;
+ query_id_t used_query_id;
+ uchar cache_present;
+
public:
Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg,
LEX_STRING *component_arg, const char *name_arg,
size_t name_len_arg);
- bool fix_fields(THD *thd, Item **ref);
- /*
- Stubs for pure virtual methods. Should never be called: this
- item is always substituted with a constant in fix_fields().
- */
- double val_real() { DBUG_ASSERT(0); return 0.0; }
- longlong val_int() { DBUG_ASSERT(0); return 0; }
- String* val_str(String*) { DBUG_ASSERT(0); return 0; }
- void fix_length_and_dec() { DBUG_ASSERT(0); }
+ enum Functype functype() const { return GSYSVAR_FUNC; }
+ void fix_length_and_dec();
+ void print(String *str, enum_query_type query_type);
+ bool const_item() const { return true; }
+ table_map used_tables() const { return 0; }
+ enum Item_result result_type() const;
+ enum_field_types field_type() const;
+ double val_real();
+ longlong val_int();
+ String* val_str(String*);
/* TODO: fix to support views */
const char *func_name() const { return "get_system_var"; }
/**
@@ -1455,6 +1467,9 @@ public:
@return true if the variable is written to the binlog, false otherwise.
*/
bool is_written_to_binlog();
+ bool eq(const Item *item, bool binary_cmp) const;
+
+ void cleanup();
};
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 96f0b6a142d..c2b3b954634 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -369,6 +369,10 @@ Item_sum::Item_sum(List<Item> &list) :arg_count(list.elements),
args[i++]= item;
}
}
+ if (!(orig_args= (Item **) sql_alloc(sizeof(Item *) * arg_count)))
+ {
+ args= NULL;
+ }
mark_as_sum_func();
list.empty(); // Fields are used
}
@@ -379,18 +383,28 @@ Item_sum::Item_sum(List<Item> &list) :arg_count(list.elements),
*/
Item_sum::Item_sum(THD *thd, Item_sum *item):
- Item_result_field(thd, item), arg_count(item->arg_count),
+ Item_result_field(thd, item),
aggr_sel(item->aggr_sel),
nest_level(item->nest_level), aggr_level(item->aggr_level),
- quick_group(item->quick_group), used_tables_cache(item->used_tables_cache),
+ quick_group(item->quick_group),
+ arg_count(item->arg_count), orig_args(NULL),
+ used_tables_cache(item->used_tables_cache),
forced_const(item->forced_const)
{
if (arg_count <= 2)
+ {
args=tmp_args;
+ orig_args=tmp_orig_args;
+ }
else
+ {
if (!(args= (Item**) thd->alloc(sizeof(Item*)*arg_count)))
return;
+ if (!(orig_args= (Item**) thd->alloc(sizeof(Item*)*arg_count)))
+ return;
+ }
memcpy(args, item->args, sizeof(Item*)*arg_count);
+ memcpy(orig_args, item->orig_args, sizeof(Item*)*arg_count);
}
@@ -425,12 +439,13 @@ void Item_sum::make_field(Send_field *tmp_field)
void Item_sum::print(String *str, enum_query_type query_type)
{
+ Item **pargs= orig_args;
str->append(func_name());
for (uint i=0 ; i < arg_count ; i++)
{
if (i)
str->append(',');
- args[i]->print(str, query_type);
+ pargs[i]->print(str, query_type);
}
str->append(')');
}
@@ -535,6 +550,13 @@ void Item_sum::update_used_tables ()
}
+Item *Item_sum::set_arg(int i, THD *thd, Item *new_val)
+{
+ thd->change_item_tree(args + i, new_val);
+ return new_val;
+}
+
+
String *
Item_sum_num::val_str(String *str)
{
@@ -586,6 +608,7 @@ Item_sum_num::fix_fields(THD *thd, Item **ref)
if (check_sum_func(thd, ref))
return TRUE;
+ memcpy (orig_args, args, sizeof (Item *) * arg_count);
fixed= 1;
return FALSE;
}
@@ -673,6 +696,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
if (check_sum_func(thd, ref))
return TRUE;
+ orig_args[0]= args[0];
fixed= 1;
return FALSE;
}
@@ -3141,6 +3165,12 @@ Item_func_group_concat(Name_resolution_context *context_arg,
sizeof(ORDER*)*arg_count_order)))
return;
+ if (!(orig_args= (Item **) sql_alloc(sizeof(Item *) * arg_count)))
+ {
+ args= NULL;
+ return;
+ }
+
order= (ORDER**)(args + arg_count);
/* fill args items of show and sort */
@@ -3368,6 +3398,7 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
if (check_sum_func(thd, ref))
return TRUE;
+ memcpy (orig_args, args, sizeof (Item *) * arg_count);
fixed= 1;
return FALSE;
}
diff --git a/sql/item_sum.h b/sql/item_sum.h
index bee8792fbfa..d991327d847 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -228,10 +228,8 @@ public:
VARIANCE_FUNC, SUM_BIT_FUNC, UDF_SUM_FUNC, GROUP_CONCAT_FUNC
};
- Item **args, *tmp_args[2];
Item **ref_by; /* pointer to a ref to the object used to register it */
Item_sum *next; /* next in the circular chain of registered objects */
- uint arg_count;
Item_sum *in_sum_func; /* embedding set function if any */
st_select_lex * aggr_sel; /* select where the function is aggregated */
int8 nest_level; /* number of the nesting level of the set function */
@@ -248,24 +246,32 @@ public:
List<Item_field> outer_fields;
protected:
+ uint arg_count;
+ Item **args, *tmp_args[2];
+ /*
+ Copy of the arguments list to hold the original set of arguments.
+ Used in EXPLAIN EXTENDED instead of the current argument list because
+ the current argument list can be altered by usage of temporary tables.
+ */
+ Item **orig_args, *tmp_orig_args[2];
table_map used_tables_cache;
bool forced_const;
public:
void mark_as_sum_func();
- Item_sum() :arg_count(0), quick_group(1), forced_const(FALSE)
+ Item_sum() :quick_group(1), arg_count(0), forced_const(FALSE)
{
mark_as_sum_func();
}
- Item_sum(Item *a) :args(tmp_args), arg_count(1), quick_group(1),
- forced_const(FALSE)
+ Item_sum(Item *a) :quick_group(1), arg_count(1), args(tmp_args),
+ orig_args(tmp_orig_args), forced_const(FALSE)
{
args[0]=a;
mark_as_sum_func();
}
- Item_sum( Item *a, Item *b ) :args(tmp_args), arg_count(2), quick_group(1),
- forced_const(FALSE)
+ Item_sum( Item *a, Item *b ) :quick_group(1), arg_count(2), args(tmp_args),
+ orig_args(tmp_orig_args), forced_const(FALSE)
{
args[0]=a; args[1]=b;
mark_as_sum_func();
@@ -374,6 +380,10 @@ public:
bool register_sum_func(THD *thd, Item **ref);
st_select_lex *depended_from()
{ return (nest_level == aggr_level ? 0 : aggr_sel); }
+
+ Item *get_arg(int i) { return args[i]; }
+ Item *set_arg(int i, THD *thd, Item *new_val);
+ uint get_arg_count() { return arg_count; }
};
@@ -981,6 +991,7 @@ public:
if (udf.fix_fields(thd, this, this->arg_count, this->args))
return TRUE;
+ memcpy (orig_args, args, sizeof (Item *) * arg_count);
return check_sum_func(thd, ref);
}
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
diff --git a/sql/log.cc b/sql/log.cc
index 8ab2e892b27..fb8669a5731 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -3779,7 +3779,7 @@ THD::binlog_set_pending_rows_event(Rows_log_event* ev)
int
MYSQL_BIN_LOG::remove_pending_rows_event(THD *thd)
{
- DBUG_ENTER(__FUNCTION__);
+ DBUG_ENTER("MYSQL_BIN_LOG::remove_pending_rows_event");
binlog_trx_data *const trx_data=
(binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
diff --git a/sql/message.h b/sql/message.h
new file mode 100644
index 00000000000..0e7c282d5a1
--- /dev/null
+++ b/sql/message.h
@@ -0,0 +1,55 @@
+/*
+ To change or add messages mysqld writes to the Windows error log, run
+ mc.exe message.mc
+ and checkin generated messages.h, messages.rc and msg000001.bin under the
+ source control.
+ mc.exe can be installed with Windows SDK, some Visual Studio distributions
+ do not include it.
+*/
+//
+// Values are 32 bit values layed out as follows:
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// +---+-+-+-----------------------+-------------------------------+
+// |Sev|C|R| Facility | Code |
+// +---+-+-+-----------------------+-------------------------------+
+//
+// where
+//
+// Sev - is the severity code
+//
+// 00 - Success
+// 01 - Informational
+// 10 - Warning
+// 11 - Error
+//
+// C - is the Customer code flag
+//
+// R - is a reserved bit
+//
+// Facility - is the facility code
+//
+// Code - is the facility's status code
+//
+//
+// Define the facility codes
+//
+
+
+//
+// Define the severity codes
+//
+
+
+//
+// MessageId: MSG_DEFAULT
+//
+// MessageText:
+//
+// %1For more information, see Help and Support Center at http://www.mysql.com.
+//
+//
+//
+#define MSG_DEFAULT 0xC0000064L
+
diff --git a/sql/message.mc b/sql/message.mc
index a1a7c8cff7e..8d68d599365 100644
--- a/sql/message.mc
+++ b/sql/message.mc
@@ -1,3 +1,11 @@
+;/*
+; To change or add messages mysqld writes to the Windows error log, run
+; mc.exe message.mc
+; and checkin generated messages.h, messages.rc and msg000001.bin under the
+; source control.
+; mc.exe can be installed with Windows SDK, some Visual Studio distributions
+; do not include it.
+;*/
MessageId = 100
Severity = Error
Facility = Application
diff --git a/sql/message.rc b/sql/message.rc
new file mode 100644
index 00000000000..116522b7d48
--- /dev/null
+++ b/sql/message.rc
@@ -0,0 +1,2 @@
+LANGUAGE 0x9,0x1
+1 11 MSG00001.bin
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index d59ea8eca45..abb778394e6 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2800,11 +2800,25 @@ int my_message_sql(uint error, const char *str, myf MyFlags)
THD *thd;
DBUG_ENTER("my_message_sql");
DBUG_PRINT("error", ("error: %u message: '%s'", error, str));
+
+ DBUG_ASSERT(str != NULL);
/*
- Put here following assertion when situation with EE_* error codes
- will be fixed
+ An error should have a valid error number (!= 0), so it can be caught
+ in stored procedures by SQL exception handlers.
+ Calling my_error() with error == 0 is a bug.
+ Remaining known places to fix:
+ - storage/myisam/mi_create.c, my_printf_error()
+ TODO:
DBUG_ASSERT(error != 0);
*/
+
+ if (error == 0)
+ {
+ /* At least, prevent new abuse ... */
+ DBUG_ASSERT(strncmp(str, "MyISAM table", 12) == 0);
+ error= ER_UNKNOWN_ERROR;
+ }
+
if ((thd= current_thd))
{
/*
@@ -2835,10 +2849,6 @@ int my_message_sql(uint error, const char *str, myf MyFlags)
{
if (! thd->main_da.is_error()) // Return only first message
{
- if (error == 0)
- error= ER_UNKNOWN_ERROR;
- if (str == NULL)
- str= ER(error);
thd->main_da.set_error_status(thd, error, str);
}
query_cache_abort(&thd->net);
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index f228551b586..bafc368e415 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1151,7 +1151,7 @@ int QUICK_RANGE_SELECT::init()
if (file->inited != handler::NONE)
file->ha_index_or_rnd_end();
- DBUG_RETURN(error= file->ha_index_init(index, 1));
+ DBUG_RETURN(FALSE);
}
@@ -9200,7 +9200,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
DBUG_RETURN(NULL);
/* The argument of MIN/MAX. */
- Item *expr= min_max_item->args[0]->real_item();
+ Item *expr= min_max_item->get_arg(0)->real_item();
if (expr->type() == Item::FIELD_ITEM) /* Is it an attribute? */
{
if (! min_max_arg_item)
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 42d36756845..3ccc1e5cf41 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -199,7 +199,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
to the number of rows in the tables if this number is exact and
there are no outer joins.
*/
- if (!conds && !((Item_sum_count*) item)->args[0]->maybe_null &&
+ if (!conds && !((Item_sum_count*) item)->get_arg(0)->maybe_null &&
!outer_tables && maybe_exact_count)
{
if (!is_exact_count)
@@ -225,7 +225,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
parts of the key is found in the COND, then we can use
indexes to find the key.
*/
- Item *expr=item_sum->args[0];
+ Item *expr=item_sum->get_arg(0);
if (expr->real_item()->type() == Item::FIELD_ITEM)
{
uchar key_buff[MAX_KEY_LENGTH];
@@ -373,7 +373,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
parts of the key is found in the COND, then we can use
indexes to find the key.
*/
- Item *expr=item_sum->args[0];
+ Item *expr=item_sum->get_arg(0);
if (expr->real_item()->type() == Item::FIELD_ITEM)
{
uchar key_buff[MAX_KEY_LENGTH];
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 8feac884c77..02f2c9b0ab1 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -956,11 +956,13 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
#endif
{
if (part_elem->data_file_name)
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
- "DATA DIRECTORY option ignored");
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ "DATA DIRECTORY");
if (part_elem->index_file_name)
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
- "INDEX DIRECTORY option ignored");
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ "INDEX DIRECTORY");
part_elem->data_file_name= part_elem->index_file_name= NULL;
}
if (!is_sub_partitioned())
diff --git a/sql/set_var.cc b/sql/set_var.cc
index a62cafc3873..3e15cce2cea 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1734,119 +1734,6 @@ err:
}
-/**
- Return an Item for a variable.
-
- Used with @@[global.]variable_name.
-
- If type is not given, return local value if exists, else global.
-*/
-
-Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
-{
- if (check_type(var_type))
- {
- if (var_type != OPT_DEFAULT)
- {
- my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0),
- name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
- return 0;
- }
- /* As there was no local variable, return the global value */
- var_type= OPT_GLOBAL;
- }
- switch (show_type()) {
- case SHOW_INT:
- {
- uint value;
- pthread_mutex_lock(&LOCK_global_system_variables);
- value= *(uint*) value_ptr(thd, var_type, base);
- pthread_mutex_unlock(&LOCK_global_system_variables);
- return new Item_uint((ulonglong) value);
- }
- case SHOW_LONG:
- {
- ulong value;
- pthread_mutex_lock(&LOCK_global_system_variables);
- value= *(ulong*) value_ptr(thd, var_type, base);
- pthread_mutex_unlock(&LOCK_global_system_variables);
- return new Item_uint((ulonglong) value);
- }
- case SHOW_LONGLONG:
- {
- longlong value;
- pthread_mutex_lock(&LOCK_global_system_variables);
- value= *(longlong*) value_ptr(thd, var_type, base);
- pthread_mutex_unlock(&LOCK_global_system_variables);
- return new Item_int(value);
- }
- case SHOW_DOUBLE:
- {
- double value;
- pthread_mutex_lock(&LOCK_global_system_variables);
- value= *(double*) value_ptr(thd, var_type, base);
- pthread_mutex_unlock(&LOCK_global_system_variables);
- /* 6, as this is for now only used with microseconds */
- return new Item_float(value, 6);
- }
- case SHOW_HA_ROWS:
- {
- ha_rows value;
- pthread_mutex_lock(&LOCK_global_system_variables);
- value= *(ha_rows*) value_ptr(thd, var_type, base);
- pthread_mutex_unlock(&LOCK_global_system_variables);
- return new Item_int((ulonglong) value);
- }
- case SHOW_MY_BOOL:
- {
- int32 value;
- pthread_mutex_lock(&LOCK_global_system_variables);
- value= *(my_bool*) value_ptr(thd, var_type, base);
- pthread_mutex_unlock(&LOCK_global_system_variables);
- return new Item_int(value,1);
- }
- case SHOW_CHAR_PTR:
- {
- Item *tmp;
- pthread_mutex_lock(&LOCK_global_system_variables);
- char *str= *(char**) value_ptr(thd, var_type, base);
- if (str)
- {
- uint length= strlen(str);
- tmp= new Item_string(thd->strmake(str, length), length,
- system_charset_info, DERIVATION_SYSCONST);
- }
- else
- {
- tmp= new Item_null();
- tmp->collation.set(system_charset_info, DERIVATION_SYSCONST);
- }
- pthread_mutex_unlock(&LOCK_global_system_variables);
- return tmp;
- }
- case SHOW_CHAR:
- {
- Item *tmp;
- pthread_mutex_lock(&LOCK_global_system_variables);
- char *str= (char*) value_ptr(thd, var_type, base);
- if (str)
- tmp= new Item_string(str, strlen(str),
- system_charset_info, DERIVATION_SYSCONST);
- else
- {
- tmp= new Item_null();
- tmp->collation.set(system_charset_info, DERIVATION_SYSCONST);
- }
- pthread_mutex_unlock(&LOCK_global_system_variables);
- return tmp;
- }
- default:
- my_error(ER_VAR_CANT_BE_READ, MYF(0), name);
- }
- return 0;
-}
-
-
bool sys_var_thd_enum::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
diff --git a/sql/set_var.h b/sql/set_var.h
index 8ae97c6502d..9681c955a98 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -105,7 +105,6 @@ public:
{ return type != INT_RESULT; } /* Assume INT */
virtual bool check_default(enum_var_type type)
{ return option_limits == 0; }
- Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
virtual bool is_struct() { return 0; }
virtual bool is_readonly() const { return 0; }
virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index c6fa5366f46..b86007408fb 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -6139,3 +6139,15 @@ ER_NEED_REPREPARE
ER_DELAYED_NOT_SUPPORTED
eng "DELAYED option not supported for table '%-.192s'"
+
+WARN_NO_MASTER_INFO
+ eng "The master info structure does not exist"
+
+WARN_OPTION_IGNORED
+ eng "<%-.64s> option ignored"
+
+WARN_PLUGIN_DELETE_BUILTIN
+ eng "Built-in plugins cannot be deleted"
+
+WARN_PLUGIN_BUSY
+ eng "Plugin is busy and will be uninstalled on shutdown"
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index f18ee0ec562..658acadf226 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -489,12 +489,20 @@ static TABLE_SHARE
"no such table" errors.
@todo Rework the alternative ways to deal with ER_NO_SUCH TABLE.
*/
- if (thd->is_error() && table_list->belong_to_view)
+ if (thd->is_error())
{
- TABLE_LIST *view= table_list->belong_to_view;
- thd->clear_error();
- my_error(ER_VIEW_INVALID, MYF(0),
- view->view_db.str, view->view_name.str);
+ if (table_list->parent_l)
+ {
+ thd->clear_error();
+ my_error(ER_WRONG_MRG_TABLE, MYF(0));
+ }
+ else if (table_list->belong_to_view)
+ {
+ TABLE_LIST *view= table_list->belong_to_view;
+ thd->clear_error();
+ my_error(ER_VIEW_INVALID, MYF(0),
+ view->view_db.str, view->view_name.str);
+ }
}
DBUG_RETURN(0);
}
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index abbb2de0a82..e63eed2d23c 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -3513,7 +3513,7 @@ int THD::binlog_delete_row(TABLE* table, bool is_trans,
int THD::binlog_remove_pending_rows_event(bool clear_maps)
{
- DBUG_ENTER(__FUNCTION__);
+ DBUG_ENTER("THD::binlog_remove_pending_rows_event");
if (!mysql_bin_log.is_open())
DBUG_RETURN(0);
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index 0b74e3455eb..79da1936eb9 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -109,6 +109,9 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
DBUG_ENTER("push_warning");
DBUG_PRINT("enter", ("code: %d, msg: %s", code, msg));
+ DBUG_ASSERT(code != 0);
+ DBUG_ASSERT(msg != NULL);
+
if (level == MYSQL_ERROR::WARN_LEVEL_NOTE &&
!(thd->options & OPTION_SQL_NOTES))
DBUG_RETURN(0);
@@ -177,7 +180,10 @@ void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
char warning[ERRMSGSIZE+20];
DBUG_ENTER("push_warning_printf");
DBUG_PRINT("enter",("warning: %u", code));
-
+
+ DBUG_ASSERT(code != 0);
+ DBUG_ASSERT(format != NULL);
+
va_start(args,format);
my_vsnprintf(warning, sizeof(warning), format, args);
va_end(args);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 8762d3dc8fa..de58b506940 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -830,7 +830,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
info.copied=values_list.elements;
end_delayed_insert(thd);
}
- query_cache_invalidate3(thd, table_list, 1);
}
else
#endif
@@ -2754,6 +2753,11 @@ bool Delayed_insert::handle_inserts(void)
/* Remove all not used rows */
while ((row=rows.get()))
{
+ if (table->s->blob_fields)
+ {
+ memcpy(table->record[0],row->record,table->s->reclength);
+ free_delayed_insert_blobs(table);
+ }
delete row;
thread_safe_increment(delayed_insert_errors,&LOCK_delayed_status);
stacked_inserts--;
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 4ac73baa992..983d53a041d 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -2397,15 +2397,20 @@ void st_select_lex_unit::set_limit(st_select_lex *sl)
val= sl->select_limit ? sl->select_limit->val_uint() : HA_POS_ERROR;
select_limit_val= (ha_rows)val;
#ifndef BIG_TABLES
- /*
+ /*
Check for overflow : ha_rows can be smaller then ulonglong if
BIG_TABLES is off.
*/
if (val != (ulonglong)select_limit_val)
select_limit_val= HA_POS_ERROR;
#endif
- offset_limit_cnt= (ha_rows)(sl->offset_limit ? sl->offset_limit->val_uint() :
- ULL(0));
+ val= sl->offset_limit ? sl->offset_limit->val_uint() : ULL(0);
+ offset_limit_cnt= (ha_rows)val;
+#ifndef BIG_TABLES
+ /* Check for truncation. */
+ if (val != (ulonglong)offset_limit_cnt)
+ offset_limit_cnt= HA_POS_ERROR;
+#endif
select_limit_cnt= select_limit_val + offset_limit_cnt;
if (select_limit_cnt < select_limit_val)
select_limit_cnt= HA_POS_ERROR; // no limit
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 704c16cfdec..f518e1ef9e8 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2372,8 +2372,8 @@ mysql_execute_command(THD *thd)
}
else
{
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
- "the master info structure does not exist");
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_NO_MASTER_INFO, ER(WARN_NO_MASTER_INFO));
my_ok(thd);
}
pthread_mutex_unlock(&LOCK_active_mi);
@@ -2770,11 +2770,13 @@ end_with_restore_list:
/* Don't yet allow changing of symlinks with ALTER TABLE */
if (create_info.data_file_name)
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
- "DATA DIRECTORY option ignored");
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ "DATA DIRECTORY");
if (create_info.index_file_name)
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
- "INDEX DIRECTORY option ignored");
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ "INDEX DIRECTORY");
create_info.data_file_name= create_info.index_file_name= NULL;
/* ALTER TABLE ends previous transaction */
if (end_active_trans(thd))
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 089ef012d3a..13b2bfef24d 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1715,16 +1715,16 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
}
if (!plugin->plugin_dl)
{
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
- "Built-in plugins cannot be deleted,.");
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_PLUGIN_DELETE_BUILTIN, ER(WARN_PLUGIN_DELETE_BUILTIN));
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PLUGIN", name->str);
goto err;
}
plugin->state= PLUGIN_IS_DELETED;
if (plugin->ref_count)
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
- "Plugin is busy and will be uninstalled on shutdown");
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_PLUGIN_BUSY, ER(WARN_PLUGIN_BUSY));
else
reap_needed= true;
reap_plugins();
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 102809f9f64..9debe2bb038 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -6863,6 +6863,7 @@ only_eq_ref_tables(JOIN *join,ORDER *order,table_map tables)
{
if (specialflag & SPECIAL_SAFE_MODE)
return 0; // skip this optimize /* purecov: inspected */
+ tables&= ~PSEUDO_TABLE_BITS;
for (JOIN_TAB **tab=join->map2table ; tables ; tab++, tables>>=1)
{
if (tables & 1 && !eq_ref_table(join, order, *tab))
@@ -9274,6 +9275,7 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
*/
if ((type= item->field_type()) == MYSQL_TYPE_DATETIME ||
type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_DATE ||
+ type == MYSQL_TYPE_NEWDATE ||
type == MYSQL_TYPE_TIMESTAMP || type == MYSQL_TYPE_GEOMETRY)
new_field= item->tmp_table_field_from_field_type(table, 1);
/*
@@ -9791,11 +9793,11 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
}
if (type == Item::SUM_FUNC_ITEM && !group && !save_sum_fields)
{ /* Can't calc group yet */
- ((Item_sum*) item)->result_field=0;
- for (i=0 ; i < ((Item_sum*) item)->arg_count ; i++)
+ Item_sum *sum_item= (Item_sum *) item;
+ sum_item->result_field=0;
+ for (i=0 ; i < sum_item->get_arg_count() ; i++)
{
- Item **argp= ((Item_sum*) item)->args + i;
- Item *arg= *argp;
+ Item *arg= sum_item->get_arg(i);
if (!arg->const_item())
{
Field *new_field=
@@ -9823,7 +9825,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
string_total_length+= new_field->pack_length();
}
thd->mem_root= mem_root_save;
- thd->change_item_tree(argp, new Item_field(new_field));
+ arg= sum_item->set_arg(i, thd, new Item_field(new_field));
thd->mem_root= &table->mem_root;
if (!(new_field->flags & NOT_NULL_FLAG))
{
@@ -9832,7 +9834,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
new_field->maybe_null() is still false, it will be
changed below. But we have to setup Item_field correctly
*/
- (*argp)->maybe_null=1;
+ arg->maybe_null=1;
}
new_field->field_index= fieldnr++;
}
@@ -14533,9 +14535,9 @@ count_field_types(SELECT_LEX *select_lex, TMP_TABLE_PARAM *param,
param->quick_group=0; // UDF SUM function
param->sum_func_count++;
- for (uint i=0 ; i < sum_item->arg_count ; i++)
+ for (uint i=0 ; i < sum_item->get_arg_count() ; i++)
{
- if (sum_item->args[0]->real_item()->type() == Item::FIELD_ITEM)
+ if (sum_item->get_arg(i)->real_item()->type() == Item::FIELD_ITEM)
param->field_count++;
else
param->func_count++;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index fc2c2548cc4..ca7e222e18d 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2983,7 +2983,7 @@ static int fill_schema_table_names(THD *thd, TABLE *table,
@retval SKIP_OPEN_TABLE | OPEN_FRM_ONLY | OPEN_FULL_TABLE
*/
-static uint get_table_open_method(TABLE_LIST *tables,
+uint get_table_open_method(TABLE_LIST *tables,
ST_SCHEMA_TABLE *schema_table,
enum enum_schema_tables schema_table_idx)
{
@@ -2994,12 +2994,22 @@ static uint get_table_open_method(TABLE_LIST *tables,
{
Field **ptr, *field;
int table_open_method= 0, field_indx= 0;
+ uint star_table_open_method= OPEN_FULL_TABLE;
+ bool used_star= true; // true if '*' is used in select
for (ptr=tables->table->field; (field= *ptr) ; ptr++)
{
+ star_table_open_method=
+ min(star_table_open_method,
+ schema_table->fields_info[field_indx].open_method);
if (bitmap_is_set(tables->table->read_set, field->field_index))
+ {
+ used_star= false;
table_open_method|= schema_table->fields_info[field_indx].open_method;
+ }
field_indx++;
}
+ if (used_star)
+ return star_table_open_method;
return table_open_method;
}
/* I_S tables which use get_all_tables but can not be optimized */
@@ -6137,7 +6147,7 @@ ST_FIELD_INFO events_fields_info[]=
SKIP_OPEN_TABLE},
{"INTERVAL_FIELD", 18, MYSQL_TYPE_STRING, 0, 1, "Interval field",
SKIP_OPEN_TABLE},
- {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
+ {"SQL_MODE", 32*256, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
{"STARTS", 0, MYSQL_TYPE_DATETIME, 0, 1, "Starts", SKIP_OPEN_TABLE},
{"ENDS", 0, MYSQL_TYPE_DATETIME, 0, 1, "Ends", SKIP_OPEN_TABLE},
{"STATUS", 18, MYSQL_TYPE_STRING, 0, 0, "Status", SKIP_OPEN_TABLE},
@@ -6380,8 +6390,8 @@ ST_FIELD_INFO triggers_fields_info[]=
{"ACTION_REFERENCE_OLD_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
{"ACTION_REFERENCE_NEW_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
{"CREATED", 0, MYSQL_TYPE_DATETIME, 0, 1, "Created", OPEN_FULL_TABLE},
- {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, "sql_mode", OPEN_FULL_TABLE},
- {"DEFINER", 65535, MYSQL_TYPE_STRING, 0, 0, "Definer", OPEN_FULL_TABLE},
+ {"SQL_MODE", 32*256, MYSQL_TYPE_STRING, 0, 0, "sql_mode", OPEN_FULL_TABLE},
+ {"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, "Definer", OPEN_FULL_TABLE},
{"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
"character_set_client", OPEN_FULL_TABLE},
{"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index c866fdfc173..ff9a968f7f2 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3540,11 +3540,13 @@ bool mysql_create_table_no_lock(THD *thd,
#endif /* HAVE_READLINK */
{
if (create_info->data_file_name)
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
- "DATA DIRECTORY option ignored");
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ "DATA DIRECTORY");
if (create_info->index_file_name)
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
- "INDEX DIRECTORY option ignored");
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ "INDEX DIRECTORY");
create_info->data_file_name= create_info->index_file_name= 0;
}
create_info->table_options=db_options;
@@ -5280,6 +5282,8 @@ compare_tables(TABLE *table,
create_info->used_fields & HA_CREATE_USED_CHARSET ||
create_info->used_fields & HA_CREATE_USED_DEFAULT_CHARSET ||
create_info->used_fields & HA_CREATE_USED_ROW_FORMAT ||
+ create_info->used_fields & HA_CREATE_USED_PACK_KEYS ||
+ create_info->used_fields & HA_CREATE_USED_MAX_ROWS ||
(alter_info->flags & (ALTER_RECREATE | ALTER_FOREIGN_KEY)) ||
order_num ||
!table->s->mysql_version ||
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 6da7b3e8072..a50b009303a 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -7201,9 +7201,6 @@ static void test_field_misc()
{
MYSQL_STMT *stmt;
MYSQL_RES *result;
- MYSQL_BIND my_bind[1];
- char table_type[NAME_LEN];
- ulong type_length;
int rc;
myheader("test_field_misc");
@@ -7246,53 +7243,6 @@ static void test_field_misc()
mysql_free_result(result);
mysql_stmt_close(stmt);
- stmt= mysql_simple_prepare(mysql, "SELECT @@table_type");
- check_stmt(stmt);
-
- rc= mysql_stmt_execute(stmt);
- check_execute(stmt, rc);
-
- bzero((char*) my_bind, sizeof(my_bind));
- my_bind[0].buffer_type= MYSQL_TYPE_STRING;
- my_bind[0].buffer= table_type;
- my_bind[0].length= &type_length;
- my_bind[0].buffer_length= NAME_LEN;
-
- rc= mysql_stmt_bind_result(stmt, my_bind);
- check_execute(stmt, rc);
-
- rc= mysql_stmt_fetch(stmt);
- check_execute(stmt, rc);
- if (!opt_silent)
- fprintf(stdout, "\n default table type: %s(%ld)", table_type, type_length);
-
- rc= mysql_stmt_fetch(stmt);
- DIE_UNLESS(rc == MYSQL_NO_DATA);
-
- mysql_stmt_close(stmt);
-
- stmt= mysql_simple_prepare(mysql, "SELECT @@table_type");
- check_stmt(stmt);
-
- result= mysql_stmt_result_metadata(stmt);
- mytest(result);
- DIE_UNLESS(mysql_stmt_field_count(stmt) == mysql_num_fields(result));
-
- rc= mysql_stmt_execute(stmt);
- check_execute(stmt, rc);
-
- DIE_UNLESS(1 == my_process_stmt_result(stmt));
-
- verify_prepare_field(result, 0,
- "@@table_type", "", /* field and its org name */
- mysql_get_server_version(mysql) <= 50000 ?
- MYSQL_TYPE_STRING : MYSQL_TYPE_VAR_STRING,
- "", "", /* table and its org name */
- "", type_length, 0); /* db name, length */
-
- mysql_free_result(result);
- mysql_stmt_close(stmt);
-
stmt= mysql_simple_prepare(mysql, "SELECT @@max_error_count");
check_stmt(stmt);
@@ -7309,7 +7259,8 @@ static void test_field_misc()
"@@max_error_count", "", /* field and its org name */
MYSQL_TYPE_LONGLONG, /* field type */
"", "", /* table and its org name */
- "", 10, 0); /* db name, length */
+ /* db name, length */
+ "", MY_INT64_NUM_DECIMAL_DIGITS , 0);
mysql_free_result(result);
mysql_stmt_close(stmt);
@@ -7329,7 +7280,8 @@ static void test_field_misc()
"@@max_allowed_packet", "", /* field and its org name */
MYSQL_TYPE_LONGLONG, /* field type */
"", "", /* table and its org name */
- "", 10, 0); /* db name, length */
+ /* db name, length */
+ "", MY_INT64_NUM_DECIMAL_DIGITS, 0);
mysql_free_result(result);
mysql_stmt_close(stmt);