summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore25
-rw-r--r--client/mysql.cc2
-rw-r--r--client/mysqlcheck.c9
-rw-r--r--dbug/dbug.c8
-rw-r--r--extra/perror.c40
-rw-r--r--extra/yassl/include/cert_wrapper.hpp3
-rw-r--r--extra/yassl/include/openssl/prefix_ssl.h1
-rw-r--r--extra/yassl/include/openssl/ssl.h9
-rw-r--r--extra/yassl/include/yassl_imp.hpp4
-rw-r--r--extra/yassl/include/yassl_int.hpp12
-rw-r--r--extra/yassl/include/yassl_types.hpp12
-rw-r--r--extra/yassl/src/cert_wrapper.cpp36
-rw-r--r--extra/yassl/src/ssl.cpp25
-rw-r--r--extra/yassl/src/yassl_error.cpp7
-rw-r--r--extra/yassl/src/yassl_imp.cpp156
-rw-r--r--extra/yassl/src/yassl_int.cpp108
-rw-r--r--include/my_global.h10
-rw-r--r--libmysql/libmysql.c4
-rw-r--r--libmysqld/examples/CMakeLists.txt8
-rw-r--r--libmysqld/lib_sql.cc10
-rw-r--r--libmysqld/libmysqld.def66
-rw-r--r--mysql-test/include/mtr_warnings.sql4
-rw-r--r--mysql-test/r/create.result4
-rw-r--r--mysql-test/r/csv_alter_table.result40
-rw-r--r--mysql-test/r/ctype_filesystem.result11
-rw-r--r--mysql-test/r/ctype_utf8.result32
-rw-r--r--mysql-test/r/events_scheduling.result9
-rw-r--r--mysql-test/r/events_time_zone.result11
-rw-r--r--mysql-test/r/fulltext.result28
-rw-r--r--mysql-test/r/func_compress.result2
-rw-r--r--mysql-test/r/func_group.result23
-rw-r--r--mysql-test/r/func_sapdb.result12
-rw-r--r--mysql-test/r/general_log_func.result2
-rw-r--r--mysql-test/r/group_concat_max_len_func.result74
-rw-r--r--mysql-test/r/information_schema.result73
-rw-r--r--mysql-test/r/information_schema_part.result6
-rw-r--r--mysql-test/r/innodb_mysql.result6
-rw-r--r--mysql-test/r/log_output_func.result38
-rw-r--r--mysql-test/r/max_allowed_packet_basic.result53
-rw-r--r--mysql-test/r/max_allowed_packet_func.result21
-rw-r--r--mysql-test/r/multi_update.result23
-rw-r--r--mysql-test/r/multi_update2.result25
-rw-r--r--mysql-test/r/mysqlbinlog_row_big.result2
-rw-r--r--mysql-test/r/mysqlcheck.result13
-rw-r--r--mysql-test/r/net_buffer_length_basic.result72
-rw-r--r--mysql-test/r/openssl_1.result17
-rw-r--r--mysql-test/r/packet.result12
-rw-r--r--mysql-test/r/partition.result12
-rw-r--r--mysql-test/r/partition_innodb.result22
-rw-r--r--mysql-test/r/perror-win.result6
-rw-r--r--mysql-test/r/show_check.result26
-rw-r--r--mysql-test/r/subselect.result30
-rw-r--r--mysql-test/r/symlink.result8
-rw-r--r--mysql-test/r/timestamp_func.result44
-rw-r--r--mysql-test/r/timestamp_sysdate_is_now_func.result25
-rw-r--r--mysql-test/r/timezone2.result2
-rw-r--r--mysql-test/r/timezone3.result8
-rw-r--r--mysql-test/r/type_newdecimal.result15
-rw-r--r--mysql-test/r/union.result8
-rw-r--r--mysql-test/r/update.result11
-rw-r--r--mysql-test/r/variables-notembedded.result92
-rw-r--r--mysql-test/r/variables.result373
-rw-r--r--mysql-test/r/view.result33
-rw-r--r--mysql-test/r/wait_timeout_func.result61
-rw-r--r--mysql-test/std_data/Moscow_leapbin991 -> 2674 bytes
-rw-r--r--mysql-test/suite/federated/federated.result9
-rw-r--r--mysql-test/suite/federated/federated.test19
-rw-r--r--mysql-test/suite/federated/federated_innodb.test7
-rw-r--r--mysql-test/suite/funcs_1/datadict/is_tables.inc1
-rw-r--r--mysql-test/suite/funcs_1/r/is_character_sets.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_collation_character_set_applicability.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_collations.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result64
-rw-r--r--mysql-test/suite/funcs_1/r/is_routines.result6
-rw-r--r--mysql-test/suite/funcs_1/r/is_schemata.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables.result7
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc2
-rw-r--r--mysql-test/t/ctype_filesystem-master.opt2
-rw-r--r--mysql-test/t/ctype_filesystem.test6
-rw-r--r--mysql-test/t/ctype_utf8.test17
-rw-r--r--mysql-test/t/disabled.def2
-rw-r--r--mysql-test/t/events_scheduling.test33
-rw-r--r--mysql-test/t/events_time_zone.test83
-rw-r--r--mysql-test/t/fulltext.test27
-rw-r--r--mysql-test/t/func_compress.test5
-rw-r--r--mysql-test/t/func_group.test29
-rw-r--r--mysql-test/t/func_sapdb.test17
-rw-r--r--mysql-test/t/general_log_func.test2
-rw-r--r--mysql-test/t/group_concat_max_len_func.test83
-rw-r--r--mysql-test/t/information_schema.test37
-rw-r--r--mysql-test/t/information_schema_part.test10
-rw-r--r--mysql-test/t/innodb_bug34300.test4
-rw-r--r--mysql-test/t/innodb_mysql.test10
-rw-r--r--mysql-test/t/log_output_func.test75
-rw-r--r--mysql-test/t/max_allowed_packet_basic.test27
-rw-r--r--mysql-test/t/max_allowed_packet_func.test21
-rw-r--r--mysql-test/t/multi_update.test57
-rw-r--r--mysql-test/t/multi_update2-master.opt1
-rw-r--r--mysql-test/t/multi_update2.test43
-rw-r--r--mysql-test/t/mysqlbinlog_row_big.test2
-rw-r--r--mysql-test/t/mysqlcheck.test27
-rw-r--r--mysql-test/t/net_buffer_length_basic.test49
-rw-r--r--mysql-test/t/openssl_1.test47
-rw-r--r--mysql-test/t/packet.test24
-rw-r--r--mysql-test/t/partition.test15
-rw-r--r--mysql-test/t/partition_innodb.test40
-rw-r--r--mysql-test/t/perror-win.test14
-rw-r--r--mysql-test/t/subselect.test36
-rw-r--r--mysql-test/t/symlink.test34
-rw-r--r--mysql-test/t/timestamp_func.test69
-rw-r--r--mysql-test/t/timestamp_sysdate_is_now_func-master.opt1
-rw-r--r--mysql-test/t/timestamp_sysdate_is_now_func.test47
-rw-r--r--mysql-test/t/timezone3.test12
-rw-r--r--mysql-test/t/type_newdecimal.test10
-rw-r--r--mysql-test/t/union.test10
-rw-r--r--mysql-test/t/update.test21
-rw-r--r--mysql-test/t/variables-notembedded.test79
-rw-r--r--mysql-test/t/variables.test306
-rw-r--r--mysql-test/t/view.test34
-rw-r--r--mysql-test/t/wait_timeout_func.test109
-rw-r--r--mysys/mf_tempdir.c2
-rw-r--r--mysys/my_getopt.c19
-rw-r--r--mysys/my_init.c2
-rw-r--r--mysys/my_thr_init.c12
-rw-r--r--scripts/Makefile.am1
-rw-r--r--scripts/mysql_config.pl.in2
-rw-r--r--scripts/mysql_config.sh2
-rw-r--r--sql/field.cc2
-rw-r--r--sql/ha_partition.cc39
-rw-r--r--sql/ha_partition.h4
-rw-r--r--sql/handler.cc4
-rw-r--r--sql/item_cmpfunc.cc14
-rw-r--r--sql/item_cmpfunc.h6
-rw-r--r--sql/item_func.cc31
-rw-r--r--sql/item_func.h8
-rw-r--r--sql/item_timefunc.cc13
-rw-r--r--sql/item_timefunc.h1
-rw-r--r--sql/my_decimal.cc2
-rw-r--r--sql/mysql_priv.h12
-rw-r--r--sql/mysqld.cc62
-rw-r--r--sql/nt_servc.cc19
-rw-r--r--sql/nt_servc.h14
-rw-r--r--sql/parse_file.cc98
-rw-r--r--sql/parse_file.h6
-rw-r--r--sql/set_var.cc276
-rw-r--r--sql/set_var.h115
-rw-r--r--sql/share/errmsg.txt3
-rw-r--r--sql/slave.cc61
-rw-r--r--sql/slave.h1
-rw-r--r--sql/sql_base.cc3
-rw-r--r--sql/sql_class.cc14
-rw-r--r--sql/sql_db.cc2
-rw-r--r--sql/sql_manager.cc54
-rw-r--r--sql/sql_repl.cc74
-rw-r--r--sql/sql_select.cc10
-rw-r--r--sql/sql_show.cc100
-rw-r--r--sql/sql_table.cc6
-rw-r--r--sql/sql_trigger.cc10
-rw-r--r--sql/sql_update.cc31
-rw-r--r--sql/sql_view.cc36
-rw-r--r--sql/table.h1
-rw-r--r--sql/tztime.cc21
-rw-r--r--sql/tztime.h3
-rw-r--r--tests/mysql_client_test.c82
165 files changed, 3573 insertions, 1401 deletions
diff --git a/.bzrignore b/.bzrignore
index b677e8d815b..01ef6f2ffef 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -3036,3 +3036,28 @@ mysql-test/bug36522.tar
mysql-test/t.log
mysql-test/tps.log
libmysqld/event_parse_data.cc
+autom4te.cache
+sql/share/czech
+sql/share/danish
+sql/share/dutch
+sql/share/english
+sql/share/estonian
+sql/share/french
+sql/share/german
+sql/share/greek
+sql/share/hungarian
+sql/share/italian
+sql/share/japanese
+sql/share/japanese-sjis
+sql/share/korean
+sql/share/norwegian
+sql/share/norwegian-ny
+sql/share/polish
+sql/share/portuguese
+sql/share/romanian
+sql/share/russian
+sql/share/serbian
+sql/share/slovak
+sql/share/spanish
+sql/share/swedish
+sql/share/ukrainian
diff --git a/client/mysql.cc b/client/mysql.cc
index 024194d81f6..ff53d623d07 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1627,8 +1627,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_nopager= 1;
break;
case OPT_MYSQL_PROTOCOL:
+#ifndef EMBEDDED_LIBRARY
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
+#endif
break;
case OPT_SERVER_ARG:
#ifdef EMBEDDED_LIBRARY
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index e71cf70d882..17ebca497e4 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -517,9 +517,14 @@ static int process_all_tables_in_db(char *database)
LINT_INIT(res);
if (use_db(database))
return 1;
- if (mysql_query(sock, "SHOW /*!50002 FULL*/ TABLES") ||
- !((res= mysql_store_result(sock))))
+ if ((mysql_query(sock, "SHOW /*!50002 FULL*/ TABLES") &&
+ mysql_query(sock, "SHOW TABLES")) ||
+ !(res= mysql_store_result(sock)))
+ {
+ my_printf_error(0, "Error: Couldn't get table list for database %s: %s",
+ MYF(0), database, mysql_error(sock));
return 1;
+ }
num_columns= mysql_num_fields(res);
diff --git a/dbug/dbug.c b/dbug/dbug.c
index 1cebbbcf72a..baf080f5e27 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -1851,13 +1851,7 @@ static void DBUGOpenFile(CODE_STATE *cs,
else
{
newfile= !EXISTS(name);
- if (!(fp= fopen(name,
-#if defined(MSDOS) || defined(__WIN__)
- append ? "a+c" : "wc"
-#else
- append ? "a+" : "w"
-#endif
- )))
+ if (!(fp= fopen(name, append ? "a+" : "w")))
{
(void) fprintf(stderr, ERR_OPEN, cs->process, name);
perror("");
diff --git a/extra/perror.c b/extra/perror.c
index 237b2582d43..80eb2af2dae 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -185,11 +185,36 @@ static const char *get_ha_error_msg(int code)
}
+#if defined(__WIN__)
+static my_bool print_win_error_msg(DWORD error, my_bool verbose)
+{
+ LPTSTR s;
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, error, 0, (LPTSTR)&s, 0,
+ NULL))
+ {
+ if (verbose)
+ printf("Win32 error code %d: %s", error, s);
+ else
+ puts(s);
+ LocalFree(s);
+ return 0;
+ }
+ return 1;
+}
+#endif
+
+
+
int main(int argc,char *argv[])
{
int error,code,found;
const char *msg;
char *unknown_error = 0;
+#if defined(__WIN__)
+ my_bool skip_win_message= 0;
+#endif
MY_INIT(argv[0]);
if (get_options(&argc,&argv))
@@ -293,9 +318,20 @@ int main(int argc,char *argv[])
}
if (!found)
{
- fprintf(stderr,"Illegal error code: %d\n", code);
- error= 1;
+#if defined(__WIN__)
+ if (!(skip_win_message= !print_win_error_msg((DWORD)code, verbose)))
+ {
+#endif
+ fprintf(stderr,"Illegal error code: %d\n",code);
+ error=1;
+#if defined(__WIN__)
+ }
+#endif
}
+#if defined(__WIN__)
+ if (!skip_win_message)
+ print_win_error_msg((DWORD)code, verbose);
+#endif
}
}
diff --git a/extra/yassl/include/cert_wrapper.hpp b/extra/yassl/include/cert_wrapper.hpp
index ce8003aa4cf..572b9f87293 100644
--- a/extra/yassl/include/cert_wrapper.hpp
+++ b/extra/yassl/include/cert_wrapper.hpp
@@ -34,6 +34,7 @@
#include "yassl_types.hpp" // SignatureAlgorithm
#include "buffer.hpp" // input_buffer
#include "asn.hpp" // SignerList
+#include "openssl/ssl.h" // internal and external use
#include STL_LIST_FILE
#include STL_ALGORITHM_FILE
@@ -87,6 +88,7 @@ class CertManager {
bool verifyNone_; // no error if verify fails
bool failNoCert_;
bool sendVerify_;
+ VerifyCallback verifyCallback_; // user verify callback
public:
CertManager();
~CertManager();
@@ -118,6 +120,7 @@ public:
void setFailNoCert();
void setSendVerify();
void setPeerX509(X509*);
+ void setVerifyCallback(VerifyCallback);
private:
CertManager(const CertManager&); // hide copy
CertManager& operator=(const CertManager&); // and assign
diff --git a/extra/yassl/include/openssl/prefix_ssl.h b/extra/yassl/include/openssl/prefix_ssl.h
index 3a3a8c26c9c..138d9fb8821 100644
--- a/extra/yassl/include/openssl/prefix_ssl.h
+++ b/extra/yassl/include/openssl/prefix_ssl.h
@@ -52,6 +52,7 @@
#define SSL_load_error_strings yaSSL_load_error_strings
#define SSL_set_session yaSSL_set_session
#define SSL_get_session yaSSL_get_session
+#define SSL_flush_sessions yaSSL_flush_sessions
#define SSL_SESSION_set_timeout yaSSL_SESSION_set_timeout
#define SSL_CTX_set_session_cache_mode yaSSL_CTX_set_session_cache_mode
#define SSL_get_peer_certificate yaSSL_get_peer_certificate
diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h
index c0b87f804ad..de09f1ebe4b 100644
--- a/extra/yassl/include/openssl/ssl.h
+++ b/extra/yassl/include/openssl/ssl.h
@@ -170,8 +170,9 @@ enum { /* X509 Constants */
X509_V_ERR_CRL_SIGNATURE_FAILURE = 10,
X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD = 11,
X509_V_ERR_CRL_HAS_EXPIRED = 12,
- X509_V_ERR_CERT_REVOKED = 13
-
+ X509_V_ERR_CERT_REVOKED = 13,
+ X509_V_FLAG_CRL_CHECK = 14,
+ X509_V_FLAG_CRL_CHECK_ALL = 15
};
@@ -202,7 +203,8 @@ SSL_CTX* SSL_CTX_new(SSL_METHOD*);
SSL* SSL_new(SSL_CTX*);
int SSL_set_fd (SSL*, YASSL_SOCKET_T);
YASSL_SOCKET_T SSL_get_fd(const SSL*);
-int SSL_connect(SSL*);
+int SSL_connect(SSL*); // if you get an error from connect
+ // see note at top of REAMDE
int SSL_write(SSL*, const void*, int);
int SSL_read(SSL*, void*, int);
int SSL_accept(SSL*);
@@ -227,6 +229,7 @@ void SSL_load_error_strings(void);
int SSL_set_session(SSL *ssl, SSL_SESSION *session);
SSL_SESSION* SSL_get_session(SSL* ssl);
+void SSL_flush_sessions(SSL_CTX *ctx, long tm);
long SSL_SESSION_set_timeout(SSL_SESSION*, long);
long SSL_CTX_set_session_cache_mode(SSL_CTX* ctx, long mode);
X509* SSL_get_peer_certificate(SSL*);
diff --git a/extra/yassl/include/yassl_imp.hpp b/extra/yassl/include/yassl_imp.hpp
index f6434443cb0..8893ba8a8ba 100644
--- a/extra/yassl/include/yassl_imp.hpp
+++ b/extra/yassl/include/yassl_imp.hpp
@@ -667,10 +667,12 @@ struct Parameters {
Cipher suites_[MAX_SUITE_SZ];
char cipher_name_[MAX_SUITE_NAME];
char cipher_list_[MAX_CIPHERS][MAX_SUITE_NAME];
+ bool removeDH_; // for server's later use
Parameters(ConnectionEnd, const Ciphers&, ProtocolVersion, bool haveDH);
- void SetSuites(ProtocolVersion pv, bool removeDH = false);
+ void SetSuites(ProtocolVersion pv, bool removeDH = false,
+ bool removeRSA = false, bool removeDSA = false);
void SetCipherNames();
private:
Parameters(const Parameters&); // hide copy
diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp
index b207f0bffbd..d18dc41860c 100644
--- a/extra/yassl/include/yassl_int.hpp
+++ b/extra/yassl/include/yassl_int.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -268,12 +268,14 @@ class Sessions {
STL::list<SSL_SESSION*> list_;
RandomPool random_; // for session cleaning
Mutex mutex_; // no-op for single threaded
+ int count_; // flush counter
- Sessions() {} // only GetSessions can create
+ Sessions() : count_(0) {} // only GetSessions can create
public:
SSL_SESSION* lookup(const opaque*, SSL_SESSION* copy = 0);
void add(const SSL&);
void remove(const opaque*);
+ void Flush();
~Sessions();
@@ -425,8 +427,10 @@ private:
pem_password_cb passwordCb_;
void* userData_;
bool sessionCacheOff_;
+ bool sessionCacheFlushOff_;
Stats stats_;
Mutex mutex_; // for Stats
+ VerifyCallback verifyCallback_;
public:
explicit SSL_CTX(SSL_METHOD* meth);
~SSL_CTX();
@@ -437,18 +441,22 @@ public:
const Ciphers& GetCiphers() const;
const DH_Parms& GetDH_Parms() const;
const Stats& GetStats() const;
+ const VerifyCallback getVerifyCallback() const;
pem_password_cb GetPasswordCb() const;
void* GetUserData() const;
bool GetSessionCacheOff() const;
+ bool GetSessionCacheFlushOff() const;
void setVerifyPeer();
void setVerifyNone();
void setFailNoCert();
+ void setVerifyCallback(VerifyCallback);
bool SetCipherList(const char*);
bool SetDH(const DH&);
void SetPasswordCb(pem_password_cb cb);
void SetUserData(void*);
void SetSessionCacheOff();
+ void SetSessionCacheFlushOff();
void IncrementStats(StatsField);
void AddCA(x509* ca);
diff --git a/extra/yassl/include/yassl_types.hpp b/extra/yassl/include/yassl_types.hpp
index e4b81f98fff..28535792828 100644
--- a/extra/yassl/include/yassl_types.hpp
+++ b/extra/yassl/include/yassl_types.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,6 +29,13 @@
#include "type_traits.hpp"
+#ifdef _MSC_VER
+ // disable conversion warning
+ // 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy
+ #pragma warning(disable:4244 4996)
+#endif
+
+
namespace yaSSL {
#define YASSL_LIB
@@ -163,7 +170,7 @@ const int RMD_LEN = 20; // RIPEMD-160 digest length
const int PREFIX = 3; // up to 3 prefix letters for secret rounds
const int KEY_PREFIX = 7; // up to 7 prefix letters for key rounds
const int FORTEZZA_MAX = 128; // Maximum Fortezza Key length
-const int MAX_SUITE_SZ = 64; // 32 max suites * sizeof(suite)
+const int MAX_SUITE_SZ = 128; // 64 max suites * sizeof(suite)
const int MAX_SUITE_NAME = 48; // max length of suite name
const int MAX_CIPHERS = 32; // max supported ciphers for cipher list
const int SIZEOF_ENUM = 1; // SSL considers an enum 1 byte, not 4
@@ -205,6 +212,7 @@ const int SEED_LEN = RAN_LEN * 2; // TLS seed, client + server random
const int DEFAULT_TIMEOUT = 500; // Default Session timeout in seconds
const int MAX_RECORD_SIZE = 16384; // 2^14, max size by standard
const int COMPRESS_EXTRA = 1024; // extra compression possible addition
+const int SESSION_FLUSH_COUNT = 256; // when to flush session cache
typedef uint8 Cipher; // first byte is always 0x00 for SSLv3 & TLS
diff --git a/extra/yassl/src/cert_wrapper.cpp b/extra/yassl/src/cert_wrapper.cpp
index 5eacf9083f9..ebec0882265 100644
--- a/extra/yassl/src/cert_wrapper.cpp
+++ b/extra/yassl/src/cert_wrapper.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
#include "runtime.hpp"
#include "cert_wrapper.hpp"
#include "yassl_int.hpp"
+#include "error.hpp"
#if defined(USE_CML_LIB)
#include "cmapi_cpp.h"
@@ -90,7 +91,7 @@ opaque* x509::use_buffer()
//CertManager
CertManager::CertManager()
: peerX509_(0), verifyPeer_(false), verifyNone_(false), failNoCert_(false),
- sendVerify_(false)
+ sendVerify_(false), verifyCallback_(0)
{}
@@ -154,6 +155,12 @@ void CertManager::setSendVerify()
}
+void CertManager::setVerifyCallback(VerifyCallback vc)
+{
+ verifyCallback_ = vc;
+}
+
+
void CertManager::AddPeerCert(x509* x)
{
peerList_.push_back(x); // take ownership
@@ -236,7 +243,7 @@ uint CertManager::get_privateKeyLength() const
int CertManager::Validate()
{
CertList::reverse_iterator last = peerList_.rbegin();
- int count = peerList_.size();
+ size_t count = peerList_.size();
while ( count > 1 ) {
TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length());
@@ -257,7 +264,8 @@ int CertManager::Validate()
TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length());
TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_);
- if (int err = cert.GetError().What())
+ int err = cert.GetError().What();
+ if ( err )
return err;
uint sz = cert.GetPublicKey().size();
@@ -269,13 +277,25 @@ int CertManager::Validate()
else
peerKeyType_ = dsa_sa_algo;
- int iSz = strlen(cert.GetIssuer()) + 1;
- int sSz = strlen(cert.GetCommonName()) + 1;
- int bSz = strlen(cert.GetBeforeDate()) + 1;
- int aSz = strlen(cert.GetAfterDate()) + 1;
+ size_t iSz = strlen(cert.GetIssuer()) + 1;
+ size_t sSz = strlen(cert.GetCommonName()) + 1;
+ int bSz = (int)strlen(cert.GetBeforeDate()) + 1;
+ int aSz = (int)strlen(cert.GetAfterDate()) + 1;
peerX509_ = NEW_YS X509(cert.GetIssuer(), iSz, cert.GetCommonName(),
sSz, cert.GetBeforeDate(), bSz,
cert.GetAfterDate(), aSz);
+
+ if (err == TaoCrypt::SIG_OTHER_E && verifyCallback_) {
+ X509_STORE_CTX store;
+ store.error = err;
+ store.error_depth = static_cast<int>(count) - 1;
+ store.current_cert = peerX509_;
+
+ int ok = verifyCallback_(0, &store);
+ if (ok) return 0;
+ }
+
+ if (err == TaoCrypt::SIG_OTHER_E) return err;
}
return 0;
}
diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp
index f09a43be56e..29aa034f885 100644
--- a/extra/yassl/src/ssl.cpp
+++ b/extra/yassl/src/ssl.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -245,6 +245,7 @@ YASSL_SOCKET_T SSL_get_fd(const SSL* ssl)
}
+// if you get an error from connect see note at top of README
int SSL_connect(SSL* ssl)
{
if (ssl->GetError() == YasslError(SSL_ERROR_WANT_READ))
@@ -447,6 +448,9 @@ long SSL_CTX_set_session_cache_mode(SSL_CTX* ctx, long mode)
if (mode == SSL_SESS_CACHE_OFF)
ctx->SetSessionCacheOff();
+ if (mode == SSL_SESS_CACHE_NO_AUTO_CLEAR)
+ ctx->SetSessionCacheFlushOff();
+
return SSL_SUCCESS;
}
@@ -493,6 +497,15 @@ long SSL_get_default_timeout(SSL* /*ssl*/)
}
+void SSL_flush_sessions(SSL_CTX *ctx, long /* tm */)
+{
+ if (ctx->GetSessionCacheOff())
+ return;
+
+ GetSessions().Flush();
+}
+
+
const char* SSL_get_cipher_name(SSL* ssl)
{
return SSL_get_cipher(ssl);
@@ -560,7 +573,7 @@ int SSL_get_error(SSL* ssl, int /*previous*/)
only need to turn on for client, becuase server on by default if built in
but calling for server will tell you whether it's available or not
*/
-int SSL_set_compression(SSL* ssl)
+int SSL_set_compression(SSL* ssl) /* Chad didn't rename to ya~ because it is prob. bug. */
{
return ssl->SetCompression();
}
@@ -604,7 +617,7 @@ char* X509_NAME_oneline(X509_NAME* name, char* buffer, int sz)
{
if (!name->GetName()) return buffer;
- int len = strlen(name->GetName()) + 1;
+ int len = (int)strlen(name->GetName()) + 1;
int copySz = min(len, sz);
if (!buffer) {
@@ -693,7 +706,7 @@ int SSL_CTX_use_PrivateKey_file(SSL_CTX* ctx, const char* file, int format)
}
-void SSL_CTX_set_verify(SSL_CTX* ctx, int mode, VerifyCallback /*vc*/)
+void SSL_CTX_set_verify(SSL_CTX* ctx, int mode, VerifyCallback vc)
{
if (mode & SSL_VERIFY_PEER)
ctx->setVerifyPeer();
@@ -703,6 +716,8 @@ void SSL_CTX_set_verify(SSL_CTX* ctx, int mode, VerifyCallback /*vc*/)
if (mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT)
ctx->setFailNoCert();
+
+ ctx->setVerifyCallback(vc);
}
@@ -1450,6 +1465,8 @@ unsigned long err_helper(bool peek = false)
default :
return 0;
}
+
+ return 0; // shut up compiler
}
diff --git a/extra/yassl/src/yassl_error.cpp b/extra/yassl/src/yassl_error.cpp
index dc120028e13..a1ef8578da6 100644
--- a/extra/yassl/src/yassl_error.cpp
+++ b/extra/yassl/src/yassl_error.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,6 +26,11 @@
#include "openssl/ssl.h" // SSL_ERROR_WANT_READ
#include <string.h> // strncpy
+#ifdef _MSC_VER
+ // 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy
+ #pragma warning(disable: 4996)
+#endif
+
namespace yaSSL {
diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp
index b43d9c27355..20dfe50f132 100644
--- a/extra/yassl/src/yassl_imp.cpp
+++ b/extra/yassl/src/yassl_imp.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -136,9 +136,19 @@ void DH_Server::build(SSL& ssl)
const CertManager& cert = ssl.getCrypto().get_certManager();
if (ssl.getSecurity().get_parms().sig_algo_ == rsa_sa_algo)
+ {
+ if (cert.get_keyType() != rsa_sa_algo) {
+ ssl.SetError(privateKey_error);
+ return;
+ }
auth.reset(NEW_YS RSA(cert.get_privateKey(),
cert.get_privateKeyLength(), false));
+ }
else {
+ if (cert.get_keyType() != dsa_sa_algo) {
+ ssl.SetError(privateKey_error);
+ return;
+ }
auth.reset(NEW_YS DSS(cert.get_privateKey(),
cert.get_privateKeyLength(), false));
sigSz += DSS_ENCODED_EXTRA;
@@ -436,18 +446,21 @@ Parameters::Parameters(ConnectionEnd ce, const Ciphers& ciphers,
pending_ = true; // suite not set yet
strncpy(cipher_name_, "NONE", 5);
+ removeDH_ = !haveDH; // only use on server side for set suites
+
if (ciphers.setSuites_) { // use user set list
suites_size_ = ciphers.suiteSz_;
memcpy(suites_, ciphers.suites_, ciphers.suiteSz_);
SetCipherNames();
}
else
- SetSuites(pv, ce == server_end && !haveDH); // defaults
+ SetSuites(pv, ce == server_end && removeDH_); // defaults
}
-void Parameters::SetSuites(ProtocolVersion pv, bool removeDH)
+void Parameters::SetSuites(ProtocolVersion pv, bool removeDH, bool removeRSA,
+ bool removeDSA)
{
int i = 0;
// available suites, best first
@@ -456,67 +469,87 @@ void Parameters::SetSuites(ProtocolVersion pv, bool removeDH)
if (isTLS(pv)) {
if (!removeDH) {
- suites_[i++] = 0x00;
- suites_[i++] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA;
- suites_[i++] = 0x00;
- suites_[i++] = TLS_DHE_DSS_WITH_AES_256_CBC_SHA;
+ if (!removeRSA) {
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA;
+ }
+ if (!removeDSA) {
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_DHE_DSS_WITH_AES_256_CBC_SHA;
+ }
+ }
+ if (!removeRSA) {
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_RSA_WITH_AES_256_CBC_SHA;
}
- suites_[i++] = 0x00;
- suites_[i++] = TLS_RSA_WITH_AES_256_CBC_SHA;
-
if (!removeDH) {
- suites_[i++] = 0x00;
- suites_[i++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA;
- suites_[i++] = 0x00;
- suites_[i++] = TLS_DHE_DSS_WITH_AES_128_CBC_SHA;
+ if (!removeRSA) {
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA;
+ }
+ if (!removeDSA) {
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_DHE_DSS_WITH_AES_128_CBC_SHA;
+ }
+ }
+ if (!removeRSA) {
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_RSA_WITH_AES_128_CBC_SHA;
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_RSA_WITH_AES_256_CBC_RMD160;
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_RSA_WITH_AES_128_CBC_RMD160;
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_RSA_WITH_3DES_EDE_CBC_RMD160;
}
- suites_[i++] = 0x00;
- suites_[i++] = TLS_RSA_WITH_AES_128_CBC_SHA;
-
- suites_[i++] = 0x00;
- suites_[i++] = TLS_RSA_WITH_AES_256_CBC_RMD160;
- suites_[i++] = 0x00;
- suites_[i++] = TLS_RSA_WITH_AES_128_CBC_RMD160;
- suites_[i++] = 0x00;
- suites_[i++] = TLS_RSA_WITH_3DES_EDE_CBC_RMD160;
-
if (!removeDH) {
+ if (!removeRSA) {
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_DHE_RSA_WITH_AES_256_CBC_RMD160;
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_DHE_RSA_WITH_AES_128_CBC_RMD160;
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_DHE_RSA_WITH_3DES_EDE_CBC_RMD160;
+ }
+ if (!removeDSA) {
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_DHE_DSS_WITH_AES_256_CBC_RMD160;
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_DHE_DSS_WITH_AES_128_CBC_RMD160;
+ suites_[i++] = 0x00;
+ suites_[i++] = TLS_DHE_DSS_WITH_3DES_EDE_CBC_RMD160;
+ }
+ }
+ }
+
+ if (!removeRSA) {
suites_[i++] = 0x00;
- suites_[i++] = TLS_DHE_RSA_WITH_AES_256_CBC_RMD160;
- suites_[i++] = 0x00;
- suites_[i++] = TLS_DHE_RSA_WITH_AES_128_CBC_RMD160;
+ suites_[i++] = SSL_RSA_WITH_RC4_128_SHA;
suites_[i++] = 0x00;
- suites_[i++] = TLS_DHE_RSA_WITH_3DES_EDE_CBC_RMD160;
+ suites_[i++] = SSL_RSA_WITH_RC4_128_MD5;
suites_[i++] = 0x00;
- suites_[i++] = TLS_DHE_DSS_WITH_AES_256_CBC_RMD160;
- suites_[i++] = 0x00;
- suites_[i++] = TLS_DHE_DSS_WITH_AES_128_CBC_RMD160;
+ suites_[i++] = SSL_RSA_WITH_3DES_EDE_CBC_SHA;
suites_[i++] = 0x00;
- suites_[i++] = TLS_DHE_DSS_WITH_3DES_EDE_CBC_RMD160;
+ suites_[i++] = SSL_RSA_WITH_DES_CBC_SHA;
}
- }
-
- suites_[i++] = 0x00;
- suites_[i++] = SSL_RSA_WITH_RC4_128_SHA;
- suites_[i++] = 0x00;
- suites_[i++] = SSL_RSA_WITH_RC4_128_MD5;
-
- suites_[i++] = 0x00;
- suites_[i++] = SSL_RSA_WITH_3DES_EDE_CBC_SHA;
- suites_[i++] = 0x00;
- suites_[i++] = SSL_RSA_WITH_DES_CBC_SHA;
-
if (!removeDH) {
- suites_[i++] = 0x00;
- suites_[i++] = SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA;
- suites_[i++] = 0x00;
- suites_[i++] = SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA;
-
- suites_[i++] = 0x00;
- suites_[i++] = SSL_DHE_RSA_WITH_DES_CBC_SHA;
- suites_[i++] = 0x00;
- suites_[i++] = SSL_DHE_DSS_WITH_DES_CBC_SHA;
+ if (!removeRSA) {
+ suites_[i++] = 0x00;
+ suites_[i++] = SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA;
+ }
+ if (!removeDSA) {
+ suites_[i++] = 0x00;
+ suites_[i++] = SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA;
+ }
+ if (!removeRSA) {
+ suites_[i++] = 0x00;
+ suites_[i++] = SSL_DHE_RSA_WITH_DES_CBC_SHA;
+ }
+ if (!removeDSA) {
+ suites_[i++] = 0x00;
+ suites_[i++] = SSL_DHE_DSS_WITH_DES_CBC_SHA;
+ }
}
suites_size_ = i;
@@ -532,7 +565,7 @@ void Parameters::SetCipherNames()
for (int j = 0; j < suites; j++) {
int index = suites_[j*2 + 1]; // every other suite is suite id
- int len = strlen(cipher_names[index]) + 1;
+ size_t len = strlen(cipher_names[index]) + 1;
strncpy(cipher_list_[pos++], cipher_names[index], len);
}
cipher_list_[pos][0] = 0;
@@ -1469,7 +1502,19 @@ void ClientHello::Process(input_buffer&, SSL& ssl)
// downgrade to SSLv3
ssl.useSecurity().use_connection().TurnOffTLS();
ProtocolVersion pv = ssl.getSecurity().get_connection().version_;
- ssl.useSecurity().use_parms().SetSuites(pv); // reset w/ SSL suites
+ bool removeDH = ssl.getSecurity().get_parms().removeDH_;
+ bool removeRSA = false;
+ bool removeDSA = false;
+
+ const CertManager& cm = ssl.getCrypto().get_certManager();
+ if (cm.get_keyType() == rsa_sa_algo)
+ removeDSA = true;
+ else
+ removeRSA = true;
+
+ // reset w/ SSL suites
+ ssl.useSecurity().use_parms().SetSuites(pv, removeDH, removeRSA,
+ removeDSA);
}
else if (ssl.isTLSv1_1() && client_version_.minor_ == 1)
// downgrade to TLSv1, but use same suites
@@ -1515,6 +1560,7 @@ void ClientHello::Process(input_buffer&, SSL& ssl)
return;
}
ssl.matchSuite(cipher_suites_, suite_len_);
+ if (ssl.GetError()) return;
ssl.set_pending(ssl.getSecurity().get_parms().suite_[1]);
if (compression_methods_ == zlib)
diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp
index 0b6cb89e77e..b7f91d72166 100644
--- a/extra/yassl/src/yassl_int.cpp
+++ b/extra/yassl/src/yassl_int.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -40,28 +40,28 @@
void* operator new(size_t sz, yaSSL::new_t)
{
- void* ptr = malloc(sz ? sz : 1);
- if (!ptr) abort();
+ void* ptr = malloc(sz ? sz : 1);
+ if (!ptr) abort();
- return ptr;
+ return ptr;
}
void operator delete(void* ptr, yaSSL::new_t)
{
- if (ptr) free(ptr);
+ if (ptr) free(ptr);
}
void* operator new[](size_t sz, yaSSL::new_t nt)
{
- return ::operator new(sz, nt);
+ return ::operator new(sz, nt);
}
void operator delete[](void* ptr, yaSSL::new_t nt)
{
- ::operator delete(ptr, nt);
+ ::operator delete(ptr, nt);
}
namespace yaSSL {
@@ -308,6 +308,20 @@ SSL::SSL(SSL_CTX* ctx)
SetError(YasslError(err));
return;
}
+ else if (serverSide) {
+ // remove RSA or DSA suites depending on cert key type
+ ProtocolVersion pv = secure_.get_connection().version_;
+
+ bool removeDH = secure_.use_parms().removeDH_;
+ bool removeRSA = false;
+ bool removeDSA = false;
+
+ if (cm.get_keyType() == rsa_sa_algo)
+ removeDSA = true;
+ else
+ removeRSA = true;
+ secure_.use_parms().SetSuites(pv, removeDH, removeRSA, removeDSA);
+ }
}
else if (serverSide) {
SetError(no_key_file);
@@ -320,6 +334,7 @@ SSL::SSL(SSL_CTX* ctx)
cm.setVerifyNone();
if (ctx->getMethod()->failNoCert())
cm.setFailNoCert();
+ cm.setVerifyCallback(ctx->getVerifyCallback());
if (serverSide)
crypto_.SetDH(ctx->GetDH_Parms());
@@ -1034,12 +1049,12 @@ void SSL::fillData(Data& data)
{
if (GetError()) return;
uint dataSz = data.get_length(); // input, data size to fill
- uint elements = buffers_.getData().size();
+ size_t elements = buffers_.getData().size();
data.set_length(0); // output, actual data filled
dataSz = min(dataSz, bufferedData());
- for (uint i = 0; i < elements; i++) {
+ for (size_t i = 0; i < elements; i++) {
input_buffer* front = buffers_.getData().front();
uint frontSz = front->get_remaining();
uint readSz = min(dataSz - data.get_length(), frontSz);
@@ -1063,8 +1078,8 @@ void SSL::fillData(Data& data)
void SSL::PeekData(Data& data)
{
if (GetError()) return;
- uint dataSz = data.get_length(); // input, data size to fill
- uint elements = buffers_.getData().size();
+ uint dataSz = data.get_length(); // input, data size to fill
+ size_t elements = buffers_.getData().size();
data.set_length(0); // output, actual data filled
dataSz = min(dataSz, bufferedData());
@@ -1098,9 +1113,9 @@ void SSL::flushBuffer()
buffers_.getHandShake().end(),
SumBuffer()).total_;
output_buffer out(sz);
- uint elements = buffers_.getHandShake().size();
+ size_t elements = buffers_.getHandShake().size();
- for (uint i = 0; i < elements; i++) {
+ for (size_t i = 0; i < elements; i++) {
output_buffer* front = buffers_.getHandShake().front();
out.write(front->get_buffer(), front->get_size());
@@ -1276,6 +1291,7 @@ void SSL::matchSuite(const opaque* peer, uint length)
if (secure_.use_parms().suites_[i] == peer[j]) {
secure_.use_parms().suite_[0] = 0x00;
secure_.use_parms().suite_[1] = peer[j];
+
return;
}
@@ -1284,7 +1300,7 @@ void SSL::matchSuite(const opaque* peer, uint length)
void SSL::set_session(SSL_SESSION* s)
-{
+{
if (getSecurity().GetContext()->GetSessionCacheOff())
return;
@@ -1565,13 +1581,19 @@ Errors& GetErrors()
typedef Mutex::Lock Lock;
+
void Sessions::add(const SSL& ssl)
{
if (ssl.getSecurity().get_connection().sessionID_Set_) {
- Lock guard(mutex_);
- list_.push_back(NEW_YS SSL_SESSION(ssl, random_));
+ Lock guard(mutex_);
+ list_.push_back(NEW_YS SSL_SESSION(ssl, random_));
+ count_++;
}
+
+ if (count_ > SESSION_FLUSH_COUNT)
+ if (!ssl.getSecurity().GetContext()->GetSessionCacheFlushOff())
+ Flush();
}
@@ -1660,6 +1682,25 @@ void Sessions::remove(const opaque* id)
}
+// flush expired sessions from cache
+void Sessions::Flush()
+{
+ Lock guard(mutex_);
+ sess_iterator next = list_.begin();
+ uint current = lowResTimer();
+
+ while (next != list_.end()) {
+ sess_iterator si = next;
+ ++next;
+ if ( ((*si)->GetBornOn() + (*si)->GetTimeOut()) < current) {
+ del_ptr_zero()(*si);
+ list_.erase(si);
+ }
+ }
+ count_ = 0; // reset flush counter
+}
+
+
// remove a self thread error
void Errors::Remove()
{
@@ -1764,7 +1805,8 @@ bool SSL_METHOD::multipleProtocol() const
SSL_CTX::SSL_CTX(SSL_METHOD* meth)
: method_(meth), certificate_(0), privateKey_(0), passwordCb_(0),
- userData_(0), sessionCacheOff_(false)
+ userData_(0), sessionCacheOff_(false), sessionCacheFlushOff_(false),
+ verifyCallback_(0)
{}
@@ -1791,6 +1833,12 @@ SSL_CTX::GetCA_List() const
}
+const VerifyCallback SSL_CTX::getVerifyCallback() const
+{
+ return verifyCallback_;
+}
+
+
const x509* SSL_CTX::getCert() const
{
return certificate_;
@@ -1851,6 +1899,12 @@ bool SSL_CTX::GetSessionCacheOff() const
}
+bool SSL_CTX::GetSessionCacheFlushOff() const
+{
+ return sessionCacheFlushOff_;
+}
+
+
void SSL_CTX::SetUserData(void* data)
{
userData_ = data;
@@ -1863,6 +1917,12 @@ void SSL_CTX::SetSessionCacheOff()
}
+void SSL_CTX::SetSessionCacheFlushOff()
+{
+ sessionCacheFlushOff_ = true;
+}
+
+
void SSL_CTX::setVerifyPeer()
{
method_->setVerifyPeer();
@@ -1881,6 +1941,12 @@ void SSL_CTX::setFailNoCert()
}
+void SSL_CTX::setVerifyCallback(VerifyCallback vc)
+{
+ verifyCallback_ = vc;
+}
+
+
bool SSL_CTX::SetDH(const DH& dh)
{
dhParms_.p_ = dh.p->int_;
@@ -1906,7 +1972,7 @@ bool SSL_CTX::SetCipherList(const char* list)
int idx = 0;
for(;;) {
- int len;
+ size_t len;
prev = haystack;
haystack = strstr(haystack, needle);
@@ -2316,7 +2382,7 @@ X509::X509(const char* i, size_t iSz, const char* s, size_t sSz,
: issuer_(i, iSz), subject_(s, sSz),
beforeDate_(b, bSz), afterDate_(a, aSz)
{}
-
+
X509_NAME* X509::GetIssuer()
{
@@ -2354,10 +2420,10 @@ ASN1_STRING* X509_NAME::GetEntry(int i)
memcpy(entry_.data, &name_[i], sz_ - i);
if (entry_.data[sz_ -i - 1]) {
entry_.data[sz_ - i] = 0;
- entry_.length = sz_ - i;
+ entry_.length = int(sz_) - i;
}
else
- entry_.length = sz_ - i - 1;
+ entry_.length = int(sz_) - i - 1;
entry_.type = 0;
return &entry_;
diff --git a/include/my_global.h b/include/my_global.h
index c6ac90d4a34..25ba94f7d3e 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -18,11 +18,6 @@
#ifndef _global_h
#define _global_h
-#ifndef EMBEDDED_LIBRARY
-#define HAVE_REPLICATION
-#define HAVE_EXTERNAL_CLIENT
-#endif
-
/*
InnoDB depends on some MySQL internals which other plugins should not
need. This is because of InnoDB's foreign key support, "safe" binlog
@@ -101,6 +96,11 @@
#endif
#endif /* !EMBEDDED_LIBRARY */
+#ifndef EMBEDDED_LIBRARY
+#define HAVE_REPLICATION
+#define HAVE_EXTERNAL_CLIENT
+#endif
+
/* Some defines to avoid ifdefs in the code */
#ifndef NETWARE_YIELD
#define NETWARE_YIELD
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 1eab4199deb..ca329eadf0f 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -207,9 +207,7 @@ void STDCALL mysql_server_end()
/* If library called my_init(), free memory allocated by it */
if (!org_my_init_done)
{
- my_end(MY_DONT_FREE_DBUG);
- /* Remove TRACING, if enabled by mysql_debug() */
- DBUG_POP();
+ my_end(0);
}
else
{
diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt
index fde37830ddf..346278425a7 100644
--- a/libmysqld/examples/CMakeLists.txt
+++ b/libmysqld/examples/CMakeLists.txt
@@ -29,13 +29,13 @@ ADD_DEFINITIONS(-DEMBEDDED_LIBRARY)
ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
../../client/mysql.cc ../../client/readline.cc
../../client/sql_string.cc)
-TARGET_LINK_LIBRARIES(mysql_embedded mysys yassl taocrypt zlib debug dbug regex strings wsock32)
+TARGET_LINK_LIBRARIES(mysql_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
ADD_DEPENDENCIES(mysql_embedded libmysqld)
-ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc)
-TARGET_LINK_LIBRARIES(mysqltest_embedded mysys yassl taocrypt zlib debug dbug regex strings wsock32)
+ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.c)
+TARGET_LINK_LIBRARIES(mysqltest_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
ADD_DEPENDENCIES(mysqltest_embedded libmysqld)
ADD_EXECUTABLE(mysql_client_test_embedded ../../tests/mysql_client_test.c)
-TARGET_LINK_LIBRARIES(mysql_client_test_embedded debug dbug mysys yassl taocrypt zlib strings wsock32)
+TARGET_LINK_LIBRARIES(mysql_client_test_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
ADD_DEPENDENCIES(mysql_client_test_embedded libmysqld)
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 6e82812239e..23572ad4929 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -384,7 +384,9 @@ static void emb_free_embedded_thd(MYSQL *mysql)
thd->clear_data_list();
thread_count--;
thd->store_globals();
+ thd->unlink();
delete thd;
+ my_pthread_setspecific_ptr(THR_THD, 0);
mysql->thd=0;
}
@@ -538,12 +540,7 @@ int init_embedded_server(int argc, char **argv, char **groups)
(void) thr_setconcurrency(concurrency); // 10 by default
- if (flush_time && flush_time != ~(ulong) 0L)
- {
- pthread_t hThread;
- if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
- sql_print_error("Warning: Can't create thread to manage maintenance");
- }
+ start_handle_manager();
// FIXME initialize binlog_filter and rpl_filter if not already done
// corresponding delete is in clean_up()
@@ -627,6 +624,7 @@ void *create_embedded_thd(int client_flag)
bzero((char*) &thd->net, sizeof(thd->net));
thread_count++;
+ threads.append(thd);
return thd;
err:
delete(thd);
diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def
index 2aa75c0b23c..047cfe0fe57 100644
--- a/libmysqld/libmysqld.def
+++ b/libmysqld/libmysqld.def
@@ -2,34 +2,6 @@ LIBRARY LIBMYSQLD
DESCRIPTION 'MySQL 5.1 Embedded Server Library'
VERSION 5.1
EXPORTS
- _dig_vec_upper
- _dig_vec_lower
- bmove_upp
- delete_dynamic
- free_defaults
- getopt_compare_strings
- getopt_ull_limit_value
- handle_options
- init_dynamic_array
- insert_dynamic
- int2str
- is_prefix
- list_add
- list_delete
- load_defaults
- max_allowed_packet
- my_cgets
- my_end
- my_getopt_print_errors
- my_init
- my_malloc
- my_memdup
- my_no_flags_free
- my_path
- my_print_help
- my_print_variables
- my_realloc
- my_strdup
mysql_thread_end
mysql_thread_init
myodbc_remove_escape
@@ -102,47 +74,13 @@ EXPORTS
mysql_thread_safe
mysql_use_result
mysql_warning_count
- set_dynamic
- strcend
- strcont
- strdup_root
- strfill
- strinstr
- strmake
- strmov
- strxmov
mysql_server_end
mysql_server_init
get_tty_password
- sql_protocol_typelib
mysql_get_server_version
mysql_set_character_set
mysql_sqlstate
- charsets_dir
- disabled_my_option
- my_charset_latin1
- init_alloc_root
- my_progname
- get_charset_name
- get_charset_by_csname
- print_defaults
- find_type
- strxnmov
- strend
- my_fopen
- my_fclose
- unpack_filename
- str2int
- int10_to_str
- longlong10_to_str
- my_snprintf_8bit
- alloc_root
- free_root
- my_read
- llstr
mysql_get_parameters
- mysql_thread_init
- mysql_thread_end
mysql_stmt_bind_param
mysql_stmt_bind_result
mysql_stmt_execute
@@ -170,7 +108,3 @@ EXPORTS
mysql_stmt_attr_get
mysql_stmt_attr_set
mysql_stmt_field_count
- get_defaults_options
- my_charset_bin
- my_charset_same
- modify_defaults_file
diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql
index 999f9c1dde5..f9e572c1215 100644
--- a/mysql-test/include/mtr_warnings.sql
+++ b/mysql-test/include/mtr_warnings.sql
@@ -235,8 +235,10 @@ BEGIN
FROM information_schema.global_variables
WHERE variable_name='LOG_ERROR';
- SET @@session.max_allowed_packet= 1024*1024*1024;
+ SET @old_max_allowed_packet= @@global.max_allowed_packet;
+ SET @@global.max_allowed_packet= 1024*1024*1024;
SET text= load_file(@log_error);
+ SET @@global.max_allowed_packet= @old_max_allowed_packet;
-- select text;
SET pos= LOCATE('\n', text);
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 66258aa3eca..1842fb8b1dd 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1754,8 +1754,8 @@ create table t1 like information_schema.character_sets;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `CHARACTER_SET_NAME` varchar(64) NOT NULL DEFAULT '',
- `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL DEFAULT '',
+ `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '',
+ `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '',
`DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
`MAXLEN` bigint(3) NOT NULL DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
diff --git a/mysql-test/r/csv_alter_table.result b/mysql-test/r/csv_alter_table.result
new file mode 100644
index 00000000000..b406e40b15d
--- /dev/null
+++ b/mysql-test/r/csv_alter_table.result
@@ -0,0 +1,40 @@
+# ===== csv_alter_table.1 =====
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
+ALTER TABLE t1 ADD COLUMN b CHAR(5) NOT NULL;
+DESC t1;
+Field Type Null Key Default Extra
+a int(11) NO NULL
+b char(5) NO NULL
+ALTER TABLE t1 DROP COLUMN b;
+DESC t1;
+Field Type Null Key Default Extra
+a int(11) NO NULL
+ALTER TABLE t1 MODIFY a BIGINT NOT NULL;
+DESC t1;
+Field Type Null Key Default Extra
+a bigint(20) NO NULL
+ALTER TABLE t1 CHANGE a a INT NOT NULL;
+DESC t1;
+Field Type Null Key Default Extra
+a int(11) NO NULL
+DROP TABLE t1;
+# ===== csv_alter_table.2 =====
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
+ALTER TABLE t1 ADD COLUMN b CHAR(5);
+ERROR 42000: The storage engine for the table doesn't support nullable columns
+DESC t1;
+Field Type Null Key Default Extra
+a int(11) NO NULL
+ALTER TABLE t1 MODIFY a BIGINT;
+ERROR 42000: The storage engine for the table doesn't support nullable columns
+DESC t1;
+Field Type Null Key Default Extra
+a int(11) NO NULL
+ALTER TABLE t1 CHANGE a a INT;
+ERROR 42000: The storage engine for the table doesn't support nullable columns
+DESC t1;
+Field Type Null Key Default Extra
+a int(11) NO NULL
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_filesystem.result b/mysql-test/r/ctype_filesystem.result
new file mode 100644
index 00000000000..b461cf2a1a4
--- /dev/null
+++ b/mysql-test/r/ctype_filesystem.result
@@ -0,0 +1,11 @@
+SET CHARACTER SET utf8;
+SHOW VARIABLES like 'character_sets_dir';
+Variable_name Value
+character_sets_dir MYSQL_TEST_DIR/ß/
+SHOW VARIABLES like 'character_set_filesystem';
+Variable_name Value
+character_set_filesystem latin1
+SHOW VARIABLES like 'character_set_client';
+Variable_name Value
+character_set_client utf8
+SET CHARACTER SET default;
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 12e6c9bb492..6f4ae965ca0 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -1848,3 +1848,35 @@ select hex(_utf8 B'001111111111');
ERROR HY000: Invalid utf8 character string: 'FF'
select (_utf8 X'616263FF');
ERROR HY000: Invalid utf8 character string: 'FF'
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
+INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
+CONVERT(a, CHAR) CONVERT(b, CHAR)
+70002 1065
+70001 1085
+70000 1092
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
+CONVERT(a, CHAR) CONVERT(b, CHAR)
+70000 1092
+70001 1085
+70002 1065
+ALTER TABLE t1 ADD UNIQUE (b);
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
+CONVERT(a, CHAR) CONVERT(b, CHAR)
+70002 1065
+70001 1085
+70000 1092
+DROP INDEX b ON t1;
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
+CONVERT(a, CHAR) CONVERT(b, CHAR)
+70002 1065
+70001 1085
+70000 1092
+ALTER TABLE t1 ADD INDEX (b);
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
+CONVERT(a, CHAR) CONVERT(b, CHAR)
+70002 1065
+70001 1085
+70000 1092
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/events_scheduling.result b/mysql-test/r/events_scheduling.result
index b7d4578bede..63140bffaa4 100644
--- a/mysql-test/r/events_scheduling.result
+++ b/mysql-test/r/events_scheduling.result
@@ -1,7 +1,8 @@
CREATE DATABASE IF NOT EXISTS events_test;
USE events_test;
+SET @event_scheduler=@@global.event_scheduler;
SET GLOBAL event_scheduler=OFF;
-Try agian to make sure it's allowed
+Try again to make sure it's allowed
SET GLOBAL event_scheduler=OFF;
SHOW VARIABLES LIKE 'event_scheduler';
Variable_name Value
@@ -64,8 +65,8 @@ INSERT INTO table_4 VALUES (1);
SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
IF(SUM(a) >= 4, 'OK', 'ERROR')
OK
-SELECT IF(SUM(a) >= 5, 'OK', 'ERROR') FROM table_2;
-IF(SUM(a) >= 5, 'OK', 'ERROR')
+SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_2;
+IF(SUM(a) >= 4, 'OK', 'ERROR')
OK
SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3;
IF(SUM(a) >= 1, 'OK', 'ERROR')
@@ -94,4 +95,4 @@ DROP TABLE table_2;
DROP TABLE table_3;
DROP TABLE table_4;
DROP DATABASE events_test;
-SET GLOBAL event_scheduler=OFF;
+SET GLOBAL event_scheduler=@event_scheduler;
diff --git a/mysql-test/r/events_time_zone.result b/mysql-test/r/events_time_zone.result
index b20aa445183..155a9d155af 100644
--- a/mysql-test/r/events_time_zone.result
+++ b/mysql-test/r/events_time_zone.result
@@ -14,6 +14,7 @@ RETURN FLOOR((i % (step * n) + 0.1) / step);
END//
SET @step3= @step * 3;
SET @step6= @step * 6;
+SET @unix_time= UNIX_TIMESTAMP() - 1;
SET @unix_time= @unix_time - @unix_time % @step6;
INSERT INTO mysql.time_zone VALUES (NULL, 'N');
SET @tzid= LAST_INSERT_ID();
@@ -21,7 +22,7 @@ INSERT INTO mysql.time_zone_transition_type
VALUES (@tzid, 0, 0, 0, 'b16420_0');
INSERT INTO mysql.time_zone_transition_type
VALUES (@tzid, 1, @step3 - @step, 1, 'b16420_1');
-INSERT INTO mysql.time_zone_name VALUES ('bug16420', @tzid);
+INSERT INTO mysql.time_zone_name VALUES ('<TZ_NAME_1>', @tzid);
CREATE TABLE t1 (count INT, unix_time INT, local_time INT, comment CHAR(80));
CREATE TABLE t2 (count INT);
INSERT INTO t2 VALUES (1);
@@ -48,7 +49,7 @@ END//
SET TIME_ZONE= '+00:00';
CREATE EVENT e1 ON SCHEDULE EVERY @step SECOND
STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e1>");
-SET TIME_ZONE= 'bug16420';
+SET TIME_ZONE= '<TZ_NAME_1>';
CREATE EVENT e2 ON SCHEDULE EVERY @step SECOND
STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e2>");
SET GLOBAL EVENT_SCHEDULER= ON;
@@ -86,6 +87,7 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
+ALTER TABLE mysql.time_zone AUTO_INCREMENT = 6;
SET TIME_ZONE= '+00:00';
CREATE TABLE t1 (event CHAR(2), dt DATE, offset INT);
INSERT INTO mysql.time_zone VALUES (NULL, 'N');
@@ -111,8 +113,8 @@ INSERT INTO mysql.time_zone_transition
VALUES (@tzid, @now + 7 * @step, 2);
INSERT INTO mysql.time_zone_transition
VALUES (@tzid, @now + 12 * @step, 3);
-INSERT INTO mysql.time_zone_name VALUES ('bug16420_2', @tzid);
-SET TIME_ZONE= 'bug16420_2';
+INSERT INTO mysql.time_zone_name VALUES ('<TZ_NAME_2>', @tzid);
+SET TIME_ZONE= '<TZ_NAME_2>';
SET GLOBAL EVENT_SCHEDULER= ON;
SET GLOBAL EVENT_SCHEDULER= OFF;
Below we should see the following:
@@ -143,6 +145,7 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
+ALTER TABLE mysql.time_zone AUTO_INCREMENT = 6;
DROP FUNCTION round_to_step;
DROP TABLE t_step;
DROP DATABASE mysqltest_db1;
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 2fc00073448..0124ced40ce 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -494,3 +494,31 @@ SELECT a FROM t1 WHERE MATCH a AGAINST ('+city* of*' IN BOOLEAN MODE);
a
City Of God
DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b));
+INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1),
+('test', 1),('test', 2),('test', 3),('test', 4);
+EXPLAIN SELECT * FROM t1
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext b,a a 0 1 Using where
+EXPLAIN SELECT * FROM t1 USE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
+EXPLAIN SELECT * FROM t1 FORCE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
+EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b b 5 const 4 Using where
+EXPLAIN SELECT * FROM t1 USE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b b 5 const 4 Using where
+EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b b 5 const 4 Using where
+DROP TABLE t1;
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index 715f319198c..def03deb351 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -68,7 +68,7 @@ Warnings:
Error 1259 ZLIB: Input data corrupted
Error 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
drop table t1;
-set @@max_allowed_packet=1048576*100;
+set @@global.max_allowed_packet=1048576*100;
select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
0
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index fd9cf69907c..e0a6c44eb01 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1453,4 +1453,27 @@ LIMIT 1)
1
DROP TABLE derived1;
DROP TABLE D;
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
+SET SQL_MODE='ONLY_FULL_GROUP_BY';
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+3
+SELECT COUNT(*) FROM t1 where a=1;
+COUNT(*)
+3
+SELECT COUNT(*),a FROM t1;
+ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
+SELECT COUNT(*) FROM t1 a JOIN t1 b ON a.a= b.a;
+COUNT(*)
+9
+SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
+FROM t1 outr;
+ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
+SELECT COUNT(*) FROM t1 a JOIN t1 outr
+ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
+COUNT(*)
+0
+SET SQL_MODE=default;
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result
index 942073e3fbd..63f9ac71e74 100644
--- a/mysql-test/r/func_sapdb.result
+++ b/mysql-test/r/func_sapdb.result
@@ -256,3 +256,15 @@ a
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f")
2003-01-02 10:11:12.001200
+select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00');
+timediff('2008-09-29 20:10:10','2008-09-30 20:10:10') time('00:00:00')
+-24:00:00 00:00:00
+select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00');
+timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00')
+0
+select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
+timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00')
+1
+SELECT CAST(time('-73:42:12') AS DECIMAL);
+CAST(time('-73:42:12') AS DECIMAL)
+-734212
diff --git a/mysql-test/r/general_log_func.result b/mysql-test/r/general_log_func.result
index 4b6cbda6eff..39ba90265d5 100644
--- a/mysql-test/r/general_log_func.result
+++ b/mysql-test/r/general_log_func.result
@@ -26,7 +26,7 @@ SELECT @@general_log;
INSERT into t1(name) values('Record_3');
INSERT into t1(name) values('Record_4');
## There should be a difference ##
-SET @@session.max_allowed_packet= 1024*1024*1024;
+SET @@global.max_allowed_packet= 1024*1024*1024;
SET @orig_file= load_file('MYSQLD_LOGFILE.orig');
SET @copy_file= load_file('MYSQLD_LOGFILE.copy');
SELECT STRCMP(@orig_file, @copy_file);
diff --git a/mysql-test/r/group_concat_max_len_func.result b/mysql-test/r/group_concat_max_len_func.result
index 715a84ce72b..52d67b8d274 100644
--- a/mysql-test/r/group_concat_max_len_func.result
+++ b/mysql-test/r/group_concat_max_len_func.result
@@ -1,31 +1,41 @@
SET @save = @@global.group_concat_max_len;
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
## Creating new table t1 ##
CREATE TABLE t1
(
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id),
-rollno int NOT NULL,
+rollno INT NOT NULL,
name VARCHAR(30)
);
'#--------------------FN_DYNVARS_034_01-------------------------#'
-## Setting initial value of variable to 4 ##
+## Setting initial value of variable to 4 ##
SET @@global.group_concat_max_len = 4;
-## Inserting some rows in table ##
-INSERT into t1(rollno, name) values(1, 'Record_1');
-INSERT into t1(rollno, name) values(2, 'Record_2');
-INSERT into t1(rollno, name) values(1, 'Record_3');
-INSERT into t1(rollno, name) values(3, 'Record_4');
-INSERT into t1(rollno, name) values(1, 'Record_5');
-INSERT into t1(rollno, name) values(3, 'Record_6');
-INSERT into t1(rollno, name) values(4, 'Record_7');
-INSERT into t1(rollno, name) values(4, 'Record_8');
-## Creating two new connections ##
+## Inserting some rows in table ##
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_1');
+INSERT INTO t1(rollno, name) VALUES(2, 'Record_2');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_3');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_4');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_5');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_6');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_7');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_8');
+SELECT * FROM t1 ORDER BY id;
+id rollno name
+1 1 Record_1
+2 2 Record_2
+3 1 Record_3
+4 3 Record_4
+5 1 Record_5
+6 3 Record_6
+7 4 Record_7
+8 4 Record_8
+## Creating two new connections ##
'#--------------------FN_DYNVARS_034_02-------------------------#'
## Connecting with test_con1 ##
-## Accessing data and using group_concat on column whose value is greater than 4 ##
-SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
-id rollno group_concat(name)
+## Accessing data and using group_concat on column whose value is greater than 4 ##
+SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
+id rollno GROUP_CONCAT(name)
1 1 Reco
2 2 Reco
4 3 Reco
@@ -33,10 +43,10 @@ id rollno group_concat(name)
Warnings:
Warning 1260 4 line(s) were cut by GROUP_CONCAT()
## Changing session value of variable and verifying its behavior, ##
-## warning should come here ##
+## warning should come here ##
SET @@session.group_concat_max_len = 10;
-SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
-id rollno group_concat(name)
+SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
+id rollno GROUP_CONCAT(name)
1 1 Record_1,R
2 2 Record_2
4 3 Record_4,R
@@ -44,18 +54,18 @@ id rollno group_concat(name)
Warnings:
Warning 1260 3 line(s) were cut by GROUP_CONCAT()
'#--------------------FN_DYNVARS_034_03-------------------------#'
-## Connecting with new connection test_con2 ##
-## Verifying initial value of variable. It should be 4 ##
+## Connecting with new connection test_con2 ##
+## Verifying initial value of variable. It should be 4 ##
SELECT @@session.group_concat_max_len = 4;
@@session.group_concat_max_len = 4
1
-## Setting session value of variable to 20 and verifying variable is concating ##
-## column's value to 20 or not ##
+## Setting session value of variable to 20 and verifying variable is concating ##
+## column's value to 20 or not ##
SET @@session.group_concat_max_len = 20;
## Verifying value of name column, it should not me more than 20 characters ##
## Warning should come here ##
-SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
-id rollno group_concat(name)
+SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
+id rollno GROUP_CONCAT(name)
1 1 Record_1,Record_3,Re
2 2 Record_2
4 3 Record_4,Record_6
@@ -63,17 +73,17 @@ id rollno group_concat(name)
Warnings:
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
'#--------------------FN_DYNVARS_034_04-------------------------#'
-## Setting session value of variable to 26. No warning should appear here ##
-## because the value after concatination is less than 30 ##
+## Setting session value of variable to 26. No warning should appear here ##
+## because the value after concatination is less than 30 ##
SET @@session.group_concat_max_len = 26;
-## Verifying value of name column, it should not give warning now ##
-SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
-id rollno group_concat(name)
+## Verifying value of name column, it should not give warning now ##
+SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
+id rollno GROUP_CONCAT(name)
1 1 Record_1,Record_3,Record_5
2 2 Record_2
4 3 Record_4,Record_6
7 4 Record_7,Record_8
## Dropping table t1 ##
-DROP table t1;
+DROP TABLE t1;
## Disconnecting both the connection ##
SET @@global.group_concat_max_len = @save;
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 288d86e2db5..bbcae78f5e3 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -525,8 +525,8 @@ drop table t1;
SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table
CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` (
- `CHARACTER_SET_NAME` varchar(64) NOT NULL DEFAULT '',
- `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL DEFAULT '',
+ `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '',
+ `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '',
`DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
`MAXLEN` bigint(3) NOT NULL DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
@@ -534,8 +534,8 @@ set names latin2;
SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table
CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` (
- `CHARACTER_SET_NAME` varchar(64) NOT NULL DEFAULT '',
- `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL DEFAULT '',
+ `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '',
+ `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '',
`DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
`MAXLEN` bigint(3) NOT NULL DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
@@ -549,8 +549,8 @@ alter table t1 default character set utf8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `CHARACTER_SET_NAME` varchar(64) NOT NULL DEFAULT '',
- `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL DEFAULT '',
+ `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '',
+ `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '',
`DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
`MAXLEN` bigint(3) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8
@@ -724,8 +724,8 @@ select column_type from information_schema.columns
where table_schema="information_schema" and table_name="COLUMNS" and
(column_name="character_set_name" or column_name="collation_name");
column_type
-varchar(64)
-varchar(64)
+varchar(32)
+varchar(32)
select TABLE_ROWS from information_schema.tables where
table_schema="information_schema" and table_name="COLUMNS";
TABLE_ROWS
@@ -772,7 +772,6 @@ information_schema PARTITIONS PARTITION_DESCRIPTION
information_schema PLUGINS PLUGIN_DESCRIPTION
information_schema PROCESSLIST INFO
information_schema ROUTINES ROUTINE_DEFINITION
-information_schema ROUTINES SQL_MODE
information_schema TRIGGERS ACTION_CONDITION
information_schema TRIGGERS ACTION_STATEMENT
information_schema VIEWS VIEW_DEFINITION
@@ -1660,4 +1659,60 @@ id select_type table type possible_keys key key_len ref rows Extra
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
+set global init_connect="drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;";
+select * from information_schema.global_variables where variable_name='init_connect';
+VARIABLE_NAME VARIABLE_VALUE
+INIT_CONNECT drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists t1;
+drop table if exists t1;drop table if exists
+Warnings:
+Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row 1
+set global init_connect="";
+create table t0 select * from information_schema.global_status where VARIABLE_NAME='COM_SELECT';
+SELECT 1;
+1
+1
+select a.VARIABLE_VALUE - b.VARIABLE_VALUE from t0 b, information_schema.global_status a
+where a.VARIABLE_NAME = b.VARIABLE_NAME;
+a.VARIABLE_VALUE - b.VARIABLE_VALUE
+2
+drop table t0;
End of 5.1 tests.
diff --git a/mysql-test/r/information_schema_part.result b/mysql-test/r/information_schema_part.result
index 74d52e9521f..04dc9ccf2c0 100644
--- a/mysql-test/r/information_schema_part.result
+++ b/mysql-test/r/information_schema_part.result
@@ -145,3 +145,9 @@ table_schema = "test" AND table_name = "t1";
PARTITION_DESCRIPTION
10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53
drop table t1;
+drop table if exists t1;
+create table t1 (f1 int key) partition by key(f1) partitions 2;
+select create_options from information_schema.tables where table_schema="test";
+create_options
+partitioned
+drop table t1;
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index 2c14b1f2385..aeacd054511 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -1677,3 +1677,9 @@ select @@session.sql_log_bin, @@session.binlog_format, @@session.tx_isolation;
CREATE TABLE t1 ( a INT ) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
+CREATE INDEX i1 on t1 (a(3));
+SELECT * FROM t1 WHERE a = 'abcde';
+a
+DROP TABLE t1;
diff --git a/mysql-test/r/log_output_func.result b/mysql-test/r/log_output_func.result
index 8af7f471195..060f930a161 100644
--- a/mysql-test/r/log_output_func.result
+++ b/mysql-test/r/log_output_func.result
@@ -1,13 +1,11 @@
+SET @start_value= @@global.log_output;
+SET @start_general_log= @@global.general_log;
+SET @start_general_log_file= @@global.general_log_file;
'#--------------------FN_DYNVARS_065_01-------------------------#'
SET @@global.log_output = 'NONE';
'connect (con1,localhost,root,,,,)'
-'connection con1'
-SELECT @@global.log_output;
-@@global.log_output
-NONE
SET @@global.log_output = 'TABLE,FILE';
'connect (con2,localhost,root,,,,)'
-'connection con2'
SELECT @@global.log_output;
@@global.log_output
FILE,TABLE
@@ -18,7 +16,7 @@ SET @@global.log_output = 'NONE';
TRUNCATE TABLE mysql.general_log;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT);
-INSERT INTO t1 value(1);
+INSERT INTO t1 VALUE(1);
SELECT 'abc';
abc
abc
@@ -29,25 +27,33 @@ count(*)
SET @@global.log_output = 'TABLE';
TRUNCATE TABLE mysql.general_log;
DROP TABLE IF EXISTS t1;
-create table t1(a int);
-INSERT INTO t1 value(1);
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUE(1);
SELECT 'abc';
abc
abc
-SELECT count(*) from mysql.general_log;
-count(*)
-5
-'Bug#35371: Changing general_log file is crashing server'
-'SET @@global.general_log_file = @log_file;'
+SELECT count(*)>4 FROM mysql.general_log;
+count(*)>4
+1
+SET @@global.general_log = 'OFF';
+FLUSH LOGS;
+SET @@global.general_log_file = 'MYSQLTEST_VARDIR/run/mytest.log';
+SET @@global.general_log = 'ON';
SET @@global.log_output = 'FILE';
TRUNCATE TABLE mysql.general_log;
DROP TABLE IF EXISTS t1;
-create table t1(a int);
-INSERT INTO t1 value(1);
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUE(1);
SELECT 'abc';
abc
abc
-SELECT count(*) from mysql.general_log;
+SELECT count(*) FROM mysql.general_log;
count(*)
0
DROP TABLE t1;
+connection default;
+SET @@global.general_log= 'OFF';
+SET @@global.general_log_file= @start_general_log_file;
+SET @@global.log_output= @start_value;
+SET @@global.general_log= @start_general_log;
+SET @@global.general_log= 'ON';
diff --git a/mysql-test/r/max_allowed_packet_basic.result b/mysql-test/r/max_allowed_packet_basic.result
index 3940cc1b2f2..0745d5a36e1 100644
--- a/mysql-test/r/max_allowed_packet_basic.result
+++ b/mysql-test/r/max_allowed_packet_basic.result
@@ -2,10 +2,7 @@ SET @start_global_value = @@global.max_allowed_packet;
SELECT @start_global_value;
@start_global_value
1048576
-SET @start_session_value = @@session.max_allowed_packet;
-SELECT @start_session_value;
-@start_session_value
-1048576
+SET @@global.max_allowed_packet = DEFAULT;
'#--------------------FN_DYNVARS_070_01-------------------------#'
SET @@global.max_allowed_packet = 1000;
Warnings:
@@ -15,7 +12,9 @@ SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1048576
SET @@session.max_allowed_packet = 20000;
+ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SET @@session.max_allowed_packet = DEFAULT;
+ERROR 42000: Variable 'max_allowed_packet' doesn't have a default value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1048576
@@ -24,10 +23,6 @@ SET @@global.max_allowed_packet = DEFAULT;
SELECT @@global.max_allowed_packet = 1048576;
@@global.max_allowed_packet = 1048576
1
-SET @@session.max_allowed_packet = DEFAULT;
-SELECT @@session.max_allowed_packet = 1048576;
-@@session.max_allowed_packet = 1048576
-1
'#--------------------FN_DYNVARS_070_03-------------------------#'
SET @@global.max_allowed_packet = 1024;
SELECT @@global.max_allowed_packet;
@@ -48,25 +43,30 @@ SELECT @@global.max_allowed_packet;
1073740800
'#--------------------FN_DYNVARS_070_04-------------------------#'
SET @@session.max_allowed_packet = 1024;
+ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1024
+1048576
SET @@session.max_allowed_packet = 1025;
+ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1024
+1048576
SET @@session.max_allowed_packet = 65535;
+ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-64512
+1048576
SET @@session.max_allowed_packet = 1073741824;
+ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1073741824
+1048576
SET @@session.max_allowed_packet = 1073741823;
+ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1073740800
+1048576
'#------------------FN_DYNVARS_070_05-----------------------#'
SET @@global.max_allowed_packet = 0;
Warnings:
@@ -103,37 +103,33 @@ SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1073741824
SET @@session.max_allowed_packet = 0;
-Warnings:
-Warning 1292 Truncated incorrect max_allowed_packet value: '0'
+ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1024
+1048576
SET @@session.max_allowed_packet = 1023;
-Warnings:
-Warning 1292 Truncated incorrect max_allowed_packet value: '1023'
+ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1024
+1048576
SET @@session.max_allowed_packet = -2;
-Warnings:
-Warning 1292 Truncated incorrect max_allowed_packet value: '0'
+ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1024
+1048576
SET @@session.max_allowed_packet = 65530.34.;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
SET @@session.max_allowed_packet = 10737418241;
-Warnings:
-Warning 1292 Truncated incorrect max_allowed_packet value: '10737418241'
+ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1073741824
+1048576
'Bug # 34837: Errors are not coming on assigning invalid values to variable';
SET @@session.max_allowed_packet = test;
ERROR 42000: Incorrect argument type to variable 'max_allowed_packet'
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1073741824
+1048576
'#------------------FN_DYNVARS_070_06-----------------------#'
SELECT @@global.max_allowed_packet = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -166,6 +162,7 @@ SELECT @@max_allowed_packet = @@global.max_allowed_packet;
0
'#---------------------FN_DYNVARS_070_10----------------------#'
SET @@max_allowed_packet = 100000;
+ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@max_allowed_packet = @@local.max_allowed_packet;
@@max_allowed_packet = @@local.max_allowed_packet
1
@@ -174,9 +171,10 @@ SELECT @@local.max_allowed_packet = @@session.max_allowed_packet;
1
'#---------------------FN_DYNVARS_070_11----------------------#'
SET max_allowed_packet = 1024;
+ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@max_allowed_packet;
@@max_allowed_packet
-1024
+1048576
SELECT local.max_allowed_packet;
ERROR 42S02: Unknown table 'local' in field list
SELECT session.max_allowed_packet;
@@ -187,7 +185,6 @@ SET @@global.max_allowed_packet = @start_global_value;
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1048576
-SET @@session.max_allowed_packet = @start_session_value;
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
1048576
diff --git a/mysql-test/r/max_allowed_packet_func.result b/mysql-test/r/max_allowed_packet_func.result
index 87d1a908932..0d682b65aea 100644
--- a/mysql-test/r/max_allowed_packet_func.result
+++ b/mysql-test/r/max_allowed_packet_func.result
@@ -9,26 +9,17 @@ PRIMARY KEY (id),
name BLOB
);
'#--------------------FN_DYNVARS_070_01-------------------------#'
-## Setting value of max_allowed packet and net_buffer_length to 1024 ##
+## Setting value of max_allowed packet and net_buffer_length to 1024 ##
SET @@session.max_allowed_packet = 1024;
-SET @@session.net_buffer_length = 1024;
+ERROR HY000: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.max_allowed_packet;
@@session.max_allowed_packet
-1024
+1048576
+SET @@session.net_buffer_length = 1024;
+ERROR HY000: SESSION variable 'net_buffer_length' is read-only. Use SET GLOBAL to assign the value
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
-1024
-## Inserting and fetching data of length greater than 1024 ##
-INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
-SELECT length("aaaaaasssssssssssdddddddfffffgggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk") as len;
-len
-1470
-## Verifying record in table t1 ##
-SELECT * from t1;
-id name
-1 aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-'Bug#35381: Error is not coming on inserting and fetching data of length'
-'greater than max_allowed_packet size at session level';
+16384
'#--------------------FN_DYNVARS_070_02-------------------------#'
## Setting value of max_allowed packet and net_buffer_length to 1024 ##
SET @@global.max_allowed_packet = 1024;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index aa88b44f5b4..b8f6aa9e4d4 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -378,29 +378,6 @@ where 0=1;
delete t1, t2 from t2,t1
where t1.id1=t2.id2 and 0=1;
drop table t1,t2;
-create table t1 ( a int not null, b int not null) ;
-alter table t1 add index i1(a);
-delete from t1 where a > 2000000;
-create table t2 like t1;
-insert into t2 select * from t1;
-select 't2 rows before small delete', count(*) from t1;
-t2 rows before small delete count(*)
-t2 rows before small delete 2000000
-delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 2;
-select 't2 rows after small delete', count(*) from t2;
-t2 rows after small delete count(*)
-t2 rows after small delete 1999999
-select 't1 rows after small delete', count(*) from t1;
-t1 rows after small delete count(*)
-t1 rows after small delete 1999999
-delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 100*1000;
-select 't2 rows after big delete', count(*) from t2;
-t2 rows after big delete count(*)
-t2 rows after big delete 1900001
-select 't1 rows after big delete', count(*) from t1;
-t1 rows after big delete count(*)
-t1 rows after big delete 1900001
-drop table t1,t2;
CREATE TABLE t1 ( a int );
CREATE TABLE t2 ( a int );
DELETE t1 FROM t1, t2 AS t3;
diff --git a/mysql-test/r/multi_update2.result b/mysql-test/r/multi_update2.result
new file mode 100644
index 00000000000..3712e638f40
--- /dev/null
+++ b/mysql-test/r/multi_update2.result
@@ -0,0 +1,25 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
+# The protocolling of many inserts into t1 is suppressed.
+ALTER TABLE t1 ADD INDEX i1(a);
+DELETE FROM t1 WHERE a > 2000000;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 SELECT * FROM t1;
+SELECT 't2 rows before small delete', COUNT(*) FROM t1;
+t2 rows before small delete COUNT(*)
+t2 rows before small delete 2000000
+DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 2;
+SELECT 't2 rows after small delete', COUNT(*) FROM t2;
+t2 rows after small delete COUNT(*)
+t2 rows after small delete 1999999
+SELECT 't1 rows after small delete', COUNT(*) FROM t1;
+t1 rows after small delete COUNT(*)
+t1 rows after small delete 1999999
+DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 100*1000;
+SELECT 't2 rows after big delete', COUNT(*) FROM t2;
+t2 rows after big delete COUNT(*)
+t2 rows after big delete 1900001
+SELECT 't1 rows after big delete', COUNT(*) FROM t1;
+t1 rows after big delete COUNT(*)
+t1 rows after big delete 1900001
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/mysqlbinlog_row_big.result b/mysql-test/r/mysqlbinlog_row_big.result
index 0daf50e1ac3..f2ca72f9936 100644
--- a/mysql-test/r/mysqlbinlog_row_big.result
+++ b/mysql-test/r/mysqlbinlog_row_big.result
@@ -9,7 +9,7 @@ SET timestamp=1000000000;
#
# We need big packets.
#
-SET @@session.max_allowed_packet= 1024*1024*1024;
+SET @@global.max_allowed_packet= 1024*1024*1024;
#
# Delete all existing binary logs.
#
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index 138d36ad606..0b0ce3c2ba4 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -101,6 +101,19 @@ drop view v_bug25347;
drop table t_bug25347;
drop database d_bug25347;
use test;
+create view v1 as select * from information_schema.routines;
+check table v1, information_schema.routines;
+Table Op Msg_type Msg_text
+test.v1 check status OK
+information_schema.routines check note The storage engine for the table doesn't support check
+drop view v1;
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT);
+test.t1
+Error : Incorrect information in file: './test/t1.frm'
+error : Corrupt
+test.t2 OK
+DROP TABLE t1, t2;
End of 5.0 tests
create table t1(a int);
create view v1 as select * from t1;
diff --git a/mysql-test/r/net_buffer_length_basic.result b/mysql-test/r/net_buffer_length_basic.result
index ddaad3dfa91..be7e9082332 100644
--- a/mysql-test/r/net_buffer_length_basic.result
+++ b/mysql-test/r/net_buffer_length_basic.result
@@ -1,5 +1,5 @@
SET @start_global_value = @@global.net_buffer_length;
-SET @start_session_value = @@session.net_buffer_length;
+SET @@global.net_buffer_length = DEFAULT;
'#--------------------FN_DYNVARS_109_01-------------------------#'
SET @@global.net_buffer_length = 10000;
SET @@global.net_buffer_length = DEFAULT;
@@ -7,7 +7,9 @@ SELECT @@global.net_buffer_length;
@@global.net_buffer_length
16384
SET @@session.net_buffer_length = 20000;
+ERROR HY000: SESSION variable 'net_buffer_length' is read-only. Use SET GLOBAL to assign the value
SET @@session.net_buffer_length = DEFAULT;
+ERROR 42000: Variable 'net_buffer_length' doesn't have a default value
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
16384
@@ -16,10 +18,6 @@ SET @@global.net_buffer_length = DEFAULT;
SELECT @@global.net_buffer_length = 16384;
@@global.net_buffer_length = 16384
1
-SET @@session.net_buffer_length = DEFAULT;
-SELECT @@session.net_buffer_length = 16384;
-@@session.net_buffer_length = 16384
-1
'#--------------------FN_DYNVARS_109_03-------------------------#'
SET @@global.net_buffer_length = 1024;
SELECT @@global.net_buffer_length;
@@ -43,27 +41,6 @@ SELECT @@global.net_buffer_length;
64512
'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
'#--------------------FN_DYNVARS_109_04-------------------------#'
-SET @@session.net_buffer_length = 1024;
-SELECT @@session.net_buffer_length;
-@@session.net_buffer_length
-1024
-SET @@session.net_buffer_length = 1025;
-SELECT @@session.net_buffer_length;
-@@session.net_buffer_length
-1024
-SET @@session.net_buffer_length = 1048576;
-SELECT @@session.net_buffer_length;
-@@session.net_buffer_length
-1048576
-SET @@session.net_buffer_length = 1048575;
-SELECT @@session.net_buffer_length;
-@@session.net_buffer_length
-1047552
-SET @@session.net_buffer_length = 65535;
-SELECT @@session.net_buffer_length;
-@@session.net_buffer_length
-64512
-'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
'#------------------FN_DYNVARS_109_05-----------------------#'
SET @@global.net_buffer_length = 0;
Warnings:
@@ -105,42 +82,12 @@ ERROR 42000: Incorrect argument type to variable 'net_buffer_length'
SELECT @@global.net_buffer_length;
@@global.net_buffer_length
1048576
-SET @@session.net_buffer_length = 0;
-Warnings:
-Warning 1292 Truncated incorrect net_buffer_length value: '0'
-SELECT @@session.net_buffer_length;
-@@session.net_buffer_length
-1024
-SET @@session.net_buffer_length = -2;
-Warnings:
-Warning 1292 Truncated incorrect net_buffer_length value: '0'
-SELECT @@session.net_buffer_length;
-@@session.net_buffer_length
-1024
-SET @@session.net_buffer_length = 1048577;
-Warnings:
-Warning 1292 Truncated incorrect net_buffer_length value: '1048577'
-SELECT @@session.net_buffer_length;
-@@session.net_buffer_length
-1048576
-SET @@session.net_buffer_length = 1048576002;
-Warnings:
-Warning 1292 Truncated incorrect net_buffer_length value: '1048576002'
-SELECT @@session.net_buffer_length;
-@@session.net_buffer_length
-1048576
-SET @@session.net_buffer_length = 65530.34.;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
-SET @@session.net_buffer_length = 65550;
-SELECT @@session.net_buffer_length;
-@@session.net_buffer_length
-65536
'Bug # 34837: Errors are not coming on assigning invalid values to variable';
SET @@session.net_buffer_length = test;
ERROR 42000: Incorrect argument type to variable 'net_buffer_length'
SELECT @@session.net_buffer_length;
@@session.net_buffer_length
-65536
+16384
'#------------------FN_DYNVARS_109_06-----------------------#'
SELECT @@global.net_buffer_length = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -172,18 +119,10 @@ SELECT @@net_buffer_length = @@global.net_buffer_length;
@@net_buffer_length = @@global.net_buffer_length
0
'#---------------------FN_DYNVARS_109_10----------------------#'
-SET @@net_buffer_length = 100000;
-SELECT @@net_buffer_length = @@local.net_buffer_length;
-@@net_buffer_length = @@local.net_buffer_length
-1
-SELECT @@local.net_buffer_length = @@session.net_buffer_length;
-@@local.net_buffer_length = @@session.net_buffer_length
-1
'#---------------------FN_DYNVARS_109_11----------------------#'
-SET net_buffer_length = 1024;
SELECT @@net_buffer_length;
@@net_buffer_length
-1024
+16384
SELECT local.net_buffer_length;
ERROR 42S02: Unknown table 'local' in field list
SELECT session.net_buffer_length;
@@ -191,4 +130,3 @@ ERROR 42S02: Unknown table 'session' in field list
SELECT net_buffer_length = @@session.net_buffer_length;
ERROR 42S22: Unknown column 'net_buffer_length' in 'field list'
SET @@global.net_buffer_length = @start_global_value;
-SET @@session.net_buffer_length = @start_session_value;
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index a042d0a5dc3..70151acda22 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -73,11 +73,10 @@ variable_name LIKE 'SSL_CALLBACK_CACHE_HITS';
END$$
SELECT variable_name, variable_value FROM thread_status;
variable_name variable_value
-SSL_ACCEPTS 0
-SSL_CALLBACK_CACHE_HITS 0
+SSL_ACCEPTS #
+SSL_CALLBACK_CACHE_HITS #
DROP TABLE thread_status;
SET GLOBAL event_scheduler=0;
-End of 5.1 tests
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
Ssl_cipher AES128-SHA
@@ -192,3 +191,15 @@ UNLOCK TABLES;
SSL error: Unable to get private key from 'MYSQL_TEST_DIR/std_data/client-cert.pem'
mysqldump: Got error: 2026: SSL connection error when trying to connect
DROP TABLE t1;
+Variable_name Value
+Ssl_cipher DHE-RSA-AES256-SHA
+Variable_name Value
+Ssl_cipher EDH-RSA-DES-CBC3-SHA
+Variable_name Value
+Ssl_cipher EDH-RSA-DES-CBC-SHA
+Variable_name Value
+Ssl_cipher RC4-SHA
+select 'is still running; no cipher request crashed the server' as result from dual;
+result
+is still running; no cipher request crashed the server
+End of 5.1 tests
diff --git a/mysql-test/r/packet.result b/mysql-test/r/packet.result
index df0d9ff9adc..fa2fb33d278 100644
--- a/mysql-test/r/packet.result
+++ b/mysql-test/r/packet.result
@@ -1,32 +1,22 @@
set global max_allowed_packet=100;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100'
-set max_allowed_packet=100;
-Warnings:
-Warning 1292 Truncated incorrect max_allowed_packet value: '100'
set global net_buffer_length=100;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '100'
-set net_buffer_length=100;
-Warnings:
-Warning 1292 Truncated incorrect net_buffer_length value: '100'
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len
1024
select repeat('a',2000);
repeat('a',2000)
-NULL
-Warnings:
-Warning 1301 Result of repeat() was larger than max_allowed_packet (1024) - truncated
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length @@max_allowed_packet
1024 1024
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
ERROR 08S01: Got a packet bigger than 'max_allowed_packet' bytes
set global max_allowed_packet=default;
-set max_allowed_packet=default;
set global net_buffer_length=default;
-set net_buffer_length=default;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len
100
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 7a62001987f..cec4e60d139 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1,5 +1,17 @@
SET @old_general_log= @@global.general_log;
drop table if exists t1, t2;
+CREATE TABLE t1 (
+pk INT NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (pk)
+)
+/*!50100 PARTITION BY HASH (pk)
+PARTITIONS 2 */;
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (NULL);
+SELECT * FROM t1 WHERE pk < 0 ORDER BY pk;
+pk
+DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL, KEY(a))
PARTITION BY RANGE(a)
(PARTITION p1 VALUES LESS THAN (200), PARTITION pmax VALUES LESS THAN MAXVALUE);
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index 3692626f9ac..ad4d08e89ff 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -1,3 +1,25 @@
+drop table if exists t1;
+CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB
+PARTITION BY RANGE(id) (
+PARTITION p0 VALUES LESS THAN (5),
+PARTITION p1 VALUES LESS THAN (10),
+PARTITION p2 VALUES LESS THAN MAXVALUE
+);
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8),
+(9,9), (10,10), (11,11);
+SET @old_tx_isolation := @@session.tx_isolation;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+SET autocommit = 0;
+UPDATE t1 SET DATA = data*2 WHERE id = 3;
+SHOW ENGINE InnoDB STATUS;
+Type Name Status
+InnoDB 2 lock struct(s) 1 row lock(s)
+UPDATE t1 SET data = data*2 WHERE data = 2;
+SHOW ENGINE InnoDB STATUS;
+Type Name Status
+InnoDB 6 lock struct(s) 2 row lock(s)
+SET @@session.tx_isolation = @old_tx_isolation;
+DROP TABLE t1;
# Bug#37721, test of ORDER BY on PK and WHERE on INDEX
CREATE TABLE t1 (
a INT,
diff --git a/mysql-test/r/perror-win.result b/mysql-test/r/perror-win.result
new file mode 100644
index 00000000000..1d42235cc14
--- /dev/null
+++ b/mysql-test/r/perror-win.result
@@ -0,0 +1,6 @@
+MySQL error code 150: Foreign key constraint is incorrectly formed
+Win32 error code 150: System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
+OS error code 23: Too many open files in system
+Win32 error code 23: Data error (cyclic redundancy check).
+Win32 error code 1062: The service has not been started.
+Illegal error code: 30000
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index fddca23006d..2051939e4b6 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -100,19 +100,19 @@ drop table t1;
show variables like "wait_timeout%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8
-def VARIABLES VARIABLE_VALUE Value 253 20480 5 Y 0 0 8
+def VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8
Variable_name Value
wait_timeout 28800
show variables like "WAIT_timeout%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8
-def VARIABLES VARIABLE_VALUE Value 253 20480 5 Y 0 0 8
+def VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8
Variable_name Value
wait_timeout 28800
show variables like "this_doesn't_exists%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8
-def VARIABLES VARIABLE_VALUE Value 253 20480 0 Y 0 0 8
+def VARIABLES VARIABLE_VALUE Value 253 1024 0 Y 0 0 8
Variable_name Value
show table status from test like "this_doesn't_exists%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
@@ -130,7 +130,7 @@ def TABLES AUTO_INCREMENT Auto_increment 8 21 0 Y 32800 0 63
def TABLES CREATE_TIME Create_time 12 19 0 Y 128 0 63
def TABLES UPDATE_TIME Update_time 12 19 0 Y 128 0 63
def TABLES CHECK_TIME Check_time 12 19 0 Y 128 0 63
-def TABLES TABLE_COLLATION Collation 253 64 0 Y 0 0 8
+def TABLES TABLE_COLLATION Collation 253 32 0 Y 0 0 8
def TABLES CHECKSUM Checksum 8 21 0 Y 32800 0 63
def TABLES CREATE_OPTIONS Create_options 253 255 0 Y 0 0 8
def TABLES TABLE_COMMENT Comment 253 80 0 N 1 0 8
@@ -859,17 +859,17 @@ set names utf8;
----------------------------------------------------------------
SHOW CHARACTER SET LIKE 'utf8';
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def CHARACTER_SETS CHARACTER_SET_NAME Charset 253 192 4 N 1 0 33
+def CHARACTER_SETS CHARACTER_SET_NAME Charset 253 96 4 N 1 0 33
def CHARACTER_SETS DESCRIPTION Description 253 180 13 N 1 0 33
-def CHARACTER_SETS DEFAULT_COLLATE_NAME Default collation 253 192 15 N 1 0 33
+def CHARACTER_SETS DEFAULT_COLLATE_NAME Default collation 253 96 15 N 1 0 33
def CHARACTER_SETS MAXLEN Maxlen 8 3 1 N 32769 0 63
Charset Description Default collation Maxlen
utf8 UTF-8 Unicode utf8_general_ci 3
----------------------------------------------------------------
SHOW COLLATION LIKE 'latin1_bin';
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COLLATIONS COLLATION_NAME Collation 253 192 10 N 1 0 33
-def COLLATIONS CHARACTER_SET_NAME Charset 253 192 6 N 1 0 33
+def COLLATIONS COLLATION_NAME Collation 253 96 10 N 1 0 33
+def COLLATIONS CHARACTER_SET_NAME Charset 253 96 6 N 1 0 33
def COLLATIONS ID Id 8 11 2 N 32769 0 63
def COLLATIONS IS_DEFAULT Default 253 9 0 N 1 0 33
def COLLATIONS IS_COMPILED Compiled 253 9 3 N 1 0 33
@@ -936,7 +936,7 @@ def TABLES TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33
def TABLES TABLE_TYPE TABLE_TYPE 253 192 10 N 1 0 33
def TABLES ENGINE ENGINE 253 192 6 Y 0 0 33
def TABLES ROW_FORMAT ROW_FORMAT 253 30 5 Y 0 0 33
-def TABLES TABLE_COLLATION TABLE_COLLATION 253 192 17 Y 0 0 33
+def TABLES TABLE_COLLATION TABLE_COLLATION 253 96 17 Y 0 0 33
def TABLES CREATE_OPTIONS CREATE_OPTIONS 253 765 0 Y 0 0 33
def TABLES TABLE_COMMENT TABLE_COMMENT 253 240 0 N 1 0 33
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_COLLATION CREATE_OPTIONS TABLE_COMMENT
@@ -967,8 +967,8 @@ def COLUMNS COLUMN_NAME COLUMN_NAME 253 192 1 N 1 0 33
def COLUMNS COLUMN_DEFAULT COLUMN_DEFAULT 252 589815 0 Y 16 0 33
def COLUMNS IS_NULLABLE IS_NULLABLE 253 9 2 N 1 0 33
def COLUMNS DATA_TYPE DATA_TYPE 253 192 3 N 1 0 33
-def COLUMNS CHARACTER_SET_NAME CHARACTER_SET_NAME 253 192 0 Y 0 0 33
-def COLUMNS COLLATION_NAME COLLATION_NAME 253 192 0 Y 0 0 33
+def COLUMNS CHARACTER_SET_NAME CHARACTER_SET_NAME 253 96 0 Y 0 0 33
+def COLUMNS COLLATION_NAME COLLATION_NAME 253 96 0 Y 0 0 33
def COLUMNS COLUMN_TYPE COLUMN_TYPE 252 589815 7 N 17 0 33
def COLUMNS COLUMN_KEY COLUMN_KEY 253 9 3 N 1 0 33
def COLUMNS EXTRA EXTRA 253 81 0 N 1 0 33
@@ -1126,7 +1126,7 @@ def ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 2 N 1 0 33
def ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33
def ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33
def ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33
-def ROUTINES SQL_MODE SQL_MODE 252 589815 0 N 17 0 33
+def ROUTINES SQL_MODE SQL_MODE 253 24576 0 N 1 0 33
def ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 253 192 0 N 1 0 33
def ROUTINES DEFINER DEFINER 253 231 14 N 1 0 33
SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE SQL_MODE ROUTINE_COMMENT DEFINER
@@ -1181,7 +1181,7 @@ def ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 2 N 1 0 33
def ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33
def ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33
def ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33
-def ROUTINES SQL_MODE SQL_MODE 252 589815 0 N 17 0 33
+def ROUTINES SQL_MODE SQL_MODE 253 24576 0 N 1 0 33
def ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 253 192 0 N 1 0 33
def ROUTINES DEFINER DEFINER 253 231 14 N 1 0 33
SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE SQL_MODE ROUTINE_COMMENT DEFINER
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 1782a4e87b3..906c6a4f8ab 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -4448,4 +4448,34 @@ SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT
a incorrect
1 1
DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int, c int);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+CREATE VIEW v1 AS
+SELECT t2.c AS c FROM t1, t2
+WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+UPDATE v1 SET c=1;
+CREATE VIEW v2 (a,b) AS
+SELECT t2.id, t2.c AS c FROM t1, t2
+WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+INSERT INTO v2(a,b) VALUES (2,2);
+ERROR HY000: CHECK OPTION failed 'test.v2'
+INSERT INTO v2(a,b) VALUES (1,2);
+SELECT * FROM v1;
+c
+1
+1
+1
+1
+2
+2
+CREATE VIEW v3 AS
+SELECT t2.c AS c FROM t2
+WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+DELETE FROM v3;
+DROP VIEW v1,v2,v3;
+DROP TABLE t1,t2;
End of 5.1 tests.
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index 67eed2e41c2..245dcec04da 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -148,16 +148,16 @@ DROP TABLE t1;
End of 5.0 tests
CREATE TABLE t1(a INT)
INDEX DIRECTORY='MYSQLD_DATADIR/mysql';
-ERROR HY000: Incorrect arguments to INDEX DIRECTORY
+DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
DATA DIRECTORY='MYSQLD_DATADIR/test';
-ERROR HY000: Incorrect arguments to DATA DIRECTORY
+DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
DATA DIRECTORY='MYSQLD_DATADIR/';
-ERROR HY000: Incorrect arguments to DATA DIRECTORY
+DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
INDEX DIRECTORY='MYSQLD_DATADIR';
-ERROR HY000: Incorrect arguments to INDEX DIRECTORY
+DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data_var';
ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errcode: 2)
diff --git a/mysql-test/r/timestamp_func.result b/mysql-test/r/timestamp_func.result
index ed51cec4227..1b49331c069 100644
--- a/mysql-test/r/timestamp_func.result
+++ b/mysql-test/r/timestamp_func.result
@@ -1,33 +1,25 @@
-** Setup **
-
-** Connecting con0 using root **
** Connecting con1 using root **
-'#-----------------------------FN_DYNVARS_179_01------------------#'
-** Connection con0 **
-SET @ts_old = @@SESSION.timestamp;
-waiting 1 sec
-SET @ts_new = @@SESSION.timestamp;
-SELECT @ts_new - @ts_old >= 1 AS 'Timestamp Difference';
-Timestamp Difference
+SELECT date(now()) = date(sysdate());
+date(now()) = date(sysdate())
+1
+SET @@session.timestamp = 1100000000;
+SELECT date(now()) != date(sysdate());
+date(now()) != date(sysdate())
+1
+** Connecting con0 using root **
+SELECT @@session.timestamp != 1100000000;
+@@session.timestamp != 1100000000
+1
+SET @@session.timestamp = 1000000000;
+SELECT date(now()) != date(sysdate());
+date(now()) != date(sysdate())
1
-1 means >=1 expected is true
** Connection con1 **
-SET @ts_old = @@SESSION.timestamp;
-waiting 4 sec
-SET @ts_new = @@SESSION.timestamp;
-SELECT @ts_new - @ts_old >= 4 AS 'Timestamp Difference';
-Timestamp Difference
+SELECT @@session.timestamp != 1000000000;
+@@session.timestamp != 1000000000
1
-1 means >=4 expected is true
-'#-----------------------------FN_DYNVARS_179_02---------------------#'
-SET @ts_old = @@SESSION.timestamp;
-Changing time zone
-SET time_zone = 'MET';
-SET @ts_new = @@SESSION.timestamp;
-SELECT @ts_new - @ts_old >= 1 AS 'Timestamp Difference';
-Timestamp Difference
+SELECT @@session.timestamp = 1100000000;
+@@session.timestamp = 1100000000
1
-1 means >=1 expected is true
-** Cleanup **
** Connection default **
Disconnecting Connections con0, con1
diff --git a/mysql-test/r/timestamp_sysdate_is_now_func.result b/mysql-test/r/timestamp_sysdate_is_now_func.result
new file mode 100644
index 00000000000..e24ff2e962a
--- /dev/null
+++ b/mysql-test/r/timestamp_sysdate_is_now_func.result
@@ -0,0 +1,25 @@
+** Connecting con1 using root **
+SELECT date(now()) = date(sysdate());
+date(now()) = date(sysdate())
+1
+SET @@session.timestamp = 1100000000;
+SELECT date(now()) != date(sysdate());
+date(now()) != date(sysdate())
+0
+** Connecting con0 using root **
+SELECT @@session.timestamp != 1100000000;
+@@session.timestamp != 1100000000
+1
+SET @@session.timestamp = 1000000000;
+SELECT date(now()) != date(sysdate());
+date(now()) != date(sysdate())
+0
+** Connection con1 **
+SELECT @@session.timestamp != 1000000000;
+@@session.timestamp != 1000000000
+1
+SELECT @@session.timestamp = 1100000000;
+@@session.timestamp = 1100000000
+1
+** Connection default **
+Disconnecting Connections con0, con1
diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result
index 49d7bd6542a..2948bb8ecec 100644
--- a/mysql-test/r/timezone2.result
+++ b/mysql-test/r/timezone2.result
@@ -110,7 +110,7 @@ i ts
362793610 1981-07-01 04:00:00
select from_unixtime(362793609);
from_unixtime(362793609)
-1981-07-01 03:59:60
+1981-07-01 03:59:59
drop table t1;
create table t1 (ts timestamp);
set time_zone='UTC';
diff --git a/mysql-test/r/timezone3.result b/mysql-test/r/timezone3.result
index ec0b6045f93..ceac4a5aefb 100644
--- a/mysql-test/r/timezone3.result
+++ b/mysql-test/r/timezone3.result
@@ -17,6 +17,9 @@ insert into t1 values
insert into t1 values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
+insert into t1 values
+(unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'),
+(unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00');
select i, from_unixtime(i), c from t1;
i from_unixtime(i) c
1072904422 2004-01-01 00:00:00 2004-01-01 00:00:00
@@ -31,6 +34,8 @@ i from_unixtime(i) c
1099180821 2004-10-31 02:59:59 2004-10-31 02:59:59
362793608 1981-07-01 03:59:59 1981-07-01 03:59:59
362793610 1981-07-01 04:00:00 1981-07-01 04:00:00
+1230768022 2009-01-01 02:59:59 2009-01-01 02:59:59
+1230768024 2009-01-01 03:00:00 2009-01-01 03:00:00
drop table t1;
create table t1 (ts timestamp);
insert into t1 values (19730101235900), (20040101235900);
@@ -39,3 +44,6 @@ ts
1973-01-01 23:59:00
2004-01-01 23:59:00
drop table t1;
+SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);
+FROM_UNIXTIME(1230768022) FROM_UNIXTIME(1230768023) FROM_UNIXTIME(1230768024)
+2009-01-01 02:59:59 2009-01-01 02:59:59 2009-01-01 03:00:00
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index 37b77dc4dc8..f2b08d1c6b7 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -1534,6 +1534,21 @@ select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
(1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
1.01500000 * 1.01500000 * 0.99500000)
0.812988073953673124592306939480
+create table t1 as select 5.05 / 0.014;
+Warnings:
+Note 1265 Data truncated for column '5.05 / 0.014' at row 1
+show warnings;
+Level Code Message
+Note 1265 Data truncated for column '5.05 / 0.014' at row 1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `5.05 / 0.014` decimal(10,6) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+5.05 / 0.014
+360.714286
+DROP TABLE t1;
End of 5.0 tests
select cast(143.481 as decimal(4,1));
cast(143.481 as decimal(4,1))
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 3f99a053df4..2a10f34d081 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1343,10 +1343,10 @@ t3 CREATE TABLE `t3` (
`left(a,100000000)` longtext
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop tables t1,t2,t3;
-SELECT @tmp_max:= @@max_allowed_packet;
-@tmp_max:= @@max_allowed_packet
+SELECT @tmp_max:= @@global.max_allowed_packet;
+@tmp_max:= @@global.max_allowed_packet
1048576
-SET max_allowed_packet=25000000;
+SET @@global.max_allowed_packet=25000000;
CREATE TABLE t1 (a mediumtext);
CREATE TABLE t2 (b varchar(20));
INSERT INTO t1 VALUES ('a');
@@ -1384,7 +1384,7 @@ t3 CREATE TABLE `t3` (
`a` varbinary(510) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLES t1,t2,t3;
-SET max_allowed_packet:= @tmp_max;
+SET @@global.max_allowed_packet:= @tmp_max;
create table t1 ( id int not null auto_increment, primary key (id), col1 int);
insert into t1 (col1) values (2),(3),(4),(5),(6);
select 99 union all select id from t1 order by 1;
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index b861ec96882..7a51649fac5 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -491,4 +491,15 @@ update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
affected rows: 127
info: Rows matched: 128 Changed: 127 Warnings: 0
drop table t1,t2;
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+CREATE FUNCTION f1() RETURNS INT RETURN f1();
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1);
+UPDATE t1 SET i = 3 WHERE f1();
+ERROR HY000: Recursive stored functions and triggers are not allowed.
+UPDATE t1 SET i = f1();
+ERROR HY000: Recursive stored functions and triggers are not allowed.
+DROP TABLE t1;
+DROP FUNCTION f1;
End of 5.0 tests
diff --git a/mysql-test/r/variables-notembedded.result b/mysql-test/r/variables-notembedded.result
index e241edcc5ec..c9125bcee90 100644
--- a/mysql-test/r/variables-notembedded.result
+++ b/mysql-test/r/variables-notembedded.result
@@ -16,3 +16,95 @@ slave_skip_errors 3,100,137,643,1752
set global slave_net_timeout=default;
set global sql_slave_skip_counter= 0;
set @@global.slave_net_timeout= @my_slave_net_timeout;
+
+#
+SHOW VARIABLES like 'log_slave_updates';
+Variable_name Value
+log_slave_updates OFF
+SELECT @@session.log_slave_updates;
+ERROR HY000: Variable 'log_slave_updates' is a GLOBAL variable
+SELECT @@global.log_slave_updates;
+@@global.log_slave_updates
+0
+SET @@session.log_slave_updates= true;
+ERROR HY000: Variable 'log_slave_updates' is a read only variable
+SET @@global.log_slave_updates= true;
+ERROR HY000: Variable 'log_slave_updates' is a read only variable
+#
+SHOW VARIABLES like 'relay_log';
+Variable_name Value
+relay_log
+SELECT @@session.relay_log;
+ERROR HY000: Variable 'relay_log' is a GLOBAL variable
+SELECT @@global.relay_log;
+@@global.relay_log
+NULL
+SET @@session.relay_log= 'x';
+ERROR HY000: Variable 'relay_log' is a read only variable
+SET @@global.relay_log= 'x';
+ERROR HY000: Variable 'relay_log' is a read only variable
+#
+SHOW VARIABLES like 'relay_log_index';
+Variable_name Value
+relay_log_index
+SELECT @@session.relay_log_index;
+ERROR HY000: Variable 'relay_log_index' is a GLOBAL variable
+SELECT @@global.relay_log_index;
+@@global.relay_log_index
+NULL
+SET @@session.relay_log_index= 'x';
+ERROR HY000: Variable 'relay_log_index' is a read only variable
+SET @@global.relay_log_index= 'x';
+ERROR HY000: Variable 'relay_log_index' is a read only variable
+#
+SHOW VARIABLES like 'relay_log_info_file';
+Variable_name Value
+relay_log_info_file relay-log.info
+SELECT @@session.relay_log_info_file;
+ERROR HY000: Variable 'relay_log_info_file' is a GLOBAL variable
+SELECT @@global.relay_log_info_file;
+@@global.relay_log_info_file
+relay-log.info
+SET @@session.relay_log_info_file= 'x';
+ERROR HY000: Variable 'relay_log_info_file' is a read only variable
+SET @@global.relay_log_info_file= 'x';
+ERROR HY000: Variable 'relay_log_info_file' is a read only variable
+#
+SHOW VARIABLES like 'relay_log_space_limit';
+Variable_name Value
+relay_log_space_limit 0
+SELECT @@session.relay_log_space_limit;
+ERROR HY000: Variable 'relay_log_space_limit' is a GLOBAL variable
+SELECT @@global.relay_log_space_limit;
+@@global.relay_log_space_limit
+0
+SET @@session.relay_log_space_limit= 7;
+ERROR HY000: Variable 'relay_log_space_limit' is a read only variable
+SET @@global.relay_log_space_limit= 7;
+ERROR HY000: Variable 'relay_log_space_limit' is a read only variable
+#
+SHOW VARIABLES like 'slave_load_tmpdir';
+Variable_name Value
+slave_load_tmpdir #
+SELECT @@session.slave_load_tmpdir;
+ERROR HY000: Variable 'slave_load_tmpdir' is a GLOBAL variable
+SELECT @@global.slave_load_tmpdir;
+@@global.slave_load_tmpdir
+#
+SET @@session.slave_load_tmpdir= 'x';
+ERROR HY000: Variable 'slave_load_tmpdir' is a read only variable
+SET @@global.slave_load_tmpdir= 'x';
+ERROR HY000: Variable 'slave_load_tmpdir' is a read only variable
+#
+SHOW VARIABLES like 'slave_skip_errors';
+Variable_name Value
+slave_skip_errors 3,100,137,643,1752
+SELECT @@session.slave_skip_errors;
+ERROR HY000: Variable 'slave_skip_errors' is a GLOBAL variable
+SELECT @@global.slave_skip_errors;
+@@global.slave_skip_errors
+3,100,137,643,1752
+SET @@session.slave_skip_errors= 7;
+ERROR HY000: Variable 'slave_skip_errors' is a read only variable
+SET @@global.slave_skip_errors= 7;
+ERROR HY000: Variable 'slave_skip_errors' is a read only variable
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 87afaaa3179..e7243183ee8 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -229,7 +229,6 @@ VARIABLE_NAME VARIABLE_VALUE
MYISAM_MAX_SORT_FILE_SIZE FILE_SIZE
set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
-set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
show global variables like 'net_%';
Variable_name Value
net_buffer_length 1024
@@ -244,57 +243,45 @@ NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 200
show session variables like 'net_%';
Variable_name Value
-net_buffer_length 2048
-net_read_timeout 600
+net_buffer_length 16384
+net_read_timeout 30
net_retry_count 10
-net_write_timeout 500
+net_write_timeout 60
select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
VARIABLE_NAME VARIABLE_VALUE
-NET_BUFFER_LENGTH 2048
-NET_READ_TIMEOUT 600
+NET_BUFFER_LENGTH 16384
+NET_READ_TIMEOUT 30
NET_RETRY_COUNT 10
-NET_WRITE_TIMEOUT 500
-set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
+NET_WRITE_TIMEOUT 60
+set global net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
show global variables like 'net_%';
Variable_name Value
-net_buffer_length 1024
+net_buffer_length 7168
net_read_timeout 900
net_retry_count 10
net_write_timeout 1000
select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
VARIABLE_NAME VARIABLE_VALUE
-NET_BUFFER_LENGTH 1024
+NET_BUFFER_LENGTH 7168
NET_READ_TIMEOUT 900
NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 1000
-show session variables like 'net_%';
-Variable_name Value
-net_buffer_length 7168
-net_read_timeout 600
-net_retry_count 10
-net_write_timeout 500
-select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
-VARIABLE_NAME VARIABLE_VALUE
-NET_BUFFER_LENGTH 7168
-NET_READ_TIMEOUT 600
-NET_RETRY_COUNT 10
-NET_WRITE_TIMEOUT 500
-set net_buffer_length=1;
+set global net_buffer_length=1;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '1'
-show variables like 'net_buffer_length';
+show global variables like 'net_buffer_length';
Variable_name Value
net_buffer_length 1024
-select * from information_schema.session_variables where variable_name like 'net_buffer_length';
+select * from information_schema.global_variables where variable_name like 'net_buffer_length';
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1024
-set net_buffer_length=2000000000;
+set global net_buffer_length=2000000000;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '2000000000'
-show variables like 'net_buffer_length';
+show global variables like 'net_buffer_length';
Variable_name Value
net_buffer_length 1048576
-select * from information_schema.session_variables where variable_name like 'net_buffer_length';
+select * from information_schema.global_variables where variable_name like 'net_buffer_length';
VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1048576
set character set cp1251_koi8;
@@ -462,7 +449,7 @@ select @@long_query_time;
@@long_query_time
100.000001
set low_priority_updates=1;
-set max_allowed_packet=100;
+set global max_allowed_packet=100;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100'
set global max_binlog_cache_size=100;
@@ -486,7 +473,7 @@ select @@max_user_connections;
100
set global max_write_lock_count=100;
set myisam_sort_buffer_size=100;
-set net_buffer_length=100;
+set global net_buffer_length=100;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '100'
set net_read_timeout=100;
@@ -1026,3 +1013,329 @@ SET GLOBAL log_output = 0;
ERROR 42000: Variable 'log_output' can't be set to the value of '0'
# -- End of Bug#34820.
+
+#
+SHOW VARIABLES like 'ft_max_word_len';
+Variable_name Value
+ft_max_word_len 84
+SELECT @@session.ft_max_word_len;
+ERROR HY000: Variable 'ft_max_word_len' is a GLOBAL variable
+SELECT @@global.ft_max_word_len;
+@@global.ft_max_word_len
+84
+SET @@session.ft_max_word_len= 7;
+ERROR HY000: Variable 'ft_max_word_len' is a read only variable
+SET @@global.ft_max_word_len= 7;
+ERROR HY000: Variable 'ft_max_word_len' is a read only variable
+#
+SHOW VARIABLES like 'ft_min_word_len';
+Variable_name Value
+ft_min_word_len 4
+SELECT @@session.ft_min_word_len;
+ERROR HY000: Variable 'ft_min_word_len' is a GLOBAL variable
+SELECT @@global.ft_min_word_len;
+@@global.ft_min_word_len
+4
+SET @@session.ft_min_word_len= 7;
+ERROR HY000: Variable 'ft_min_word_len' is a read only variable
+SET @@global.ft_min_word_len= 7;
+ERROR HY000: Variable 'ft_min_word_len' is a read only variable
+#
+SHOW VARIABLES like 'ft_query_expansion_limit';
+Variable_name Value
+ft_query_expansion_limit 20
+SELECT @@session.ft_query_expansion_limit;
+ERROR HY000: Variable 'ft_query_expansion_limit' is a GLOBAL variable
+SELECT @@global.ft_query_expansion_limit;
+@@global.ft_query_expansion_limit
+20
+SET @@session.ft_query_expansion_limit= 7;
+ERROR HY000: Variable 'ft_query_expansion_limit' is a read only variable
+SET @@global.ft_query_expansion_limit= 7;
+ERROR HY000: Variable 'ft_query_expansion_limit' is a read only variable
+#
+SHOW VARIABLES like 'ft_stopword_file';
+Variable_name Value
+ft_stopword_file (built-in)
+SELECT @@session.ft_stopword_file;
+ERROR HY000: Variable 'ft_stopword_file' is a GLOBAL variable
+SELECT @@global.ft_stopword_file;
+@@global.ft_stopword_file
+(built-in)
+SET @@session.ft_stopword_file= 'x';
+ERROR HY000: Variable 'ft_stopword_file' is a read only variable
+SET @@global.ft_stopword_file= 'x';
+ERROR HY000: Variable 'ft_stopword_file' is a read only variable
+#
+SHOW VARIABLES like 'back_log';
+Variable_name Value
+back_log 50
+SELECT @@session.back_log;
+ERROR HY000: Variable 'back_log' is a GLOBAL variable
+SELECT @@global.back_log;
+@@global.back_log
+50
+SET @@session.back_log= 7;
+ERROR HY000: Variable 'back_log' is a read only variable
+SET @@global.back_log= 7;
+ERROR HY000: Variable 'back_log' is a read only variable
+#
+SHOW VARIABLES like 'large_files_support';
+Variable_name Value
+large_files_support #
+SELECT @@session.large_files_support;
+ERROR HY000: Variable 'large_files_support' is a GLOBAL variable
+SELECT @@global.large_files_support;
+@@global.large_files_support
+#
+SET @@session.large_files_support= true;
+ERROR HY000: Variable 'large_files_support' is a read only variable
+SET @@global.large_files_support= true;
+ERROR HY000: Variable 'large_files_support' is a read only variable
+#
+SHOW VARIABLES like 'character_sets_dir';
+Variable_name Value
+character_sets_dir #
+SELECT @@session.character_sets_dir;
+ERROR HY000: Variable 'character_sets_dir' is a GLOBAL variable
+SELECT @@global.character_sets_dir;
+@@global.character_sets_dir
+#
+SET @@session.character_sets_dir= 'x';
+ERROR HY000: Variable 'character_sets_dir' is a read only variable
+SET @@global.character_sets_dir= 'x';
+ERROR HY000: Variable 'character_sets_dir' is a read only variable
+#
+SHOW VARIABLES like 'init_file';
+Variable_name Value
+init_file #
+SELECT @@session.init_file;
+ERROR HY000: Variable 'init_file' is a GLOBAL variable
+SELECT @@global.init_file;
+@@global.init_file
+#
+SET @@session.init_file= 'x';
+ERROR HY000: Variable 'init_file' is a read only variable
+SET @@global.init_file= 'x';
+ERROR HY000: Variable 'init_file' is a read only variable
+#
+SHOW VARIABLES like 'language';
+Variable_name Value
+language #
+SELECT @@session.language;
+ERROR HY000: Variable 'language' is a GLOBAL variable
+SELECT @@global.language;
+@@global.language
+#
+SET @@session.language= 'x';
+ERROR HY000: Variable 'language' is a read only variable
+SET @@global.language= 'x';
+ERROR HY000: Variable 'language' is a read only variable
+#
+SHOW VARIABLES like 'large_page_size';
+Variable_name Value
+large_page_size #
+SELECT @@session.large_page_size;
+ERROR HY000: Variable 'large_page_size' is a GLOBAL variable
+SELECT @@global.large_page_size;
+@@global.large_page_size
+#
+SET @@session.large_page_size= 7;
+ERROR HY000: Variable 'large_page_size' is a read only variable
+SET @@global.large_page_size= 7;
+ERROR HY000: Variable 'large_page_size' is a read only variable
+#
+SHOW VARIABLES like 'large_pages';
+Variable_name Value
+large_pages #
+SELECT @@session.large_pages;
+ERROR HY000: Variable 'large_pages' is a GLOBAL variable
+SELECT @@global.large_pages;
+@@global.large_pages
+#
+SET @@session.large_pages= true;
+ERROR HY000: Variable 'large_pages' is a read only variable
+SET @@global.large_pages= true;
+ERROR HY000: Variable 'large_pages' is a read only variable
+#
+SHOW VARIABLES like 'log_bin';
+Variable_name Value
+log_bin OFF
+SELECT @@session.log_bin;
+ERROR HY000: Variable 'log_bin' is a GLOBAL variable
+SELECT @@global.log_bin;
+@@global.log_bin
+0
+SET @@session.log_bin= true;
+ERROR HY000: Variable 'log_bin' is a read only variable
+SET @@global.log_bin= true;
+ERROR HY000: Variable 'log_bin' is a read only variable
+#
+SHOW VARIABLES like 'log_error';
+Variable_name Value
+log_error #
+SELECT @@session.log_error;
+ERROR HY000: Variable 'log_error' is a GLOBAL variable
+SELECT @@global.log_error;
+@@global.log_error
+#
+SET @@session.log_error= 'x';
+ERROR HY000: Variable 'log_error' is a read only variable
+SET @@global.log_error= 'x';
+ERROR HY000: Variable 'log_error' is a read only variable
+#
+SHOW VARIABLES like 'lower_case_file_system';
+Variable_name Value
+lower_case_file_system #
+SELECT @@session.lower_case_file_system;
+ERROR HY000: Variable 'lower_case_file_system' is a GLOBAL variable
+SELECT @@global.lower_case_file_system;
+@@global.lower_case_file_system
+#
+SET @@session.lower_case_file_system= true;
+ERROR HY000: Variable 'lower_case_file_system' is a read only variable
+SET @@global.lower_case_file_system= true;
+ERROR HY000: Variable 'lower_case_file_system' is a read only variable
+#
+SHOW VARIABLES like 'lower_case_table_names';
+Variable_name Value
+lower_case_table_names #
+SELECT @@session.lower_case_table_names;
+ERROR HY000: Variable 'lower_case_table_names' is a GLOBAL variable
+SELECT @@global.lower_case_table_names;
+@@global.lower_case_table_names
+#
+SET @@session.lower_case_table_names= 7;
+ERROR HY000: Variable 'lower_case_table_names' is a read only variable
+SET @@global.lower_case_table_names= 7;
+ERROR HY000: Variable 'lower_case_table_names' is a read only variable
+#
+SHOW VARIABLES like 'myisam_recover_options';
+Variable_name Value
+myisam_recover_options OFF
+SELECT @@session.myisam_recover_options;
+ERROR HY000: Variable 'myisam_recover_options' is a GLOBAL variable
+SELECT @@global.myisam_recover_options;
+@@global.myisam_recover_options
+OFF
+SET @@session.myisam_recover_options= 'x';
+ERROR HY000: Variable 'myisam_recover_options' is a read only variable
+SET @@global.myisam_recover_options= 'x';
+ERROR HY000: Variable 'myisam_recover_options' is a read only variable
+#
+SHOW VARIABLES like 'open_files_limit';
+Variable_name Value
+open_files_limit #
+SELECT @@session.open_files_limit;
+ERROR HY000: Variable 'open_files_limit' is a GLOBAL variable
+SELECT @@global.open_files_limit;
+@@global.open_files_limit
+#
+SET @@session.open_files_limit= 7;
+ERROR HY000: Variable 'open_files_limit' is a read only variable
+SET @@global.open_files_limit= 7;
+ERROR HY000: Variable 'open_files_limit' is a read only variable
+#
+SHOW VARIABLES like 'pid_file';
+Variable_name Value
+pid_file #
+SELECT @@session.pid_file;
+ERROR HY000: Variable 'pid_file' is a GLOBAL variable
+SELECT @@global.pid_file;
+@@global.pid_file
+#
+SET @@session.pid_file= 'x';
+ERROR HY000: Variable 'pid_file' is a read only variable
+SET @@global.pid_file= 'x';
+ERROR HY000: Variable 'pid_file' is a read only variable
+#
+SHOW VARIABLES like 'plugin_dir';
+Variable_name Value
+plugin_dir #
+SELECT @@session.plugin_dir;
+ERROR HY000: Variable 'plugin_dir' is a GLOBAL variable
+SELECT @@global.plugin_dir;
+@@global.plugin_dir
+#
+SET @@session.plugin_dir= 'x';
+ERROR HY000: Variable 'plugin_dir' is a read only variable
+SET @@global.plugin_dir= 'x';
+ERROR HY000: Variable 'plugin_dir' is a read only variable
+#
+SHOW VARIABLES like 'port';
+Variable_name Value
+port #
+SELECT @@session.port;
+ERROR HY000: Variable 'port' is a GLOBAL variable
+SELECT @@global.port;
+@@global.port
+#
+SET @@session.port= 7;
+ERROR HY000: Variable 'port' is a read only variable
+SET @@global.port= 7;
+ERROR HY000: Variable 'port' is a read only variable
+#
+SHOW VARIABLES like 'protocol_version';
+Variable_name Value
+protocol_version 10
+SELECT @@session.protocol_version;
+ERROR HY000: Variable 'protocol_version' is a GLOBAL variable
+SELECT @@global.protocol_version;
+@@global.protocol_version
+10
+SET @@session.protocol_version= 7;
+ERROR HY000: Variable 'protocol_version' is a read only variable
+SET @@global.protocol_version= 7;
+ERROR HY000: Variable 'protocol_version' is a read only variable
+#
+SHOW VARIABLES like 'skip_external_locking';
+Variable_name Value
+skip_external_locking ON
+SELECT @@session.skip_external_locking;
+ERROR HY000: Variable 'skip_external_locking' is a GLOBAL variable
+SELECT @@global.skip_external_locking;
+@@global.skip_external_locking
+1
+SET @@session.skip_external_locking= true;
+ERROR HY000: Variable 'skip_external_locking' is a read only variable
+SET @@global.skip_external_locking= true;
+ERROR HY000: Variable 'skip_external_locking' is a read only variable
+#
+SHOW VARIABLES like 'skip_networking';
+Variable_name Value
+skip_networking OFF
+SELECT @@session.skip_networking;
+ERROR HY000: Variable 'skip_networking' is a GLOBAL variable
+SELECT @@global.skip_networking;
+@@global.skip_networking
+0
+SET @@session.skip_networking= true;
+ERROR HY000: Variable 'skip_networking' is a read only variable
+SET @@global.skip_networking= true;
+ERROR HY000: Variable 'skip_networking' is a read only variable
+#
+SHOW VARIABLES like 'skip_show_database';
+Variable_name Value
+skip_show_database OFF
+SELECT @@session.skip_show_database;
+ERROR HY000: Variable 'skip_show_database' is a GLOBAL variable
+SELECT @@global.skip_show_database;
+@@global.skip_show_database
+0
+SET @@session.skip_show_database= true;
+ERROR HY000: Variable 'skip_show_database' is a read only variable
+SET @@global.skip_show_database= true;
+ERROR HY000: Variable 'skip_show_database' is a read only variable
+#
+SHOW VARIABLES like 'thread_stack';
+Variable_name Value
+thread_stack #
+SELECT @@session.thread_stack;
+ERROR HY000: Variable 'thread_stack' is a GLOBAL variable
+SELECT @@global.thread_stack;
+@@global.thread_stack
+#
+SET @@session.thread_stack= 7;
+ERROR HY000: Variable 'thread_stack' is a read only variable
+SET @@global.thread_stack= 7;
+ERROR HY000: Variable 'thread_stack' is a read only variable
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 322e441154e..38d05ae84fe 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -625,7 +625,7 @@ drop table t1;
create table t1 (a int, b int);
create view v1 as select a, sum(b) from t1 group by a;
select b from v1 use index (some_index) where b=1;
-ERROR HY000: Incorrect usage of index hints and VIEW
+ERROR 42000: Key 'some_index' doesn't exist in table 'v1'
drop view v1;
drop table t1;
create table t1 (col1 char(5),col2 char(5));
@@ -3562,11 +3562,11 @@ CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM v1 USE KEY(non_existant);
-ERROR HY000: Incorrect usage of index hints and VIEW
+ERROR 42000: Key 'non_existant' doesn't exist in table 'v1'
SELECT * FROM v1 FORCE KEY(non_existant);
-ERROR HY000: Incorrect usage of index hints and VIEW
+ERROR 42000: Key 'non_existant' doesn't exist in table 'v1'
SELECT * FROM v1 IGNORE KEY(non_existant);
-ERROR HY000: Incorrect usage of index hints and VIEW
+ERROR 42000: Key 'non_existant' doesn't exist in table 'v1'
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0,
@@ -3674,6 +3674,31 @@ DROP VIEW v1;
CREATE VIEW v1 AS SELECT 1;
DROP VIEW v1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+SELECT * FROM t1 USE INDEX (PRIMARY) WHERE c1=2;
+c1 c2
+2 2
+SELECT * FROM t1 USE INDEX (c2) WHERE c2=2;
+c1 c2
+2 2
+CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
+SHOW INDEX FROM v1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
+ERROR 42000: Key 'PRIMARY' doesn't exist in table 'v1'
+SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
+ERROR 42000: Key 'PRIMARY' doesn't exist in table 'v1'
+SELECT * FROM v1 IGNORE INDEX (PRIMARY) WHERE c1=2;
+ERROR 42000: Key 'PRIMARY' doesn't exist in table 'v1'
+SELECT * FROM v1 USE INDEX (c2) WHERE c2=2;
+ERROR 42000: Key 'c2' doesn't exist in table 'v1'
+SELECT * FROM v1 FORCE INDEX (c2) WHERE c2=2;
+ERROR 42000: Key 'c2' doesn't exist in table 'v1'
+SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
+ERROR 42000: Key 'c2' doesn't exist in table 'v1'
+DROP VIEW v1;
+DROP TABLE t1;
# -----------------------------------------------------------------
# -- End of 5.0 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/r/wait_timeout_func.result b/mysql-test/r/wait_timeout_func.result
index a624a0c5923..01b4a71df87 100644
--- a/mysql-test/r/wait_timeout_func.result
+++ b/mysql-test/r/wait_timeout_func.result
@@ -1,33 +1,32 @@
-drop table if exists t1;
-## Creating new table t1 ##
-CREATE TABLE t1
-(
-id INT NOT NULL auto_increment,
-PRIMARY KEY (id),
-name VARCHAR(30)
-);
-SET @old_wait_timeout = @@global.wait_timeout;
+SET @start_value= @@global.wait_timeout;
'#--------------------FN_DYNVARS_186_01-------------------------#'
-## Creating new connection test_con1 ##
-## Setting value of variable to 5 ##
-SET @@session.wait_timeout = 5;
-## Inserting record in table t1 ##
-INSERT into t1(name) values('Record_1');
-## Using sleep to check timeout ##
-'#--------------------FN_DYNVARS_186_02-------------------------#'
-## Setting value of variable ##
-SET @@global.wait_timeout = 5;
-## Creating new connection test_con2 ##
-INSERT into t1(name) values('Record_2');
-## Using sleep to check timeout ##
+SET @start_time= UNIX_TIMESTAMP();
+connect (test_con1, localhost, root,,);
+SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
+Expect 1
+1
+SET @@session.wait_timeout = <session_value>;
+connect (test_con2, localhost, root,,);
+SET @@session.wait_timeout = <session_value> - 1;
+connection default;
+wait until connections ready
+SELECT info FROM information_schema.processlist;
+info
+SELECT info FROM information_schema.processlist
'#--------------------FN_DYNVARS_186_03-------------------------#'
-## Setting value of variable to 1 ##
-SET @@global.wait_timeout = 1;
-## Creating new connection ##
-INSERT into t1(name) values('Record_3');
-## Using sleep to check timeout ##
-## We cannot test it further because the server closes the connection due to wait_timeout ##
-SELECT * from t1;
-ERROR HY000: MySQL server has gone away
-DROP TABLE t1;
-SET @@global.wait_timeout = @old_wait_timeout;
+SET @@global.wait_timeout= <global_value>;
+SELECT @@session.wait_timeout = @start_value AS 'Expect 1';
+Expect 1
+1
+connect (test_con3, localhost, root,,);
+SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
+Expect 1
+1
+connection default;
+SELECT info FROM information_schema.processlist;
+info
+SELECT info FROM information_schema.processlist
+SELECT UNIX_TIMESTAMP() - @start_time >= <global_value> + <session_value>;;
+UNIX_TIMESTAMP() - @start_time >= <global_value> + <session_value>;
+1
+SET @@global.wait_timeout= @start_value;
diff --git a/mysql-test/std_data/Moscow_leap b/mysql-test/std_data/Moscow_leap
index 4994c005595..3e73923cfb3 100644
--- a/mysql-test/std_data/Moscow_leap
+++ b/mysql-test/std_data/Moscow_leap
Binary files differ
diff --git a/mysql-test/suite/federated/federated.result b/mysql-test/suite/federated/federated.result
index 341aede679c..d13eb9526ca 100644
--- a/mysql-test/suite/federated/federated.result
+++ b/mysql-test/suite/federated/federated.result
@@ -2123,6 +2123,15 @@ Table Checksum
test.t1 2465757603
DROP TABLE t1;
DROP TABLE t1;
+CREATE TABLE t1 (a TEXT, b TEXT, KEY(b(1)));
+INSERT INTO t1 VALUES (NULL, NULL), (NULL, NULL), (NULL, NULL), (NULL, NULL);
+CREATE TABLE t1
+(a TEXT, b TEXT, KEY(b(1))) ENGINE=FEDERATED
+CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
+SELECT t1.a FROM t1, t1 as t2 WHERE t2.b NOT LIKE t1.b;
+a
+DROP TABLE t1;
+DROP TABLE t1;
End of 5.0 tests
create server 's1' foreign data wrapper 'mysql' options (port 3306);
drop server 's1';
diff --git a/mysql-test/suite/federated/federated.test b/mysql-test/suite/federated/federated.test
index 1c4c3fc2161..fa448e74a18 100644
--- a/mysql-test/suite/federated/federated.test
+++ b/mysql-test/suite/federated/federated.test
@@ -1923,6 +1923,25 @@ DROP TABLE t1;
connection master;
DROP TABLE t1;
+
+#
+# Bug #34774 key prefix on text field in federated tables can cause
+# server to crash!
+#
+connection slave;
+CREATE TABLE t1 (a TEXT, b TEXT, KEY(b(1)));
+INSERT INTO t1 VALUES (NULL, NULL), (NULL, NULL), (NULL, NULL), (NULL, NULL);
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1
+ (a TEXT, b TEXT, KEY(b(1))) ENGINE=FEDERATED
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
+SELECT t1.a FROM t1, t1 as t2 WHERE t2.b NOT LIKE t1.b;
+connection slave;
+DROP TABLE t1;
+connection master;
+DROP TABLE t1;
+
connection default;
--echo End of 5.0 tests
diff --git a/mysql-test/suite/federated/federated_innodb.test b/mysql-test/suite/federated/federated_innodb.test
index 6f1ad941f82..278c5b18661 100644
--- a/mysql-test/suite/federated/federated_innodb.test
+++ b/mysql-test/suite/federated/federated_innodb.test
@@ -1,5 +1,10 @@
-source federated.inc;
+# NOTE: Keep any include/ files that will kill / skip a test BEFORE any others
+# having federated.inc before have_innodb.inc allows for an orphaned database
+# that can cause other tests to fail.
+# See Bug #40645 Test main.federated_innodb does not always clean up after itself
+
source include/have_innodb.inc;
+source federated.inc;
#
# Bug#25513 Federated transaction failures
diff --git a/mysql-test/suite/funcs_1/datadict/is_tables.inc b/mysql-test/suite/funcs_1/datadict/is_tables.inc
index 6d47c33e715..d1e4608a572 100644
--- a/mysql-test/suite/funcs_1/datadict/is_tables.inc
+++ b/mysql-test/suite/funcs_1/datadict/is_tables.inc
@@ -346,6 +346,7 @@ WHERE table_name = 't1_my_tablex';
# Enforce a time difference bigger than the smallest unit (1 second).
--real_sleep 1.1
INSERT INTO db_datadict.t1_my_tablex SET f1 = 3;
+FLUSH TABLES;
SELECT UPDATE_TIME > @UPDATE_TIME
AS "Is current UPDATE_TIME bigger than before last INSERT?"
FROM information_schema.tables
diff --git a/mysql-test/suite/funcs_1/r/is_character_sets.result b/mysql-test/suite/funcs_1/r/is_character_sets.result
index 4c24a4a829a..2aaa1985020 100644
--- a/mysql-test/suite/funcs_1/r/is_character_sets.result
+++ b/mysql-test/suite/funcs_1/r/is_character_sets.result
@@ -28,22 +28,22 @@ DROP FUNCTION test.f1;
#########################################################################
DESCRIBE information_schema.CHARACTER_SETS;
Field Type Null Key Default Extra
-CHARACTER_SET_NAME varchar(64) NO
-DEFAULT_COLLATE_NAME varchar(64) NO
+CHARACTER_SET_NAME varchar(32) NO
+DEFAULT_COLLATE_NAME varchar(32) NO
DESCRIPTION varchar(60) NO
MAXLEN bigint(3) NO 0
SHOW CREATE TABLE information_schema.CHARACTER_SETS;
Table Create Table
CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` (
- `CHARACTER_SET_NAME` varchar(64) NOT NULL DEFAULT '',
- `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL DEFAULT '',
+ `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '',
+ `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '',
`DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
`MAXLEN` bigint(3) NOT NULL DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW COLUMNS FROM information_schema.CHARACTER_SETS;
Field Type Null Key Default Extra
-CHARACTER_SET_NAME varchar(64) NO
-DEFAULT_COLLATE_NAME varchar(64) NO
+CHARACTER_SET_NAME varchar(32) NO
+DEFAULT_COLLATE_NAME varchar(32) NO
DESCRIPTION varchar(60) NO
MAXLEN bigint(3) NO 0
# Testcases 3.2.2.2 and 3.2.2.3 are checked in suite/funcs_1/t/charset_collation*.test
diff --git a/mysql-test/suite/funcs_1/r/is_collation_character_set_applicability.result b/mysql-test/suite/funcs_1/r/is_collation_character_set_applicability.result
index 43dc14784f4..7eba964bdf6 100644
--- a/mysql-test/suite/funcs_1/r/is_collation_character_set_applicability.result
+++ b/mysql-test/suite/funcs_1/r/is_collation_character_set_applicability.result
@@ -28,18 +28,18 @@ DROP FUNCTION test.f1;
#########################################################################
DESCRIBE information_schema.COLLATION_CHARACTER_SET_APPLICABILITY;
Field Type Null Key Default Extra
-COLLATION_NAME varchar(64) NO
-CHARACTER_SET_NAME varchar(64) NO
+COLLATION_NAME varchar(32) NO
+CHARACTER_SET_NAME varchar(32) NO
SHOW CREATE TABLE information_schema.COLLATION_CHARACTER_SET_APPLICABILITY;
Table Create Table
COLLATION_CHARACTER_SET_APPLICABILITY CREATE TEMPORARY TABLE `COLLATION_CHARACTER_SET_APPLICABILITY` (
- `COLLATION_NAME` varchar(64) NOT NULL DEFAULT '',
- `CHARACTER_SET_NAME` varchar(64) NOT NULL DEFAULT ''
+ `COLLATION_NAME` varchar(32) NOT NULL DEFAULT '',
+ `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW COLUMNS FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY;
Field Type Null Key Default Extra
-COLLATION_NAME varchar(64) NO
-CHARACTER_SET_NAME varchar(64) NO
+COLLATION_NAME varchar(32) NO
+CHARACTER_SET_NAME varchar(32) NO
# Testcases 3.2.4.2 and 3.2.4.3 are checked in suite/funcs_1/t/charset_collation*.test
########################################################################
# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
diff --git a/mysql-test/suite/funcs_1/r/is_collations.result b/mysql-test/suite/funcs_1/r/is_collations.result
index ca9259b67eb..234aeff8ff2 100644
--- a/mysql-test/suite/funcs_1/r/is_collations.result
+++ b/mysql-test/suite/funcs_1/r/is_collations.result
@@ -28,8 +28,8 @@ DROP FUNCTION test.f1;
#########################################################################
DESCRIBE information_schema.COLLATIONS;
Field Type Null Key Default Extra
-COLLATION_NAME varchar(64) NO
-CHARACTER_SET_NAME varchar(64) NO
+COLLATION_NAME varchar(32) NO
+CHARACTER_SET_NAME varchar(32) NO
ID bigint(11) NO 0
IS_DEFAULT varchar(3) NO
IS_COMPILED varchar(3) NO
@@ -37,8 +37,8 @@ SORTLEN bigint(3) NO 0
SHOW CREATE TABLE information_schema.COLLATIONS;
Table Create Table
COLLATIONS CREATE TEMPORARY TABLE `COLLATIONS` (
- `COLLATION_NAME` varchar(64) NOT NULL DEFAULT '',
- `CHARACTER_SET_NAME` varchar(64) NOT NULL DEFAULT '',
+ `COLLATION_NAME` varchar(32) NOT NULL DEFAULT '',
+ `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '',
`ID` bigint(11) NOT NULL DEFAULT '0',
`IS_DEFAULT` varchar(3) NOT NULL DEFAULT '',
`IS_COMPILED` varchar(3) NOT NULL DEFAULT '',
@@ -46,8 +46,8 @@ COLLATIONS CREATE TEMPORARY TABLE `COLLATIONS` (
) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW COLUMNS FROM information_schema.COLLATIONS;
Field Type Null Key Default Extra
-COLLATION_NAME varchar(64) NO
-CHARACTER_SET_NAME varchar(64) NO
+COLLATION_NAME varchar(32) NO
+CHARACTER_SET_NAME varchar(32) NO
ID bigint(11) NO 0
IS_DEFAULT varchar(3) NO
IS_COMPILED varchar(3) NO
diff --git a/mysql-test/suite/funcs_1/r/is_columns.result b/mysql-test/suite/funcs_1/r/is_columns.result
index 99a497d806d..e0780a60e2e 100644
--- a/mysql-test/suite/funcs_1/r/is_columns.result
+++ b/mysql-test/suite/funcs_1/r/is_columns.result
@@ -40,8 +40,8 @@ CHARACTER_MAXIMUM_LENGTH bigint(21) unsigned YES NULL
CHARACTER_OCTET_LENGTH bigint(21) unsigned YES NULL
NUMERIC_PRECISION bigint(21) unsigned YES NULL
NUMERIC_SCALE bigint(21) unsigned YES NULL
-CHARACTER_SET_NAME varchar(64) YES NULL
-COLLATION_NAME varchar(64) YES NULL
+CHARACTER_SET_NAME varchar(32) YES NULL
+COLLATION_NAME varchar(32) YES NULL
COLUMN_TYPE longtext NO NULL
COLUMN_KEY varchar(3) NO
EXTRA varchar(27) NO
@@ -62,8 +62,8 @@ COLUMNS CREATE TEMPORARY TABLE `COLUMNS` (
`CHARACTER_OCTET_LENGTH` bigint(21) unsigned DEFAULT NULL,
`NUMERIC_PRECISION` bigint(21) unsigned DEFAULT NULL,
`NUMERIC_SCALE` bigint(21) unsigned DEFAULT NULL,
- `CHARACTER_SET_NAME` varchar(64) DEFAULT NULL,
- `COLLATION_NAME` varchar(64) DEFAULT NULL,
+ `CHARACTER_SET_NAME` varchar(32) DEFAULT NULL,
+ `COLLATION_NAME` varchar(32) DEFAULT NULL,
`COLUMN_TYPE` longtext NOT NULL,
`COLUMN_KEY` varchar(3) NOT NULL DEFAULT '',
`EXTRA` varchar(27) NOT NULL DEFAULT '',
@@ -84,8 +84,8 @@ CHARACTER_MAXIMUM_LENGTH bigint(21) unsigned YES NULL
CHARACTER_OCTET_LENGTH bigint(21) unsigned YES NULL
NUMERIC_PRECISION bigint(21) unsigned YES NULL
NUMERIC_SCALE bigint(21) unsigned YES NULL
-CHARACTER_SET_NAME varchar(64) YES NULL
-COLLATION_NAME varchar(64) YES NULL
+CHARACTER_SET_NAME varchar(32) YES NULL
+COLLATION_NAME varchar(32) YES NULL
COLUMN_TYPE longtext NO NULL
COLUMN_KEY varchar(3) NO
EXTRA varchar(27) NO
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 84daef5f8da..15466887ecc 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -3,22 +3,22 @@ WHERE table_schema = 'information_schema'
AND table_name <> 'profiling'
ORDER BY table_schema, table_name, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
-NULL information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-NULL information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
+NULL information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
+NULL information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
NULL information_schema CHARACTER_SETS DESCRIPTION 3 NO varchar 60 180 NULL NULL utf8 utf8_general_ci varchar(60) select
NULL information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL bigint(3) select
-NULL information_schema COLLATIONS CHARACTER_SET_NAME 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-NULL information_schema COLLATIONS COLLATION_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
+NULL information_schema COLLATIONS CHARACTER_SET_NAME 2 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
+NULL information_schema COLLATIONS COLLATION_NAME 1 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
NULL information_schema COLLATIONS ID 3 0 NO bigint NULL NULL 19 0 NULL NULL bigint(11) select
NULL information_schema COLLATIONS IS_COMPILED 5 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select
NULL information_schema COLLATIONS IS_DEFAULT 4 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select
NULL information_schema COLLATIONS SORTLEN 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(3) select
-NULL information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-NULL information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
+NULL information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME 2 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
+NULL information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME 1 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
NULL information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
+NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
+NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
NULL information_schema COLUMNS COLUMN_COMMENT 19 NO varchar 255 765 NULL NULL utf8 utf8_general_ci varchar(255) select
NULL information_schema COLUMNS COLUMN_DEFAULT 6 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
NULL information_schema COLUMNS COLUMN_KEY 16 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select
@@ -110,9 +110,9 @@ NULL information_schema FILES UPDATE_COUNT 13 NULL YES bigint NULL NULL 19 0 NUL
NULL information_schema FILES UPDATE_TIME 34 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
NULL information_schema FILES VERSION 25 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-NULL information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL YES varchar 20480 61440 NULL NULL utf8 utf8_general_ci varchar(20480) select
+NULL information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select
NULL information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-NULL information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NULL YES varchar 20480 61440 NULL NULL utf8 utf8_general_ci varchar(20480) select
+NULL information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select
NULL information_schema KEY_COLUMN_USAGE COLUMN_NAME 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
NULL information_schema KEY_COLUMN_USAGE CONSTRAINT_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
NULL information_schema KEY_COLUMN_USAGE CONSTRAINT_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
@@ -200,11 +200,11 @@ NULL information_schema ROUTINES ROUTINE_TYPE 5 NO varchar 9 27 NULL NULL utf8
NULL information_schema ROUTINES SECURITY_TYPE 15 NO varchar 7 21 NULL NULL utf8 utf8_general_ci varchar(7) select
NULL information_schema ROUTINES SPECIFIC_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
NULL information_schema ROUTINES SQL_DATA_ACCESS 13 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-NULL information_schema ROUTINES SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
+NULL information_schema ROUTINES SQL_MODE 18 NO varchar 8192 24576 NULL NULL utf8 utf8_general_ci varchar(8192) select
NULL information_schema ROUTINES SQL_PATH 14 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
NULL information_schema SCHEMATA CATALOG_NAME 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
-NULL information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-NULL information_schema SCHEMATA DEFAULT_COLLATION_NAME 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
+NULL information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME 3 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
+NULL information_schema SCHEMATA DEFAULT_COLLATION_NAME 4 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
NULL information_schema SCHEMATA SCHEMA_NAME 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
NULL information_schema SCHEMATA SQL_PATH 5 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
NULL information_schema SCHEMA_PRIVILEGES GRANTEE 1 NO varchar 81 243 NULL NULL utf8 utf8_general_ci varchar(81) select
@@ -213,9 +213,9 @@ NULL information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NO varchar 64 192 NU
NULL information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
NULL information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
NULL information_schema SESSION_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-NULL information_schema SESSION_STATUS VARIABLE_VALUE 2 NULL YES varchar 20480 61440 NULL NULL utf8 utf8_general_ci varchar(20480) select
+NULL information_schema SESSION_STATUS VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select
NULL information_schema SESSION_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-NULL information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NULL YES varchar 20480 61440 NULL NULL utf8 utf8_general_ci varchar(20480) select
+NULL information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select
NULL information_schema STATISTICS CARDINALITY 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) select
NULL information_schema STATISTICS COLLATION 9 NULL YES varchar 1 3 NULL NULL utf8 utf8_general_ci varchar(1) select
NULL information_schema STATISTICS COLUMN_NAME 8 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
@@ -244,7 +244,7 @@ NULL information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 19 0 NU
NULL information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema TABLES ROW_FORMAT 7 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select
NULL information_schema TABLES TABLE_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
-NULL information_schema TABLES TABLE_COLLATION 18 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
+NULL information_schema TABLES TABLE_COLLATION 18 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
NULL information_schema TABLES TABLE_COMMENT 21 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select
NULL information_schema TABLES TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
NULL information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
@@ -357,18 +357,18 @@ WHERE table_schema = 'information_schema'
AND table_name <> 'profiling'
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION;
COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE
-3.0000 information_schema CHARACTER_SETS CHARACTER_SET_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema CHARACTER_SETS CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
+3.0000 information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema CHARACTER_SETS DESCRIPTION varchar 60 180 utf8 utf8_general_ci varchar(60)
NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(3)
-3.0000 information_schema COLLATIONS COLLATION_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema COLLATIONS CHARACTER_SET_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema COLLATIONS COLLATION_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
+3.0000 information_schema COLLATIONS CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
NULL information_schema COLLATIONS ID bigint NULL NULL NULL NULL bigint(11)
3.0000 information_schema COLLATIONS IS_DEFAULT varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema COLLATIONS IS_COMPILED varchar 3 9 utf8 utf8_general_ci varchar(3)
NULL information_schema COLLATIONS SORTLEN bigint NULL NULL NULL NULL bigint(3)
-3.0000 information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
+3.0000 information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema COLUMNS TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema COLUMNS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema COLUMNS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
@@ -381,8 +381,8 @@ NULL information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH bigint NULL NULL NULL N
NULL information_schema COLUMNS CHARACTER_OCTET_LENGTH bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema COLUMNS NUMERIC_PRECISION bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema COLUMNS NUMERIC_SCALE bigint NULL NULL NULL NULL bigint(21) unsigned
-3.0000 information_schema COLUMNS CHARACTER_SET_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema COLUMNS COLLATION_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema COLUMNS CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
+3.0000 information_schema COLUMNS COLLATION_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
1.0000 information_schema COLUMNS COLUMN_TYPE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
3.0000 information_schema COLUMNS COLUMN_KEY varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema COLUMNS EXTRA varchar 27 81 utf8 utf8_general_ci varchar(27)
@@ -464,9 +464,9 @@ NULL information_schema FILES CHECKSUM bigint NULL NULL NULL NULL bigint(21) uns
3.0000 information_schema FILES STATUS varchar 20 60 utf8 utf8_general_ci varchar(20)
3.0000 information_schema FILES EXTRA varchar 255 765 utf8 utf8_general_ci varchar(255)
3.0000 information_schema GLOBAL_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 20480 61440 utf8 utf8_general_ci varchar(20480)
+3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema GLOBAL_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 20480 61440 utf8 utf8_general_ci varchar(20480)
+3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema KEY_COLUMN_USAGE CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema KEY_COLUMN_USAGE CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema KEY_COLUMN_USAGE CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
@@ -550,7 +550,7 @@ NULL information_schema PROCESSLIST TIME bigint NULL NULL NULL NULL bigint(7)
3.0000 information_schema ROUTINES SECURITY_TYPE varchar 7 21 utf8 utf8_general_ci varchar(7)
NULL information_schema ROUTINES CREATED datetime NULL NULL NULL NULL datetime
NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datetime
-1.0000 information_schema ROUTINES SQL_MODE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
+3.0000 information_schema ROUTINES SQL_MODE varchar 8192 24576 utf8 utf8_general_ci varchar(8192)
3.0000 information_schema ROUTINES ROUTINE_COMMENT varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema ROUTINES DEFINER varchar 77 231 utf8 utf8_general_ci varchar(77)
3.0000 information_schema ROUTINES CHARACTER_SET_CLIENT varchar 32 96 utf8 utf8_general_ci varchar(32)
@@ -558,8 +558,8 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet
3.0000 information_schema ROUTINES DATABASE_COLLATION varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema SCHEMATA CATALOG_NAME varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema SCHEMATA SCHEMA_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema SCHEMATA DEFAULT_COLLATION_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema SCHEMATA DEFAULT_CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
+3.0000 information_schema SCHEMATA DEFAULT_COLLATION_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema SCHEMATA SQL_PATH varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema SCHEMA_PRIVILEGES GRANTEE varchar 81 243 utf8 utf8_general_ci varchar(81)
3.0000 information_schema SCHEMA_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
@@ -567,9 +567,9 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet
3.0000 information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema SCHEMA_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3)
3.0000 information_schema SESSION_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 20480 61440 utf8 utf8_general_ci varchar(20480)
+3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema SESSION_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 20480 61440 utf8 utf8_general_ci varchar(20480)
+3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema STATISTICS TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema STATISTICS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema STATISTICS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
@@ -602,7 +602,7 @@ NULL information_schema TABLES AUTO_INCREMENT bigint NULL NULL NULL NULL bigint(
NULL information_schema TABLES CREATE_TIME datetime NULL NULL NULL NULL datetime
NULL information_schema TABLES UPDATE_TIME datetime NULL NULL NULL NULL datetime
NULL information_schema TABLES CHECK_TIME datetime NULL NULL NULL NULL datetime
-3.0000 information_schema TABLES TABLE_COLLATION varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema TABLES TABLE_COLLATION varchar 32 96 utf8 utf8_general_ci varchar(32)
NULL information_schema TABLES CHECKSUM bigint NULL NULL NULL NULL bigint(21) unsigned
3.0000 information_schema TABLES CREATE_OPTIONS varchar 255 765 utf8 utf8_general_ci varchar(255)
3.0000 information_schema TABLES TABLE_COMMENT varchar 80 240 utf8 utf8_general_ci varchar(80)
diff --git a/mysql-test/suite/funcs_1/r/is_routines.result b/mysql-test/suite/funcs_1/r/is_routines.result
index ba564c42f91..e7a900f5c0b 100644
--- a/mysql-test/suite/funcs_1/r/is_routines.result
+++ b/mysql-test/suite/funcs_1/r/is_routines.result
@@ -45,7 +45,7 @@ SQL_PATH varchar(64) YES NULL
SECURITY_TYPE varchar(7) NO
CREATED datetime NO 0000-00-00 00:00:00
LAST_ALTERED datetime NO 0000-00-00 00:00:00
-SQL_MODE longtext NO NULL
+SQL_MODE varchar(8192) NO
ROUTINE_COMMENT varchar(64) NO
DEFINER varchar(77) NO
CHARACTER_SET_CLIENT varchar(32) NO
@@ -71,7 +71,7 @@ ROUTINES CREATE TEMPORARY TABLE `ROUTINES` (
`SECURITY_TYPE` varchar(7) NOT NULL DEFAULT '',
`CREATED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`LAST_ALTERED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `SQL_MODE` longtext NOT NULL,
+ `SQL_MODE` varchar(8192) NOT NULL DEFAULT '',
`ROUTINE_COMMENT` varchar(64) NOT NULL DEFAULT '',
`DEFINER` varchar(77) NOT NULL DEFAULT '',
`CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '',
@@ -97,7 +97,7 @@ SQL_PATH varchar(64) YES NULL
SECURITY_TYPE varchar(7) NO
CREATED datetime NO 0000-00-00 00:00:00
LAST_ALTERED datetime NO 0000-00-00 00:00:00
-SQL_MODE longtext NO NULL
+SQL_MODE varchar(8192) NO
ROUTINE_COMMENT varchar(64) NO
DEFINER varchar(77) NO
CHARACTER_SET_CLIENT varchar(32) NO
diff --git a/mysql-test/suite/funcs_1/r/is_schemata.result b/mysql-test/suite/funcs_1/r/is_schemata.result
index 33ab912efce..2850655148e 100644
--- a/mysql-test/suite/funcs_1/r/is_schemata.result
+++ b/mysql-test/suite/funcs_1/r/is_schemata.result
@@ -30,24 +30,24 @@ DESCRIBE information_schema.SCHEMATA;
Field Type Null Key Default Extra
CATALOG_NAME varchar(512) YES NULL
SCHEMA_NAME varchar(64) NO
-DEFAULT_CHARACTER_SET_NAME varchar(64) NO
-DEFAULT_COLLATION_NAME varchar(64) NO
+DEFAULT_CHARACTER_SET_NAME varchar(32) NO
+DEFAULT_COLLATION_NAME varchar(32) NO
SQL_PATH varchar(512) YES NULL
SHOW CREATE TABLE information_schema.SCHEMATA;
Table Create Table
SCHEMATA CREATE TEMPORARY TABLE `SCHEMATA` (
`CATALOG_NAME` varchar(512) DEFAULT NULL,
`SCHEMA_NAME` varchar(64) NOT NULL DEFAULT '',
- `DEFAULT_CHARACTER_SET_NAME` varchar(64) NOT NULL DEFAULT '',
- `DEFAULT_COLLATION_NAME` varchar(64) NOT NULL DEFAULT '',
+ `DEFAULT_CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '',
+ `DEFAULT_COLLATION_NAME` varchar(32) NOT NULL DEFAULT '',
`SQL_PATH` varchar(512) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW COLUMNS FROM information_schema.SCHEMATA;
Field Type Null Key Default Extra
CATALOG_NAME varchar(512) YES NULL
SCHEMA_NAME varchar(64) NO
-DEFAULT_CHARACTER_SET_NAME varchar(64) NO
-DEFAULT_COLLATION_NAME varchar(64) NO
+DEFAULT_CHARACTER_SET_NAME varchar(32) NO
+DEFAULT_COLLATION_NAME varchar(32) NO
SQL_PATH varchar(512) YES NULL
SELECT catalog_name, schema_name, sql_path
FROM information_schema.schemata
diff --git a/mysql-test/suite/funcs_1/r/is_tables.result b/mysql-test/suite/funcs_1/r/is_tables.result
index 1ed97e52c6c..1ab863b9b7d 100644
--- a/mysql-test/suite/funcs_1/r/is_tables.result
+++ b/mysql-test/suite/funcs_1/r/is_tables.result
@@ -45,7 +45,7 @@ AUTO_INCREMENT bigint(21) unsigned YES NULL
CREATE_TIME datetime YES NULL
UPDATE_TIME datetime YES NULL
CHECK_TIME datetime YES NULL
-TABLE_COLLATION varchar(64) YES NULL
+TABLE_COLLATION varchar(32) YES NULL
CHECKSUM bigint(21) unsigned YES NULL
CREATE_OPTIONS varchar(255) YES NULL
TABLE_COMMENT varchar(80) NO
@@ -69,7 +69,7 @@ TABLES CREATE TEMPORARY TABLE `TABLES` (
`CREATE_TIME` datetime DEFAULT NULL,
`UPDATE_TIME` datetime DEFAULT NULL,
`CHECK_TIME` datetime DEFAULT NULL,
- `TABLE_COLLATION` varchar(64) DEFAULT NULL,
+ `TABLE_COLLATION` varchar(32) DEFAULT NULL,
`CHECKSUM` bigint(21) unsigned DEFAULT NULL,
`CREATE_OPTIONS` varchar(255) DEFAULT NULL,
`TABLE_COMMENT` varchar(80) NOT NULL DEFAULT ''
@@ -93,7 +93,7 @@ AUTO_INCREMENT bigint(21) unsigned YES NULL
CREATE_TIME datetime YES NULL
UPDATE_TIME datetime YES NULL
CHECK_TIME datetime YES NULL
-TABLE_COLLATION varchar(64) YES NULL
+TABLE_COLLATION varchar(32) YES NULL
CHECKSUM bigint(21) unsigned YES NULL
CREATE_OPTIONS varchar(255) YES NULL
TABLE_COMMENT varchar(80) NO
@@ -310,6 +310,7 @@ SELECT UPDATE_TIME, checksum INTO @UPDATE_TIME, @checksum
FROM information_schema.tables
WHERE table_name = 't1_my_tablex';
INSERT INTO db_datadict.t1_my_tablex SET f1 = 3;
+FLUSH TABLES;
SELECT UPDATE_TIME > @UPDATE_TIME
AS "Is current UPDATE_TIME bigger than before last INSERT?"
FROM information_schema.tables
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc
index e3012ed0ca0..e5933eb84a8 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc
@@ -185,7 +185,7 @@ let $message= use db with trigger privilege on db level and without...:;
select f1 from t1 order by f1;
--disable_warnings
disconnect no_privs;
- --enable warnings
+ --enable_warnings
connection yes_privs;
select current_user;
diff --git a/mysql-test/t/ctype_filesystem-master.opt b/mysql-test/t/ctype_filesystem-master.opt
new file mode 100644
index 00000000000..44127f68664
--- /dev/null
+++ b/mysql-test/t/ctype_filesystem-master.opt
@@ -0,0 +1,2 @@
+--character-sets-dir=$MYSQL_TEST_DIR/ß
+--character-set-filesystem=latin1
diff --git a/mysql-test/t/ctype_filesystem.test b/mysql-test/t/ctype_filesystem.test
new file mode 100644
index 00000000000..2b993c2b924
--- /dev/null
+++ b/mysql-test/t/ctype_filesystem.test
@@ -0,0 +1,6 @@
+SET CHARACTER SET utf8;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+SHOW VARIABLES like 'character_sets_dir';
+SHOW VARIABLES like 'character_set_filesystem';
+SHOW VARIABLES like 'character_set_client';
+SET CHARACTER SET default;
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 2e23ac3661c..f0c769251cf 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1439,3 +1439,20 @@ select hex(_utf8 X'616263FF');
select hex(_utf8 B'001111111111');
--error ER_INVALID_CHARACTER_STRING
select (_utf8 X'616263FF');
+
+#
+# Bug #36772: When using UTF8, CONVERT with GROUP BY returns truncated results
+#
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
+INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
+ALTER TABLE t1 ADD UNIQUE (b);
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
+DROP INDEX b ON t1;
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
+ALTER TABLE t1 ADD INDEX (b);
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index bf141cbfa41..cc02f1faba3 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -10,7 +10,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
log_tables.test : Bug #37798: main.log_tables fails randomly on powermacg5 and windows
wait_timeout_func : BUG#36873 2008-07-06 sven wait_timeout_func.test fails randomly
delayed_insert_limit_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
@@ -25,3 +24,4 @@ timestamp_func : BUG#37962 2008-07-08 sven *_func tests c
log_output_func : BUG#37766 2008-07-10 sven main.log_output_func randomly fails in pushbuild
slow_query_log_func.test : Bug #37962: *_func tests containing sleeps/race conditions
innodb_max_dirty_pages_pct_func : BUG#41018 BUG#39382 2008-12-02 sven test fails often. some failures fill up the disk, causing subsequent failures in many other tests
+wait_timeout_func : Bug #41225 joro wait_timeout_func fails
diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test
index a5133166495..87cfa42e283 100644
--- a/mysql-test/t/events_scheduling.test
+++ b/mysql-test/t/events_scheduling.test
@@ -1,11 +1,12 @@
-# Can't test with embedded server that doesn't support grants
+# Can't test with embedded server that doesn't support events
-- source include/not_embedded.inc
CREATE DATABASE IF NOT EXISTS events_test;
USE events_test;
+SET @event_scheduler=@@global.event_scheduler;
SET GLOBAL event_scheduler=OFF;
---echo Try agian to make sure it's allowed
+--echo Try again to make sure it's allowed
SET GLOBAL event_scheduler=OFF;
SHOW VARIABLES LIKE 'event_scheduler';
SET GLOBAL event_scheduler=1;
@@ -57,34 +58,44 @@ ON COMPLETION PRESERVE
DO
INSERT INTO table_4 VALUES (1);
+# Wait for the events to fire and check the data afterwards
+
# Let event_1 insert at least 4 records into the table
let $wait_condition=select count(*) >= 4 from table_1;
--source include/wait_condition.inc
+# Minimum of passed time is 6 seconds assuming
+# - event executions starts immediate after creation
+# - 4 times event_1 means an insert at ect, ect+2, ect+4, ect+6
+# ect = event creation time
-# Let event_2 reach the end of its execution interval
+# Let event_2 reach the end of its execution interval
let $wait_condition=select count(*) = 0 from information_schema.events
where event_name='event_2' and status='enabled';
--source include/wait_condition.inc
+# Minimum of passed time is 6 seconds.
+# See wait_condition for event_1 above and ENDS condition for event_2.
-# Let event_3, which is ON COMPLETION NOT PRESERVE execute and drop itself
+# Let event_3, which is ON COMPLETION NOT PRESERVE execute and drop itself
let $wait_condition=select count(*) = 0 from information_schema.events
where event_name='event_3';
--source include/wait_condition.inc
-# Let event_4 reach the end of its execution interval
+# Let event_4 reach the end of its execution interval
let $wait_condition=select count(*) = 0 from information_schema.events
where event_name='event_4' and status='enabled';
--source include/wait_condition.inc
-# Wait for the events to fire and check the data afterwards
-
let $wait_condition=SELECT SUM(a) >= 4 FROM table_1;
source include/wait_condition.inc;
SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
-let $wait_condition=SELECT SUM(a) >= 5 FROM table_2;
+# In case of a testing box under heavy load it cannot be guaranteed that
+# it is really often enough checked if event_2 has to be executed.
+# -> Bug#39854 events_scheduling fails sporadically on pushbuild
+# Therefore we lowered here the original expectation of 5 to 4.
+let $wait_condition=SELECT SUM(a) >= 4 FROM table_2;
source include/wait_condition.inc;
-SELECT IF(SUM(a) >= 5, 'OK', 'ERROR') FROM table_2;
+SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_2;
let $wait_condition=SELECT SUM(a) >= 1 FROM table_3;
source include/wait_condition.inc;
@@ -112,9 +123,9 @@ DROP TABLE table_2;
DROP TABLE table_3;
DROP TABLE table_4;
DROP DATABASE events_test;
-SET GLOBAL event_scheduler=OFF;
+SET GLOBAL event_scheduler=@event_scheduler;
-#
+#
# End of tests
#
diff --git a/mysql-test/t/events_time_zone.test b/mysql-test/t/events_time_zone.test
index af3466a339c..ccae7847618 100644
--- a/mysql-test/t/events_time_zone.test
+++ b/mysql-test/t/events_time_zone.test
@@ -1,11 +1,40 @@
-# This test case is sensitive to execution timing. You may control
-# this sensitivity by the parameter below. Small values will result
-# in fast but more unstable execution, large values will improve
-# stability at the cost of speed. Basically, N is a number of seconds
-# to wait for operation to complete. Should be positive. Test runs
-# about 25*N seconds (it sleeps most of the time, so CPU speed is not
-# relevant).
+# 1. This test case is sensitive to execution timing. You may control
+# this sensitivity by the parameter below. Small values will result
+# in fast but more unstable execution, large values will improve
+# stability at the cost of speed. Basically, N is a number of seconds
+# to wait for operation to complete. Should be positive. Test runs
+# about 25*N seconds (it sleeps most of the time, so CPU speed is not
+# relevant).
let $N = 5;
+#
+# 2. Some subtests
+# - create a new time zone
+# - run some statements
+# - delete the new time zone.
+# But the time zone name used gets somewhere cached and it cannot be
+# "reused" later in the same or another session for a new time zone.
+# Experiments (2008-11 MySQL 5.1) showed that none of the available
+# RESET/FLUSH commands removes these entries.
+# 2008-11 MySQL 5.1 Bug#39979 main.events_time_zone does not clean up
+# second bad effect
+# Therefore we compute unique and unusual timezone names to minimize
+# the likelihood that a later test uses the same name.
+#
+# 3. The subtests mentioned in 2. cause that the AUTO_INCREMENT value
+# within "SHOW CREATE TABLE mysql.timezone" differ from the initial one.
+# (Bug#39979 main.events_time_zone does not clean up)
+# Therefore we reset this value after each of these subtests.
+#
+# Note(mleich):
+# There is a significant likelihood that future improvements of the server
+# cause that the solutions for the issues mentioned in 2. and 3. will no
+# more work.
+# A mysql-test-run.pl feature which allows to enforce
+# 1. Server shutdown (-> Problem mentioned in 2. disappears)
+# 2. Reset all data to initial state (-> Problem mentioned in 3. disappears)
+# 3. Server start
+# after a tests would be a perfect replacement.
+#
--source include/big_test.inc
@@ -73,19 +102,15 @@ delimiter ;//
SET @step3= @step * 3;
SET @step6= @step * 6;
-# Disable query log to hide current time.
---disable_query_log
SET @unix_time= UNIX_TIMESTAMP() - 1;
---enable_query_log
-
SET @unix_time= @unix_time - @unix_time % @step6;
INSERT INTO mysql.time_zone VALUES (NULL, 'N');
SET @tzid= LAST_INSERT_ID();
INSERT INTO mysql.time_zone_transition_type
- VALUES (@tzid, 0, 0, 0, 'b16420_0');
+ VALUES (@tzid, 0, 0, 0, 'b16420_0');
INSERT INTO mysql.time_zone_transition_type
- VALUES (@tzid, 1, @step3 - @step, 1, 'b16420_1');
+ VALUES (@tzid, 1, @step3 - @step, 1, 'b16420_1');
let $transition_unix_time= `SELECT @unix_time`;
let $count= 30;
@@ -99,7 +124,9 @@ while ($count)
dec $count;
}
--enable_query_log
-INSERT INTO mysql.time_zone_name VALUES ('bug16420', @tzid);
+let $tz_name = `SELECT CONCAT('b16420_a',UNIX_TIMESTAMP())`;
+--replace_result $tz_name <TZ_NAME_1>
+eval INSERT INTO mysql.time_zone_name VALUES ('$tz_name', @tzid);
CREATE TABLE t1 (count INT, unix_time INT, local_time INT, comment CHAR(80));
CREATE TABLE t2 (count INT);
@@ -135,7 +162,8 @@ SET TIME_ZONE= '+00:00';
CREATE EVENT e1 ON SCHEDULE EVERY @step SECOND
STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e1>");
-SET TIME_ZONE= 'bug16420';
+--replace_result $tz_name <TZ_NAME_1>
+eval SET TIME_ZONE= '$tz_name';
CREATE EVENT e2 ON SCHEDULE EVERY @step SECOND
STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e2>");
@@ -196,6 +224,8 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
+let $time_zone_auto_inc = `SELECT MAX(Time_zone_id) + 1 FROM mysql.time_zone`;
+eval ALTER TABLE mysql.time_zone AUTO_INCREMENT = $time_zone_auto_inc;
#----------------------------------------------------------------------
@@ -216,13 +246,13 @@ SET @offset_month_03= UNIX_TIMESTAMP('2030-03-31 12:00:00') - @now - 5*@step;
SET @offset_month_04= UNIX_TIMESTAMP('2030-04-30 12:00:00') - @now - 13*@step;
INSERT INTO mysql.time_zone_transition_type
- VALUES (@tzid, 0, @offset_month_01, 0, 'b16420_0');
+ VALUES (@tzid, 0, @offset_month_01, 0, 'b16420_0');
INSERT INTO mysql.time_zone_transition_type
- VALUES (@tzid, 1, @offset_month_02, 1, 'b16420_1');
+ VALUES (@tzid, 1, @offset_month_02, 1, 'b16420_1');
INSERT INTO mysql.time_zone_transition_type
- VALUES (@tzid, 2, @offset_month_03, 1, 'b16420_2');
+ VALUES (@tzid, 2, @offset_month_03, 1, 'b16420_2');
INSERT INTO mysql.time_zone_transition_type
- VALUES (@tzid, 3, @offset_month_04, 1, 'b16420_3');
+ VALUES (@tzid, 3, @offset_month_04, 1, 'b16420_3');
INSERT INTO mysql.time_zone_transition
VALUES (@tzid, @now, 0);
INSERT INTO mysql.time_zone_transition
@@ -231,11 +261,12 @@ INSERT INTO mysql.time_zone_transition
VALUES (@tzid, @now + 7 * @step, 2);
INSERT INTO mysql.time_zone_transition
VALUES (@tzid, @now + 12 * @step, 3);
-# We have to user a new time zone name, because 'bug16420' has been
-# cached already.
-INSERT INTO mysql.time_zone_name VALUES ('bug16420_2', @tzid);
+let $tz_name = `SELECT CONCAT('b16420_b',UNIX_TIMESTAMP())`;
+--replace_result $tz_name <TZ_NAME_2>
+eval INSERT INTO mysql.time_zone_name VALUES ('$tz_name', @tzid);
-SET TIME_ZONE= 'bug16420_2';
+--replace_result $tz_name <TZ_NAME_2>
+eval SET TIME_ZONE= '$tz_name';
SET GLOBAL EVENT_SCHEDULER= ON;
@@ -280,6 +311,8 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
+let $time_zone_auto_inc = `SELECT MAX(Time_zone_id) + 1 FROM mysql.time_zone`;
+eval ALTER TABLE mysql.time_zone AUTO_INCREMENT = $time_zone_auto_inc;
DROP FUNCTION round_to_step;
DROP TABLE t_step;
@@ -291,8 +324,8 @@ eval USE $old_db;
--enable_query_log
let $wait_condition=
- select count(*) = 0 from information_schema.processlist
- where db='mysqltest_db1' and command = 'Connect' and user=current_user();
+ SELECT COUNT(*) = 0 FROM information_schema.processlist
+ WHERE db='mysqltest_db1' AND command = 'Connect' AND user=current_user();
--source include/wait_condition.inc
--echo End of 5.1 tests.
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 64f77b4f0b7..21b06ca0882 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -418,3 +418,30 @@ SELECT a FROM t1 WHERE MATCH a AGAINST ('+city* of*' IN BOOLEAN MODE);
DROP TABLE t1;
# End of 4.1 tests
+
+#
+# BUG#38842 - Fix for 25951 seems incorrect
+#
+CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b));
+INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1),
+ ('test', 1),('test', 2),('test', 3),('test', 4);
+
+EXPLAIN SELECT * FROM t1
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 USE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 FORCE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 USE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test
index 68f07f258bf..7f17fd2180f 100644
--- a/mysql-test/t/func_compress.test
+++ b/mysql-test/t/func_compress.test
@@ -43,8 +43,11 @@ drop table t1;
# note that when LOW_MEMORY is set the "test" below is meaningless
#
-set @@max_allowed_packet=1048576*100;
+set @@global.max_allowed_packet=1048576*100;
--replace_result "''" XXX "'1'" XXX
+
+# reconnect to make the new max packet size take effect
+--connect (newconn, localhost, root,,)
eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null;
#
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 4eedd433d34..be4e9c32686 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -973,5 +973,34 @@ GROUP BY int_nokey LIMIT 1;
DROP TABLE derived1;
DROP TABLE D;
+#
+# Bug #39656: Behaviour different for agg functions with & without where -
+# ONLY_FULL_GROUP_BY
+#
+
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
+
+SET SQL_MODE='ONLY_FULL_GROUP_BY';
+
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t1 where a=1;
+
+--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
+SELECT COUNT(*),a FROM t1;
+
+SELECT COUNT(*) FROM t1 a JOIN t1 b ON a.a= b.a;
+
+--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
+SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
+ FROM t1 outr;
+
+SELECT COUNT(*) FROM t1 a JOIN t1 outr
+ ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
+
+SET SQL_MODE=default;
+DROP TABLE t1;
+
+
###
--echo End of 5.0 tests
diff --git a/mysql-test/t/func_sapdb.test b/mysql-test/t/func_sapdb.test
index 5db6db70e8f..f37ee0c39f0 100644
--- a/mysql-test/t/func_sapdb.test
+++ b/mysql-test/t/func_sapdb.test
@@ -135,3 +135,20 @@ select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
--enable_ps_protocol
# End of 4.1 tests
+
+
+
+#
+# Bug#37553: MySql Error Compare TimeDiff & Time
+#
+
+# calculations involving negative time values ignored sign
+select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00');
+select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00');
+select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
+
+# show that conversion to DECIMAL no longer drops sign
+SELECT CAST(time('-73:42:12') AS DECIMAL);
+
+
+# End of 5.0 tests
diff --git a/mysql-test/t/general_log_func.test b/mysql-test/t/general_log_func.test
index 20b875388c1..24d535e88e5 100644
--- a/mysql-test/t/general_log_func.test
+++ b/mysql-test/t/general_log_func.test
@@ -79,7 +79,7 @@ INSERT into t1(name) values('Record_4');
--chmod 0777 $MYSQLD_LOGFILE.orig
--echo ## There should be a difference ##
-SET @@session.max_allowed_packet= 1024*1024*1024;
+SET @@global.max_allowed_packet= 1024*1024*1024;
--replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE
eval SET @orig_file= load_file('$MYSQLD_LOGFILE.orig');
--replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE
diff --git a/mysql-test/t/group_concat_max_len_func.test b/mysql-test/t/group_concat_max_len_func.test
index d1dc8df43a0..29a4ff5becb 100644
--- a/mysql-test/t/group_concat_max_len_func.test
+++ b/mysql-test/t/group_concat_max_len_func.test
@@ -11,18 +11,23 @@
# Creation Date: 2008-03-07 #
# Author: Salman Rawala #
# #
+# Last modification: #
+# 2008-11-14 mleich Fix Bug#40644 main.group_concat_max_len_func random #
+# failures #
+# + minor improvements #
+# #
# Description: Test Cases of Dynamic System Variable group_concat_max_len #
# that checks the functionality of this variable #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
SET @save = @@global.group_concat_max_len;
--disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
--enable_warnings
#########################
@@ -32,34 +37,38 @@ drop table if exists t1;
--echo ## Creating new table t1 ##
CREATE TABLE t1
(
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id),
-rollno int NOT NULL,
+rollno INT NOT NULL,
name VARCHAR(30)
);
--echo '#--------------------FN_DYNVARS_034_01-------------------------#'
########################################################################
# Setting initial value of group_concat_max_len, inserting some rows
-# & creating 2 new connections
+# & creating 2 new connections
########################################################################
---echo ## Setting initial value of variable to 4 ##
+--echo ## Setting initial value of variable to 4 ##
SET @@global.group_concat_max_len = 4;
---echo ## Inserting some rows in table ##
-INSERT into t1(rollno, name) values(1, 'Record_1');
-INSERT into t1(rollno, name) values(2, 'Record_2');
-INSERT into t1(rollno, name) values(1, 'Record_3');
-INSERT into t1(rollno, name) values(3, 'Record_4');
-INSERT into t1(rollno, name) values(1, 'Record_5');
-INSERT into t1(rollno, name) values(3, 'Record_6');
-INSERT into t1(rollno, name) values(4, 'Record_7');
-INSERT into t1(rollno, name) values(4, 'Record_8');
-
---echo ## Creating two new connections ##
-CONNECT (test_con1,localhost,root,,);
-CONNECT (test_con2,localhost,root,,);
+--echo ## Inserting some rows in table ##
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_1');
+INSERT INTO t1(rollno, name) VALUES(2, 'Record_2');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_3');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_4');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_5');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_6');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_7');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_8');
+# The following "auxiliary" select ensures that all records are on disk
+# = result sets got by parallel sessions cannot suffer from effects
+# caused by the MyISAM feature "concurrent_inserts".
+SELECT * FROM t1 ORDER BY id;
+
+--echo ## Creating two new connections ##
+connect (test_con1,localhost,root,,);
+connect (test_con2,localhost,root,,);
--echo '#--------------------FN_DYNVARS_034_02-------------------------#'
@@ -68,16 +77,16 @@ CONNECT (test_con2,localhost,root,,);
###############################################################################
--echo ## Connecting with test_con1 ##
-CONNECTION test_con1;
+connection test_con1;
---echo ## Accessing data and using group_concat on column whose value is greater than 4 ##
-SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
+--echo ## Accessing data and using group_concat on column whose value is greater than 4 ##
+SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
--echo ## Changing session value of variable and verifying its behavior, ##
---echo ## warning should come here ##
+--echo ## warning should come here ##
SET @@session.group_concat_max_len = 10;
-SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
+SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
--echo '#--------------------FN_DYNVARS_034_03-------------------------#'
@@ -85,19 +94,19 @@ SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
# Verifying behavior of variable by increasing session value of variable #
##############################################################################
---echo ## Connecting with new connection test_con2 ##
+--echo ## Connecting with new connection test_con2 ##
connection test_con2;
---echo ## Verifying initial value of variable. It should be 4 ##
+--echo ## Verifying initial value of variable. It should be 4 ##
SELECT @@session.group_concat_max_len = 4;
---echo ## Setting session value of variable to 20 and verifying variable is concating ##
---echo ## column's value to 20 or not ##
+--echo ## Setting session value of variable to 20 and verifying variable is concating ##
+--echo ## column's value to 20 or not ##
SET @@session.group_concat_max_len = 20;
--echo ## Verifying value of name column, it should not me more than 20 characters ##
--echo ## Warning should come here ##
-SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
+SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
--echo '#--------------------FN_DYNVARS_034_04-------------------------#'
@@ -106,12 +115,12 @@ SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
# greater than the maximum concat length of name column #
###############################################################################
---echo ## Setting session value of variable to 26. No warning should appear here ##
---echo ## because the value after concatination is less than 30 ##
+--echo ## Setting session value of variable to 26. No warning should appear here ##
+--echo ## because the value after concatination is less than 30 ##
SET @@session.group_concat_max_len = 26;
---echo ## Verifying value of name column, it should not give warning now ##
-SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
+--echo ## Verifying value of name column, it should not give warning now ##
+SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
############################################################
@@ -119,11 +128,11 @@ SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
############################################################
--echo ## Dropping table t1 ##
-DROP table t1;
+DROP TABLE t1;
--echo ## Disconnecting both the connection ##
-DISCONNECT test_con2;
-DISCONNECT test_con1;
+disconnect test_con2;
+disconnect test_con1;
connection default;
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 26da7aa2ce5..d475fb2adb9 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1350,4 +1350,41 @@ explain select count(*) from information_schema.tables;
explain select count(*) from information_schema.columns;
explain select count(*) from information_schema.views;
+#
+# Bug#39955 SELECT on INFORMATION_SCHEMA.GLOBAL_VARIABLES takes too long
+#
+set global init_connect="drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;\
+drop table if exists t1;drop table if exists t1;";
+select * from information_schema.global_variables where variable_name='init_connect';
+set global init_connect="";
+
+#
+# Bug #34517 SHOW GLOBAL STATUS does not work properly in embedded server.
+#
+
+create table t0 select * from information_schema.global_status where VARIABLE_NAME='COM_SELECT';
+SELECT 1;
+select a.VARIABLE_VALUE - b.VARIABLE_VALUE from t0 b, information_schema.global_status a
+ where a.VARIABLE_NAME = b.VARIABLE_NAME;
+drop table t0;
+
--echo End of 5.1 tests.
diff --git a/mysql-test/t/information_schema_part.test b/mysql-test/t/information_schema_part.test
index 4cbf21ca1d3..f1415d12f79 100644
--- a/mysql-test/t/information_schema_part.test
+++ b/mysql-test/t/information_schema_part.test
@@ -121,3 +121,13 @@ SHOW CREATE TABLE t1;
SELECT PARTITION_DESCRIPTION FROM information_schema.partitions WHERE
table_schema = "test" AND table_name = "t1";
drop table t1;
+
+#
+# Bug#38909 CREATE_OPTIONS in information_schema produces wrong results
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (f1 int key) partition by key(f1) partitions 2;
+select create_options from information_schema.tables where table_schema="test";
+drop table t1;
diff --git a/mysql-test/t/innodb_bug34300.test b/mysql-test/t/innodb_bug34300.test
index 4b4a3fdc8a3..114bcf98c25 100644
--- a/mysql-test/t/innodb_bug34300.test
+++ b/mysql-test/t/innodb_bug34300.test
@@ -8,7 +8,9 @@
-- disable_query_log
-- disable_result_log
-SET @@max_allowed_packet=16777216;
+# set packet size and reconnect
+SET @@global.max_allowed_packet=16777216;
+--connect (newconn, localhost, root,,)
DROP TABLE IF EXISTS bug34300;
CREATE TABLE bug34300 (
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index ed8de208474..d47406697f8 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -43,3 +43,13 @@ CREATE TABLE t1 ( a INT ) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
DROP TABLE t1;
+#
+# Bug#37284 Crash in Field_string::type()
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
+CREATE INDEX i1 on t1 (a(3));
+SELECT * FROM t1 WHERE a = 'abcde';
+DROP TABLE t1;
diff --git a/mysql-test/t/log_output_func.test b/mysql-test/t/log_output_func.test
index 32026d8de59..007c4f38659 100644
--- a/mysql-test/t/log_output_func.test
+++ b/mysql-test/t/log_output_func.test
@@ -10,12 +10,13 @@
# #
# Creation Date: 2008-03-08 #
# Author: Rizwan #
+# Modified: HHunger 2008-08-29
# #
# Description: Test Cases of Dynamic System Variable log_output #
# that checks the behavior of this variable #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
@@ -23,6 +24,10 @@
# ps-protocol. So, it is switched off.
--disable_ps_protocol
+SET @start_value= @@global.log_output;
+SET @start_general_log= @@global.general_log;
+SET @start_general_log_file= @@global.general_log_file;
+
--echo '#--------------------FN_DYNVARS_065_01-------------------------#'
##################################################################
# Check if setting log_output is changed in every new connection #
@@ -32,17 +37,12 @@ SET @@global.log_output = 'NONE';
# con1 will be default connection from now on
--echo 'connect (con1,localhost,root,,,,)'
connect (con1,localhost,root,,,,);
---echo 'connection con1'
-connection con1;
-SELECT @@global.log_output;
SET @@global.log_output = 'TABLE,FILE';
+
+# Test that the effect is global
--echo 'connect (con2,localhost,root,,,,)'
connect (con2,localhost,root,,,,);
---echo 'connection con2'
-connection con2;
SELECT @@global.log_output;
-disconnect con2;
-
--echo '#--------------------FN_DYNVARS_065_02-------------------------#'
####################################################
@@ -52,10 +52,9 @@ disconnect con2;
--echo 'connection con1'
connection con1;
-
-#=======================================================================
+#===============================================================
--echo '---Checking general_log when log_output is NONE---'
-#=======================================================================
+#===============================================================
SET @@global.log_output = 'NONE';
TRUNCATE TABLE mysql.general_log;
@@ -64,13 +63,13 @@ TRUNCATE TABLE mysql.general_log;
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1(a INT);
-INSERT INTO t1 value(1);
+INSERT INTO t1 VALUE(1);
SELECT 'abc';
SELECT count(*) FROM mysql.general_log;
-#==============================================================================
+#===============================================================
--echo '---Checking general_log when log_output is TABLE---'
-#==============================================================================
+#===============================================================
SET @@global.log_output = 'TABLE';
TRUNCATE TABLE mysql.general_log;
@@ -78,35 +77,49 @@ TRUNCATE TABLE mysql.general_log;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
-create table t1(a int);
-INSERT INTO t1 value(1);
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUE(1);
SELECT 'abc';
-SELECT count(*) from mysql.general_log;
+# At least the last 4 statement should be logged.
+SELECT count(*)>4 FROM mysql.general_log;
-#===========================================================
+#===============================================================
# Checking general_log when log_output is FILE
-#===========================================================
-
-#SET @log_file = "mytest.log";
-#SET @@global.general_log = 0;
-#FLUSH LOGS;
-#SET @@global.general_log_file = @log_file;
---echo 'Bug#35371: Changing general_log file is crashing server'
---echo 'SET @@global.general_log_file = @log_file;'
+#===============================================================
+SET @@global.general_log = 'OFF';
+FLUSH LOGS;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval SET @@global.general_log_file = '$MYSQLTEST_VARDIR/run/mytest.log';
+SET @@global.general_log = 'ON';
SET @@global.log_output = 'FILE';
TRUNCATE TABLE mysql.general_log;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
-create table t1(a int);
-INSERT INTO t1 value(1);
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUE(1);
SELECT 'abc';
-SELECT count(*) from mysql.general_log;
+SELECT count(*) FROM mysql.general_log;
DROP TABLE t1;
+file_exists $MYSQLTEST_VARDIR/run/mytest.log ;
+
+#==============================================================
+# Clean up
+#==============================================================
+
+--echo connection default;
+connection default;
+SET @@global.general_log= 'OFF';
+SET @@global.general_log_file= @start_general_log_file;
+SET @@global.log_output= @start_value;
+SET @@global.general_log= @start_general_log;
+SET @@global.general_log= 'ON';
+
--enable_ps_protocol
####################################################
-# Endo of functionality Testing for log_output #
+# End of functionality Testing for log_output #
####################################################
+
diff --git a/mysql-test/t/max_allowed_packet_basic.test b/mysql-test/t/max_allowed_packet_basic.test
index beb9b62d6de..8be0e5f670e 100644
--- a/mysql-test/t/max_allowed_packet_basic.test
+++ b/mysql-test/t/max_allowed_packet_basic.test
@@ -36,8 +36,13 @@
SET @start_global_value = @@global.max_allowed_packet;
SELECT @start_global_value;
-SET @start_session_value = @@session.max_allowed_packet;
-SELECT @start_session_value;
+
+# give a known value to @@session.max_allowed_packet by assigning to
+# @@global and setting up a new connection (for deterministic result
+# file diffing)
+SET @@global.max_allowed_packet = DEFAULT;
+connect (conn1, localhost, root,,);
+
--echo '#--------------------FN_DYNVARS_070_01-------------------------#'
@@ -49,7 +54,9 @@ SET @@global.max_allowed_packet = 1000;
SET @@global.max_allowed_packet = DEFAULT;
SELECT @@global.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 20000;
+--Error ER_NO_DEFAULT
SET @@session.max_allowed_packet = DEFAULT;
SELECT @@session.max_allowed_packet;
@@ -62,9 +69,6 @@ SELECT @@session.max_allowed_packet;
SET @@global.max_allowed_packet = DEFAULT;
SELECT @@global.max_allowed_packet = 1048576;
-SET @@session.max_allowed_packet = DEFAULT;
-SELECT @@session.max_allowed_packet = 1048576;
-
--echo '#--------------------FN_DYNVARS_070_03-------------------------#'
############################################################################
@@ -86,14 +90,19 @@ SELECT @@global.max_allowed_packet;
# Change the value of max_allowed_packet to a valid value for SESSION Scope #
#############################################################################
+--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1024;
SELECT @@session.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1025;
SELECT @@session.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 65535;
SELECT @@session.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1073741824;
SELECT @@session.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1073741823;
SELECT @@session.max_allowed_packet;
@@ -118,14 +127,18 @@ SELECT @@global.max_allowed_packet;
SET @@global.max_allowed_packet = test;
SELECT @@global.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 0;
SELECT @@session.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1023;
SELECT @@session.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = -2;
SELECT @@session.max_allowed_packet;
--Error ER_PARSE_ERROR
SET @@session.max_allowed_packet = 65530.34.;
+--Error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 10737418241;
SELECT @@session.max_allowed_packet;
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
@@ -180,6 +193,7 @@ SELECT @@max_allowed_packet = @@global.max_allowed_packet;
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
########################################################################################################
+--Error ER_VARIABLE_IS_READONLY
SET @@max_allowed_packet = 100000;
SELECT @@max_allowed_packet = @@local.max_allowed_packet;
SELECT @@local.max_allowed_packet = @@session.max_allowed_packet;
@@ -190,6 +204,7 @@ SELECT @@local.max_allowed_packet = @@session.max_allowed_packet;
# Check if max_allowed_packet can be accessed with and without @@ sign #
#############################################################################
+--Error ER_VARIABLE_IS_READONLY
SET max_allowed_packet = 1024;
SELECT @@max_allowed_packet;
--Error ER_UNKNOWN_TABLE
@@ -204,9 +219,9 @@ SELECT max_allowed_packet = @@session.max_allowed_packet;
# Restore initial value #
####################################
+connection default;
SET @@global.max_allowed_packet = @start_global_value;
SELECT @@global.max_allowed_packet;
-SET @@session.max_allowed_packet = @start_session_value;
SELECT @@session.max_allowed_packet;
diff --git a/mysql-test/t/max_allowed_packet_func.test b/mysql-test/t/max_allowed_packet_func.test
index c6a2a561234..0cfbeb4de5f 100644
--- a/mysql-test/t/max_allowed_packet_func.test
+++ b/mysql-test/t/max_allowed_packet_func.test
@@ -43,26 +43,19 @@ name BLOB
--echo '#--------------------FN_DYNVARS_070_01-------------------------#'
###############################################################################
-# Setting initial value of max_allowed_packet to 1024 at session level and #
-# verifying its behavior after inserting data greater than 1024 bytes #
+# Setting initial value of max_allowed_packet to 1024 at session level
+# should result in an error (session variable is readonly)
###############################################################################
---echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ##
+--echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ##
+--error ER_VARIABLE_IS_READONLY
SET @@session.max_allowed_packet = 1024;
-SET @@session.net_buffer_length = 1024;
SELECT @@session.max_allowed_packet;
-SELECT @@session.net_buffer_length;
---echo ## Inserting and fetching data of length greater than 1024 ##
-INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
-
-SELECT length("aaaaaasssssssssssdddddddfffffgggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk") as len;
-
---echo ## Verifying record in table t1 ##
-SELECT * from t1;
+--error ER_VARIABLE_IS_READONLY
+SET @@session.net_buffer_length = 1024;
+SELECT @@session.net_buffer_length;
---echo 'Bug#35381: Error is not coming on inserting and fetching data of length'
---echo 'greater than max_allowed_packet size at session level';
--echo '#--------------------FN_DYNVARS_070_02-------------------------#'
###############################################################################
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 331663dceb5..0793ef15faf 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -10,9 +10,9 @@ source include/have_log_bin.inc;
drop table if exists t1,t2,t3;
drop database if exists mysqltest;
drop view if exists v1;
---error 0,1141,1147
+--error 0,ER_NONEXISTING_GRANT,ER_NONEXISTING_TABLE_GRANT
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
---error 0,1141,1147
+--error 0,ER_NONEXISTING_GRANT,ER_NONEXISTING_TABLE_GRANT
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1';
--enable_warnings
@@ -160,9 +160,9 @@ create table t2 (n int(10) not null primary key, d int(10));
insert into t1 values(1,1);
insert into t2 values(1,10),(2,20);
LOCK TABLES t1 write, t2 read;
---error 1099
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n;
---error 1099
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
unlock tables;
@@ -183,7 +183,7 @@ create table t1 (n int(10), d int(10));
create table t2 (n int(10), d int(10));
insert into t1 values(1,1);
insert into t2 values(1,10),(2,20);
---error 1175
+--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
set sql_safe_updates=0;
drop table t1,t2;
@@ -196,7 +196,7 @@ set timestamp=1038000000;
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
select n,d,unix_timestamp(t) from t1;
select n,d,unix_timestamp(t) from t2;
---error 1064
+--error ER_PARSE_ERROR
UPDATE t1,t2 SET 1=2 WHERE t1.n=t2.n;
drop table t1,t2;
set timestamp=0;
@@ -324,41 +324,6 @@ delete t1, t2 from t2,t1
drop table t1,t2;
#
-# Test for bug #1820.
-#
-
-create table t1 ( a int not null, b int not null) ;
---disable_query_log
-insert into t1 values (1,1),(2,2),(3,3),(4,4);
-let $1=19;
-set @d=4;
-while ($1)
-{
- eval insert into t1 select a+@d,b+@d from t1;
- eval set @d=@d*2;
- dec $1;
-}
-
---enable_query_log
-alter table t1 add index i1(a);
-delete from t1 where a > 2000000;
-create table t2 like t1;
-insert into t2 select * from t1;
-
-select 't2 rows before small delete', count(*) from t1;
-delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 2;
-select 't2 rows after small delete', count(*) from t2;
-select 't1 rows after small delete', count(*) from t1;
-
-## Try deleting many rows
-
-delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 100*1000;
-select 't2 rows after big delete', count(*) from t2;
-select 't1 rows after big delete', count(*) from t1;
-
-drop table t1,t2;
-
-#
# Test alias (this is not correct in 4.0)
#
@@ -367,7 +332,7 @@ CREATE TABLE t2 ( a int );
DELETE t1 FROM t1, t2 AS t3;
DELETE t4 FROM t1, t1 AS t4;
DELETE t3 FROM t1 AS t3, t1 AS t4;
---error 1109
+--error ER_UNKNOWN_TABLE
DELETE t1 FROM t1 AS t3, t2 AS t4;
INSERT INTO t1 values (1),(2);
INSERT INTO t2 values (1),(2);
@@ -422,7 +387,7 @@ drop database mysqltest;
create table t1 (a int, primary key (a));
create table t2 (a int, primary key (a));
create table t3 (a int, primary key (a));
--- error 1109
+-- error ER_UNKNOWN_TABLE
delete t1,t3 from t1,t2 where t1.a=t2.a and t2.a=(select t3.a from t3 where t1.a=t3.a);
drop table t1, t2, t3;
@@ -431,9 +396,9 @@ drop table t1, t2, t3;
#
create table t1 (col1 int);
create table t2 (col1 int);
--- error 1093
+-- error ER_UPDATE_TABLE_USED
update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
--- error 1093
+-- error ER_UPDATE_TABLE_USED
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
drop table t1,t2;
@@ -458,7 +423,7 @@ drop table t1, t2;
#
create table t1(a int);
create table t2(a int);
---error 1093
+--error ER_UPDATE_TABLE_USED
delete from t1,t2 using t1,t2 where t1.a=(select a from t1);
drop table t1, t2;
# End of 4.1 tests
diff --git a/mysql-test/t/multi_update2-master.opt b/mysql-test/t/multi_update2-master.opt
new file mode 100644
index 00000000000..9f1a29461ff
--- /dev/null
+++ b/mysql-test/t/multi_update2-master.opt
@@ -0,0 +1 @@
+--set-variable=tmp_table_size=1024
diff --git a/mysql-test/t/multi_update2.test b/mysql-test/t/multi_update2.test
new file mode 100644
index 00000000000..47f9bc7bad7
--- /dev/null
+++ b/mysql-test/t/multi_update2.test
@@ -0,0 +1,43 @@
+#
+# Test of update statement that uses many tables.
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+#
+# Bug#1820 Rows not deleted from second table on multi-table delete
+#
+
+CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
+--echo # The protocolling of many inserts into t1 is suppressed.
+--disable_query_log
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4);
+let $1=19;
+set @d=4;
+while ($1)
+{
+ eval INSERT INTO t1 SELECT a+@d,b+@d FROM t1;
+ eval SET @d=@d*2;
+ dec $1;
+}
+
+--enable_query_log
+ALTER TABLE t1 ADD INDEX i1(a);
+DELETE FROM t1 WHERE a > 2000000;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 SELECT * FROM t1;
+
+SELECT 't2 rows before small delete', COUNT(*) FROM t1;
+DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 2;
+SELECT 't2 rows after small delete', COUNT(*) FROM t2;
+SELECT 't1 rows after small delete', COUNT(*) FROM t1;
+
+## Try deleting many rows
+
+DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 100*1000;
+SELECT 't2 rows after big delete', COUNT(*) FROM t2;
+SELECT 't1 rows after big delete', COUNT(*) FROM t1;
+
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/mysqlbinlog_row_big.test b/mysql-test/t/mysqlbinlog_row_big.test
index bad39255bac..14e818e7214 100644
--- a/mysql-test/t/mysqlbinlog_row_big.test
+++ b/mysql-test/t/mysqlbinlog_row_big.test
@@ -38,7 +38,7 @@ SET timestamp=1000000000;
--echo #
--echo # We need big packets.
--echo #
-SET @@session.max_allowed_packet= 1024*1024*1024;
+SET @@global.max_allowed_packet= 1024*1024*1024;
--echo #
--echo # Delete all existing binary logs.
diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test
index 22b7f007b7e..da00ea0c2bf 100644
--- a/mysql-test/t/mysqlcheck.test
+++ b/mysql-test/t/mysqlcheck.test
@@ -75,6 +75,33 @@ drop table t_bug25347;
drop database d_bug25347;
use test;
+#
+# Bug#39541 CHECK TABLE on information_schema myisam tables produces error
+#
+create view v1 as select * from information_schema.routines;
+check table v1, information_schema.routines;
+drop view v1;
+
+
+#
+# Bug#37527: mysqlcheck fails to report entire database
+# when frm file corruption
+#
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT);
+# backup then null t1.frm
+--copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm.bak
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--write_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
+EOF
+--exec $MYSQL_CHECK test
+# restore t1.frm
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm.bak $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm.bak
+DROP TABLE t1, t2;
+
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/net_buffer_length_basic.test b/mysql-test/t/net_buffer_length_basic.test
index 80403bfec2b..6e1e0559c61 100644
--- a/mysql-test/t/net_buffer_length_basic.test
+++ b/mysql-test/t/net_buffer_length_basic.test
@@ -38,9 +38,13 @@
SET @start_global_value = @@global.net_buffer_length;
# Due to differences in results of linux and windows
#SELECT @start_global_value;
-SET @start_session_value = @@session.net_buffer_length;
-#SELECT @start_session_value;
+# give a known value to @@session.net_buffer_length by assigning to
+# @@global and setting up a new connection (for deterministic result
+# file diffing)
+SET @@global.net_buffer_length = DEFAULT;
+connect(con1,localhost,root,,);
+connection con1;
--echo '#--------------------FN_DYNVARS_109_01-------------------------#'
#################################################################
@@ -51,7 +55,9 @@ SET @@global.net_buffer_length = 10000;
SET @@global.net_buffer_length = DEFAULT;
SELECT @@global.net_buffer_length;
+--Error ER_VARIABLE_IS_READONLY
SET @@session.net_buffer_length = 20000;
+--Error ER_NO_DEFAULT
SET @@session.net_buffer_length = DEFAULT;
SELECT @@session.net_buffer_length;
@@ -64,9 +70,6 @@ SELECT @@session.net_buffer_length;
SET @@global.net_buffer_length = DEFAULT;
SELECT @@global.net_buffer_length = 16384;
-SET @@session.net_buffer_length = DEFAULT;
-SELECT @@session.net_buffer_length = 16384;
-
--echo '#--------------------FN_DYNVARS_109_03-------------------------#'
###########################################################################
@@ -91,17 +94,7 @@ SELECT @@global.net_buffer_length;
# Change the value of net_buffer_length to a valid value for SESSION Scope #
############################################################################
-SET @@session.net_buffer_length = 1024;
-SELECT @@session.net_buffer_length;
-SET @@session.net_buffer_length = 1025;
-SELECT @@session.net_buffer_length;
-SET @@session.net_buffer_length = 1048576;
-SELECT @@session.net_buffer_length;
-SET @@session.net_buffer_length = 1048575;
-SELECT @@session.net_buffer_length;
-SET @@session.net_buffer_length = 65535;
-SELECT @@session.net_buffer_length;
---echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
+# Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped
--echo '#------------------FN_DYNVARS_109_05-----------------------#'
@@ -126,18 +119,8 @@ SELECT @@global.net_buffer_length;
SET @@global.net_buffer_length = test;
SELECT @@global.net_buffer_length;
-SET @@session.net_buffer_length = 0;
-SELECT @@session.net_buffer_length;
-SET @@session.net_buffer_length = -2;
-SELECT @@session.net_buffer_length;
-SET @@session.net_buffer_length = 1048577;
-SELECT @@session.net_buffer_length;
-SET @@session.net_buffer_length = 1048576002;
-SELECT @@session.net_buffer_length;
---Error ER_PARSE_ERROR
-SET @@session.net_buffer_length = 65530.34.;
-SET @@session.net_buffer_length = 65550;
-SELECT @@session.net_buffer_length;
+# Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped
+
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
--Error ER_WRONG_TYPE_FOR_VAR
@@ -190,9 +173,7 @@ SELECT @@net_buffer_length = @@global.net_buffer_length;
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
########################################################################################################
-SET @@net_buffer_length = 100000;
-SELECT @@net_buffer_length = @@local.net_buffer_length;
-SELECT @@local.net_buffer_length = @@session.net_buffer_length;
+# Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped
--echo '#---------------------FN_DYNVARS_109_11----------------------#'
@@ -200,7 +181,7 @@ SELECT @@local.net_buffer_length = @@session.net_buffer_length;
# Check if net_buffer_length can be accessed with and without @@ sign #
############################################################################
-SET net_buffer_length = 1024;
+# Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped
SELECT @@net_buffer_length;
--Error ER_UNKNOWN_TABLE
SELECT local.net_buffer_length;
@@ -214,11 +195,11 @@ SELECT net_buffer_length = @@session.net_buffer_length;
# Restore initial value #
####################################
+connection default;
+
SET @@global.net_buffer_length = @start_global_value;
# Due to differences in results of linux and windows
#SELECT @@global.net_buffer_length;
-SET @@session.net_buffer_length = @start_session_value;
-#SELECT @@session.net_buffer_length;
######################################################
diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test
index a76f62c9611..fb9622a4ed9 100644
--- a/mysql-test/t/openssl_1.test
+++ b/mysql-test/t/openssl_1.test
@@ -1,7 +1,7 @@
# Tests for SSL connections, only run if mysqld is compiled
# with support for SSL.
--- source include/have_ssl.inc
+--source include/have_ssl.inc
--disable_warnings
drop table if exists t1;
@@ -145,12 +145,12 @@ DELIMITER ;$$
let $wait_condition=select count(*) = 0 from information_schema.events where event_name='event_status';
--source include/wait_condition.inc
+# The actual value doesn't matter and can vary based on test ordering and on ssl library.
+--replace_column 2 #
SELECT variable_name, variable_value FROM thread_status;
DROP TABLE thread_status;
SET GLOBAL event_scheduler=0;
---echo End of 5.1 tests
-
#
# Test to connect using a list of ciphers
@@ -190,3 +190,44 @@ INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create --skip-comments --ssl --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test 2>&1
DROP TABLE t1;
+
+#
+# Bug#39172: Asking for DH+non-RSA key with server set to use other key caused
+# YaSSL to crash the server.
+#
+
+# Common ciphers to openssl and yassl
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=DHE-RSA-AES256-SHA
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC3-SHA
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC-SHA
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=RC4-SHA
+--disable_query_log
+--disable_result_log
+
+# Below here caused crashes. ################
+--error 1,0
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=NOT----EXIST
+# These probably exist but the server's keys can't be used to accept these kinds of connections.
+--error 1,0
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=DHE-DSS-AES128-RMD
+--error 1,0
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=DHE-DSS-AES128-SHA
+--error 1,0
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=DHE-DSS-AES256-RMD
+--error 1,0
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=DHE-DSS-AES256-SHA
+--error 1,0
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=DHE-DSS-DES-CBC3-RMD
+--error 1,0
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=EDH-DSS-DES-CBC3-SHA
+--error 1,0
+--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=EDH-DSS-DES-CBC-SHA
+# End of crashers. ##########################
+
+# If this gives a result, then the bug is fixed.
+--enable_result_log
+--enable_query_log
+select 'is still running; no cipher request crashed the server' as result from dual;
+
+##
+--echo End of 5.1 tests
diff --git a/mysql-test/t/packet.test b/mysql-test/t/packet.test
index 4de284b7824..93b46766d99 100644
--- a/mysql-test/t/packet.test
+++ b/mysql-test/t/packet.test
@@ -8,30 +8,30 @@
# Check protocol handling
#
-connect (con1,localhost,root,,);
-
-connection con1;
+# setting values below minimum threshold of 1024 will cause truncating
set global max_allowed_packet=100;
-set max_allowed_packet=100;
set global net_buffer_length=100;
-set net_buffer_length=100;
-# Have to be > 1024 as min value of net_buffer_length is 1024
+
+# is not yet in effect
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
-# Should return NULL as 2000 is bigger than max_allowed_packet
select repeat('a',2000);
#
-# Connection 2 should get error for too big packets
+# Connection 1 should get error for too big packets
#
-connect (con2,localhost,root,,);
-connection con2;
+connect (con1,localhost,root,,);
+connection con1;
select @@net_buffer_length, @@max_allowed_packet;
--error 1153
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
+
+#
+# Reset to default values and reconnect
+#
set global max_allowed_packet=default;
-set max_allowed_packet=default;
set global net_buffer_length=default;
-set net_buffer_length=default;
+connect (con2,localhost,root,,);
+connection con2;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
select length(repeat('a',2000));
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index efa7c5f4263..23a300de9e5 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -17,6 +17,21 @@ drop table if exists t1, t2;
--enable_warnings
#
+# Bug#40954: Crash if range search and order by.
+#
+CREATE TABLE t1 (
+ pk INT NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (pk)
+)
+/*!50100 PARTITION BY HASH (pk)
+PARTITIONS 2 */;
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (NULL);
+SELECT * FROM t1 WHERE pk < 0 ORDER BY pk;
+DROP TABLE t1;
+
+#
# Bug#40494: Crash MYSQL server crashes on range access with partitioning
# and order by
#
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index c29b3458d19..2abbceffbb0 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -1,6 +1,46 @@
--source include/have_partition.inc
--source include/have_innodb.inc
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Bug#40595: Non-matching rows not released with READ-COMMITTED on tables
+# with partitions
+CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB
+PARTITION BY RANGE(id) (
+ PARTITION p0 VALUES LESS THAN (5),
+ PARTITION p1 VALUES LESS THAN (10),
+ PARTITION p2 VALUES LESS THAN MAXVALUE
+);
+
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8),
+ (9,9), (10,10), (11,11);
+
+SET @old_tx_isolation := @@session.tx_isolation;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+
+SET autocommit = 0;
+
+UPDATE t1 SET DATA = data*2 WHERE id = 3;
+
+# grouping/referencing in replace_regex is very slow on long strings,
+# removing all before/after the interesting row before grouping/referencing
+--replace_regex /.*---TRANSACTION [0-9]+ [0-9]+, .*, OS thread id [0-9]+// /MySQL thread id [0-9]+, query id [0-9]+ .*// /.*([0-9]+ lock struct\(s\)), heap size [0-9]+, ([0-9]+ row lock\(s\)).*/\1 \2/
+SHOW ENGINE InnoDB STATUS;
+
+UPDATE t1 SET data = data*2 WHERE data = 2;
+
+# grouping/referencing in replace_regex is very slow on long strings,
+# removing all before/after the interesting row before grouping/referencing
+--replace_regex /.*---TRANSACTION [0-9]+ [0-9]+, .*, OS thread id [0-9]+// /MySQL thread id [0-9]+, query id [0-9]+ .*// /.*([0-9]+ lock struct\(s\)), heap size [0-9]+, ([0-9]+ row lock\(s\)).*/\1 \2/
+SHOW ENGINE InnoDB STATUS;
+
+SET @@session.tx_isolation = @old_tx_isolation;
+
+DROP TABLE t1;
+
#
# Bug37721: ORDER BY when WHERE contains non-partitioned index column
# wrong order since it did not use pk as second compare
diff --git a/mysql-test/t/perror-win.test b/mysql-test/t/perror-win.test
new file mode 100644
index 00000000000..cc09b8527be
--- /dev/null
+++ b/mysql-test/t/perror-win.test
@@ -0,0 +1,14 @@
+# Windows-specific tests
+--source include/windows.inc
+--require r/have_perror.require
+disable_query_log;
+eval select LENGTH("$MY_PERROR") > 0 as "have_perror";
+enable_query_log;
+
+
+--exec $MY_PERROR 150 2>&1
+--exec $MY_PERROR 23 2>&1
+--exec $MY_PERROR 1062 2>&1
+--error 1
+--exec $MY_PERROR 30000 2>&1
+
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 5d6ce11edcf..d2b7394e979 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -3356,4 +3356,40 @@ SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT
SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a;
DROP TABLE t1,t2,t3;
+
+#
+# Bug#37460 Assertion failed:
+# !table->file || table->file->inited == handler::NONE
+#
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int, c int);
+
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+
+CREATE VIEW v1 AS
+ SELECT t2.c AS c FROM t1, t2
+ WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+UPDATE v1 SET c=1;
+
+CREATE VIEW v2 (a,b) AS
+ SELECT t2.id, t2.c AS c FROM t1, t2
+ WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+
+--error 1369
+INSERT INTO v2(a,b) VALUES (2,2);
+INSERT INTO v2(a,b) VALUES (1,2);
+SELECT * FROM v1;
+
+CREATE VIEW v3 AS
+ SELECT t2.c AS c FROM t2
+ WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+
+DELETE FROM v3;
+
+DROP VIEW v1,v2,v3;
+DROP TABLE t1,t2;
+
--echo End of 5.1 tests.
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
index b1186b7438b..c805dd40fe8 100644
--- a/mysql-test/t/symlink.test
+++ b/mysql-test/t/symlink.test
@@ -195,32 +195,50 @@ DROP TABLE t1;
#
# Bug#32167: another privilege bypass with DATA/INDEX DIRECTORY
#
+# With Bug#41002 (symlink.test fails on symlinked datadir) it was
+# decided that the below statements may also succeed if the data
+# home directory is symlinked, e.g. mysql-test-run --mem.
+# This will be fixed in 6.0 only.
+#
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---error ER_WRONG_ARGUMENTS
+--error 0,ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
INDEX DIRECTORY='$MYSQLD_DATADIR/mysql';
-
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+#
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---error ER_WRONG_ARGUMENTS
+--error 0,ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
DATA DIRECTORY='$MYSQLD_DATADIR/test';
-
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+#
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---error ER_WRONG_ARGUMENTS
+--error 0,ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
DATA DIRECTORY='$MYSQLD_DATADIR/';
-
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+#
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---error ER_WRONG_ARGUMENTS
+--error 0,ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
INDEX DIRECTORY='$MYSQLD_DATADIR';
-
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+#
--replace_result $MYSQLTEST_VARDIR TEST_DIR
--error 1
eval CREATE TABLE t1(a INT)
INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data_var';
+#
# BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY clause is
# silently ignored
#
diff --git a/mysql-test/t/timestamp_func.test b/mysql-test/t/timestamp_func.test
index ecca3c7daeb..e119f1b6253 100644
--- a/mysql-test/t/timestamp_func.test
+++ b/mysql-test/t/timestamp_func.test
@@ -9,6 +9,8 @@
# Creation Date: 2008-02-25 #
# Author: Sharique Abdullah #
# #
+# Modified: HHunger 2008-08-28 Reimplemented the test completely. #
+# #
# Description: Test Cases of Dynamic System Variable "timestamp" #
# that checks behavior of this variable in the following ways #
# * Functionality based on different values #
@@ -17,63 +19,32 @@
# #
############################################################################
---echo ** Setup **
---echo
-#
-# Setup
-#
---echo ** Connecting con0 using root **
-connect (con0,localhost,root,,);
---echo ** Connecting con1 using root **
-connect (con1, localhost, root,,);
-
---echo '#-----------------------------FN_DYNVARS_179_01------------------#'
-#
-# Checking for connection 1
-#
+# Change timestamp which must have an effect on now(), but not on sysdate().
+# Use Unix epoch timestamp
+# All comparisons must deliver true(1)
+# Exception: --sysdate-is-now switches off this behaviour and must not be set.
---echo ** Connection con0 **
-connection con0;
-SET @ts_old = @@SESSION.timestamp;
---echo waiting 1 sec
---sleep 1
-SET @ts_new = @@SESSION.timestamp;
-SELECT @ts_new - @ts_old >= 1 AS 'Timestamp Difference';
---echo 1 means >=1 expected is true
+--echo ** Connecting con1 using root **
+connect (con1,localhost,root,,);
+SELECT date(now()) = date(sysdate());
+SET @@session.timestamp = 1100000000;
+SELECT date(now()) != date(sysdate());
+# Assure that setting of the variable has no effect on other session.
+--echo ** Connecting con0 using root **
+connect (con0,localhost,root,,);
+SELECT @@session.timestamp != 1100000000;
+SET @@session.timestamp = 1000000000;
+SELECT date(now()) != date(sysdate());
-#
-# Checking for connection 2
-#
--echo ** Connection con1 **
connection con1;
-SET @ts_old = @@SESSION.timestamp;
---echo waiting 4 sec
---sleep 4
-SET @ts_new = @@SESSION.timestamp;
-SELECT @ts_new - @ts_old >= 4 AS 'Timestamp Difference';
---echo 1 means >=4 expected is true
-
---echo '#-----------------------------FN_DYNVARS_179_02---------------------#'
-#
-# Testing timezone change effect
-#
-
-SET @ts_old = @@SESSION.timestamp;
---sleep 1
---echo Changing time zone
-SET time_zone = 'MET';
-SET @ts_new = @@SESSION.timestamp;
-SELECT @ts_new - @ts_old >= 1 AS 'Timestamp Difference';
---echo 1 means >=1 expected is true
-
-#
-# Cleanup
-#
---echo ** Cleanup **
+SELECT @@session.timestamp != 1000000000;
+SELECT @@session.timestamp = 1100000000;
--echo ** Connection default **
connection default;
--echo Disconnecting Connections con0, con1
disconnect con0;
disconnect con1;
+
diff --git a/mysql-test/t/timestamp_sysdate_is_now_func-master.opt b/mysql-test/t/timestamp_sysdate_is_now_func-master.opt
new file mode 100644
index 00000000000..97a58d28032
--- /dev/null
+++ b/mysql-test/t/timestamp_sysdate_is_now_func-master.opt
@@ -0,0 +1 @@
+--sysdate-is-now
diff --git a/mysql-test/t/timestamp_sysdate_is_now_func.test b/mysql-test/t/timestamp_sysdate_is_now_func.test
new file mode 100644
index 00000000000..7ca3b4cddac
--- /dev/null
+++ b/mysql-test/t/timestamp_sysdate_is_now_func.test
@@ -0,0 +1,47 @@
+############################################################################
+# #
+# Variable Name: timestamp with sysdate-is-now #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: INTEGER #
+# #
+# #
+# Creation Date: 2008-11-25 #
+# Author: Horst Hunger #
+# #
+# Description: Test Cases of Dynamic System Variable "timestamp" #
+# that checks behavior of this variable in the following ways #
+# * Like timstamp_func, but with set "sysdate-is-now". #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+############################################################################
+
+# Use Unix epoch timestamp
+# Due to "--sysdate-is-now" timestamp must have an effect on both.
+# See also timestamp_func.test.
+
+--echo ** Connecting con1 using root **
+connect (con1,localhost,root,,);
+SELECT date(now()) = date(sysdate());
+SET @@session.timestamp = 1100000000;
+SELECT date(now()) != date(sysdate());
+
+# Assure that setting of the variable has no effect on other session.
+--echo ** Connecting con0 using root **
+connect (con0,localhost,root,,);
+SELECT @@session.timestamp != 1100000000;
+SET @@session.timestamp = 1000000000;
+SELECT date(now()) != date(sysdate());
+
+--echo ** Connection con1 **
+connection con1;
+SELECT @@session.timestamp != 1000000000;
+SELECT @@session.timestamp = 1100000000;
+
+--echo ** Connection default **
+connection default;
+--echo Disconnecting Connections con0, con1
+disconnect con0;
+disconnect con1;
+
diff --git a/mysql-test/t/timezone3.test b/mysql-test/t/timezone3.test
index 0aedbafcec4..8a9941f6383 100644
--- a/mysql-test/t/timezone3.test
+++ b/mysql-test/t/timezone3.test
@@ -45,6 +45,10 @@ insert into t1 values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
+insert into t1 values
+ (unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'),
+ (unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00');
+
select i, from_unixtime(i), c from t1;
drop table t1;
@@ -58,4 +62,12 @@ insert into t1 values (19730101235900), (20040101235900);
select * from t1;
drop table t1;
+#
+# Test Bug #39920: MySQL cannot deal with Leap Second expression in string
+# literal
+#
+
+# 2009-01-01 02:59:59, 2009-01-01 02:59:60 and 2009-01-01 03:00:00
+SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);
+
# End of 4.1 tests
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index 4a6462a8e72..4cf9ea63dad 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -1235,6 +1235,16 @@ DROP TABLE t1;
select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
1.01500000 * 1.01500000 * 0.99500000);
+#
+# Bug #31616 div_precision_increment description looks wrong
+#
+
+create table t1 as select 5.05 / 0.014;
+show warnings;
+show create table t1;
+select * from t1;
+DROP TABLE t1;
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index f58cd54250b..ad4d57b7128 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -861,8 +861,10 @@ drop tables t1,t2,t3;
# exceeds mediumtext maximum length
#
-SELECT @tmp_max:= @@max_allowed_packet;
-SET max_allowed_packet=25000000;
+SELECT @tmp_max:= @@global.max_allowed_packet;
+SET @@global.max_allowed_packet=25000000;
+# switching connection to allow the new max_allowed_packet take effect
+--connect (newconn, localhost, root,,)
CREATE TABLE t1 (a mediumtext);
CREATE TABLE t2 (b varchar(20));
INSERT INTO t1 VALUES ('a');
@@ -884,7 +886,9 @@ INSERT INTO t1 VALUES ('a');
CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
SHOW CREATE TABLE t3;
DROP TABLES t1,t2,t3;
-SET max_allowed_packet:= @tmp_max;
+--connection default
+SET @@global.max_allowed_packet:= @tmp_max;
+--disconnect newconn
#
# Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index f79c9e773aa..7d56df259ba 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -430,4 +430,25 @@ drop table t1,t2;
connection default;
disconnect con1;
+#
+# Bug #40745: Error during WHERE clause calculation in UPDATE
+# leads to an assertion failure
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+CREATE FUNCTION f1() RETURNS INT RETURN f1();
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1);
+
+--error ER_SP_NO_RECURSION
+UPDATE t1 SET i = 3 WHERE f1();
+--error ER_SP_NO_RECURSION
+UPDATE t1 SET i = f1();
+
+DROP TABLE t1;
+DROP FUNCTION f1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/variables-notembedded.test b/mysql-test/t/variables-notembedded.test
index 20ce3a74532..7cc068c68c7 100644
--- a/mysql-test/t/variables-notembedded.test
+++ b/mysql-test/t/variables-notembedded.test
@@ -30,3 +30,82 @@ set global slave_net_timeout=default;
set global sql_slave_skip_counter= 0;
set @@global.slave_net_timeout= @my_slave_net_timeout;
+#
+# Bug#28234 - global/session scope - documentation vs implementation
+#
+--echo
+#
+# Additional variables fixed from sql_repl.cc.
+#
+--echo #
+SHOW VARIABLES like 'log_slave_updates';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.log_slave_updates;
+SELECT @@global.log_slave_updates;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.log_slave_updates= true;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.log_slave_updates= true;
+#
+--echo #
+SHOW VARIABLES like 'relay_log';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.relay_log;
+SELECT @@global.relay_log;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.relay_log= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.relay_log= 'x';
+#
+--echo #
+SHOW VARIABLES like 'relay_log_index';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.relay_log_index;
+SELECT @@global.relay_log_index;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.relay_log_index= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.relay_log_index= 'x';
+#
+--echo #
+SHOW VARIABLES like 'relay_log_info_file';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.relay_log_info_file;
+SELECT @@global.relay_log_info_file;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.relay_log_info_file= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.relay_log_info_file= 'x';
+#
+--echo #
+SHOW VARIABLES like 'relay_log_space_limit';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.relay_log_space_limit;
+SELECT @@global.relay_log_space_limit;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.relay_log_space_limit= 7;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.relay_log_space_limit= 7;
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'slave_load_tmpdir';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.slave_load_tmpdir;
+--replace_column 1 #
+SELECT @@global.slave_load_tmpdir;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.slave_load_tmpdir= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.slave_load_tmpdir= 'x';
+#
+--echo #
+SHOW VARIABLES like 'slave_skip_errors';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.slave_skip_errors;
+SELECT @@global.slave_skip_errors;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.slave_skip_errors= 7;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.slave_skip_errors= 7;
+#
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 7dbe72865d3..fb2b8adf4af 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -146,25 +146,23 @@ show global variables like 'myisam_max_sort_file_size';
--replace_result 9223372036853727232 FILE_SIZE 2146435072 FILE_SIZE
select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
+# bug#22891: modified to take read-only SESSION net_buffer_length into account
set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
-set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
show global variables like 'net_%';
select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
show session variables like 'net_%';
select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
-set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
+set global net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
show global variables like 'net_%';
select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
-show session variables like 'net_%';
-select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
-set net_buffer_length=1;
-show variables like 'net_buffer_length';
-select * from information_schema.session_variables where variable_name like 'net_buffer_length';
+set global net_buffer_length=1;
+show global variables like 'net_buffer_length';
+select * from information_schema.global_variables where variable_name like 'net_buffer_length';
#warning 1292
-set net_buffer_length=2000000000;
-show variables like 'net_buffer_length';
-select * from information_schema.session_variables where variable_name like 'net_buffer_length';
+set global net_buffer_length=2000000000;
+show global variables like 'net_buffer_length';
+select * from information_schema.global_variables where variable_name like 'net_buffer_length';
set character set cp1251_koi8;
show variables like "character_set_client";
@@ -274,7 +272,7 @@ select @@long_query_time;
set long_query_time=100.000001;
select @@long_query_time;
set low_priority_updates=1;
-set max_allowed_packet=100;
+set global max_allowed_packet=100;
set global max_binlog_cache_size=100;
set global max_binlog_size=100;
set global max_connect_errors=100;
@@ -288,7 +286,7 @@ set global max_user_connections=100;
select @@max_user_connections;
set global max_write_lock_count=100;
set myisam_sort_buffer_size=100;
-set net_buffer_length=100;
+set global net_buffer_length=100;
set net_read_timeout=100;
set net_write_timeout=100;
set global query_cache_limit=100;
@@ -795,3 +793,287 @@ SET GLOBAL log_output = 0;
--echo
--echo # -- End of Bug#34820.
+#
+# Bug#28234 - global/session scope - documentation vs implementation
+#
+--echo
+--echo #
+SHOW VARIABLES like 'ft_max_word_len';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.ft_max_word_len;
+SELECT @@global.ft_max_word_len;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.ft_max_word_len= 7;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.ft_max_word_len= 7;
+#
+--echo #
+SHOW VARIABLES like 'ft_min_word_len';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.ft_min_word_len;
+SELECT @@global.ft_min_word_len;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.ft_min_word_len= 7;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.ft_min_word_len= 7;
+#
+--echo #
+SHOW VARIABLES like 'ft_query_expansion_limit';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.ft_query_expansion_limit;
+SELECT @@global.ft_query_expansion_limit;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.ft_query_expansion_limit= 7;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.ft_query_expansion_limit= 7;
+#
+--echo #
+SHOW VARIABLES like 'ft_stopword_file';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.ft_stopword_file;
+SELECT @@global.ft_stopword_file;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.ft_stopword_file= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.ft_stopword_file= 'x';
+#
+# Additional variables fixed.
+#
+--echo #
+SHOW VARIABLES like 'back_log';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.back_log;
+SELECT @@global.back_log;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.back_log= 7;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.back_log= 7;
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'large_files_support';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.large_files_support;
+--replace_column 1 #
+SELECT @@global.large_files_support;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.large_files_support= true;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.large_files_support= true;
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'character_sets_dir';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.character_sets_dir;
+--replace_column 1 #
+SELECT @@global.character_sets_dir;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.character_sets_dir= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.character_sets_dir= 'x';
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'init_file';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.init_file;
+--replace_column 1 #
+SELECT @@global.init_file;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.init_file= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.init_file= 'x';
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'language';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.language;
+--replace_column 1 #
+SELECT @@global.language;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.language= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.language= 'x';
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'large_page_size';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.large_page_size;
+--replace_column 1 #
+SELECT @@global.large_page_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.large_page_size= 7;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.large_page_size= 7;
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'large_pages';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.large_pages;
+--replace_column 1 #
+SELECT @@global.large_pages;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.large_pages= true;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.large_pages= true;
+#
+--echo #
+SHOW VARIABLES like 'log_bin';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.log_bin;
+SELECT @@global.log_bin;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.log_bin= true;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.log_bin= true;
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'log_error';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.log_error;
+--replace_column 1 #
+SELECT @@global.log_error;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.log_error= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.log_error= 'x';
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'lower_case_file_system';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.lower_case_file_system;
+--replace_column 1 #
+SELECT @@global.lower_case_file_system;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.lower_case_file_system= true;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.lower_case_file_system= true;
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'lower_case_table_names';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.lower_case_table_names;
+--replace_column 1 #
+SELECT @@global.lower_case_table_names;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.lower_case_table_names= 7;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.lower_case_table_names= 7;
+#
+--echo #
+SHOW VARIABLES like 'myisam_recover_options';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.myisam_recover_options;
+SELECT @@global.myisam_recover_options;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.myisam_recover_options= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.myisam_recover_options= 'x';
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'open_files_limit';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.open_files_limit;
+--replace_column 1 #
+SELECT @@global.open_files_limit;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.open_files_limit= 7;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.open_files_limit= 7;
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'pid_file';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.pid_file;
+--replace_column 1 #
+SELECT @@global.pid_file;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.pid_file= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.pid_file= 'x';
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'plugin_dir';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.plugin_dir;
+--replace_column 1 #
+SELECT @@global.plugin_dir;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.plugin_dir= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.plugin_dir= 'x';
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'port';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.port;
+--replace_column 1 #
+SELECT @@global.port;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.port= 7;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.port= 7;
+#
+--echo #
+SHOW VARIABLES like 'protocol_version';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.protocol_version;
+SELECT @@global.protocol_version;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.protocol_version= 7;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.protocol_version= 7;
+#
+--echo #
+SHOW VARIABLES like 'skip_external_locking';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.skip_external_locking;
+SELECT @@global.skip_external_locking;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.skip_external_locking= true;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.skip_external_locking= true;
+#
+--echo #
+SHOW VARIABLES like 'skip_networking';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.skip_networking;
+SELECT @@global.skip_networking;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.skip_networking= true;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.skip_networking= true;
+#
+--echo #
+SHOW VARIABLES like 'skip_show_database';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.skip_show_database;
+SELECT @@global.skip_show_database;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.skip_show_database= true;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.skip_show_database= true;
+#
+--echo #
+--replace_column 2 #
+SHOW VARIABLES like 'thread_stack';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.thread_stack;
+--replace_column 1 #
+SELECT @@global.thread_stack;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.thread_stack= 7;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.thread_stack= 7;
+#
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 112fbdf1da7..9e22006ea67 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -510,7 +510,7 @@ drop table t1;
#
create table t1 (a int, b int);
create view v1 as select a, sum(b) from t1 group by a;
---error ER_WRONG_USAGE
+--error ER_KEY_DOES_NOT_EXITS
select b from v1 use index (some_index) where b=1;
drop view v1;
drop table t1;
@@ -3421,11 +3421,11 @@ drop table t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1;
---error ER_WRONG_USAGE
+--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 USE KEY(non_existant);
---error ER_WRONG_USAGE
+--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 FORCE KEY(non_existant);
---error ER_WRONG_USAGE
+--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 IGNORE KEY(non_existant);
DROP VIEW v1;
@@ -3564,6 +3564,32 @@ DROP VIEW v1;
CREATE VIEW v1 AS SELECT 1;
DROP VIEW v1;
+#
+# Bug #33461: SELECT ... FROM <view> USE INDEX (...) throws an error
+#
+
+CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+SELECT * FROM t1 USE INDEX (PRIMARY) WHERE c1=2;
+SELECT * FROM t1 USE INDEX (c2) WHERE c2=2;
+
+CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
+SHOW INDEX FROM v1;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 IGNORE INDEX (PRIMARY) WHERE c1=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 USE INDEX (c2) WHERE c2=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 FORCE INDEX (c2) WHERE c2=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
+
+DROP VIEW v1;
+DROP TABLE t1;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.0 tests.
diff --git a/mysql-test/t/wait_timeout_func.test b/mysql-test/t/wait_timeout_func.test
index f7467062b61..6b7c8d016d2 100644
--- a/mysql-test/t/wait_timeout_func.test
+++ b/mysql-test/t/wait_timeout_func.test
@@ -11,98 +11,87 @@
# Creation Date: 2008-03-07 #
# Author: Salman Rawala #
# #
+# Modified: HHunger 2008-08-27 Simplified the test and replaced the sleeps. #
+# #
# Description: Test Cases of Dynamic System Variable wait_timeout #
# that checks the functionality of this variable #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html#option_mysqld_wait_timeouts #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
--source include/not_embedded.inc
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-##############################
-# Creating two new tables #
-##############################
-
---echo ## Creating new table t1 ##
-CREATE TABLE t1
-(
-id INT NOT NULL auto_increment,
-PRIMARY KEY (id),
-name VARCHAR(30)
-);
-
-SET @old_wait_timeout = @@global.wait_timeout;
+SET @start_value= @@global.wait_timeout;
--echo '#--------------------FN_DYNVARS_186_01-------------------------#'
#######################################################################
-# Setting initial value of interactive_timeout greater than sleep and
-# verifying its behavior on session scope
+# 1. test of scope session
#######################################################################
---echo ## Creating new connection test_con1 ##
+SET @start_time= UNIX_TIMESTAMP();
+--echo connect (test_con1, localhost, root,,);
connect (test_con1, localhost, root,,);
connection test_con1;
---echo ## Setting value of variable to 5 ##
-SET @@session.wait_timeout = 5;
-
---echo ## Inserting record in table t1 ##
-INSERT into t1(name) values('Record_1');
+# If not explicitly changed, @@session.wait_timeout equals @@global.wait_timeout.
+SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
---echo ## Using sleep to check timeout ##
-sleep 4;
-
-
---echo '#--------------------FN_DYNVARS_186_02-------------------------#'
-#######################################################################
-# Setting initial value of interactive_timeout greater than sleep and
-# verifying its behavior on global scope
-#######################################################################
+# Find a small value <> @@global.wait_timeout.
+let $session_value =
+`SELECT IF(@@global.wait_timeout <> 2 OR @@global.wait_timeout IS NULL, 2, 3)`;
+--replace_result $session_value <session_value>
+eval SET @@session.wait_timeout = $session_value;
---echo ## Setting value of variable ##
-SET @@global.wait_timeout = 5;
-
---echo ## Creating new connection test_con2 ##
+--echo connect (test_con2, localhost, root,,);
connect (test_con2, localhost, root,,);
connection test_con2;
-INSERT into t1(name) values('Record_2');
-
---echo ## Using sleep to check timeout ##
-sleep 4;
-
+--replace_result $session_value <session_value>
+eval SET @@session.wait_timeout = $session_value - 1;
+--echo connection default;
+connection default;
+--echo wait until connections ready
+let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist;
+--source include/wait_condition.inc
+SELECT info FROM information_schema.processlist;
--echo '#--------------------FN_DYNVARS_186_03-------------------------#'
#######################################################################
-# Setting initial value of interactive_timeout less than sleep and
-# verifying its behavior on global scope
+# 2. test of scope global
#######################################################################
---echo ## Setting value of variable to 1 ##
-SET @@global.wait_timeout = 1;
+# Find a small value <> @@global.wait_timeout.
+let $global_value = $session_value + 1;
+--replace_result $global_value <global_value>
+eval SET @@global.wait_timeout= $global_value;
---echo ## Creating new connection ##
+# Changing the @@global.wait_timeout has no influence on the
+# @@session.wait_timeout of already established sessions.
+SELECT @@session.wait_timeout = @start_value AS 'Expect 1';
+
+--echo connect (test_con3, localhost, root,,);
connect (test_con3, localhost, root,,);
connection test_con3;
-INSERT into t1(name) values('Record_3');
-
---echo ## Using sleep to check timeout ##
-sleep 5;
-
---echo ## We cannot test it further because the server closes the connection due to wait_timeout ##
---Error 2006
-SELECT * from t1;
+# If not explicitly changed, @@session.wait_timeout equals @@global.wait_timeout.
+SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
+--echo connection default;
connection default;
-DROP TABLE t1;
-SET @@global.wait_timeout = @old_wait_timeout;
+# We can be sure that the connections test_con1 and test_con2 must be
+# established because both have already executed a SET @@session.wait_timeout.
+# This means they are or at least were visible within the processlist.
+# Therefore we can now simply wait till both disappear from the processlist.
+let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist;
+--source include/wait_condition.inc
+SELECT info FROM information_schema.processlist;
+
+--replace_result $global_value <global_value> $session_value <session_value>;
+eval SELECT UNIX_TIMESTAMP() - @start_time >= $global_value + $session_value;
+SET @@global.wait_timeout= @start_value;
+
diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c
index b2c18c74347..d6492c90965 100644
--- a/mysys/mf_tempdir.c
+++ b/mysys/mf_tempdir.c
@@ -85,6 +85,8 @@ char *my_tmpdir(MY_TMPDIR *tmpdir)
void free_tmpdir(MY_TMPDIR *tmpdir)
{
uint i;
+ if (!tmpdir->full_list.elements)
+ return;
for (i=0; i<=tmpdir->max; i++)
my_free(tmpdir->list[i], MYF(0));
delete_dynamic(&tmpdir->full_list);
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 6a7ee748930..0f8055860d4 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -397,9 +397,10 @@ invalid value '%s'",
my_progname, optp->name, optend);
continue;
}
- get_one_option(optp->id, optp,
- *((my_bool*) value) ?
- (char*) "1" : disabled_my_option);
+ if (get_one_option(optp->id, optp,
+ *((my_bool*) value) ?
+ (char*) "1" : disabled_my_option))
+ return EXIT_ARGUMENT_INVALID;
continue;
}
argument= optend;
@@ -457,7 +458,8 @@ invalid value '%s'",
optp->arg_type == NO_ARG)
{
*((my_bool*) optp->value)= (my_bool) 1;
- get_one_option(optp->id, optp, argument);
+ if (get_one_option(optp->id, optp, argument))
+ return EXIT_UNSPECIFIED_ERROR;
continue;
}
else if (optp->arg_type == REQUIRED_ARG ||
@@ -476,7 +478,8 @@ invalid value '%s'",
{
if (optp->var_type == GET_BOOL)
*((my_bool*) optp->value)= (my_bool) 1;
- get_one_option(optp->id, optp, argument);
+ if (get_one_option(optp->id, optp, argument))
+ return EXIT_UNSPECIFIED_ERROR;
continue;
}
/* Check if there are more arguments after this one */
@@ -501,7 +504,8 @@ invalid value '%s'",
my_progname, argument, optp->name);
return error;
}
- get_one_option(optp->id, optp, argument);
+ if (get_one_option(optp->id, optp, argument))
+ return EXIT_UNSPECIFIED_ERROR;
break;
}
}
@@ -524,7 +528,8 @@ invalid value '%s'",
my_progname, argument, optp->name);
return error;
}
- get_one_option(optp->id, optp, argument);
+ if (get_one_option(optp->id, optp, argument))
+ return EXIT_UNSPECIFIED_ERROR;
(*argc)--; /* option handled (short or long), decrease argument count */
}
diff --git a/mysys/my_init.c b/mysys/my_init.c
index 9965f1a13a5..d9f857da955 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -285,8 +285,6 @@ static void my_win_init(void)
{
DBUG_ENTER("my_win_init");
- setlocale(LC_CTYPE, ""); /* To get right sortorder */
-
#if defined(_MSC_VER)
#if _MSC_VER < 1300
/*
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index 933674fa007..2278c467f32 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -368,17 +368,7 @@ void my_thread_end(void)
struct st_my_thread_var *_my_thread_var(void)
{
- struct st_my_thread_var *tmp=
- my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
-#if defined(USE_TLS)
- /* This can only happen in a .DLL */
- if (!tmp)
- {
- my_thread_init();
- tmp=my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
- }
-#endif
- return tmp;
+ return my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
}
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index ac43bb7b0a4..0292617c7a5 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -162,6 +162,7 @@ SUFFIXES = .sh
-e 's!@''CFLAGS''@!@CFLAGS@!'\
-e 's!@''CXXFLAGS''@!@CXXFLAGS@!'\
-e 's!@''LDFLAGS''@!@LDFLAGS@!'\
+ -e 's!@''LIBDL''@!@LIBDL@!'\
-e 's!@''CLIENT_LIBS''@!@CLIENT_LIBS@!' \
-e 's!@''ZLIB_LIBS''@!@ZLIB_LIBS@!' \
-e 's!@''LIBS''@!@LIBS@!' \
diff --git a/scripts/mysql_config.pl.in b/scripts/mysql_config.pl.in
index 3ae8baf7db0..21896711fa8 100644
--- a/scripts/mysql_config.pl.in
+++ b/scripts/mysql_config.pl.in
@@ -202,7 +202,7 @@ $flags->{libs} =
$flags->{libs_r} =
[@ldflags,@lib_r_opts,'@ZLIB_DEPS@','@LIBS@','@openssl_libs@'];
$flags->{embedded_libs} =
- [@ldflags,@lib_e_opts,'@ZLIB_DEPS@','@LIBS@','@WRAPLIBS@','@innodb_system_libs@','@openssl_libs@'];
+ [@ldflags,@lib_e_opts,'@LIBDL@','@ZLIB_DEPS@','@LIBS@','@WRAPLIBS@','@innodb_system_libs@','@openssl_libs@'];
$flags->{include} = ["-I$pkgincludedir"];
$flags->{cflags} = [@{$flags->{include}},split(" ",'@CFLAGS@')];
diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh
index c16d9bb62e5..efc82544bc0 100644
--- a/scripts/mysql_config.sh
+++ b/scripts/mysql_config.sh
@@ -107,7 +107,7 @@ fi
libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ "
libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ "
-embedded_libs=" $ldflags -L$pkglibdir -lmysqld @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ "
+embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ "
if [ -r "$pkglibdir/libmygcc.a" ]; then
# When linking against the static library with a different version of GCC
diff --git a/sql/field.cc b/sql/field.cc
index a03beb4e8af..e815320bc9e 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5814,6 +5814,7 @@ int Field_newdate::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
{
char buff[MAX_DATE_STRING_REP_LENGTH];
String str(buff, sizeof(buff), &my_charset_latin1);
+ tmp= 0;
make_date((DATE_TIME_FORMAT *) 0, ltime, &str);
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
str.ptr(), str.length(), MYSQL_TIMESTAMP_DATE, 1);
@@ -6056,6 +6057,7 @@ int Field_datetime::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
{
char buff[MAX_DATE_STRING_REP_LENGTH];
String str(buff, sizeof(buff), &my_charset_latin1);
+ tmp= 0;
make_datetime((DATE_TIME_FORMAT *) 0, ltime, &str);
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
str.ptr(), str.length(), MYSQL_TIMESTAMP_DATETIME,1);
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 3324bbc2f45..0c96b06381c 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -2813,8 +2813,42 @@ uint ha_partition::lock_count() const
void ha_partition::unlock_row()
{
+ DBUG_ENTER("ha_partition::unlock_row");
m_file[m_last_part]->unlock_row();
- return;
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ Use semi consistent read if possible
+
+ SYNOPSIS
+ try_semi_consistent_read()
+ yes Turn on semi consistent read
+
+ RETURN VALUE
+ NONE
+
+ DESCRIPTION
+ See handler.h:
+ Tell the engine whether it should avoid unnecessary lock waits.
+ If yes, in an UPDATE or DELETE, if the row under the cursor was locked
+ by another transaction, the engine may try an optimistic read of
+ the last committed row value under the cursor.
+ Note: prune_partitions are already called before this call, so using
+ pruning is OK.
+*/
+void ha_partition::try_semi_consistent_read(bool yes)
+{
+ handler **file;
+ DBUG_ENTER("ha_partition::try_semi_consistent_read");
+
+ for (file= m_file; *file; file++)
+ {
+ if (bitmap_is_set(&(m_part_info->used_partitions), (file - m_file)))
+ (*file)->try_semi_consistent_read(yes);
+ }
+ DBUG_VOID_RETURN;
}
@@ -4456,7 +4490,8 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
This can only read record to table->record[0], as it was set when
the table was being opened. We have to memcpy data ourselves.
*/
- error= file->read_range_first(&m_start_key, end_range, eq_range, TRUE);
+ error= file->read_range_first(m_start_key.key? &m_start_key: NULL,
+ end_range, eq_range, TRUE);
memcpy(rec_buf_ptr, table->record[0], m_rec_length);
reverse_order= FALSE;
break;
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 78cf47dd1aa..dd06d8d647b 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -325,6 +325,10 @@ public:
Call to unlock rows not to be updated in transaction
*/
virtual void unlock_row();
+ /*
+ Call to hint about semi consistent read
+ */
+ virtual void try_semi_consistent_read(bool);
/*
-------------------------------------------------------------------------
diff --git a/sql/handler.cc b/sql/handler.cc
index 6d5c0c93f75..47c2ff40119 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -3627,7 +3627,7 @@ int ha_init_key_cache(const char *name, KEY_CACHE *key_cache)
if (!key_cache->key_cache_inited)
{
pthread_mutex_lock(&LOCK_global_system_variables);
- ulong tmp_buff_size= (ulong) key_cache->param_buff_size;
+ size_t tmp_buff_size= (size_t) key_cache->param_buff_size;
uint tmp_block_size= (uint) key_cache->param_block_size;
uint division_limit= key_cache->param_division_limit;
uint age_threshold= key_cache->param_age_threshold;
@@ -3651,7 +3651,7 @@ int ha_resize_key_cache(KEY_CACHE *key_cache)
if (key_cache->key_cache_inited)
{
pthread_mutex_lock(&LOCK_global_system_variables);
- long tmp_buff_size= (long) key_cache->param_buff_size;
+ size_t tmp_buff_size= (size_t) key_cache->param_buff_size;
long tmp_block_size= (long) key_cache->param_block_size;
uint division_limit= key_cache->param_division_limit;
uint age_threshold= key_cache->param_age_threshold;
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 3fd925c1182..c5de0b3df08 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -810,11 +810,11 @@ Arg_comparator::can_compare_as_dates(Item *a, Item *b, ulonglong *const_value)
obtained value
*/
-ulonglong
+longlong
get_time_value(THD *thd, Item ***item_arg, Item **cache_arg,
Item *warn_item, bool *is_null)
{
- ulonglong value;
+ longlong value;
Item *item= **item_arg;
MYSQL_TIME ltime;
@@ -826,7 +826,7 @@ get_time_value(THD *thd, Item ***item_arg, Item **cache_arg,
else
{
*is_null= item->get_time(&ltime);
- value= !*is_null ? TIME_to_ulonglong_datetime(&ltime) : 0;
+ value= !*is_null ? (longlong) TIME_to_ulonglong_datetime(&ltime) : 0;
}
/*
Do not cache GET_USER_VAR() function as its const_item() may return TRUE
@@ -951,11 +951,11 @@ void Arg_comparator::set_datetime_cmp_func(Item **a1, Item **b1)
obtained value
*/
-ulonglong
+longlong
get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
Item *warn_item, bool *is_null)
{
- ulonglong value= 0;
+ longlong value= 0;
String buf, *str= 0;
Item *item= **item_arg;
@@ -993,7 +993,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
enum_field_types f_type= warn_item->field_type();
timestamp_type t_type= f_type ==
MYSQL_TYPE_DATE ? MYSQL_TIMESTAMP_DATE : MYSQL_TIMESTAMP_DATETIME;
- value= get_date_from_str(thd, str, t_type, warn_item->name, &error);
+ value= (longlong) get_date_from_str(thd, str, t_type, warn_item->name, &error);
/*
If str did not contain a valid date according to the current
SQL_MODE, get_date_from_str() has already thrown a warning,
@@ -1047,7 +1047,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
int Arg_comparator::compare_datetime()
{
bool a_is_null, b_is_null;
- ulonglong a_value, b_value;
+ longlong a_value, b_value;
/* Get DATE/DATETIME/TIME value of the 'a' item. */
a_value= (*get_value_func)(thd, &a, &a_cache, *b, &a_is_null);
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 2bf39e6da8d..c2227fa04e0 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -42,8 +42,8 @@ class Arg_comparator: public Sql_alloc
bool is_nulls_eq; // TRUE <=> compare for the EQUAL_FUNC
enum enum_date_cmp_type { CMP_DATE_DFLT= 0, CMP_DATE_WITH_DATE,
CMP_DATE_WITH_STR, CMP_STR_WITH_DATE };
- ulonglong (*get_value_func)(THD *thd, Item ***item_arg, Item **cache_arg,
- Item *warn_item, bool *is_null);
+ longlong (*get_value_func)(THD *thd, Item ***item_arg, Item **cache_arg,
+ Item *warn_item, bool *is_null);
public:
DTCollation cmp_collation;
@@ -1012,7 +1012,7 @@ public:
*/
class cmp_item_datetime :public cmp_item
{
- ulonglong value;
+ longlong value;
public:
THD *thd;
/* Item used for issuing warnings. */
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 185100bf125..33b5f21774f 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1301,8 +1301,10 @@ my_decimal *Item_func_div::decimal_op(my_decimal *decimal_value)
void Item_func_div::result_precision()
{
- uint arg_prec= args[0]->decimal_precision() + prec_increment;
- uint precision=min(arg_prec, DECIMAL_MAX_PRECISION);
+ uint precision=min(args[0]->decimal_precision() +
+ args[1]->decimals + prec_increment,
+ DECIMAL_MAX_PRECISION);
+
/* Integer operations keep unsigned_flag if one of arguments is unsigned */
if (result_type() == INT_RESULT)
unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag;
@@ -2257,7 +2259,7 @@ void Item_func_min_max::fix_length_and_dec()
uint Item_func_min_max::cmp_datetimes(ulonglong *value)
{
- ulonglong min_max;
+ longlong min_max;
uint min_max_idx= 0;
LINT_INIT(min_max);
@@ -2265,7 +2267,7 @@ uint Item_func_min_max::cmp_datetimes(ulonglong *value)
{
Item **arg= args + i;
bool is_null;
- ulonglong res= get_datetime_value(thd, &arg, 0, datetime_item, &is_null);
+ longlong res= get_datetime_value(thd, &arg, 0, datetime_item, &is_null);
if ((null_value= args[i]->null_value))
return 0;
if (i == 0 || (res < min_max ? cmp_sign : -cmp_sign) > 0)
@@ -3808,11 +3810,14 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
bool Item_func_set_user_var::set_entry(THD *thd, bool create_if_not_exists)
{
- if (thd == entry_thd && entry)
+ if (entry && thd->thread_id == entry_thread_id)
goto end; // update entry->update_query_id for PS
- entry_thd= thd;
if (!(entry= get_variable(&thd->user_vars, name, create_if_not_exists)))
+ {
+ entry_thread_id= 0;
return TRUE;
+ }
+ entry_thread_id= thd->thread_id;
/*
Remember the last query which updated it, this way a query can later know
if this variable is a constant item in the query (it is if update_query_id
@@ -4850,6 +4855,7 @@ void Item_func_get_system_var::fix_length_and_dec()
max_length= MAX_BLOB_WIDTH;
decimals=NOT_FIXED_DEC;
break;
+ case SHOW_BOOL:
case SHOW_MY_BOOL:
unsigned_flag= FALSE;
max_length= 1;
@@ -4877,6 +4883,7 @@ enum Item_result Item_func_get_system_var::result_type() const
{
switch (var->show_type())
{
+ case SHOW_BOOL:
case SHOW_MY_BOOL:
case SHOW_INT:
case SHOW_LONG:
@@ -4899,6 +4906,7 @@ enum_field_types Item_func_get_system_var::field_type() const
{
switch (var->show_type())
{
+ case SHOW_BOOL:
case SHOW_MY_BOOL:
case SHOW_INT:
case SHOW_LONG:
@@ -4917,6 +4925,10 @@ enum_field_types Item_func_get_system_var::field_type() const
}
+/*
+ Uses var, var_type, component, cache_present, used_query_id, thd,
+ cached_llval, null_value, cached_null_value
+*/
#define get_sys_var_safe(type) \
do { \
type value; \
@@ -4970,6 +4982,7 @@ longlong Item_func_get_system_var::val_int()
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_BOOL: get_sys_var_safe (bool);
case SHOW_MY_BOOL: get_sys_var_safe (my_bool);
case SHOW_DOUBLE:
{
@@ -5067,6 +5080,7 @@ String* Item_func_get_system_var::val_str(String* str)
case SHOW_LONG:
case SHOW_LONGLONG:
case SHOW_HA_ROWS:
+ case SHOW_BOOL:
case SHOW_MY_BOOL:
str->set (val_int(), collation.collation);
break;
@@ -5159,6 +5173,7 @@ double Item_func_get_system_var::val_real()
case SHOW_LONG:
case SHOW_LONGLONG:
case SHOW_HA_ROWS:
+ case SHOW_BOOL:
case SHOW_MY_BOOL:
cached_dval= (double) val_int();
cache_present|= GET_SYS_VAR_CACHE_DOUBLE;
@@ -5381,7 +5396,9 @@ bool Item_func_match::fix_index()
for (keynr=0 ; keynr < table->s->keys ; keynr++)
{
if ((table->key_info[keynr].flags & HA_FULLTEXT) &&
- (table->s->keys_in_use.is_set(keynr)))
+ (flags & FT_BOOL ? table->keys_in_use_for_query.is_set(keynr) :
+ table->s->keys_in_use.is_set(keynr)))
+
{
ft_to_key[fts]=keynr;
ft_cnt[fts]=0;
diff --git a/sql/item_func.h b/sql/item_func.h
index 08906ae826e..3acda817d26 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1295,16 +1295,16 @@ class Item_func_set_user_var :public Item_func
enum Item_result cached_result_type;
user_var_entry *entry;
/*
- The entry_thd variable is used:
+ The entry_thread_id variable is used:
1) to skip unnecessary updates of the entry field (see above);
2) to reset the entry field that was initialized in the other thread
(for example, an item tree of a trigger that updates user variables
- may be shared between several connections, and the entry_thd field
+ may be shared between several connections, and the entry_thread_id field
prevents updates of one connection user variables from a concurrent
connection calling the same trigger that initially updated some
user variable it the first connection context).
*/
- THD *entry_thd;
+ my_thread_id entry_thread_id;
char buffer[MAX_FIELD_WIDTH];
String value;
my_decimal decimal_buff;
@@ -1321,7 +1321,7 @@ public:
LEX_STRING name; // keep it public
Item_func_set_user_var(LEX_STRING a,Item *b)
:Item_func(b), cached_result_type(INT_RESULT),
- entry(NULL), entry_thd(NULL), name(a)
+ entry(NULL), entry_thread_id(0), name(a)
{}
enum Functype functype() const { return SUSERVAR_FUNC; }
double val_real();
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 390f94945aa..843a48ae118 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2504,6 +2504,8 @@ void Item_char_typecast::fix_length_and_dec()
and thus avoid unnecessary character set conversion.
- If the argument is not a number, then from_cs is set to
the argument's charset.
+
+ Note (TODO): we could use repertoire technique here.
*/
from_cs= (args[0]->result_type() == INT_RESULT ||
args[0]->result_type() == DECIMAL_RESULT ||
@@ -2511,12 +2513,13 @@ void Item_char_typecast::fix_length_and_dec()
(cast_cs->mbminlen == 1 ? cast_cs : &my_charset_latin1) :
args[0]->collation.collation;
charset_conversion= (cast_cs->mbmaxlen > 1) ||
- !my_charset_same(from_cs, cast_cs) &&
- from_cs != &my_charset_bin &&
- cast_cs != &my_charset_bin;
+ (!my_charset_same(from_cs, cast_cs) &&
+ from_cs != &my_charset_bin &&
+ cast_cs != &my_charset_bin);
collation.set(cast_cs, DERIVATION_IMPLICIT);
- char_length= (cast_length >= 0) ? cast_length :
- args[0]->max_length/from_cs->mbmaxlen;
+ char_length= (cast_length >= 0) ?
+ cast_length :
+ args[0]->max_length / args[0]->collation.collation->mbmaxlen;
max_length= char_length * cast_cs->mbmaxlen;
}
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index cfcf5fab080..99240b1c759 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -429,6 +429,7 @@ public:
{
return save_time_in_field(field);
}
+ bool result_as_longlong() { return TRUE; }
};
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc
index 651ff22d198..208ddefb890 100644
--- a/sql/my_decimal.cc
+++ b/sql/my_decimal.cc
@@ -214,7 +214,7 @@ my_decimal *date2my_decimal(MYSQL_TIME *ltime, my_decimal *dec)
date = (ltime->year*100L + ltime->month)*100L + ltime->day;
if (ltime->time_type > MYSQL_TIMESTAMP_DATE)
date= ((date*100L + ltime->hour)*100L+ ltime->minute)*100L + ltime->second;
- if (int2my_decimal(E_DEC_FATAL_ERROR, date, FALSE, dec))
+ if (int2my_decimal(E_DEC_FATAL_ERROR, ltime->neg ? -date : date, FALSE, dec))
return dec;
if (ltime->second_part)
{
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index d11f2838e3a..0d276cce177 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -548,6 +548,7 @@ protected:
#define UNCACHEABLE_PREPARE 16
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
#define UNCACHEABLE_UNITED 32
+#define UNCACHEABLE_CHECKOPTION 64
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
#define UNDEF_POS (-1)
@@ -1767,10 +1768,9 @@ int mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list,
int write_record(THD *thd, TABLE *table, COPY_INFO *info);
/* sql_manager.cc */
-extern ulong volatile manager_status;
-extern bool volatile manager_thread_in_use, mqh_used;
-extern pthread_t manager_thread;
-pthread_handler_t handle_manager(void *arg);
+extern bool volatile mqh_used;
+void start_handle_manager();
+void stop_handle_manager();
bool mysql_manager_submit(void (*action)());
@@ -2174,8 +2174,8 @@ void make_date(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
void make_time(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
String *str);
int my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b);
-ulonglong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
- Item *warn_item, bool *is_null);
+longlong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
+ Item *warn_item, bool *is_null);
int test_if_number(char *str,int *res,bool allow_wildcards);
void change_byte(uchar *,uint,char,char);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index c0a1b2e5306..7ff2b9e7dff 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -733,7 +733,7 @@ uint connection_count= 0;
/* Function declarations */
pthread_handler_t signal_hand(void *arg);
-static void mysql_init_variables(void);
+static int mysql_init_variables(void);
static void get_options(int *argc,char **argv);
extern "C" my_bool mysqld_get_one_option(int, const struct my_option *, char *);
static void set_server_version(void);
@@ -784,16 +784,6 @@ static void close_connections(void)
kill_cached_threads++;
flush_thread_cache();
- /* kill flush thread */
- (void) pthread_mutex_lock(&LOCK_manager);
- if (manager_thread_in_use)
- {
- DBUG_PRINT("quit", ("killing manager thread: 0x%lx",
- (ulong)manager_thread));
- (void) pthread_cond_signal(&COND_manager);
- }
- (void) pthread_mutex_unlock(&LOCK_manager);
-
/* kill connection thread */
#if !defined(__WIN__) && !defined(__NETWARE__)
DBUG_PRINT("quit", ("waiting for select thread: 0x%lx",
@@ -1196,6 +1186,7 @@ void clean_up(bool print_message)
if (cleanup_done++)
return; /* purecov: inspected */
+ stop_handle_manager();
release_ddl_log();
/*
@@ -3141,12 +3132,12 @@ static int init_common_variables(const char *conf_file_name, int argc,
if (!rpl_filter || !binlog_filter)
{
sql_perror("Could not allocate replication and binlog filters");
- exit(1);
+ return 1;
}
- if (init_thread_environment())
+ if (init_thread_environment() ||
+ mysql_init_variables())
return 1;
- mysql_init_variables();
#ifdef HAVE_TZNAME
{
@@ -3377,12 +3368,14 @@ static int init_common_variables(const char *conf_file_name, int argc,
sys_init_connect.value_length= strlen(opt_init_connect);
else
sys_init_connect.value=my_strdup("",MYF(0));
+ sys_init_connect.is_os_charset= TRUE;
sys_init_slave.value_length= 0;
if ((sys_init_slave.value= opt_init_slave))
sys_init_slave.value_length= strlen(opt_init_slave);
else
sys_init_slave.value=my_strdup("",MYF(0));
+ sys_init_slave.is_os_charset= TRUE;
/* check log options and issue warnings if needed */
if (opt_log && opt_logname && !(log_output_options & LOG_FILE) &&
@@ -3745,7 +3738,10 @@ version 5.0 and above. It is replaced by the binary log.");
{
/* as opt_bin_log==0, no need to free opt_bin_logname */
if (!(opt_bin_logname= my_strdup(opt_update_logname, MYF(MY_WME))))
- exit(EXIT_OUT_OF_MEMORY);
+ {
+ sql_print_error("Out of memory");
+ return EXIT_OUT_OF_MEMORY;
+ }
sql_print_error("The update log is no longer supported by MySQL in \
version 5.0 and above. It is replaced by the binary log. Now starting MySQL \
with --log-bin='%s' instead.",opt_bin_logname);
@@ -4033,17 +4029,6 @@ server.");
#ifndef EMBEDDED_LIBRARY
-static void create_maintenance_thread()
-{
- if (flush_time && flush_time != ~(ulong) 0L)
- {
- pthread_t hThread;
- if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
- sql_print_warning("Can't create thread to manage maintenance");
- }
-}
-
-
static void create_shutdown_thread()
{
#ifdef __WIN__
@@ -4358,7 +4343,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
execute_ddl_log_recovery();
create_shutdown_thread();
- create_maintenance_thread();
+ start_handle_manager();
if (Events::init(opt_noacl))
unireg_abort(1);
@@ -4368,6 +4353,9 @@ we force server id to 2, but this MySQL server will not act as a slave.");
: mysqld_unix_port),
mysqld_port,
MYSQL_COMPILATION_COMMENT);
+#if defined(_WIN32) && !defined(EMBEDDED_LIBRARY)
+ Service.SetRunning();
+#endif
/* Signal threads waiting for server to be started */
@@ -7348,6 +7336,7 @@ SHOW_VAR status_vars[]= {
{NullS, NullS, SHOW_LONG}
};
+#ifndef EMBEDDED_LIBRARY
static void print_version(void)
{
set_server_version();
@@ -7359,7 +7348,6 @@ static void print_version(void)
server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT);
}
-#ifndef EMBEDDED_LIBRARY
static void usage(void)
{
if (!(default_charset_info= get_charset_by_csname(default_character_set_name,
@@ -7424,7 +7412,7 @@ To see what values a running MySQL server is using, type\n\
as these are initialized by my_getopt.
*/
-static void mysql_init_variables(void)
+static int mysql_init_variables(void)
{
/* Things reset to zero */
opt_skip_slave_start= opt_reckless_slave = 0;
@@ -7505,7 +7493,10 @@ static void mysql_init_variables(void)
key_caches.empty();
if (!(dflt_key_cache= get_or_create_key_cache(default_key_cache_base.str,
default_key_cache_base.length)))
- exit(1);
+ {
+ sql_print_error("Cannot allocate the keycache");
+ return 1;
+ }
/* set key_cache_hash.default_value = dflt_key_cache */
multi_keycache_init();
@@ -7648,6 +7639,7 @@ static void mysql_init_variables(void)
tmpenv = DEFAULT_MYSQL_HOME;
(void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1);
#endif
+ return 0;
}
@@ -7708,9 +7700,11 @@ mysqld_get_one_option(int optid,
#endif
break;
#include <sslopt-case.h>
+#ifndef EMBEDDED_LIBRARY
case 'V':
print_version();
exit(0);
+#endif /*EMBEDDED_LIBRARY*/
case 'W':
if (!argument)
global_system_variables.log_warnings++;
@@ -7939,14 +7933,14 @@ mysqld_get_one_option(int optid,
if (gethostname(myhostname,sizeof(myhostname)) < 0)
{
sql_perror("Can't start server: cannot get my own hostname!");
- exit(1);
+ return 1;
}
ent=gethostbyname(myhostname);
}
if (!ent)
{
sql_perror("Can't start server: cannot resolve hostname!");
- exit(1);
+ return 1;
}
my_bind_addr = (ulong) ((in_addr*)ent->h_addr_list[0])->s_addr;
}
@@ -8143,8 +8137,8 @@ mysqld_get_one_option(int optid,
case OPT_FT_BOOLEAN_SYNTAX:
if (ft_boolean_check_syntax_string((uchar*) argument))
{
- fprintf(stderr, "Invalid ft-boolean-syntax string: %s\n", argument);
- exit(1);
+ sql_print_error("Invalid ft-boolean-syntax string: %s\n", argument);
+ return 1;
}
strmake(ft_boolean_syntax, argument, sizeof(ft_boolean_syntax)-1);
break;
diff --git a/sql/nt_servc.cc b/sql/nt_servc.cc
index 7ff06d5bdf5..f41fa08f828 100644
--- a/sql/nt_servc.cc
+++ b/sql/nt_servc.cc
@@ -255,10 +255,6 @@ void NTService::ServiceMain(DWORD argc, LPTSTR *argv)
if (!pService->StartService())
goto error;
- // Check that the service is now running.
- if (!pService->SetStatus(SERVICE_RUNNING,NO_ERROR, 0, 0, 0))
- goto error;
-
// wait for exit event
WaitForSingleObject (pService->hExitEvent, INFINITE);
@@ -274,9 +270,18 @@ error:
return;
}
-/**
- starts the appliaction thread.
-*/
+
+
+void NTService::SetRunning()
+{
+ if (pService)
+ pService->SetStatus(SERVICE_RUNNING,NO_ERROR, 0, 0, 0);
+}
+
+
+/* ------------------------------------------------------------------------
+ StartService() - starts the application thread
+ -------------------------------------------------------------------------- */
BOOL NTService::StartService()
{
diff --git a/sql/nt_servc.h b/sql/nt_servc.h
index 525f709388b..2f0d07df543 100644
--- a/sql/nt_servc.h
+++ b/sql/nt_servc.h
@@ -60,7 +60,19 @@ class NTService
BOOL IsService(LPCSTR ServiceName);
BOOL got_service_option(char **argv, char *service_option);
BOOL is_super_user();
- void Stop(void); //to be called from app. to stop service
+
+ /*
+ SetRunning() is to be called by the application
+ when initialization completes and it can accept
+ stop request
+ */
+ void SetRunning(void);
+
+ /*
+ Stop() is to be called by the application to stop
+ the service
+ */
+ void Stop(void);
protected:
LPSTR ServiceName;
diff --git a/sql/parse_file.cc b/sql/parse_file.cc
index d8cbc7ff174..d3ece194dcd 100644
--- a/sql/parse_file.cc
+++ b/sql/parse_file.cc
@@ -90,7 +90,6 @@ write_escaped_string(IO_CACHE *file, LEX_STRING *val_s)
@param file pointer to IO_CACHE structure for writing
@param base pointer to data structure
@param parameter pointer to parameter descriptor
- @param old_version for returning back old version number value
@retval
FALSE OK
@@ -100,8 +99,7 @@ write_escaped_string(IO_CACHE *file, LEX_STRING *val_s)
static my_bool
-write_parameter(IO_CACHE *file, uchar* base, File_option *parameter,
- ulonglong *old_version)
+write_parameter(IO_CACHE *file, uchar* base, File_option *parameter)
{
char num_buf[20]; // buffer for numeric operations
// string for numeric operations
@@ -129,15 +127,6 @@ write_parameter(IO_CACHE *file, uchar* base, File_option *parameter,
DBUG_RETURN(TRUE);
break;
}
- case FILE_OPTIONS_REV:
- {
- ulonglong *val_i= (ulonglong *)(base + parameter->offset);
- *old_version= (*val_i)++;
- num.set(*val_i, &my_charset_bin);
- if (my_b_append(file, (const uchar *)num.ptr(), num.length()))
- DBUG_RETURN(TRUE);
- break;
- }
case FILE_OPTIONS_TIMESTAMP:
{
/* string have to be allocated already */
@@ -207,7 +196,6 @@ write_parameter(IO_CACHE *file, uchar* base, File_option *parameter,
@param base base address for parameter reading (structure like
TABLE)
@param parameters parameters description
- @param max_versions number of versions to save
@retval
FALSE OK
@@ -219,13 +207,11 @@ write_parameter(IO_CACHE *file, uchar* base, File_option *parameter,
my_bool
sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
const LEX_STRING *type,
- uchar* base, File_option *parameters,
- uint max_versions)
+ uchar* base, File_option *parameters)
{
File handler;
IO_CACHE file;
char path[FN_REFLEN+1]; // +1 to put temporary file name for sure
- ulonglong old_version= ULONGLONG_MAX;
int path_end;
File_option *param;
DBUG_ENTER("sql_create_definition_file");
@@ -272,7 +258,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
if (my_b_append(&file, (const uchar *)param->name.str,
param->name.length) ||
my_b_append(&file, (const uchar *)STRING_WITH_LEN("=")) ||
- write_parameter(&file, base, param, &old_version) ||
+ write_parameter(&file, base, param) ||
my_b_append(&file, (const uchar *)STRING_WITH_LEN("\n")))
goto err_w_cache;
}
@@ -286,55 +272,6 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
}
path[path_end]='\0';
-#ifdef FRM_ARCHIVE
- // archive copies management: disabled unused feature (see bug #17823).
- if (!access(path, F_OK))
- {
- if (old_version != ULONGLONG_MAX && max_versions != 0)
- {
- // save backup
- char path_arc[FN_REFLEN];
- // backup old version
- char path_to[FN_REFLEN];
-
- // check archive directory existence
- fn_format(path_arc, "arc", dir->str, "", MY_UNPACK_FILENAME);
- if (access(path_arc, F_OK))
- {
- if (my_mkdir(path_arc, 0777, MYF(MY_WME)))
- {
- DBUG_RETURN(TRUE);
- }
- }
-
- my_snprintf(path_to, FN_REFLEN, "%s/%s-%04lu",
- path_arc, file_name->str, (ulong) old_version);
- if (my_rename(path, path_to, MYF(MY_WME)))
- {
- DBUG_RETURN(TRUE);
- }
-
- // remove very old version
- if (old_version > max_versions)
- {
- my_snprintf(path_to, FN_REFLEN, "%s/%s-%04lu",
- path_arc, file_name->str,
- (ulong)(old_version - max_versions));
- if (!access(path_arc, F_OK) && my_delete(path_to, MYF(MY_WME)))
- {
- DBUG_RETURN(TRUE);
- }
- }
- }
- else
- {
- if (my_delete(path, MYF(MY_WME))) // no backups
- {
- DBUG_RETURN(TRUE);
- }
- }
- }
-#endif//FRM_ARCHIVE
{
// rename temporary file
@@ -361,8 +298,6 @@ err_w_file:
@param schema name of given schema
@param old_name original file name
@param new_name new file name
- @param revision revision number
- @param num_view_backups number of backups
@retval
0 OK
@@ -371,8 +306,7 @@ err_w_file:
*/
my_bool rename_in_schema_file(THD *thd,
const char *schema, const char *old_name,
- const char *new_name, ulonglong revision,
- uint num_view_backups)
+ const char *new_name)
{
char old_path[FN_REFLEN], new_path[FN_REFLEN], arc_path[FN_REFLEN];
@@ -387,28 +321,6 @@ my_bool rename_in_schema_file(THD *thd,
/* check if arc_dir exists: disabled unused feature (see bug #17823). */
build_table_filename(arc_path, sizeof(arc_path) - 1, schema, "arc", "", 0);
-#ifdef FRM_ARCHIVE
- if (revision > 0 && !access(arc_path, F_OK))
- {
- char old_name_buf[FN_REFLEN], new_name_buf[FN_REFLEN];
- ulonglong limit= ((revision > num_view_backups) ?
- revision - num_view_backups : 0);
-
- VOID(tablename_to_filename(old_name, old_name_buf, sizeof(old_name_buf)));
- VOID(tablename_to_filename(new_name, new_name_buf, sizeof(new_name_buf)));
-
- for (; revision > limit ; revision--)
- {
- my_snprintf(old_path, FN_REFLEN, "%s/%s%s-%04lu",
- arc_path, old_name_buf, reg_ext, (ulong) revision);
- (void) unpack_filename(old_path, old_path);
- my_snprintf(new_path, FN_REFLEN, "%s/%s%s-%04lu",
- arc_path, new_name_buf, reg_ext, (ulong) revision);
- (void) unpack_filename(new_path, new_path);
- my_rename(old_path, new_path, MYF(0));
- }
- }
-#else//FRM_ARCHIVE
{ // remove obsolete 'arc' directory and files if any
MY_DIR *new_dirp;
if ((new_dirp = my_dir(arc_path, MYF(MY_DONT_SORT))))
@@ -417,7 +329,6 @@ my_bool rename_in_schema_file(THD *thd,
(void) mysql_rm_arc_files(thd, new_dirp, arc_path);
}
}
-#endif//FRM_ARCHIVE
return 0;
}
@@ -846,7 +757,6 @@ File_parser::parse(uchar* base, MEM_ROOT *mem_root,
break;
}
case FILE_OPTIONS_ULONGLONG:
- case FILE_OPTIONS_REV:
if (!(eol= strchr(ptr, '\n')))
{
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
diff --git a/sql/parse_file.h b/sql/parse_file.h
index c05b2853b9a..cfac69cc471 100644
--- a/sql/parse_file.h
+++ b/sql/parse_file.h
@@ -23,7 +23,6 @@ enum file_opt_type {
FILE_OPTIONS_STRING, /**< String (LEX_STRING) */
FILE_OPTIONS_ESTRING, /**< Escaped string (LEX_STRING) */
FILE_OPTIONS_ULONGLONG, /**< ulonglong parameter (ulonglong) */
- FILE_OPTIONS_REV, /**< Revision version number (ulonglong) */
FILE_OPTIONS_TIMESTAMP, /**< timestamp (LEX_STRING have to be
allocated with length 20 (19+1) */
FILE_OPTIONS_STRLIST, /**< list of escaped strings
@@ -81,11 +80,10 @@ File_parser *sql_parse_prepare(const LEX_STRING *file_name,
my_bool
sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
const LEX_STRING *type,
- uchar* base, File_option *parameters, uint versions);
+ uchar* base, File_option *parameters);
my_bool rename_in_schema_file(THD *thd,
const char *schema, const char *old_name,
- const char *new_name, ulonglong revision,
- uint num_view_backups);
+ const char *new_name);
class File_parser: public Sql_alloc
{
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 3e15cce2cea..a371c1113ef 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -77,7 +77,6 @@ extern ulong ndb_report_thresh_binlog_mem_usage;
extern CHARSET_INFO *character_set_filesystem;
-static DYNAMIC_ARRAY fixed_show_vars;
static HASH system_variable_hash;
const char *bool_type_names[]= { "OFF", "ON", NullS };
@@ -174,13 +173,21 @@ sys_auto_increment_offset(&vars, "auto_increment_offset",
static sys_var_bool_ptr sys_automatic_sp_privileges(&vars, "automatic_sp_privileges",
&sp_automatic_privileges);
-static sys_var_const_str sys_basedir(&vars, "basedir", mysql_home);
+static sys_var_const sys_back_log(&vars, "back_log",
+ OPT_GLOBAL, SHOW_LONG,
+ (uchar*) &back_log);
+static sys_var_const_os_str sys_basedir(&vars, "basedir", mysql_home);
static sys_var_long_ptr sys_binlog_cache_size(&vars, "binlog_cache_size",
&binlog_cache_size);
static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format",
&SV::binlog_format);
static sys_var_thd_ulong sys_bulk_insert_buff_size(&vars, "bulk_insert_buffer_size",
&SV::bulk_insert_buff_size);
+static sys_var_const_os sys_character_sets_dir(&vars,
+ "character_sets_dir",
+ OPT_GLOBAL, SHOW_CHAR,
+ (uchar*)
+ mysql_charsets_dir);
static sys_var_character_set_sv
sys_character_set_server(&vars, "character_set_server",
&SV::collation_server, &default_charset_info, 0,
@@ -226,7 +233,7 @@ static sys_var_long_ptr sys_concurrent_insert(&vars, "concurrent_insert",
&myisam_concurrent_insert);
static sys_var_long_ptr sys_connect_timeout(&vars, "connect_timeout",
&connect_timeout);
-static sys_var_const_str sys_datadir(&vars, "datadir", mysql_real_data_home);
+static sys_var_const_os_str sys_datadir(&vars, "datadir", mysql_real_data_home);
#ifndef DBUG_OFF
static sys_var_thd_dbug sys_dbug(&vars, "debug");
#endif
@@ -249,14 +256,31 @@ static sys_var_long_ptr sys_expire_logs_days(&vars, "expire_logs_days",
&expire_logs_days);
static sys_var_bool_ptr sys_flush(&vars, "flush", &myisam_flush);
static sys_var_long_ptr sys_flush_time(&vars, "flush_time", &flush_time);
-static sys_var_str sys_ft_boolean_syntax(&vars, "ft_boolean_syntax",
- sys_check_ftb_syntax,
- sys_update_ftb_syntax,
- sys_default_ftb_syntax,
- ft_boolean_syntax);
+static sys_var_str sys_ft_boolean_syntax(&vars, "ft_boolean_syntax",
+ sys_check_ftb_syntax,
+ sys_update_ftb_syntax,
+ sys_default_ftb_syntax,
+ ft_boolean_syntax);
+static sys_var_const sys_ft_max_word_len(&vars, "ft_max_word_len",
+ OPT_GLOBAL, SHOW_LONG,
+ (uchar*) &ft_max_word_len);
+static sys_var_const sys_ft_min_word_len(&vars, "ft_min_word_len",
+ OPT_GLOBAL, SHOW_LONG,
+ (uchar*) &ft_min_word_len);
+static sys_var_const sys_ft_query_expansion_limit(&vars,
+ "ft_query_expansion_limit",
+ OPT_GLOBAL, SHOW_LONG,
+ (uchar*)
+ &ft_query_expansion_limit);
+static sys_var_const sys_ft_stopword_file(&vars, "ft_stopword_file",
+ OPT_GLOBAL, SHOW_CHAR_PTR,
+ (uchar*) &ft_stopword_file);
sys_var_str sys_init_connect(&vars, "init_connect", 0,
sys_update_init_connect,
sys_default_init_connect,0);
+static sys_var_const sys_init_file(&vars, "init_file",
+ OPT_GLOBAL, SHOW_CHAR_PTR,
+ (uchar*) &opt_init_file);
sys_var_str sys_init_slave(&vars, "init_slave", 0,
sys_update_init_slave,
sys_default_init_slave,0);
@@ -274,14 +298,37 @@ static sys_var_key_cache_long sys_key_cache_division_limit(&vars, "key_cache_div
static sys_var_key_cache_long sys_key_cache_age_threshold(&vars, "key_cache_age_threshold",
offsetof(KEY_CACHE,
param_age_threshold));
+static sys_var_const sys_language(&vars, "language",
+ OPT_GLOBAL, SHOW_CHAR,
+ (uchar*) language);
+static sys_var_const sys_large_files_support(&vars, "large_files_support",
+ OPT_GLOBAL, SHOW_BOOL,
+ (uchar*) &opt_large_files);
+static sys_var_const sys_large_page_size(&vars, "large_page_size",
+ OPT_GLOBAL, SHOW_INT,
+ (uchar*) &opt_large_page_size);
+static sys_var_const sys_large_pages(&vars, "large_pages",
+ OPT_GLOBAL, SHOW_MY_BOOL,
+ (uchar*) &opt_large_pages);
static sys_var_bool_ptr sys_local_infile(&vars, "local_infile",
&opt_local_infile);
+#ifdef HAVE_MLOCKALL
+static sys_var_const sys_locked_in_memory(&vars, "locked_in_memory",
+ OPT_GLOBAL, SHOW_MY_BOOL,
+ (uchar*) &locked_in_memory);
+#endif
+static sys_var_const sys_log_bin(&vars, "log_bin",
+ OPT_GLOBAL, SHOW_BOOL,
+ (uchar*) &opt_bin_log);
static sys_var_trust_routine_creators
sys_trust_routine_creators(&vars, "log_bin_trust_routine_creators",
&trust_function_creators);
static sys_var_bool_ptr
sys_trust_function_creators(&vars, "log_bin_trust_function_creators",
&trust_function_creators);
+static sys_var_const sys_log_error(&vars, "log_error",
+ OPT_GLOBAL, SHOW_CHAR,
+ (uchar*) log_error_file);
static sys_var_bool_ptr
sys_log_queries_not_using_indexes(&vars, "log_queries_not_using_indexes",
&opt_log_queries_not_using_indexes);
@@ -296,7 +343,17 @@ static sys_var_thd_bool sys_sql_low_priority_updates(&vars, "sql_low_priority_up
&SV::low_priority_updates,
fix_low_priority_updates);
#endif
-static sys_var_thd_ulong sys_max_allowed_packet(&vars, "max_allowed_packet",
+static sys_var_const sys_lower_case_file_system(&vars,
+ "lower_case_file_system",
+ OPT_GLOBAL, SHOW_MY_BOOL,
+ (uchar*)
+ &lower_case_file_system);
+static sys_var_const sys_lower_case_table_names(&vars,
+ "lower_case_table_names",
+ OPT_GLOBAL, SHOW_INT,
+ (uchar*)
+ &lower_case_table_names);
+static sys_var_thd_ulong_session_readonly sys_max_allowed_packet(&vars, "max_allowed_packet",
&SV::max_allowed_packet);
static sys_var_long_ptr sys_max_binlog_cache_size(&vars, "max_binlog_cache_size",
&max_binlog_cache_size);
@@ -359,6 +416,10 @@ static sys_var_thd_ulong sys_multi_range_count(&vars, "multi_range_count",
static sys_var_long_ptr sys_myisam_data_pointer_size(&vars, "myisam_data_pointer_size",
&myisam_data_pointer_size);
static sys_var_thd_ulonglong sys_myisam_max_sort_file_size(&vars, "myisam_max_sort_file_size", &SV::myisam_max_sort_file_size, fix_myisam_max_sort_file_size, 1);
+static sys_var_const sys_myisam_recover_options(&vars, "myisam_recover_options",
+ OPT_GLOBAL, SHOW_CHAR_PTR,
+ (uchar*)
+ &myisam_recover_options_str);
static sys_var_thd_ulong sys_myisam_repair_threads(&vars, "myisam_repair_threads", &SV::myisam_repair_threads);
static sys_var_thd_ulong sys_myisam_sort_buffer_size(&vars, "myisam_sort_buffer_size", &SV::myisam_sort_buff_size);
static sys_var_bool_ptr sys_myisam_use_mmap(&vars, "myisam_use_mmap",
@@ -369,7 +430,14 @@ static sys_var_thd_enum sys_myisam_stats_method(&vars, "myisam_stats_met
&myisam_stats_method_typelib,
NULL);
-static sys_var_thd_ulong sys_net_buffer_length(&vars, "net_buffer_length",
+#ifdef __NT__
+/* purecov: begin inspected */
+static sys_var_const sys_named_pipe(&vars, "named_pipe",
+ OPT_GLOBAL, SHOW_MY_BOOL,
+ (uchar*) &opt_enable_named_pipe);
+/* purecov: end */
+#endif
+static sys_var_thd_ulong_session_readonly sys_net_buffer_length(&vars, "net_buffer_length",
&SV::net_buffer_length);
static sys_var_thd_ulong sys_net_read_timeout(&vars, "net_read_timeout",
&SV::net_read_timeout,
@@ -387,12 +455,29 @@ static sys_var_bool_ptr_readonly sys_old_mode(&vars, "old",
sys_var_thd_bool sys_old_alter_table(&vars, "old_alter_table",
&SV::old_alter_table);
sys_var_thd_bool sys_old_passwords(&vars, "old_passwords", &SV::old_passwords);
+static sys_var_const sys_open_files_limit(&vars, "open_files_limit",
+ OPT_GLOBAL, SHOW_LONG,
+ (uchar*)
+ &open_files_limit);
static sys_var_thd_ulong sys_optimizer_prune_level(&vars, "optimizer_prune_level",
&SV::optimizer_prune_level);
static sys_var_thd_ulong sys_optimizer_search_depth(&vars, "optimizer_search_depth",
&SV::optimizer_search_depth);
+static sys_var_const sys_pid_file(&vars, "pid_file",
+ OPT_GLOBAL, SHOW_CHAR,
+ (uchar*) pidfile_name);
+static sys_var_const_os sys_plugin_dir(&vars, "plugin_dir",
+ OPT_GLOBAL, SHOW_CHAR,
+ (uchar*) opt_plugin_dir);
+static sys_var_const sys_port(&vars, "port",
+ OPT_GLOBAL, SHOW_INT,
+ (uchar*) &mysqld_port);
static sys_var_thd_ulong sys_preload_buff_size(&vars, "preload_buffer_size",
&SV::preload_buff_size);
+static sys_var_const sys_protocol_version(&vars, "protocol_version",
+ OPT_GLOBAL, SHOW_INT,
+ (uchar*)
+ &protocol_version);
static sys_var_thd_ulong sys_read_buff_size(&vars, "read_buffer_size",
&SV::read_buff_size);
static sys_var_opt_readonly sys_readonly(&vars, "read_only", &opt_readonly);
@@ -414,7 +499,46 @@ static sys_var_thd_ulong sys_query_alloc_block_size(&vars, "query_alloc_block_si
static sys_var_thd_ulong sys_query_prealloc_size(&vars, "query_prealloc_size",
&SV::query_prealloc_size,
0, fix_thd_mem_root);
-static sys_var_readonly sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
+#ifdef HAVE_SMEM
+/* purecov: begin tested */
+static sys_var_const sys_shared_memory(&vars, "shared_memory",
+ OPT_GLOBAL, SHOW_MY_BOOL,
+ (uchar*)
+ &opt_enable_shared_memory);
+static sys_var_const sys_shared_memory_base_name(&vars,
+ "shared_memory_base_name",
+ OPT_GLOBAL, SHOW_CHAR_PTR,
+ (uchar*)
+ &shared_memory_base_name);
+/* purecov: end */
+#endif
+static sys_var_const sys_skip_external_locking(&vars,
+ "skip_external_locking",
+ OPT_GLOBAL, SHOW_MY_BOOL,
+ (uchar*)
+ &my_disable_locking);
+static sys_var_const sys_skip_networking(&vars, "skip_networking",
+ OPT_GLOBAL, SHOW_BOOL,
+ (uchar*) &opt_disable_networking);
+static sys_var_const sys_skip_show_database(&vars, "skip_show_database",
+ OPT_GLOBAL, SHOW_BOOL,
+ (uchar*) &opt_skip_show_db);
+#ifdef HAVE_SYS_UN_H
+static sys_var_const sys_socket(&vars, "socket",
+ OPT_GLOBAL, SHOW_CHAR_PTR,
+ (uchar*) &mysqld_unix_port);
+#endif
+#ifdef HAVE_THR_SETCONCURRENCY
+/* purecov: begin tested */
+static sys_var_const sys_thread_concurrency(&vars, "thread_concurrency",
+ OPT_GLOBAL, SHOW_LONG,
+ (uchar*) &concurrency);
+/* purecov: end */
+#endif
+static sys_var_const sys_thread_stack(&vars, "thread_stack",
+ OPT_GLOBAL, SHOW_LONG,
+ (uchar*) &my_thread_stack_size);
+static sys_var_readonly_os sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
static sys_var_thd_ulong sys_trans_alloc_block_size(&vars, "transaction_alloc_block_size",
&SV::trans_alloc_block_size,
0, fix_trans_mem_root);
@@ -465,17 +589,17 @@ static sys_var_thd_sql_mode sys_sql_mode(&vars, "sql_mode",
#ifdef HAVE_OPENSSL
extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
*opt_ssl_key;
-static sys_var_const_str_ptr sys_ssl_ca(&vars, "ssl_ca", &opt_ssl_ca);
-static sys_var_const_str_ptr sys_ssl_capath(&vars, "ssl_capath", &opt_ssl_capath);
-static sys_var_const_str_ptr sys_ssl_cert(&vars, "ssl_cert", &opt_ssl_cert);
-static sys_var_const_str_ptr sys_ssl_cipher(&vars, "ssl_cipher", &opt_ssl_cipher);
-static sys_var_const_str_ptr sys_ssl_key(&vars, "ssl_key", &opt_ssl_key);
+static sys_var_const_os_str_ptr sys_ssl_ca(&vars, "ssl_ca", &opt_ssl_ca);
+static sys_var_const_os_str_ptr sys_ssl_capath(&vars, "ssl_capath", &opt_ssl_capath);
+static sys_var_const_os_str_ptr sys_ssl_cert(&vars, "ssl_cert", &opt_ssl_cert);
+static sys_var_const_os_str_ptr sys_ssl_cipher(&vars, "ssl_cipher", &opt_ssl_cipher);
+static sys_var_const_os_str_ptr sys_ssl_key(&vars, "ssl_key", &opt_ssl_key);
#else
-static sys_var_const_str sys_ssl_ca(&vars, "ssl_ca", NULL);
-static sys_var_const_str sys_ssl_capath(&vars, "ssl_capath", NULL);
-static sys_var_const_str sys_ssl_cert(&vars, "ssl_cert", NULL);
-static sys_var_const_str sys_ssl_cipher(&vars, "ssl_cipher", NULL);
-static sys_var_const_str sys_ssl_key(&vars, "ssl_key", NULL);
+static sys_var_const_os_str sys_ssl_ca(&vars, "ssl_ca", NULL);
+static sys_var_const_os_str sys_ssl_capath(&vars, "ssl_capath", NULL);
+static sys_var_const_os_str sys_ssl_cert(&vars, "ssl_cert", NULL);
+static sys_var_const_os_str sys_ssl_cipher(&vars, "ssl_cipher", NULL);
+static sys_var_const_os_str sys_ssl_key(&vars, "ssl_key", NULL);
#endif
static sys_var_thd_enum
sys_updatable_views_with_limit(&vars, "updatable_views_with_limit",
@@ -764,59 +888,6 @@ static sys_var_log_output sys_var_log_output_state(&vars, "log_output", &log_out
&log_output_typelib, 0);
-/*
- Additional variables (not derived from sys_var class, not accessible as
- @@varname in SELECT or SET). Sorted in alphabetical order to facilitate
- maintenance - SHOW VARIABLES will sort its output.
- TODO: remove this list completely
-*/
-
-#define FIXED_VARS_SIZE (sizeof(fixed_vars) / sizeof(SHOW_VAR))
-static SHOW_VAR fixed_vars[]= {
- {"back_log", (char*) &back_log, SHOW_LONG},
- {"character_sets_dir", mysql_charsets_dir, SHOW_CHAR},
- {"ft_max_word_len", (char*) &ft_max_word_len, SHOW_LONG},
- {"ft_min_word_len", (char*) &ft_min_word_len, SHOW_LONG},
- {"ft_query_expansion_limit",(char*) &ft_query_expansion_limit, SHOW_LONG},
- {"ft_stopword_file", (char*) &ft_stopword_file, SHOW_CHAR_PTR},
- {"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR},
- {"language", language, SHOW_CHAR},
- {"large_files_support", (char*) &opt_large_files, SHOW_BOOL},
- {"large_page_size", (char*) &opt_large_page_size, SHOW_INT},
- {"large_pages", (char*) &opt_large_pages, SHOW_MY_BOOL},
-#ifdef HAVE_MLOCKALL
- {"locked_in_memory", (char*) &locked_in_memory, SHOW_MY_BOOL},
-#endif
- {"log_bin", (char*) &opt_bin_log, SHOW_BOOL},
- {"log_error", (char*) log_error_file, SHOW_CHAR},
- {"lower_case_file_system", (char*) &lower_case_file_system, SHOW_MY_BOOL},
- {"lower_case_table_names", (char*) &lower_case_table_names, SHOW_INT},
- {"myisam_recover_options", (char*) &myisam_recover_options_str, SHOW_CHAR_PTR},
-#ifdef __NT__
- {"named_pipe", (char*) &opt_enable_named_pipe, SHOW_MY_BOOL},
-#endif
- {"open_files_limit", (char*) &open_files_limit, SHOW_LONG},
- {"pid_file", (char*) pidfile_name, SHOW_CHAR},
- {"plugin_dir", (char*) opt_plugin_dir, SHOW_CHAR},
- {"port", (char*) &mysqld_port, SHOW_INT},
- {"protocol_version", (char*) &protocol_version, SHOW_INT},
-#ifdef HAVE_SMEM
- {"shared_memory", (char*) &opt_enable_shared_memory, SHOW_MY_BOOL},
- {"shared_memory_base_name", (char*) &shared_memory_base_name, SHOW_CHAR_PTR},
-#endif
- {"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
- {"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
- {"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
-#ifdef HAVE_SYS_UN_H
- {"socket", (char*) &mysqld_unix_port, SHOW_CHAR_PTR},
-#endif
-#ifdef HAVE_THR_SETCONCURRENCY
- {"thread_concurrency", (char*) &concurrency, SHOW_LONG},
-#endif
- {"thread_stack", (char*) &my_thread_stack_size, SHOW_LONG},
-};
-
-
bool sys_var::check(THD *thd, set_var *var)
{
var->save_result.ulonglong_value= var->value->val_int();
@@ -865,6 +936,7 @@ bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex,
old_value= var_str->value;
var_str->value= res;
var_str->value_length= new_length;
+ var_str->is_os_charset= FALSE;
rw_unlock(var_mutex);
my_free(old_value, MYF(MY_ALLOW_ZERO_PTR));
return 0;
@@ -1734,6 +1806,13 @@ err:
}
+CHARSET_INFO *sys_var::charset(THD *thd)
+{
+ return is_os_charset ? thd->variables.character_set_filesystem :
+ system_charset_info;
+}
+
+
bool sys_var_thd_enum::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
@@ -2734,6 +2813,18 @@ uchar *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type,
}
+bool sys_var_thd_ulong_session_readonly::check(THD *thd, set_var *var)
+{
+ if (var->type != OPT_GLOBAL)
+ {
+ my_error(ER_VARIABLE_IS_READONLY, MYF(0), "SESSION", name, "GLOBAL");
+ return TRUE;
+ }
+
+ return sys_var_thd_ulong::check(thd, var);
+}
+
+
bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var)
{
MY_LOCALE *locale_match;
@@ -3123,14 +3214,12 @@ static int show_cmp(SHOW_VAR *a, SHOW_VAR *b)
SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted)
{
int count= system_variable_hash.records, i;
- int fixed_count= fixed_show_vars.elements;
- int size= sizeof(SHOW_VAR) * (count + fixed_count + 1);
+ int size= sizeof(SHOW_VAR) * (count + 1);
SHOW_VAR *result= (SHOW_VAR*) thd->alloc(size);
if (result)
{
- SHOW_VAR *show= result + fixed_count;
- memcpy(result, fixed_show_vars.buffer, fixed_count * sizeof(SHOW_VAR));
+ SHOW_VAR *show= result;
for (i= 0; i < count; i++)
{
@@ -3143,7 +3232,7 @@ SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted)
/* sort into order */
if (sorted)
- my_qsort(result, count + fixed_count, sizeof(SHOW_VAR),
+ my_qsort(result, count, sizeof(SHOW_VAR),
(qsort_cmp) show_cmp);
/* make last element empty */
@@ -3171,13 +3260,6 @@ int set_var_init()
for (sys_var *var=vars.first; var; var= var->next, count++);
- if (my_init_dynamic_array(&fixed_show_vars, sizeof(SHOW_VAR),
- FIXED_VARS_SIZE + 64, 64))
- goto error;
-
- fixed_show_vars.elements= FIXED_VARS_SIZE;
- memcpy(fixed_show_vars.buffer, fixed_vars, sizeof(fixed_vars));
-
if (hash_init(&system_variable_hash, system_charset_info, count, 0,
0, (hash_get_key) get_sys_var_length, 0, HASH_UNIQUE))
goto error;
@@ -3205,28 +3287,6 @@ error:
void set_var_free()
{
hash_free(&system_variable_hash);
- delete_dynamic(&fixed_show_vars);
-}
-
-
-/*
- Add elements to the dynamic list of read-only system variables.
-
- SYNOPSIS
- mysql_append_static_vars()
- show_vars Pointer to start of array
- count Number of elements
-
- RETURN VALUES
- 0 SUCCESS
- otherwise FAILURE
-*/
-int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count)
-{
- for (; count > 0; count--, show_vars++)
- if (insert_dynamic(&fixed_show_vars, (uchar*) show_vars))
- return 1;
- return 0;
}
diff --git a/sql/set_var.h b/sql/set_var.h
index 9681c955a98..b6c67d1ab4a 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -71,9 +71,18 @@ public:
sys_after_update_func after_update;
bool no_support_one_shot;
+ /*
+ true if the value is in character_set_filesystem,
+ false otherwise.
+ Note that we can't use a pointer to the charset as the system var is
+ instantiated in global scope and the charset pointers are initialized
+ later.
+ */
+ bool is_os_charset;
sys_var(const char *name_arg, sys_after_update_func func= NULL,
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
:name(name_arg), after_update(func), no_support_one_shot(1),
+ is_os_charset (FALSE),
binlog_status(binlog_status_arg),
m_allow_empty_value(TRUE)
{}
@@ -107,6 +116,7 @@ public:
{ return option_limits == 0; }
virtual bool is_struct() { return 0; }
virtual bool is_readonly() const { return 0; }
+ CHARSET_INFO *charset(THD *thd);
virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
protected:
@@ -291,6 +301,18 @@ public:
};
+class sys_var_const_os_str: public sys_var_const_str
+{
+public:
+ sys_var_const_os_str(sys_var_chain *chain, const char *name_arg,
+ const char *value_arg)
+ :sys_var_const_str(chain, name_arg, value_arg)
+ {
+ is_os_charset= TRUE;
+ }
+};
+
+
class sys_var_const_str_ptr :public sys_var
{
public:
@@ -320,6 +342,18 @@ public:
};
+class sys_var_const_os_str_ptr :public sys_var_const_str_ptr
+{
+public:
+ sys_var_const_os_str_ptr(sys_var_chain *chain, const char *name_arg,
+ char **value_arg)
+ :sys_var_const_str_ptr(chain, name_arg, value_arg)
+ {
+ is_os_charset= TRUE;
+ }
+};
+
+
class sys_var_enum :public sys_var
{
uint *value;
@@ -929,6 +963,63 @@ public:
};
+class sys_var_readonly_os: public sys_var_readonly
+{
+public:
+ sys_var_readonly_os(sys_var_chain *chain, const char *name_arg, enum_var_type type,
+ SHOW_TYPE show_type_arg,
+ sys_value_ptr_func value_ptr_func_arg)
+ :sys_var_readonly(chain, name_arg, type, show_type_arg, value_ptr_func_arg)
+ {
+ is_os_charset= TRUE;
+ }
+};
+
+
+/**
+ Global-only, read-only variable. E.g. command line option.
+*/
+
+class sys_var_const: public sys_var
+{
+public:
+ enum_var_type var_type;
+ SHOW_TYPE show_type_value;
+ uchar *ptr;
+ sys_var_const(sys_var_chain *chain, const char *name_arg, enum_var_type type,
+ SHOW_TYPE show_type_arg, uchar *ptr_arg)
+ :sys_var(name_arg), var_type(type),
+ show_type_value(show_type_arg), ptr(ptr_arg)
+ { chain_sys_var(chain); }
+ bool update(THD *thd, set_var *var) { return 1; }
+ bool check_default(enum_var_type type) { return 1; }
+ bool check_type(enum_var_type type) { return type != var_type; }
+ bool check_update_type(Item_result type) { return 1; }
+ uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ {
+ return ptr;
+ }
+ SHOW_TYPE show_type() { return show_type_value; }
+ bool is_readonly() const { return 1; }
+};
+
+
+class sys_var_const_os: public sys_var_const
+{
+public:
+ enum_var_type var_type;
+ SHOW_TYPE show_type_value;
+ uchar *ptr;
+ sys_var_const_os(sys_var_chain *chain, const char *name_arg,
+ enum_var_type type,
+ SHOW_TYPE show_type_arg, uchar *ptr_arg)
+ :sys_var_const(chain, name_arg, type, show_type_arg, ptr_arg)
+ {
+ is_os_charset= TRUE;
+ }
+};
+
+
class sys_var_have_option: public sys_var
{
protected:
@@ -1024,6 +1115,29 @@ public:
};
+/**
+ * @brief This is a specialization of sys_var_thd_ulong that implements a
+ read-only session variable. The class overrides check() and check_default()
+ to achieve the read-only property for the session part of the variable.
+ */
+class sys_var_thd_ulong_session_readonly : public sys_var_thd_ulong
+{
+public:
+ sys_var_thd_ulong_session_readonly(sys_var_chain *chain_arg,
+ const char *name_arg, ulong SV::*offset_arg,
+ sys_check_func c_func= NULL,
+ sys_after_update_func au_func= NULL,
+ Binlog_status_enum bl_status_arg= NOT_IN_BINLOG):
+ sys_var_thd_ulong(chain_arg, name_arg, offset_arg, c_func, au_func, bl_status_arg)
+ { }
+ bool check(THD *thd, set_var *var);
+ bool check_default(enum_var_type type)
+ {
+ return type != OPT_GLOBAL || !option_limits;
+ }
+};
+
+
class sys_var_microseconds :public sys_var_thd
{
ulonglong SV::*offset;
@@ -1294,7 +1408,6 @@ struct sys_var_with_base
int set_var_init();
void set_var_free();
-int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count);
SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted);
int mysql_add_sys_var_chain(sys_var *chain, struct my_option *long_options);
int mysql_del_sys_var_chain(sys_var *chain);
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index b86007408fb..fd75fee9737 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -6151,3 +6151,6 @@ WARN_PLUGIN_DELETE_BUILTIN
WARN_PLUGIN_BUSY
eng "Plugin is busy and will be uninstalled on shutdown"
+
+ER_VARIABLE_IS_READONLY
+ eng "%s variable '%s' is read-only. Use SET %s to assign the value"
diff --git a/sql/slave.cc b/sql/slave.cc
index 0040b69f8de..43b70f29a68 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -49,6 +49,7 @@
#define MAX_SLAVE_RETRY_PAUSE 5
bool use_slave_mask = 0;
MY_BITMAP slave_error_mask;
+char slave_skip_error_names[SHOW_VAR_FUNC_BUFF_SIZE];
typedef bool (*CHECK_KILLED_FUNC)(THD*,void*);
@@ -275,6 +276,64 @@ err:
}
+/**
+ Convert slave skip errors bitmap into a printable string.
+*/
+
+static void print_slave_skip_errors(void)
+{
+ /*
+ To be safe, we want 10 characters of room in the buffer for a number
+ plus terminators. Also, we need some space for constant strings.
+ 10 characters must be sufficient for a number plus {',' | '...'}
+ plus a NUL terminator. That is a max 6 digit number.
+ */
+ const size_t MIN_ROOM= 10;
+ DBUG_ENTER("print_slave_skip_errors");
+ DBUG_ASSERT(sizeof(slave_skip_error_names) > MIN_ROOM);
+ DBUG_ASSERT(MAX_SLAVE_ERROR <= 999999); // 6 digits
+
+ if (!use_slave_mask || bitmap_is_clear_all(&slave_error_mask))
+ {
+ /* purecov: begin tested */
+ memcpy(slave_skip_error_names, STRING_WITH_LEN("OFF"));
+ /* purecov: end */
+ }
+ else if (bitmap_is_set_all(&slave_error_mask))
+ {
+ /* purecov: begin tested */
+ memcpy(slave_skip_error_names, STRING_WITH_LEN("ALL"));
+ /* purecov: end */
+ }
+ else
+ {
+ char *buff= slave_skip_error_names;
+ char *bend= buff + sizeof(slave_skip_error_names);
+ int errnum;
+
+ for (errnum= 1; errnum < MAX_SLAVE_ERROR; errnum++)
+ {
+ if (bitmap_is_set(&slave_error_mask, errnum))
+ {
+ if (buff + MIN_ROOM >= bend)
+ break; /* purecov: tested */
+ buff= int10_to_str(errnum, buff, 10);
+ *buff++= ',';
+ }
+ }
+ if (buff != slave_skip_error_names)
+ buff--; // Remove last ','
+ if (errnum < MAX_SLAVE_ERROR)
+ {
+ /* Couldn't show all errors */
+ buff= strmov(buff, "..."); /* purecov: tested */
+ }
+ *buff=0;
+ }
+ DBUG_PRINT("init", ("error_names: '%s'", slave_skip_error_names));
+ DBUG_VOID_RETURN;
+}
+
/*
Init function to set up array for errors that should be skipped for slave
@@ -314,6 +373,8 @@ void init_slave_skip_errors(const char* arg)
while (!my_isdigit(system_charset_info,*p) && *p)
p++;
}
+ /* Convert slave skip errors bitmap into a printable string. */
+ print_slave_skip_errors();
DBUG_VOID_RETURN;
}
diff --git a/sql/slave.h b/sql/slave.h
index dc2d668c97b..abd63315e62 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -98,6 +98,7 @@ class Master_info;
extern ulong master_retry_count;
extern MY_BITMAP slave_error_mask;
+extern char slave_skip_error_names[];
extern bool use_slave_mask;
extern char *slave_load_tmpdir;
extern char *master_info_file, *relay_log_info_file;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index d7bb571b8c7..6dcd11fac71 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -3095,7 +3095,10 @@ bool reopen_table(TABLE *table)
for (key=0 ; key < table->s->keys ; key++)
{
for (part=0 ; part < table->key_info[key].usable_key_parts ; part++)
+ {
table->key_info[key].key_part[part].field->table= table;
+ table->key_info[key].key_part[part].field->orig_table= table;
+ }
}
if (table->triggers)
table->triggers->set_table(table);
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 15501ec2f09..66cafd68212 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -311,7 +311,7 @@ void thd_inc_row_count(THD *thd)
Dumps a text description of a thread, its security context
(user, host) and the current query.
- @param thd current thread context
+ @param thd thread context
@param buffer pointer to preferred result buffer
@param length length of buffer
@param max_query_len how many chars of query to copy (0 for all)
@@ -385,7 +385,17 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length,
}
if (str.c_ptr_safe() == buffer)
return buffer;
- return thd->strmake(str.ptr(), str.length());
+
+ /*
+ We have to copy the new string to the destination buffer because the string
+ was reallocated to a larger buffer to be able to fit.
+ */
+ DBUG_ASSERT(buffer != NULL);
+ length= min(str.length(), length-1);
+ memcpy(buffer, str.c_ptr_quick(), length);
+ /* Make sure that the new string is null terminated */
+ buffer[length]= '\0';
+ return buffer;
}
/**
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 4571ceba93f..72ae664bba1 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -1098,7 +1098,6 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
/* .frm archive:
Those archives are obsolete, but following code should
exist to remove existent "arc" directories.
- See #ifdef FRM_ARCHIVE directives for obsolete code.
*/
char newpath[FN_REFLEN];
MY_DIR *new_dirp;
@@ -1267,7 +1266,6 @@ static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error)
NOTE
A support of "arc" directories is obsolete, however this
function should exist to remove existent "arc" directories.
- See #ifdef FRM_ARCHIVE directives for obsolete code.
*/
long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path)
{
diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc
index 171ab55145a..b082f65bfb9 100644
--- a/sql/sql_manager.cc
+++ b/sql/sql_manager.cc
@@ -23,8 +23,9 @@
#include "mysql_priv.h"
-ulong volatile manager_status;
-bool volatile manager_thread_in_use;
+
+static bool volatile manager_thread_in_use;
+static bool abort_manager;
pthread_t manager_thread;
pthread_mutex_t LOCK_manager;
@@ -63,7 +64,6 @@ bool mysql_manager_submit(void (*action)())
pthread_handler_t handle_manager(void *arg __attribute__((unused)))
{
int error = 0;
- ulong status;
struct timespec abstime;
bool reset_flush_time = TRUE;
struct handler_cb *cb= NULL;
@@ -72,7 +72,6 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
pthread_detach_this_thread();
manager_thread = pthread_self();
- manager_status = 0;
manager_thread_in_use = 1;
for (;;)
@@ -87,16 +86,14 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
set_timespec(abstime, flush_time);
reset_flush_time = FALSE;
}
- while (!manager_status && (!error || error == EINTR) && !abort_loop)
+ while ((!error || error == EINTR) && !abort_manager)
error= pthread_cond_timedwait(&COND_manager, &LOCK_manager, &abstime);
}
else
{
- while (!manager_status && (!error || error == EINTR) && !abort_loop)
+ while ((!error || error == EINTR) && !abort_manager)
error= pthread_cond_wait(&COND_manager, &LOCK_manager);
}
- status = manager_status;
- manager_status = 0;
if (cb == NULL)
{
cb= cb_list;
@@ -104,7 +101,7 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
}
pthread_mutex_unlock(&LOCK_manager);
- if (abort_loop)
+ if (abort_manager)
break;
if (error == ETIMEDOUT || error == ETIME)
@@ -121,11 +118,42 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
my_free((uchar*)cb, MYF(0));
cb= next;
}
-
- if (status)
- DBUG_PRINT("error", ("manager did not handle something: %lx", status));
}
manager_thread_in_use = 0;
+ DBUG_LEAVE; // Can't use DBUG_RETURN after my_thread_end
my_thread_end();
- DBUG_RETURN(NULL);
+ return (NULL);
}
+
+
+/* Start handle manager thread */
+void start_handle_manager()
+{
+ DBUG_ENTER("start_handle_manager");
+ abort_manager = false;
+ if (flush_time && flush_time != ~(ulong) 0L)
+ {
+ pthread_t hThread;
+ if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
+ sql_print_warning("Can't create handle_manager thread");
+ }
+ DBUG_VOID_RETURN;
+}
+
+
+/* Initiate shutdown of handle manager thread */
+void stop_handle_manager()
+{
+ DBUG_ENTER("stop_handle_manager");
+ abort_manager = true;
+ pthread_mutex_lock(&LOCK_manager);
+ if (manager_thread_in_use)
+ {
+ DBUG_PRINT("quit", ("initiate shutdown of handle manager thread: 0x%lx",
+ (ulong)manager_thread));
+ pthread_cond_signal(&COND_manager);
+ }
+ pthread_mutex_unlock(&LOCK_manager);
+ DBUG_VOID_RETURN;
+}
+
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 7aa54d3208f..3ab211f5db6 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1660,64 +1660,38 @@ public:
static sys_var_chain vars = { NULL, NULL };
+static sys_var_const sys_log_slave_updates(&vars, "log_slave_updates",
+ OPT_GLOBAL, SHOW_MY_BOOL,
+ (uchar*) &opt_log_slave_updates);
+static sys_var_const sys_relay_log(&vars, "relay_log",
+ OPT_GLOBAL, SHOW_CHAR_PTR,
+ (uchar*) &opt_relay_logname);
+static sys_var_const sys_relay_log_index(&vars, "relay_log_index",
+ OPT_GLOBAL, SHOW_CHAR_PTR,
+ (uchar*) &opt_relaylog_index_name);
+static sys_var_const sys_relay_log_info_file(&vars, "relay_log_info_file",
+ OPT_GLOBAL, SHOW_CHAR_PTR,
+ (uchar*) &relay_log_info_file);
static sys_var_bool_ptr sys_relay_log_purge(&vars, "relay_log_purge",
&relay_log_purge);
+static sys_var_const sys_relay_log_space_limit(&vars,
+ "relay_log_space_limit",
+ OPT_GLOBAL, SHOW_LONGLONG,
+ (uchar*)
+ &relay_log_space_limit);
+static sys_var_const sys_slave_load_tmpdir(&vars, "slave_load_tmpdir",
+ OPT_GLOBAL, SHOW_CHAR_PTR,
+ (uchar*) &slave_load_tmpdir);
static sys_var_long_ptr sys_slave_net_timeout(&vars, "slave_net_timeout",
&slave_net_timeout);
+static sys_var_const sys_slave_skip_errors(&vars, "slave_skip_errors",
+ OPT_GLOBAL, SHOW_CHAR,
+ (uchar*) slave_skip_error_names);
static sys_var_long_ptr sys_slave_trans_retries(&vars, "slave_transaction_retries",
&slave_trans_retries);
static sys_var_sync_binlog_period sys_sync_binlog_period(&vars, "sync_binlog", &sync_binlog_period);
static sys_var_slave_skip_counter sys_slave_skip_counter(&vars, "sql_slave_skip_counter");
-static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff);
-
-
-static SHOW_VAR fixed_vars[]= {
- {"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL},
- {"relay_log" , (char*) &opt_relay_logname, SHOW_CHAR_PTR},
- {"relay_log_index", (char*) &opt_relaylog_index_name, SHOW_CHAR_PTR},
- {"relay_log_info_file", (char*) &relay_log_info_file, SHOW_CHAR_PTR},
- {"relay_log_space_limit", (char*) &relay_log_space_limit, SHOW_LONGLONG},
- {"slave_load_tmpdir", (char*) &slave_load_tmpdir, SHOW_CHAR_PTR},
- {"slave_skip_errors", (char*) &show_slave_skip_errors, SHOW_FUNC},
-};
-
-static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff)
-{
- var->type=SHOW_CHAR;
- var->value= buff;
- if (!use_slave_mask || bitmap_is_clear_all(&slave_error_mask))
- {
- var->value= const_cast<char *>("OFF");
- }
- else if (bitmap_is_set_all(&slave_error_mask))
- {
- var->value= const_cast<char *>("ALL");
- }
- else
- {
- /* 10 is enough assuming errors are max 4 digits */
- int i;
- var->value= buff;
- for (i= 1;
- i < MAX_SLAVE_ERROR &&
- (buff - var->value) < SHOW_VAR_FUNC_BUFF_SIZE;
- i++)
- {
- if (bitmap_is_set(&slave_error_mask, i))
- {
- buff= int10_to_str(i, buff, 10);
- *buff++= ',';
- }
- }
- if (var->value != buff)
- buff--; // Remove last ','
- if (i < MAX_SLAVE_ERROR)
- buff= strmov(buff, "..."); // Couldn't show all errors
- *buff=0;
- }
- return 0;
-}
bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
{
@@ -1765,8 +1739,6 @@ bool sys_var_sync_binlog_period::update(THD *thd, set_var *var)
int init_replication_sys_vars()
{
- mysql_append_static_vars(fixed_vars, sizeof(fixed_vars) / sizeof(SHOW_VAR));
-
if (mysql_add_sys_var_chain(vars.first, my_long_options))
{
/* should not happen */
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 7e37bd7c67d..b1f74d26db3 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -402,11 +402,21 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array,
{
int res;
nesting_map save_allow_sum_func=thd->lex->allow_sum_func ;
+ /*
+ Need to save the value, so we can turn off only the new NON_AGG_FIELD
+ additions coming from the WHERE
+ */
+ uint8 saved_flag= thd->lex->current_select->full_group_by_flag;
DBUG_ENTER("setup_without_group");
thd->lex->allow_sum_func&= ~(1 << thd->lex->current_select->nest_level);
res= setup_conds(thd, tables, leaves, conds);
+ /* it's not wrong to have non-aggregated columns in a WHERE */
+ if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY)
+ thd->lex->current_select->full_group_by_flag= saved_flag |
+ (thd->lex->current_select->full_group_by_flag & ~NON_AGG_FIELD_USED);
+
thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level;
res= res || setup_order(thd, ref_pointer_array, tables, fields, all_fields,
order);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 1b6f5131c48..28e8c028362 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -83,6 +83,7 @@ static void store_key_options(THD *thd, String *packet, TABLE *table,
static void
append_algorithm(TABLE_LIST *table, String *buff);
+static COND * make_cond_for_info_schema(COND *cond, TABLE_LIST *table);
/***************************************************************************
** List all table types supported
@@ -2072,7 +2073,8 @@ static bool show_status_array(THD *thd, const char *wild,
enum enum_var_type value_type,
struct system_status_var *status_var,
const char *prefix, TABLE *table,
- bool ucase_names)
+ bool ucase_names,
+ COND *cond)
{
MY_ALIGNED_BYTE_ARRAY(buff_data, SHOW_VAR_FUNC_BUFF_SIZE, long);
char * const buff= (char *) &buff_data;
@@ -2082,8 +2084,13 @@ static bool show_status_array(THD *thd, const char *wild,
int len;
LEX_STRING null_lex_str;
SHOW_VAR tmp, *var;
+ COND *partial_cond= 0;
+ enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
+ bool res= FALSE;
+ CHARSET_INFO *charset= system_charset_info;
DBUG_ENTER("show_status_array");
+ thd->count_cuted_fields= CHECK_FIELD_WARN;
null_lex_str.str= 0; // For sys_var->value_ptr()
null_lex_str.length= 0;
@@ -2091,6 +2098,7 @@ static bool show_status_array(THD *thd, const char *wild,
if (*prefix)
*prefix_end++= '_';
len=name_buffer + sizeof(name_buffer) - prefix_end;
+ partial_cond= make_cond_for_info_schema(cond, table->pos_in_table_list);
for (; variables->name; variables++)
{
@@ -2099,6 +2107,9 @@ static bool show_status_array(THD *thd, const char *wild,
if (ucase_names)
make_upper(name_buffer);
+ restore_record(table, s->default_values);
+ table->field[0]->store(name_buffer, strlen(name_buffer),
+ system_charset_info);
/*
if var->type is SHOW_FUNC, call the function.
Repeat as necessary, if new var is again SHOW_FUNC
@@ -2110,12 +2121,13 @@ static bool show_status_array(THD *thd, const char *wild,
if (show_type == SHOW_ARRAY)
{
show_status_array(thd, wild, (SHOW_VAR *) var->value, value_type,
- status_var, name_buffer, table, ucase_names);
+ status_var, name_buffer, table, ucase_names, partial_cond);
}
else
{
if (!(wild && wild[0] && wild_case_compare(system_charset_info,
- name_buffer, wild)))
+ name_buffer, wild)) &&
+ (!partial_cond || partial_cond->val_int()))
{
char *value=var->value;
const char *pos, *end; // We assign a lot of const's
@@ -2124,9 +2136,10 @@ static bool show_status_array(THD *thd, const char *wild,
if (show_type == SHOW_SYS)
{
- show_type= ((sys_var*) value)->show_type();
- value= (char*) ((sys_var*) value)->value_ptr(thd, value_type,
- &null_lex_str);
+ sys_var *var= ((sys_var *) value);
+ show_type= var->show_type();
+ value= (char*) var->value_ptr(thd, value_type, &null_lex_str);
+ charset= var->charset(thd);
}
pos= end= buff;
@@ -2202,21 +2215,23 @@ static bool show_status_array(THD *thd, const char *wild,
DBUG_ASSERT(0);
break;
}
- restore_record(table, s->default_values);
- table->field[0]->store(name_buffer, strlen(name_buffer),
- system_charset_info);
- table->field[1]->store(pos, (uint32) (end - pos), system_charset_info);
+ table->field[1]->store(pos, (uint32) (end - pos), charset);
+ thd->count_cuted_fields= CHECK_FIELD_IGNORE;
table->field[1]->set_notnull();
pthread_mutex_unlock(&LOCK_global_system_variables);
if (schema_table_store_record(thd, table))
- DBUG_RETURN(TRUE);
+ {
+ res= TRUE;
+ goto end;
+ }
}
}
}
-
- DBUG_RETURN(FALSE);
+end:
+ thd->count_cuted_fields= save_count_cuted_fields;
+ DBUG_RETURN(res);
}
@@ -3498,6 +3513,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
TABLE_SHARE *share= show_table->s;
handler *file= show_table->file;
handlerton *tmp_db_type= share->db_type();
+ bool is_partitioned= FALSE;
if (share->tmp_table == SYSTEM_TMP_TABLE)
table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs);
else if (share->tmp_table)
@@ -3514,7 +3530,10 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (share->db_type() == partition_hton &&
share->partition_info_len)
+ {
tmp_db_type= share->default_part_db_type;
+ is_partitioned= TRUE;
+ }
#endif
tmp_buff= (char *) ha_resolve_storage_engine_name(tmp_db_type);
table->field[4]->store(tmp_buff, strlen(tmp_buff), cs);
@@ -3559,9 +3578,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
NullS);
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
- if (show_table->s->db_type() == partition_hton &&
- show_table->part_info != NULL &&
- show_table->part_info->no_parts > 0)
+ if (is_partitioned)
ptr= strmov(ptr, " partitioned");
#endif
if (share->transactional != HA_CHOICE_UNDEF)
@@ -5244,7 +5261,7 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
rw_rdlock(&LOCK_system_variables_hash);
res= show_status_array(thd, wild, enumerate_sys_vars(thd, sorted_vars),
- option_type, NULL, "", tables->table, upper_case_names);
+ option_type, NULL, "", tables->table, upper_case_names, cond);
rw_unlock(&LOCK_system_variables_hash);
DBUG_RETURN(res);
}
@@ -5287,7 +5304,7 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond)
res= show_status_array(thd, wild,
(SHOW_VAR *)all_status_vars.buffer,
option_type, tmp1, "", tables->table,
- upper_case_names);
+ upper_case_names, cond);
pthread_mutex_unlock(&LOCK_status);
DBUG_RETURN(res);
}
@@ -6013,9 +6030,10 @@ ST_FIELD_INFO schema_fields_info[]=
{"CATALOG_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
{"SCHEMA_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Database",
SKIP_OPEN_TABLE},
- {"DEFAULT_CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0,
+ {"DEFAULT_CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0,
+ SKIP_OPEN_TABLE},
+ {"DEFAULT_COLLATION_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0,
SKIP_OPEN_TABLE},
- {"DEFAULT_COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
{"SQL_PATH", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
@@ -6049,7 +6067,8 @@ ST_FIELD_INFO tables_fields_info[]=
{"CREATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Create_time", OPEN_FULL_TABLE},
{"UPDATE_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Update_time", OPEN_FULL_TABLE},
{"CHECK_TIME", 0, MYSQL_TYPE_DATETIME, 0, 1, "Check_time", OPEN_FULL_TABLE},
- {"TABLE_COLLATION", 64, MYSQL_TYPE_STRING, 0, 1, "Collation", OPEN_FRM_ONLY},
+ {"TABLE_COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 1, "Collation",
+ OPEN_FRM_ONLY},
{"CHECKSUM", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
(MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Checksum", OPEN_FULL_TABLE},
{"CREATE_OPTIONS", 255, MYSQL_TYPE_STRING, 0, 1, "Create_options",
@@ -6080,8 +6099,10 @@ ST_FIELD_INFO columns_fields_info[]=
0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY},
{"NUMERIC_SCALE", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONGLONG,
0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), 0, OPEN_FRM_ONLY},
- {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FRM_ONLY},
- {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 1, "Collation", OPEN_FRM_ONLY},
+ {"CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 1, 0,
+ OPEN_FRM_ONLY},
+ {"COLLATION_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 1, "Collation",
+ OPEN_FRM_ONLY},
{"COLUMN_TYPE", 65535, MYSQL_TYPE_STRING, 0, 0, "Type", OPEN_FRM_ONLY},
{"COLUMN_KEY", 3, MYSQL_TYPE_STRING, 0, 0, "Key", OPEN_FRM_ONLY},
{"EXTRA", 27, MYSQL_TYPE_STRING, 0, 0, "Extra", OPEN_FRM_ONLY},
@@ -6093,10 +6114,10 @@ ST_FIELD_INFO columns_fields_info[]=
ST_FIELD_INFO charsets_fields_info[]=
{
- {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Charset",
- SKIP_OPEN_TABLE},
- {"DEFAULT_COLLATE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Default collation",
+ {"CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, "Charset",
SKIP_OPEN_TABLE},
+ {"DEFAULT_COLLATE_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
+ "Default collation", SKIP_OPEN_TABLE},
{"DESCRIPTION", 60, MYSQL_TYPE_STRING, 0, 0, "Description",
SKIP_OPEN_TABLE},
{"MAXLEN", 3, MYSQL_TYPE_LONGLONG, 0, 0, "Maxlen", SKIP_OPEN_TABLE},
@@ -6106,8 +6127,9 @@ ST_FIELD_INFO charsets_fields_info[]=
ST_FIELD_INFO collation_fields_info[]=
{
- {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Collation", SKIP_OPEN_TABLE},
- {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Charset",
+ {"COLLATION_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, "Collation",
+ SKIP_OPEN_TABLE},
+ {"CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, "Charset",
SKIP_OPEN_TABLE},
{"ID", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, "Id",
SKIP_OPEN_TABLE},
@@ -6170,8 +6192,10 @@ ST_FIELD_INFO events_fields_info[]=
ST_FIELD_INFO coll_charset_app_fields_info[]=
{
- {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
+ {"COLLATION_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0,
+ SKIP_OPEN_TABLE},
+ {"CHARACTER_SET_NAME", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0,
+ SKIP_OPEN_TABLE},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
@@ -6200,7 +6224,7 @@ ST_FIELD_INFO proc_fields_info[]=
SKIP_OPEN_TABLE},
{"CREATED", 0, MYSQL_TYPE_DATETIME, 0, 0, "Created", SKIP_OPEN_TABLE},
{"LAST_ALTERED", 0, MYSQL_TYPE_DATETIME, 0, 0, "Modified", 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},
{"ROUTINE_COMMENT", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Comment",
SKIP_OPEN_TABLE},
{"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, "Definer", SKIP_OPEN_TABLE},
@@ -6449,7 +6473,7 @@ ST_FIELD_INFO variables_fields_info[]=
{
{"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name",
SKIP_OPEN_TABLE},
- {"VARIABLE_VALUE", 20480, MYSQL_TYPE_STRING, 0, 1, "Value", SKIP_OPEN_TABLE},
+ {"VARIABLE_VALUE", 1024, MYSQL_TYPE_STRING, 0, 1, "Value", SKIP_OPEN_TABLE},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
@@ -6608,9 +6632,9 @@ ST_SCHEMA_TABLE schema_tables[]=
{"FILES", files_fields_info, create_schema_table,
fill_schema_files, 0, 0, -1, -1, 0, 0},
{"GLOBAL_STATUS", variables_fields_info, create_schema_table,
- fill_status, make_old_format, 0, -1, -1, 0, 0},
+ fill_status, make_old_format, 0, 0, -1, 0, 0},
{"GLOBAL_VARIABLES", variables_fields_info, create_schema_table,
- fill_variables, make_old_format, 0, -1, -1, 0, 0},
+ fill_variables, make_old_format, 0, 0, -1, 0, 0},
{"KEY_COLUMN_USAGE", key_column_usage_fields_info, create_schema_table,
get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0,
OPEN_TABLE_ONLY},
@@ -6635,14 +6659,14 @@ ST_SCHEMA_TABLE schema_tables[]=
{"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table,
fill_schema_schema_privileges, 0, 0, -1, -1, 0, 0},
{"SESSION_STATUS", variables_fields_info, create_schema_table,
- fill_status, make_old_format, 0, -1, -1, 0, 0},
+ fill_status, make_old_format, 0, 0, -1, 0, 0},
{"SESSION_VARIABLES", variables_fields_info, create_schema_table,
- fill_variables, make_old_format, 0, -1, -1, 0, 0},
+ fill_variables, make_old_format, 0, 0, -1, 0, 0},
{"STATISTICS", stat_fields_info, create_schema_table,
get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0,
OPEN_TABLE_ONLY|OPTIMIZE_I_S_TABLE},
{"STATUS", variables_fields_info, create_schema_table, fill_status,
- make_old_format, 0, -1, -1, 1, 0},
+ make_old_format, 0, 0, -1, 1, 0},
{"TABLES", tables_fields_info, create_schema_table,
get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0,
OPTIMIZE_I_S_TABLE},
@@ -6658,7 +6682,7 @@ ST_SCHEMA_TABLE schema_tables[]=
{"USER_PRIVILEGES", user_privileges_fields_info, create_schema_table,
fill_schema_user_privileges, 0, 0, -1, -1, 0, 0},
{"VARIABLES", variables_fields_info, create_schema_table, fill_variables,
- make_old_format, 0, -1, -1, 1, 0},
+ make_old_format, 0, 0, -1, 1, 0},
{"VIEWS", view_fields_info, create_schema_table,
get_all_tables, 0, get_schema_views_record, 1, 2, 0,
OPEN_VIEW_ONLY|OPTIMIZE_I_S_TABLE},
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 0ee9566dc61..ec35616bc89 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4293,6 +4293,12 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
goto send_result;
}
+ if (table->schema_table)
+ {
+ result_code= HA_ADMIN_NOT_IMPLEMENTED;
+ goto send_result;
+ }
+
if ((table->table->db_stat & HA_READ_ONLY) && open_for_modify)
{
/* purecov: begin inspected */
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 32389bde44c..5c8b1d96646 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -682,7 +682,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
trigname.trigger_table.length= tables->table_name_length;
if (sql_create_definition_file(NULL, &trigname_file, &trigname_file_type,
- (uchar*)&trigname, trigname_file_parameters, 0))
+ (uchar*)&trigname, trigname_file_parameters))
return 1;
/*
@@ -800,7 +800,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
/* Create trigger definition file. */
if (!sql_create_definition_file(NULL, &file, &triggers_file_type,
- (uchar*)this, triggers_file_parameters, 0))
+ (uchar*)this, triggers_file_parameters))
return 0;
err_with_cleanup:
@@ -876,8 +876,7 @@ static bool save_trigger_file(Table_triggers_list *triggers, const char *db,
TRG_EXT, 0);
file.str= file_buff;
return sql_create_definition_file(NULL, &file, &triggers_file_type,
- (uchar*)triggers, triggers_file_parameters,
- 0);
+ (uchar*)triggers, triggers_file_parameters);
}
@@ -1806,8 +1805,7 @@ Table_triggers_list::change_table_name_in_trignames(const char *db_name,
trigname.trigger_table= *new_table_name;
if (sql_create_definition_file(NULL, &trigname_file, &trigname_file_type,
- (uchar*)&trigname, trigname_file_parameters,
- 0))
+ (uchar*)&trigname, trigname_file_parameters))
return trigger;
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 197e5290aba..dbdd30552ec 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -715,6 +715,11 @@ int mysql_update(THD *thd,
else
table->file->unlock_row();
thd->row_count++;
+ if (thd->is_error())
+ {
+ error= 1;
+ break;
+ }
}
dup_key_found= 0;
/*
@@ -1470,6 +1475,32 @@ multi_update::initialize_tables(JOIN *join)
}
table->prepare_for_position();
+ /*
+ enable uncacheable flag if we update a view with check option
+ and check option has a subselect, otherwise, the check option
+ can be evaluated after the subselect was freed as independent
+ (See full_local in JOIN::join_free()).
+ */
+ if (table_ref->check_option && !join->select_lex->uncacheable)
+ {
+ SELECT_LEX_UNIT *tmp_unit;
+ SELECT_LEX *sl;
+ for (tmp_unit= join->select_lex->first_inner_unit();
+ tmp_unit;
+ tmp_unit= tmp_unit->next_unit())
+ {
+ for (sl= tmp_unit->first_select(); sl; sl= sl->next_select())
+ {
+ if (sl->master_unit()->item)
+ {
+ join->select_lex->uncacheable|= UNCACHEABLE_CHECKOPTION;
+ goto loop_end;
+ }
+ }
+ }
+ }
+loop_end:
+
if (table == first_table_for_update && table_ref->check_option)
{
table_map unupdated_tables= table_ref->check_option->used_tables() &
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 83e8d5907cf..be66f7c2d80 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -655,7 +655,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
}
VOID(pthread_mutex_unlock(&LOCK_open));
- if (view->revision != 1)
+ if (mode != VIEW_CREATE_NEW)
query_cache_invalidate3(thd, view, 0);
start_waiting_global_read_lock(thd);
if (res)
@@ -673,12 +673,8 @@ err:
}
-/* index of revision number in following table */
-static const int revision_number_position= 8;
/* number of required parameters for making view */
-static const int required_view_parameters= 16;
-/* number of backups */
-static const int num_view_backups= 3;
+static const int required_view_parameters= 14;
/*
table of VIEW .frm field descriptors
@@ -711,9 +707,6 @@ static File_option view_parameters[]=
{{ C_STRING_WITH_LEN("with_check_option")},
my_offsetof(TABLE_LIST, with_check),
FILE_OPTIONS_ULONGLONG},
- {{ C_STRING_WITH_LEN("revision")},
- my_offsetof(TABLE_LIST, revision),
- FILE_OPTIONS_REV},
{{ C_STRING_WITH_LEN("timestamp")},
my_offsetof(TABLE_LIST, timestamp),
FILE_OPTIONS_TIMESTAMP},
@@ -921,18 +914,9 @@ loop_out:
}
/*
- read revision number
-
TODO: read dependence list, too, to process cascade/restrict
TODO: special cascade/restrict procedure for alter?
*/
- if (parser->parse((uchar*)view, thd->mem_root,
- view_parameters + revision_number_position, 1,
- &file_parser_dummy_hook))
- {
- error= thd->is_error() ? -1 : 0;
- goto err;
- }
}
else
{
@@ -997,7 +981,7 @@ loop_out:
}
if (sql_create_definition_file(&dir, &file, view_file_type,
- (uchar*)view, view_parameters, num_view_backups))
+ (uchar*)view, view_parameters))
{
error= thd->is_error() ? -1 : 1;
goto err;
@@ -1065,8 +1049,9 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
if (table->index_hints && table->index_hints->elements)
{
- my_error(ER_WRONG_USAGE, MYF(0), "index hints", "VIEW");
- DBUG_RETURN(TRUE);
+ my_error(ER_KEY_DOES_NOT_EXITS, MYF(0),
+ table->index_hints->head()->key_name.str, table->table_name);
+ DBUG_RETURN(TRUE);
}
/* check loop via view definition */
@@ -1963,8 +1948,7 @@ mysql_rename_view(THD *thd,
goto err;
/* rename view and it's backups */
- if (rename_in_schema_file(thd, view->db, view->table_name, new_name,
- view_def.revision - 1, num_view_backups))
+ if (rename_in_schema_file(thd, view->db, view->table_name, new_name))
goto err;
dir.str= dir_buff;
@@ -1979,12 +1963,10 @@ mysql_rename_view(THD *thd,
file.length= pathstr.length - dir.length;
if (sql_create_definition_file(&dir, &file, view_file_type,
- (uchar*)&view_def, view_parameters,
- num_view_backups))
+ (uchar*)&view_def, view_parameters))
{
/* restore renamed view in case of error */
- rename_in_schema_file(thd, view->db, new_name, view->table_name,
- view_def.revision - 1, num_view_backups);
+ rename_in_schema_file(thd, view->db, new_name, view->table_name);
goto err;
}
} else
diff --git a/sql/table.h b/sql/table.h
index ccd6b60664e..77bd7bb9e77 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1244,7 +1244,6 @@ struct TABLE_LIST
st_lex_user definer; /* definer of view */
ulonglong file_version; /* version of file's field set */
ulonglong updatable_view; /* VIEW can be updated */
- ulonglong revision; /* revision control number */
/**
@brief The declared algorithm, if this is a view.
@details One of
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 1028cfb7c1b..53870915973 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -1072,6 +1072,7 @@ Time_zone_system::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
localtime_r(&tmp_t, &tmp_tm);
localtime_to_TIME(tmp, &tmp_tm);
tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
+ adjust_leap_second(tmp);
}
@@ -1156,6 +1157,7 @@ Time_zone_utc::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
gmtime_r(&tmp_t, &tmp_tm);
localtime_to_TIME(tmp, &tmp_tm);
tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
+ adjust_leap_second(tmp);
}
@@ -1259,6 +1261,7 @@ void
Time_zone_db::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
{
::gmt_sec_to_TIME(tmp, t, tz_info);
+ adjust_leap_second(tmp);
}
@@ -2279,6 +2282,24 @@ my_tz_find(THD *thd, const String *name)
}
+/**
+ Convert leap seconds into non-leap
+
+ This function will convert the leap seconds added by the OS to
+ non-leap seconds, e.g. 23:59:59, 23:59:60 -> 23:59:59, 00:00:01 ...
+ This check is not checking for years on purpose : although it's not a
+ complete check this way it doesn't require looking (and having installed)
+ the leap seconds table.
+
+ @param[in,out] broken down time structure as filled in by the OS
+*/
+
+void Time_zone::adjust_leap_second(MYSQL_TIME *t)
+{
+ if (t->second == 60 || t->second == 61)
+ t->second= 59;
+}
+
#endif /* !defined(TESTTIME) && !defined(TZINFO2SQL) */
diff --git a/sql/tztime.h b/sql/tztime.h
index 3d77a3eefa3..9bf103519c4 100644
--- a/sql/tztime.h
+++ b/sql/tztime.h
@@ -55,6 +55,9 @@ public:
allocated on MEM_ROOT and should not require destruction.
*/
virtual ~Time_zone() {};
+
+protected:
+ static inline void adjust_leap_second(MYSQL_TIME *t);
};
extern Time_zone * my_tz_UTC;
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index a50b009303a..94ede2a625b 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -17576,6 +17576,87 @@ static void test_bug38486(void)
DBUG_VOID_RETURN;
}
+static void test_bug40365(void)
+{
+ uint rc, i;
+ MYSQL_STMT *stmt= 0;
+ MYSQL_BIND my_bind[2];
+ my_bool is_null[2]= {0};
+ MYSQL_TIME tm[2];
+
+ DBUG_ENTER("test_bug40365");
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+ rc= mysql_query(mysql, "CREATE TABLE t1(c1 DATETIME, \
+ c2 DATE)");
+ myquery(rc);
+
+ stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 VALUES(?, ?)");
+ check_stmt(stmt);
+ verify_param_count(stmt, 2);
+
+ bzero((char*) my_bind, sizeof(my_bind));
+ my_bind[0].buffer_type= MYSQL_TYPE_DATETIME;
+ my_bind[1].buffer_type= MYSQL_TYPE_DATE;
+ for (i= 0; i < (int) array_elements(my_bind); i++)
+ {
+ my_bind[i].buffer= (void *) &tm[i];
+ my_bind[i].is_null= &is_null[i];
+ }
+
+ rc= mysql_stmt_bind_param(stmt, my_bind);
+ check_execute(stmt, rc);
+
+ for (i= 0; i < (int) array_elements(my_bind); i++)
+ {
+ tm[i].neg= 0;
+ tm[i].second_part= 0;
+ tm[i].year= 2009;
+ tm[i].month= 2;
+ tm[i].day= 29;
+ tm[i].hour= 0;
+ tm[i].minute= 0;
+ tm[i].second= 0;
+ }
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_commit(mysql);
+ myquery(rc);
+ mysql_stmt_close(stmt);
+
+ stmt= mysql_simple_prepare(mysql, "SELECT * FROM t1");
+ check_stmt(stmt);
+
+ rc= mysql_stmt_bind_result(stmt, my_bind);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_store_result(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_fetch(stmt);
+ check_execute(stmt, rc);
+
+ if (!opt_silent)
+ fprintf(stdout, "\n");
+
+ for (i= 0; i < array_elements(my_bind); i++)
+ {
+ if (!opt_silent)
+ fprintf(stdout, "\ntime[%d]: %02d-%02d-%02d ",
+ i, tm[i].year, tm[i].month, tm[i].day);
+ DIE_UNLESS(tm[i].year == 0);
+ DIE_UNLESS(tm[i].month == 0);
+ DIE_UNLESS(tm[i].day == 0);
+ }
+ mysql_stmt_close(stmt);
+
+ DBUG_VOID_RETURN;
+}
/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -17885,6 +17966,7 @@ static struct my_tests_st my_tests[]= {
{ "test_wl4166_1", test_wl4166_1 },
{ "test_wl4166_2", test_wl4166_2 },
{ "test_bug38486", test_bug38486 },
+ { "test_bug40365", test_bug40365 },
{ 0, 0 }
};