diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-04-26 23:05:26 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-04-26 23:05:26 +0200 |
commit | 872649c7baab3a9f7efdda78e49c4bc7dd481d91 (patch) | |
tree | 4fffb1a99ca36ccea65e64bcaa81293c40e7539f | |
parent | 4995bcffaded6a02106632fb8f259cd3d9048dc4 (diff) | |
parent | 4f1ad43992d75676687f29da96dd7c4147247a8f (diff) | |
download | mariadb-git-872649c7baab3a9f7efdda78e49c4bc7dd481d91.tar.gz |
Merge branch '5.5' into 10.0
109 files changed, 1309 insertions, 319 deletions
@@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=0 -MYSQL_VERSION_PATCH=24 +MYSQL_VERSION_PATCH=25 diff --git a/client/client_priv.h b/client/client_priv.h index 67a6e822ea3..3905f323156 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -1,5 +1,6 @@ /* Copyright (c) 2001, 2012, Oracle and/or its affiliates. + Copyright (c) 2009, 2016, MariaDB 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 diff --git a/client/mysql.cc b/client/mysql.cc index ea7d17abafc..89f9a75ec11 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1,7 +1,6 @@ /* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2013, Monty Program Ab. - Copyright (c) 2013, 2014, SkySQL Ab + Copyright (c) 2009, 2016, MariaDB 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 @@ -96,9 +95,16 @@ extern "C" { #endif } -#if !defined(HAVE_VIDATTR) -#undef vidattr -#define vidattr(A) {} // Can't get this to work +#ifdef HAVE_VIDATTR +static int have_curses= 0; +static void my_vidattr(chtype attrs) +{ + if (have_curses) + vidattr(attrs); +} +#else +#undef HAVE_SETUPTERM +#define my_vidattr(A) {} // Can't get this to work #endif #ifdef FN_NO_CASE_SENSE @@ -4740,9 +4746,9 @@ com_status(String *buffer __attribute__((unused)), if (skip_updates) { - vidattr(A_BOLD); + my_vidattr(A_BOLD); tee_fprintf(stdout, "\nAll updates ignored to this database\n"); - vidattr(A_NORMAL); + my_vidattr(A_NORMAL); } #ifdef USE_POPEN tee_fprintf(stdout, "Current pager:\t\t%s\n", pager); @@ -4810,9 +4816,9 @@ com_status(String *buffer __attribute__((unused)), } if (safe_updates) { - vidattr(A_BOLD); + my_vidattr(A_BOLD); tee_fprintf(stdout, "\nNote that you are running in safe_update_mode:\n"); - vidattr(A_NORMAL); + my_vidattr(A_NORMAL); tee_fprintf(stdout, "\ UPDATEs and DELETEs that don't use a key in the WHERE clause are not allowed.\n\ (One can force an UPDATE/DELETE by adding LIMIT # at the end of the command.)\n\ @@ -4905,10 +4911,11 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate) { if (!inited) { - inited=1; #ifdef HAVE_SETUPTERM - (void) setupterm((char *)0, 1, (int *) 0); + int errret; + have_curses= setupterm((char *)0, 1, &errret) != ERR; #endif + inited=1; } if (info_type == INFO_ERROR) { @@ -4920,7 +4927,7 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate) putchar('\a'); /* This should make a bell */ #endif } - vidattr(A_STANDOUT); + my_vidattr(A_STANDOUT); if (error) { if (sqlstate) @@ -4939,9 +4946,9 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate) tee_fputs(": ", file); } else - vidattr(A_BOLD); + my_vidattr(A_BOLD); (void) tee_puts(str, file); - vidattr(A_NORMAL); + my_vidattr(A_NORMAL); } if (unbuffered) fflush(file); diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 06b6f991567..737f9c9c8d7 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -1,6 +1,6 @@ /* Copyright (c) 2006, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2015, MariaDB + Copyright (c) 2010, 2016, MariaDB 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 diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index bc6b68c63d1..daffdefd768 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2010, 2015, MariaDB + Copyright (c) 2010, 2016, MariaDB 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 diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 3b374f3975e..fbfdedd52ed 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2015, MariaDB + Copyright (c) 2010, 2016, MariaDB 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 diff --git a/client/mysqldump.c b/client/mysqldump.c index e41305d7c07..dc6798560c3 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2015, Monty Program Ab. + Copyright (c) 2010, 2016, MariaDB 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 diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 2363f1b69df..5b15155e039 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2011, 2015, MariaDB + Copyright (c) 2011, 2016, MariaDB 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 diff --git a/client/mysqlshow.c b/client/mysqlshow.c index fd81f18790a..444278d40f1 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2015, MariaDB + Copyright (c) 2010, 2016, MariaDB 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 diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 29919f3028d..b3229980e77 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2015, MariaDB + Copyright (c) 2010, 2016, MariaDB 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 diff --git a/client/mysqltest.cc b/client/mysqltest.cc index ec5bf0957df..84d5abc1a67 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2009, 2013, Monty Program Ab. + Copyright (c) 2009, 2016, Monty Program Ab. 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 diff --git a/debian/mariadb-test-10.0.dirs b/debian/mariadb-test-10.0.dirs index f45bf43f7e9..65dbbc81c2a 100644 --- a/debian/mariadb-test-10.0.dirs +++ b/debian/mariadb-test-10.0.dirs @@ -50,8 +50,6 @@ usr/share/mysql/mysql-test/suite/ndb usr/share/mysql/mysql-test/suite/ndb/t usr/share/mysql/mysql-test/suite/ndb/r usr/share/mysql/mysql-test/suite/maria -usr/share/mysql/mysql-test/suite/maria/t -usr/share/mysql/mysql-test/suite/maria/r usr/share/mysql/mysql-test/suite/funcs_2 usr/share/mysql/mysql-test/suite/funcs_2/lib usr/share/mysql/mysql-test/suite/funcs_2/t diff --git a/extra/yassl/README b/extra/yassl/README index 81d573d0b20..b5eb88824fb 100644 --- a/extra/yassl/README +++ b/extra/yassl/README @@ -12,6 +12,12 @@ before calling SSL_new(); *** end Note *** +yaSSL Release notes, version 2.3.9b (2/03/2016) + This release of yaSSL fixes the OpenSSL compatibility function + X509_NAME_get_index_by_NID() to use the actual index of the common name + instead of searching on the format prefix. Thanks for the report from + yashwant.sahu@oracle.com . Anyone using this function should update. + yaSSL Release notes, version 2.3.9 (12/01/2015) This release of yaSSL fixes two client side Diffie-Hellman problems. yaSSL was only handling the cases of zero or one leading zeros for the key diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h index 84ce40b8415..c95eb1ed887 100644 --- a/extra/yassl/include/openssl/ssl.h +++ b/extra/yassl/include/openssl/ssl.h @@ -34,7 +34,7 @@ #include "rsa.h" -#define YASSL_VERSION "2.3.9" +#define YASSL_VERSION "2.3.9b" #if defined(__cplusplus) diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp index 269976a6eaa..781eaa38dda 100644 --- a/extra/yassl/include/yassl_int.hpp +++ b/extra/yassl/include/yassl_int.hpp @@ -191,14 +191,18 @@ private: class X509_NAME { char* name_; size_t sz_; + int cnPosition_; // start of common name, -1 is none + int cnLen_; // length of above ASN1_STRING entry_; public: - X509_NAME(const char*, size_t sz); + X509_NAME(const char*, size_t sz, int pos, int len); ~X509_NAME(); const char* GetName() const; ASN1_STRING* GetEntry(int i); size_t GetLength() const; + int GetCnPosition() const { return cnPosition_; } + int GetCnLength() const { return cnLen_; } private: X509_NAME(const X509_NAME&); // hide copy X509_NAME& operator=(const X509_NAME&); // and assign @@ -226,7 +230,7 @@ class X509 { StringHolder afterDate_; // not valid after public: X509(const char* i, size_t, const char* s, size_t, - ASN1_STRING *b, ASN1_STRING *a); + ASN1_STRING *b, ASN1_STRING *a, int, int, int, int); ~X509() {} X509_NAME* GetIssuer(); diff --git a/extra/yassl/src/cert_wrapper.cpp b/extra/yassl/src/cert_wrapper.cpp index af94f5bc24f..1092e428351 100644 --- a/extra/yassl/src/cert_wrapper.cpp +++ b/extra/yassl/src/cert_wrapper.cpp @@ -304,7 +304,10 @@ int CertManager::Validate() afterDate.type= cert.GetAfterDateType(); afterDate.length= strlen((char *) afterDate.data) + 1; peerX509_ = NEW_YS X509(cert.GetIssuer(), iSz, cert.GetCommonName(), - sSz, &beforeDate, &afterDate); + sSz, &beforeDate, &afterDate, + cert.GetIssuerCnStart(), cert.GetIssuerCnLength(), + cert.GetSubjectCnStart(), cert.GetSubjectCnLength() + ); if (err == TaoCrypt::SIG_OTHER_E && verifyCallback_) { X509_STORE_CTX store; @@ -350,7 +353,9 @@ int CertManager::SetPrivateKey(const x509& key) afterDate.type= cd.GetAfterDateType(); afterDate.length= strlen((char *) afterDate.data) + 1; selfX509_ = NEW_YS X509(cd.GetIssuer(), iSz, cd.GetCommonName(), - sSz, &beforeDate, &afterDate); + sSz, &beforeDate, &afterDate, + cd.GetIssuerCnStart(), cd.GetIssuerCnLength(), + cd.GetSubjectCnStart(), cd.GetSubjectCnLength()); } return 0; } @@ -367,7 +372,9 @@ void CertManager::setPeerX509(X509* x) ASN1_STRING* after = x->GetAfter(); peerX509_ = NEW_YS X509(issuer->GetName(), issuer->GetLength(), - subject->GetName(), subject->GetLength(), before, after); + subject->GetName(), subject->GetLength(), before, after, + issuer->GetCnPosition(), issuer->GetCnLength(), + subject->GetCnPosition(), subject->GetCnLength()); } diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp index 26a02afcacf..57542f174c9 100644 --- a/extra/yassl/src/ssl.cpp +++ b/extra/yassl/src/ssl.cpp @@ -1351,15 +1351,13 @@ int ASN1_STRING_type(ASN1_STRING *x) int X509_NAME_get_index_by_NID(X509_NAME* name,int nid, int lastpos) { int idx = -1; // not found - const char* start = &name->GetName()[lastpos + 1]; + int cnPos = -1; switch (nid) { case NID_commonName: - const char* found = strstr(start, "/CN="); - if (found) { - found += 4; // advance to str - idx = found - start + lastpos + 1; - } + cnPos = name->GetCnPosition(); + if (lastpos < cnPos) + idx = cnPos; break; } @@ -1471,10 +1469,6 @@ int SSL_peek(SSL* ssl, void* buffer, int sz) int SSL_pending(SSL* ssl) { - // Just in case there's pending data that hasn't been processed yet... - char c; - SSL_peek(ssl, &c, 1); - return ssl->bufferedData(); } diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index a38b7a5c81f..ff9c8155d0c 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -1554,8 +1554,9 @@ void SSL_SESSION::CopyX509(X509* x) ASN1_TIME* after = x->GetAfter(); peerX509_ = NEW_YS X509(issuer->GetName(), issuer->GetLength(), - subject->GetName(), subject->GetLength(), - before, after); + subject->GetName(), subject->GetLength(), before, after, + issuer->GetCnPosition(), issuer->GetCnLength(), + subject->GetCnPosition(), subject->GetCnLength()); } @@ -2472,8 +2473,8 @@ void Security::set_resuming(bool b) } -X509_NAME::X509_NAME(const char* n, size_t sz) - : name_(0), sz_(sz) +X509_NAME::X509_NAME(const char* n, size_t sz, int pos, int len) + : name_(0), sz_(sz), cnPosition_(pos), cnLen_(len) { if (sz) { name_ = NEW_YS char[sz]; @@ -2503,8 +2504,10 @@ size_t X509_NAME::GetLength() const X509::X509(const char* i, size_t iSz, const char* s, size_t sSz, - ASN1_STRING *b, ASN1_STRING *a) - : issuer_(i, iSz), subject_(s, sSz), + ASN1_STRING *b, ASN1_STRING *a, + int issPos, int issLen, + int subPos, int subLen) + : issuer_(i, iSz, issPos, issLen), subject_(s, sSz, subPos, subLen), beforeDate_((char *) b->data, b->length, b->type), afterDate_((char *) a->data, a->length, a->type) {} @@ -2539,17 +2542,19 @@ ASN1_STRING* X509_NAME::GetEntry(int i) if (i < 0 || i >= int(sz_)) return 0; + if (i != cnPosition_ || cnLen_ <= 0) // only entry currently supported + return 0; + + if (cnLen_ > int(sz_-i)) // make sure there's room in read buffer + return 0; + if (entry_.data) ysArrayDelete(entry_.data); - entry_.data = NEW_YS byte[sz_]; // max size; + entry_.data = NEW_YS byte[cnLen_+1]; // max size; - memcpy(entry_.data, &name_[i], sz_ - i); - if (entry_.data[sz_ -i - 1]) { - entry_.data[sz_ - i] = 0; - entry_.length = int(sz_) - i; - } - else - entry_.length = int(sz_) - i - 1; + memcpy(entry_.data, &name_[i], cnLen_); + entry_.data[cnLen_] = 0; + entry_.length = cnLen_; entry_.type = 0; return &entry_; diff --git a/extra/yassl/taocrypt/include/asn.hpp b/extra/yassl/taocrypt/include/asn.hpp index 2854b8fe06d..999e853b941 100644 --- a/extra/yassl/taocrypt/include/asn.hpp +++ b/extra/yassl/taocrypt/include/asn.hpp @@ -285,6 +285,10 @@ public: byte GetBeforeDateType() const { return beforeDateType_; } const char* GetAfterDate() const { return afterDate_; } byte GetAfterDateType() const { return afterDateType_; } + int GetSubjectCnStart() const { return subCnPos_; } + int GetIssuerCnStart() const { return issCnPos_; } + int GetSubjectCnLength() const { return subCnLen_; } + int GetIssuerCnLength() const { return issCnLen_; } void DecodeToKey(); private: @@ -294,6 +298,10 @@ private: word32 sigLength_; // length of signature word32 signatureOID_; // sum of algorithm object id word32 keyOID_; // sum of key algo object id + int subCnPos_; // subject common name start, -1 is none + int subCnLen_; // length of above + int issCnPos_; // issuer common name start, -1 is none + int issCnLen_; // length of above byte subjectHash_[SHA_SIZE]; // hash of all Names byte issuerHash_[SHA_SIZE]; // hash of all Names byte* signature_; diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp index d8b133a3f0a..0474e7c21d5 100644 --- a/extra/yassl/taocrypt/src/asn.cpp +++ b/extra/yassl/taocrypt/src/asn.cpp @@ -482,8 +482,9 @@ void DH_Decoder::Decode(DH& key) CertDecoder::CertDecoder(Source& s, bool decode, SignerList* signers, bool noVerify, CertType ct) - : BER_Decoder(s), certBegin_(0), sigIndex_(0), sigLength_(0), - signature_(0), verify_(!noVerify) + : BER_Decoder(s), certBegin_(0), sigIndex_(0), sigLength_(0), subCnPos_(-1), + subCnLen_(0), issCnPos_(-1), issCnLen_(0), signature_(0), + verify_(!noVerify) { issuer_[0] = 0; subject_[0] = 0; @@ -804,6 +805,13 @@ void CertDecoder::GetName(NameType nt) case COMMON_NAME: if (!(ptr = AddTag(ptr, buf_end, "/CN=", 4, strLen))) return; + if (nt == ISSUER) { + issCnPos_ = (int)(ptr - strLen - issuer_); + issCnLen_ = (int)strLen; + } else { + subCnPos_ = (int)(ptr - strLen - subject_); + subCnLen_ = (int)strLen; + } break; case SUR_NAME: if (!(ptr = AddTag(ptr, buf_end, "/SN=", 4, strLen))) diff --git a/extra/yassl/testsuite/test.hpp b/extra/yassl/testsuite/test.hpp index 52f6ed79526..5374edd0e2a 100644 --- a/extra/yassl/testsuite/test.hpp +++ b/extra/yassl/testsuite/test.hpp @@ -470,10 +470,28 @@ inline void showPeer(SSL* ssl) char* issuer = X509_NAME_oneline(X509_get_issuer_name(peer), 0, 0); char* subject = X509_NAME_oneline(X509_get_subject_name(peer), 0, 0); - printf("peer's cert info:\n issuer : %s\n subject: %s\n", issuer, - subject); + X509_NAME_ENTRY* se = NULL; + ASN1_STRING* sd = NULL; + char* subCN = NULL; + + X509_NAME* sub = X509_get_subject_name(peer); + int lastpos = -1; + if (sub) + lastpos = X509_NAME_get_index_by_NID(sub, NID_commonName, lastpos); + if (lastpos >= 0) { + se = X509_NAME_get_entry(sub, lastpos); + if (se) + sd = X509_NAME_ENTRY_get_data(se); + if (sd) + subCN = (char*)ASN1_STRING_data(sd); + } + + printf("peer's cert info:\n issuer : %s\n subject: %s\n" + " subject cn: %s\n", issuer, subject, subCN); + free(subject); free(issuer); + } else printf("peer has no cert!\n"); diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 7dfc572b281..417f91c7879 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -274,6 +274,25 @@ SET(CLIENT_API_FUNCTIONS ) IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + IF (NOT DISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING) + + INCLUDE (CheckCSourceCompiles) + FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.ld" + "VERSION {\nlibmysqlclient_18 {\nglobal: *;\n};\n}\n") + SET(CMAKE_REQUIRED_LIBRARIES "-Wl,src.ld") + CHECK_C_SOURCE_COMPILES("int main() { return 0; }" + SUPPORTS_VERSION_IN_LINK_SCRIPT) + SET(CMAKE_REQUIRED_LIBRARIES) + + IF (NOT SUPPORTS_VERSION_IN_LINK_SCRIPT) + # https://sourceware.org/bugzilla/show_bug.cgi?id=16895 + MESSAGE(SEND_ERROR "Your current linker does not support VERSION " + "command in linker scripts like a GNU ld or any compatible linker " + "should. Perhaps you're using gold? Either switch to GNU ld compatible " + "linker or run cmake with -DDISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING=TRUE " + "to be able to complete the build") + ENDIF (NOT SUPPORTS_VERSION_IN_LINK_SCRIPT) + # When building RPM, or DEB package on Debian, use ELF symbol versioning # for compatibility with distribution packages, so client shared library can # painlessly replace the one supplied by the distribution. @@ -358,14 +377,26 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") make_scrambled_password_323 ) - # Linker script to version symbols in Fedora- and Debian- compatible way, MDEV-5529 - SET(VERSION_SCRIPT_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/libmysql_versions.ld.in) - # Generate version script. # Create semicolon separated lists of functions to export from # Since RPM packages use separate versioning for 5.1 API # and 5.5 API (libmysqlclient_16 vs libmysqlclient_18), # we need 2 lists. + SET (VERSION_HEADER +"VERSION { + libmysqlclient_18 { + global:") + SET (VERSION_FOOTER +" local: + *; + }; + + libmysqlclient_16 { + /* empty here. aliases are added above */ + }; +} +") + SET (CLIENT_API_5_1_LIST) SET (CLIENT_API_5_1_ALIASES) FOREACH (f ${CLIENT_API_FUNCTIONS_5_1} ${CLIENT_API_5_1_EXTRA}) @@ -378,6 +409,13 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET(CLIENT_API_5_5_LIST "${CLIENT_API_5_5_LIST}\t${f};\n") ENDFOREACH() + ELSE (NOT DISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING) + SET (CLIENT_API_5_1_ALIASES "/* Versioning disabled per user request. MDEV-5982 */") + ENDIF (NOT DISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING) + + # Linker script to version symbols in Fedora- and Debian- compatible way, MDEV-5529 + SET(VERSION_SCRIPT_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/libmysql_versions.ld.in) + CONFIGURE_FILE( ${VERSION_SCRIPT_TEMPLATE} ${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld @@ -386,7 +424,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET(VERSION_SCRIPT_LINK_FLAGS "-Wl,${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld") -ENDIF() +ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET(CLIENT_SOURCES diff --git a/libmysql/libmysql_versions.ld.in b/libmysql/libmysql_versions.ld.in index 8d97da5b2eb..0cf5b45cc18 100644 --- a/libmysql/libmysql_versions.ld.in +++ b/libmysql/libmysql_versions.ld.in @@ -27,19 +27,7 @@ mysql_get_charset_by_csname = get_charset_by_csname; mysql_net_realloc = net_realloc; mysql_client_errors = client_errors; -VERSION { - -libmysqlclient_18 { - global: +@VERSION_HEADER@ @CLIENT_API_5_1_LIST@ @CLIENT_API_5_5_LIST@ - - local: - *; -}; - -libmysqlclient_16 { - /* empty here. aliases are added above */ -}; - -} +@VERSION_FOOTER@ diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc index 9e59f54a8b3..47b52be9cec 100644 --- a/mysql-test/include/ctype_numconv.inc +++ b/mysql-test/include/ctype_numconv.inc @@ -1819,6 +1819,12 @@ DROP FUNCTION f1; DROP TABLE t1; --echo # +--echo # MDEV-9662 Assertion `precision || !scale' failed in my_decimal_precision_to_length_no_truncation(uint, uint8, bool) +--echo # +SELECT @@collation_connection; +SELECT CASE 1 WHEN 2 THEN ( - '3' ) END; + +--echo # --echo # MDEV-5702 Incorrect results are returned with NULLIF() --echo # CREATE TABLE t1 (d DATE); diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 505d655b6bb..b06ec5805a0 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -502,3 +502,9 @@ a SELECT * FROM t1 WHERE a IN (0.8,0.9); a DROP TABLE t1; +# +# MDEV-9372 select 100 between 1 and 9223372036854775808 returns false +# +SELECT 100 BETWEEN 1 AND 9223372036854775808; +100 BETWEEN 1 AND 9223372036854775808 +1 diff --git a/mysql-test/r/cache_temporal_4265.result b/mysql-test/r/cache_temporal_4265.result index b8f13e465de..980bb957e19 100644 --- a/mysql-test/r/cache_temporal_4265.result +++ b/mysql-test/r/cache_temporal_4265.result @@ -8,4 +8,17 @@ a Warnings: Note 1003 2000-01-01 Note 1003 2000-01-06 +set debug_dbug=''; +drop table t1; +create table t1 (id int not null, ut timestamp(6) not null); +insert into t1 values(1, '2001-01-01 00:00:00.2'); +insert into t1 values(1, '2001-01-01 00:00:00.1'); +select * from t1; +id ut +1 2001-01-01 00:00:00.200000 +1 2001-01-01 00:00:00.100000 +select (select max(m2.ut) from t1 m2 where m1.id <> 0) from t1 m1; +(select max(m2.ut) from t1 m2 where m1.id <> 0) +2001-01-01 00:00:00.200000 +2001-01-01 00:00:00.200000 drop table t1; diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index 3852da5d4b0..274d5da7d1c 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -231,3 +231,16 @@ case t1.f1 when '00:00:00' then 1 end 1 NULL drop table t1; +# +# MDEV-9745 Crash with CASE WHEN TRUE THEN COALESCE(CAST(NULL AS UNSIGNED)) ELSE 4 END +# +CREATE TABLE t1 SELECT CASE WHEN TRUE THEN COALESCE(CAST(NULL AS UNSIGNED)) ELSE 4 END AS a; +DESCRIBE t1; +Field Type Null Key Default Extra +a decimal(1,0) YES NULL +DROP TABLE t1; +CREATE TABLE t1 SELECT CASE WHEN TRUE THEN COALESCE(CAST(NULL AS UNSIGNED)) ELSE 40 END AS a; +DESCRIBE t1; +Field Type Null Key Default Extra +a decimal(2,0) YES NULL +DROP TABLE t1; diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result index aead73b3090..48b481883ca 100644 --- a/mysql-test/r/ctype_binary.result +++ b/mysql-test/r/ctype_binary.result @@ -2887,6 +2887,15 @@ f1() DROP FUNCTION f1; DROP TABLE t1; # +# MDEV-9662 Assertion `precision || !scale' failed in my_decimal_precision_to_length_no_truncation(uint, uint8, bool) +# +SELECT @@collation_connection; +@@collation_connection +binary +SELECT CASE 1 WHEN 2 THEN ( - '3' ) END; +CASE 1 WHEN 2 THEN ( - '3' ) END +NULL +# # MDEV-5702 Incorrect results are returned with NULLIF() # CREATE TABLE t1 (d DATE); diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index f7952a18f58..9d5dea2f286 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -3279,6 +3279,15 @@ f1() DROP FUNCTION f1; DROP TABLE t1; # +# MDEV-9662 Assertion `precision || !scale' failed in my_decimal_precision_to_length_no_truncation(uint, uint8, bool) +# +SELECT @@collation_connection; +@@collation_connection +cp1251_general_ci +SELECT CASE 1 WHEN 2 THEN ( - '3' ) END; +CASE 1 WHEN 2 THEN ( - '3' ) END +NULL +# # MDEV-5702 Incorrect results are returned with NULLIF() # CREATE TABLE t1 (d DATE); diff --git a/mysql-test/r/ctype_cp850.result b/mysql-test/r/ctype_cp850.result new file mode 100644 index 00000000000..c028f72b58a --- /dev/null +++ b/mysql-test/r/ctype_cp850.result @@ -0,0 +1,14 @@ +# +# Start of 5.5 tests +# +# +# MDEV-9862 Illegal mix of collation, when comparing column with CASE expression +# +SET NAMES cp850; +CREATE TABLE t1 (a CHAR(1) CHARACTER SET latin1); +SELECT a FROM t1 WHERE CASE a WHEN 'aaaa' THEN 'Y' WHEN 'aaaa' THEN 'Y' ELSE NULL END <> a; +a +DROP TABLE t1; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index 383ea3ca8f2..eee915267d5 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -3563,6 +3563,15 @@ f1() DROP FUNCTION f1; DROP TABLE t1; # +# MDEV-9662 Assertion `precision || !scale' failed in my_decimal_precision_to_length_no_truncation(uint, uint8, bool) +# +SELECT @@collation_connection; +@@collation_connection +latin1_swedish_ci +SELECT CASE 1 WHEN 2 THEN ( - '3' ) END; +CASE 1 WHEN 2 THEN ( - '3' ) END +NULL +# # MDEV-5702 Incorrect results are returned with NULLIF() # CREATE TABLE t1 (d DATE); diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 68435f3f41c..6b3d87b79e1 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -4470,6 +4470,15 @@ f1() DROP FUNCTION f1; DROP TABLE t1; # +# MDEV-9662 Assertion `precision || !scale' failed in my_decimal_precision_to_length_no_truncation(uint, uint8, bool) +# +SELECT @@collation_connection; +@@collation_connection +ucs2_general_ci +SELECT CASE 1 WHEN 2 THEN ( - '3' ) END; +CASE 1 WHEN 2 THEN ( - '3' ) END +NULL +# # MDEV-5702 Incorrect results are returned with NULLIF() # CREATE TABLE t1 (d DATE); diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 532c54dd79e..4123b06b0a7 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -5338,6 +5338,15 @@ f1() DROP FUNCTION f1; DROP TABLE t1; # +# MDEV-9662 Assertion `precision || !scale' failed in my_decimal_precision_to_length_no_truncation(uint, uint8, bool) +# +SELECT @@collation_connection; +@@collation_connection +utf8_general_ci +SELECT CASE 1 WHEN 2 THEN ( - '3' ) END; +CASE 1 WHEN 2 THEN ( - '3' ) END +NULL +# # MDEV-5702 Incorrect results are returned with NULLIF() # CREATE TABLE t1 (d DATE); diff --git a/mysql-test/r/fulltext3.result b/mysql-test/r/fulltext3.result index 4ec48369ad1..c0b871cd5a7 100644 --- a/mysql-test/r/fulltext3.result +++ b/mysql-test/r/fulltext3.result @@ -15,3 +15,15 @@ CREATE TABLE t1(a VARCHAR(2) CHARACTER SET big5 COLLATE big5_chinese_ci, FULLTEXT(a)); INSERT INTO t1 VALUES(0xA3C2); DROP TABLE t1; +create table t1 ( +id varchar(255), +business_name text null collate utf8mb4_unicode_ci, +street_address text, +fulltext index ft (business_name), +fulltext index ft2 (street_address) +); +select * from t1 where match (business_name, street_address) against ('some business name and address here'); +ERROR HY000: Can't find FULLTEXT index matching the column list +select * from t1 where match (business_name, street_address) against ('some business name and address here' in boolean mode); +id business_name street_address +drop table t1; diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 3631af8a22f..1259661f0b6 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -660,9 +660,14 @@ ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 DIV CREATE TABLE t1(a BIGINT, b BIGINT UNSIGNED); INSERT INTO t1 VALUES(-9223372036854775808, 9223372036854775809); SELECT -a FROM t1; -ERROR 22003: BIGINT value is out of range in '-(-9223372036854775808)' +ERROR 22003: BIGINT value is out of range in '-(`test`.`t1`.`a`)' SELECT -b FROM t1; -ERROR 22003: BIGINT value is out of range in '-(9223372036854775809)' +ERROR 22003: BIGINT value is out of range in '-(`test`.`t1`.`b`)' +INSERT INTO t1 VALUES(0,0); +SELECT -a FROM t1; +ERROR 22003: BIGINT value is out of range in '-(`test`.`t1`.`a`)' +SELECT -b FROM t1; +ERROR 22003: BIGINT value is out of range in '-(`test`.`t1`.`b`)' DROP TABLE t1; SET @a:=999999999999999999999999999999999999999999999999999999999999999999999999999999999; SELECT @a + @a; diff --git a/mysql-test/r/insert_innodb.result b/mysql-test/r/insert_innodb.result new file mode 100644 index 00000000000..ffba9388ec4 --- /dev/null +++ b/mysql-test/r/insert_innodb.result @@ -0,0 +1,30 @@ +# +# BUG#22037930: INSERT IGNORE FAILS TO IGNORE +# FOREIGN KEY CONSTRAINT +# Setup. +CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE=INNODB; +CREATE TABLE t2 (fld2 INT, FOREIGN KEY (fld2) REFERENCES t1 (fld1)) +ENGINE=INNODB; +INSERT INTO t1 VALUES(0); +INSERT INTO t2 VALUES(0); +# Without fix, an error is reported. +INSERT IGNORE INTO t2 VALUES(1); +Warnings: +Warning 1452 Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)) +UPDATE IGNORE t2 SET fld2=20 WHERE fld2=0; +UPDATE IGNORE t1 SET fld1=20 WHERE fld1=0; +# Test for multi update. +UPDATE IGNORE t1, t2 SET t2.fld2= t2.fld2 + 3; +UPDATE IGNORE t1, t2 SET t1.fld1= t1.fld1 + 3; +# Reports an error since IGNORE is not used. +INSERT INTO t2 VALUES(1); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)) +UPDATE t2 SET fld2=20 WHERE fld2=0; +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)) +UPDATE t1 SET fld1=20 WHERE fld1=0; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)) +UPDATE t1, t2 SET t2.fld2= t2.fld2 + 3; +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)) +UPDATE t1, t2 SET t1.fld1= t1.fld1 + 3; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)) +DROP TABLE t2, t1; diff --git a/mysql-test/r/locale.result b/mysql-test/r/locale.result index 1335f1ec9d5..c28cedae8b1 100644 --- a/mysql-test/r/locale.result +++ b/mysql-test/r/locale.result @@ -90,6 +90,17 @@ SELECT DATE_FORMAT('2001-01-07', '%w %a %W'); DATE_FORMAT('2001-01-07', '%w %a %W') 0 Du Duminică End of 5.4 tests +SET NAMES utf8; +SET lc_time_names=de_AT; +SELECT monthname('2001-01-01'); +monthname('2001-01-01') +Jänner +SELECT monthname('2001-02-01'); +monthname('2001-02-01') +Februar +SELECT monthname('2001-03-01'); +monthname('2001-03-01') +März # # Start of 5.6 tests # diff --git a/mysql-test/r/mdev6830.result b/mysql-test/r/mdev6830.result index 0570659e860..d1cf8c98ac1 100644 --- a/mysql-test/r/mdev6830.result +++ b/mysql-test/r/mdev6830.result @@ -1,5 +1,4 @@ -drop table if exists t1,t2,t3; -drop view if exists v2,v3; +set @@debug_dbug= 'd,opt'; CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM; CREATE TABLE t2 ( f1 DATE, diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index e5a5f61cf83..014547b63a9 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -1335,7 +1335,7 @@ sysdate-is-now FALSE table-cache 400 table-definition-cache 400 table-open-cache 400 -tc-heuristic-recover COMMIT +tc-heuristic-recover OFF thread-cache-size 0 thread-pool-idle-timeout 60 thread-pool-max-threads 500 diff --git a/mysql-test/r/select_debug.result b/mysql-test/r/select_debug.result index a056affc2cd..55882ad337a 100644 --- a/mysql-test/r/select_debug.result +++ b/mysql-test/r/select_debug.result @@ -6,7 +6,7 @@ insert into t1 values (2,2), (1,1); create table t2 (a int); insert into t2 values (2), (3); set session join_cache_level=3; -set @@debug_dbug= 'd:t:O,/tmp/trace.out'; +set @@debug_dbug= 'd,opt'; explain select t1.b from t1,t2 where t1.b=t2.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where diff --git a/mysql-test/r/set_password_plugin-9835.result b/mysql-test/r/set_password_plugin-9835.result new file mode 100644 index 00000000000..e9ee09fe952 --- /dev/null +++ b/mysql-test/r/set_password_plugin-9835.result @@ -0,0 +1,158 @@ +create user natauth@localhost identified via 'mysql_native_password' using '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29'; +create user newpass@localhost identified by password '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29'; +create user newpassnat@localhost identified via 'mysql_native_password'; +set password for newpassnat@localhost = '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29'; +create user oldauth@localhost identified with 'mysql_old_password' using '378b243e220ca493'; +create user oldpass@localhost identified by password '378b243e220ca493'; +create user oldpassold@localhost identified with 'mysql_old_password'; +set password for oldpassold@localhost = '378b243e220ca493'; +select user, host, password, plugin, authentication_string from mysql.user where user != 'root'; +user host password plugin authentication_string +natauth localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +newpass localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +newpassnat localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +oldauth localhost mysql_old_password 378b243e220ca493 +oldpass localhost 378b243e220ca493 +oldpassold localhost 378b243e220ca493 +connect con,localhost,natauth,test,; +select current_user(); +current_user() +natauth@localhost +disconnect con; +connect con,localhost,newpass,test,; +select current_user(); +current_user() +newpass@localhost +disconnect con; +connect con,localhost,newpassnat,test,; +select current_user(); +current_user() +newpassnat@localhost +disconnect con; +connect con,localhost,oldauth,test,; +select current_user(); +current_user() +oldauth@localhost +disconnect con; +connect con,localhost,oldpass,test,; +select current_user(); +current_user() +oldpass@localhost +disconnect con; +connect con,localhost,oldpassold,test,; +select current_user(); +current_user() +oldpassold@localhost +disconnect con; +connection default; +flush privileges; +connect con,localhost,natauth,test,; +select current_user(); +current_user() +natauth@localhost +disconnect con; +connect con,localhost,newpass,test,; +select current_user(); +current_user() +newpass@localhost +disconnect con; +connect con,localhost,newpassnat,test,; +select current_user(); +current_user() +newpassnat@localhost +disconnect con; +connect con,localhost,oldauth,test,; +select current_user(); +current_user() +oldauth@localhost +disconnect con; +connect con,localhost,oldpass,test,; +select current_user(); +current_user() +oldpass@localhost +disconnect con; +connect con,localhost,oldpassold,test,; +select current_user(); +current_user() +oldpassold@localhost +disconnect con; +connection default; +set password for natauth@localhost = PASSWORD('test2'); +set password for newpass@localhost = PASSWORD('test2'); +set password for newpassnat@localhost = PASSWORD('test2'); +set password for oldauth@localhost = PASSWORD('test2'); +set password for oldpass@localhost = PASSWORD('test2'); +set password for oldpassold@localhost = PASSWORD('test2'); +select user, host, password, plugin, authentication_string from mysql.user where user != 'root'; +user host password plugin authentication_string +natauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +newpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +newpassnat localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +oldauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +oldpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +oldpassold localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +connect con,localhost,natauth,test2,; +select current_user(); +current_user() +natauth@localhost +disconnect con; +connect con,localhost,newpass,test2,; +select current_user(); +current_user() +newpass@localhost +disconnect con; +connect con,localhost,newpassnat,test2,; +select current_user(); +current_user() +newpassnat@localhost +disconnect con; +connect con,localhost,oldauth,test2,; +select current_user(); +current_user() +oldauth@localhost +disconnect con; +connect con,localhost,oldpass,test2,; +select current_user(); +current_user() +oldpass@localhost +disconnect con; +connect con,localhost,oldpassold,test2,; +select current_user(); +current_user() +oldpassold@localhost +disconnect con; +connection default; +flush privileges; +connect con,localhost,natauth,test2,; +select current_user(); +current_user() +natauth@localhost +disconnect con; +connect con,localhost,newpass,test2,; +select current_user(); +current_user() +newpass@localhost +disconnect con; +connect con,localhost,newpassnat,test2,; +select current_user(); +current_user() +newpassnat@localhost +disconnect con; +connect con,localhost,oldauth,test2,; +select current_user(); +current_user() +oldauth@localhost +disconnect con; +connect con,localhost,oldpass,test2,; +select current_user(); +current_user() +oldpass@localhost +disconnect con; +connect con,localhost,oldpassold,test2,; +select current_user(); +current_user() +oldpassold@localhost +disconnect con; +connection default; +drop user natauth@localhost, newpass@localhost, newpassnat@localhost; +drop user oldauth@localhost, oldpass@localhost, oldpassold@localhost; diff --git a/mysql-test/r/show_grants_with_plugin-7985.result b/mysql-test/r/show_grants_with_plugin-7985.result index 5accda75383..1898c316ac5 100644 --- a/mysql-test/r/show_grants_with_plugin-7985.result +++ b/mysql-test/r/show_grants_with_plugin-7985.result @@ -71,7 +71,7 @@ connection default; set password for u1 = PASSWORD('SOMETHINGELSE'); select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; user host password plugin authentication_string -u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 mysql_native_password *7AFEFD08B6B720E781FB000CAA418F54FA662626 +u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 # # Here we should use the password field, as that primes over # the authentication_string field. @@ -115,7 +115,7 @@ connection default; update mysql.user set authentication_string = '' where user='u1'; select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; user host password plugin authentication_string -u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 mysql_native_password +u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 flush privileges; show grants for u1; Grants for u1@% @@ -127,7 +127,7 @@ GRANT SELECT ON `mysql`.* TO 'u1'@'%' connect con1, localhost, u1,'SOMETHINGELSE',; select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; user host password plugin authentication_string -u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 mysql_native_password +u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 disconnect con1; connection default; # diff --git a/mysql-test/r/sp-threads.result b/mysql-test/r/sp-threads.result index 4ce61c44762..ddf709d462b 100644 --- a/mysql-test/r/sp-threads.result +++ b/mysql-test/r/sp-threads.result @@ -32,12 +32,9 @@ update t1, t2 set val= 1 where id1=id2; call bug9486(); lock tables t2 write; call bug9486(); -show processlist; -Id User Host db Command Time State Info Progress -# root localhost test Sleep # NULL 0.000 -# root localhost test Query # Waiting for table metadata lock update t1, t2 set val= 1 where id1=id2 0.000 -# root localhost test Query # init show processlist 0.000 -# root localhost test Sleep # NULL 0.000 +SELECT state,info FROM information_schema.processlist WHERE id=con1root_id; +state info +Waiting for table metadata lock update t1, t2 set val= 1 where id1=id2 unlock tables; drop procedure bug9486; drop table t1, t2; diff --git a/mysql-test/r/ssl_timeout-9836.result b/mysql-test/r/ssl_timeout-9836.result new file mode 100644 index 00000000000..bc2e19e1475 --- /dev/null +++ b/mysql-test/r/ssl_timeout-9836.result @@ -0,0 +1,7 @@ +SET @@net_read_timeout=1; +SELECT 1; +1 +1 +SELECT 1; +1 +1 diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 66c9e7e48ef..95b82bdef82 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -439,6 +439,41 @@ select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1; 1 drop table t1; # +# MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null +# +CREATE TABLE t1 ( +id BIGINT NOT NULL, +date_debut DATE NOT NULL, +date_fin DATE DEFAULT NULL); +CREATE TABLE t2( +id BIGINT NOT NULL, +date_debut DATE NOT NULL, +date_fin DATE DEFAULT NULL); +INSERT INTO t1 VALUES (1,'2016-01-01','2016-01-31'); +INSERT INTO t1 VALUES (2,'2016-02-01',null); +INSERT INTO t1 VALUES (3,'2016-03-01','2016-03-31'); +INSERT INTO t1 VALUES (4,'2016-04-01',null); +INSERT INTO t2 VALUES (1,'2016-01-01','2016-01-31'); +INSERT INTO t2 VALUES (2,'2016-02-01','2016-01-28'); +INSERT INTO t2 VALUES (3,'2016-03-01',null); +INSERT INTO t2 VALUES (4,'2016-04-01',null); +SELECT t1.id, +GREATEST(t2.date_debut, t1.date_debut) AS date_debut, +LEAST(IFNULL(t2.date_fin, IFNULL(t1.date_fin, NULL)), +IFNULL(t1.date_fin, IFNULL(t2.date_fin, NULL))) AS date_fin +FROM t1 LEFT JOIN t2 ON (t1.id=t2.id); +id date_debut date_fin +1 2016-01-01 2016-01-31 00:00:00 +2 2016-02-01 2016-01-28 00:00:00 +3 2016-03-01 2016-03-31 00:00:00 +4 2016-04-01 NULL +DROP TABLE t1,t2; +SELECT +LEAST(COALESCE(DATE(NULL), DATE(NULL)), COALESCE(DATE(NULL), DATE(NULL))) AS d0, +LEAST(IFNULL(DATE(NULL), DATE(NULL)), IFNULL(DATE(NULL), DATE(NULL))) AS d1; +d0 d1 +NULL NULL +# # MDEV-9511 Valgrind warnings 'Invalid read' in Field_newdate::cmp and Field_newdate::val_str # CREATE TABLE t1 (f1 DATE, f2 VARCHAR(1)); diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index 1ec2dfc565f..28ec7e75870 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -644,6 +644,15 @@ SELECT MAX(dt) = '2011-01-06 12:34:30' FROM t1; MAX(dt) = '2011-01-06 12:34:30' 1 DROP TABLE t1; +# +# MDEV-9413 "datetime >= coalesce(c1(NULL))" doesn't return expected NULL +# +CREATE TABLE t1(c1 TIMESTAMP(6) NULL DEFAULT NULL); +INSERT INTO t1 VALUES(NULL); +SELECT c1, '2016-06-13 20:00:00.000003' >= COALESCE( c1 ) FROM t1; +c1 '2016-06-13 20:00:00.000003' >= COALESCE( c1 ) +NULL NULL +DROP TABLE t1; End of 5.5 tests # # MDEV-7254: Assigned expression is evaluated twice when updating column TIMESTAMP NOT NULL diff --git a/mysql-test/r/wait_timeout_not_windows.result b/mysql-test/r/wait_timeout_not_windows.result new file mode 100644 index 00000000000..df70aa99221 --- /dev/null +++ b/mysql-test/r/wait_timeout_not_windows.result @@ -0,0 +1,3 @@ +set global log_warnings=2; +set @@wait_timeout=1; +set global log_warnings=@@log_warnings; diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index 20a4b52f1a7..eb82ac4cc4b 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -683,7 +683,7 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` ( `a` int(11) DEFAULT NULL -) +) ENGINE=MyISAM master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (mysql.user) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F diff --git a/mysql-test/suite/innodb/r/innodb-fk.result b/mysql-test/suite/innodb/r/innodb-fk.result index c916d665bf0..2eb19764769 100644 --- a/mysql-test/suite/innodb/r/innodb-fk.result +++ b/mysql-test/suite/innodb/r/innodb-fk.result @@ -70,6 +70,50 @@ Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key c Warning 1215 Cannot add foreign key constraint drop table t2; drop table t1; +CREATE DATABASE kg_test1; +CREATE DATABASE kg_test2; +CREATE TABLE `kg_test1`.`group` ( +Id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE `kg_test1`.`person` ( +`Id` INT(11) NOT NULL AUTO_INCREMENT, +`Name` VARCHAR(50) NOT NULL, +PRIMARY KEY (`Id`), +CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`) +) ENGINE=INNODB DEFAULT CHARSET=utf8; +show create table `kg_test1`.`person`; +Table Create Table +person CREATE TABLE `person` ( + `Id` int(11) NOT NULL AUTO_INCREMENT, + `Name` varchar(50) NOT NULL, + PRIMARY KEY (`Id`), + CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +CREATE TABLE `kg_test2`.`person2` ( +`Id` INT(11) NOT NULL AUTO_INCREMENT, +`Name` VARCHAR(50) NOT NULL, +PRIMARY KEY (`Id`), +CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`) +) ENGINE=INNODB DEFAULT CHARSET=utf8; +ERROR HY000: Can't create table `kg_test2`.`person2` (errno: 150 "Foreign key constraint is incorrectly formed") +CREATE TABLE `kg_test2`.`person2` ( +`Id` INT(11) NOT NULL AUTO_INCREMENT, +`Name` VARCHAR(50) NOT NULL, +PRIMARY KEY (`Id`), +CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `kg_test1`.`group` (`Id`) +) ENGINE=INNODB DEFAULT CHARSET=utf8; +show create table `kg_test2`.`person2`; +Table Create Table +person2 CREATE TABLE `person2` ( + `Id` int(11) NOT NULL AUTO_INCREMENT, + `Name` varchar(50) NOT NULL, + PRIMARY KEY (`Id`), + CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `kg_test1`.`group` (`Id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +SHOW WARNINGS; +Level Code Message +DROP DATABASE kg_test2; +DROP DATABASE kg_test1; CREATE TABLE `#departaments` ( `id_depart` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id_depart`) diff --git a/mysql-test/suite/innodb/t/innodb-fk.test b/mysql-test/suite/innodb/t/innodb-fk.test index f7bcbe238dd..17e926e8647 100644 --- a/mysql-test/suite/innodb/t/innodb-fk.test +++ b/mysql-test/suite/innodb/t/innodb-fk.test @@ -126,6 +126,47 @@ drop table t2; drop table t1; # +# MDEV-9142 :Adding Constraint with no database reference +# results in ERROR 1046 (3D000) at line 13: No database selected +# +CREATE DATABASE kg_test1; +CREATE DATABASE kg_test2; + +CREATE TABLE `kg_test1`.`group` ( + Id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `kg_test1`.`person` ( +`Id` INT(11) NOT NULL AUTO_INCREMENT, +`Name` VARCHAR(50) NOT NULL, +PRIMARY KEY (`Id`), +CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`) +) ENGINE=INNODB DEFAULT CHARSET=utf8; + +show create table `kg_test1`.`person`; + +--error 1005 +CREATE TABLE `kg_test2`.`person2` ( +`Id` INT(11) NOT NULL AUTO_INCREMENT, +`Name` VARCHAR(50) NOT NULL, +PRIMARY KEY (`Id`), +CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`) +) ENGINE=INNODB DEFAULT CHARSET=utf8; + +CREATE TABLE `kg_test2`.`person2` ( +`Id` INT(11) NOT NULL AUTO_INCREMENT, +`Name` VARCHAR(50) NOT NULL, +PRIMARY KEY (`Id`), +CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `kg_test1`.`group` (`Id`) +) ENGINE=INNODB DEFAULT CHARSET=utf8; + +show create table `kg_test2`.`person2`; + +SHOW WARNINGS; +DROP DATABASE kg_test2; +DROP DATABASE kg_test1; + +# # MDEV-7627: Some symbols in table name can cause to Error Code: 1050 when created FK # diff --git a/mysql-test/suite/rpl/r/create_or_replace_mix.result b/mysql-test/suite/rpl/r/create_or_replace_mix.result index 839032a305c..f2471ac5f9e 100644 --- a/mysql-test/suite/rpl/r/create_or_replace_mix.result +++ b/mysql-test/suite/rpl/r/create_or_replace_mix.result @@ -153,7 +153,7 @@ slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Query # # use `test`; CREATE TABLE `t4` ( `a` int(11) DEFAULT NULL -) +) ENGINE=MyISAM slave-bin.000001 # Gtid # # BEGIN GTID #-#-# slave-bin.000001 # Query # # use `test`; CREATE TABLE `t5` ( `a` int(11) DEFAULT NULL diff --git a/mysql-test/suite/rpl/r/create_or_replace_row.result b/mysql-test/suite/rpl/r/create_or_replace_row.result index 6e29d02e3bc..4645d032482 100644 --- a/mysql-test/suite/rpl/r/create_or_replace_row.result +++ b/mysql-test/suite/rpl/r/create_or_replace_row.result @@ -39,7 +39,7 @@ master-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2 master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( `a_in_temporary` int(11) DEFAULT NULL -) +) ENGINE=MyISAM master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ binlog from server 2 @@ -72,7 +72,7 @@ slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2 slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( `a_in_temporary` int(11) DEFAULT NULL -) +) ENGINE=MyISAM slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ # @@ -175,7 +175,7 @@ slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Query # # use `test`; CREATE TABLE `t4` ( `a` int(11) DEFAULT NULL -) +) ENGINE=MyISAM slave-bin.000001 # Gtid # # BEGIN GTID #-#-# slave-bin.000001 # Query # # use `test`; CREATE TABLE `t5` ( `a` int(11) DEFAULT NULL diff --git a/mysql-test/suite/rpl/r/create_or_replace_statement.result b/mysql-test/suite/rpl/r/create_or_replace_statement.result index 8550976e87a..8c8f9bb2ccd 100644 --- a/mysql-test/suite/rpl/r/create_or_replace_statement.result +++ b/mysql-test/suite/rpl/r/create_or_replace_statement.result @@ -153,7 +153,7 @@ slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Query # # use `test`; CREATE TABLE `t4` ( `a` int(11) DEFAULT NULL -) +) ENGINE=MyISAM slave-bin.000001 # Gtid # # BEGIN GTID #-#-# slave-bin.000001 # Query # # use `test`; CREATE TABLE `t5` ( `a` int(11) DEFAULT NULL diff --git a/mysql-test/suite/rpl/r/rpl_killed_ddl.result b/mysql-test/suite/rpl/r/rpl_killed_ddl.result index a02c9b599bf..ed8745ca2c1 100644 --- a/mysql-test/suite/rpl/r/rpl_killed_ddl.result +++ b/mysql-test/suite/rpl/r/rpl_killed_ddl.result @@ -56,6 +56,10 @@ CREATE VIEW v1 AS SELECT a FROM t1 WHERE a < 100; CREATE DATABASE d2; source include/kill_query.inc; include/rpl_diff.inc +ALTER DATABASE d1 +DEFAULT CHARACTER SET = 'utf8'; +source include/kill_query.inc; +include/rpl_diff.inc DROP DATABASE d1; source include/kill_query.inc; include/rpl_diff.inc @@ -83,6 +87,9 @@ include/rpl_diff.inc DROP FUNCTION f1; source include/kill_query.inc; include/rpl_diff.inc +DROP FUNCTION IF EXISTS f2; +source include/kill_query.inc; +include/rpl_diff.inc CREATE PROCEDURE p2 (OUT rows INT) BEGIN SELECT COUNT(*) INTO rows FROM t2; @@ -96,6 +103,9 @@ include/rpl_diff.inc DROP PROCEDURE p1; source include/kill_query.inc; include/rpl_diff.inc +DROP PROCEDURE IF EXISTS p2; +source include/kill_query.inc; +include/rpl_diff.inc CREATE TABLE t2 (b int); source include/kill_query.inc; include/rpl_diff.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_create_table.result b/mysql-test/suite/rpl/r/rpl_row_create_table.result index 9c04f580c07..3030c8e5238 100644 --- a/mysql-test/suite/rpl/r/rpl_row_create_table.result +++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result @@ -194,7 +194,7 @@ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) +) ENGINE=MyISAM **** On Slave **** SHOW CREATE TABLE t8; Table t8 @@ -207,7 +207,7 @@ Table t9 Create Table CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; STOP SLAVE; include/wait_for_slave_to_stop.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_merge_engine.result b/mysql-test/suite/rpl/r/rpl_row_merge_engine.result index c61167e84e0..3b2e02bf97c 100644 --- a/mysql-test/suite/rpl/r/rpl_row_merge_engine.result +++ b/mysql-test/suite/rpl/r/rpl_row_merge_engine.result @@ -4,8 +4,9 @@ CREATE TABLE t1 (a int) ENGINE=MyISAM; CREATE TABLE t2 (a int) ENGINE=MyISAM; INSERT INTO t1 VALUES (1), (2), (3); INSERT INTO t2 VALUES (4), (5), (6); -CREATE TABLE IF NOT EXISTS t1_merge LIKE t1; -ALTER TABLE t1_merge ENGINE=MERGE UNION (t2, t1); +CREATE TEMPORARY TABLE IF NOT EXISTS tt1_merge LIKE t1; +ALTER TABLE tt1_merge ENGINE=MERGE UNION (t2, t1); +CREATE TABLE t1_merge LIKE tt1_merge; include/diff_tables.inc [master:test.t1, slave:test.t1] include/diff_tables.inc [master:test.t2, slave:test.t2] UPDATE t1_merge SET a=10 WHERE a=1; diff --git a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL_innodb.result b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL_innodb.result new file mode 100644 index 00000000000..4a5bc3b76e5 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL_innodb.result @@ -0,0 +1,13 @@ +include/master-slave.inc +[connection master] +CREATE TEMPORARY TABLE temp_t1 (c1 INT) ENGINE=InnoDB; +CREATE TEMPORARY TABLE temp_t2 (c1 INT) ENGINE=MyISAM; +CREATE TABLE t1 LIKE temp_t1; +CREATE TABLE t2 LIKE temp_t2; +include/assert.inc ["t1 on master and temp_t1 have the same storage engine"] +include/assert.inc ["t2 on master and temp_t2 have the same storage engine"] +include/assert.inc ["t1 on slave and temp_t1 have the same storage engine"] +include/assert.inc ["t2 on slave and temp_t2 have the same storage engine"] +DROP TEMPORARY TABLE temp_t1, temp_t2; +DROP TABLE t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_killed_ddl.test b/mysql-test/suite/rpl/t/rpl_killed_ddl.test index eff0392d5de..a910ab4bc5c 100644 --- a/mysql-test/suite/rpl/t/rpl_killed_ddl.test +++ b/mysql-test/suite/rpl/t/rpl_killed_ddl.test @@ -26,10 +26,8 @@ # # There are some part of the test are temporarily disabled because of # the following bugs, please enable then once they get fixed: -# - BUG#44041 -# - BUG#43353 -# - BUG#25705 -# - BUG#44171 +# - BUG#22473427 +# - Bug#22587377 # Temporarily disabled on Windows due to bug #47638 --source include/not_windows.inc @@ -148,11 +146,9 @@ let $rpl_diff_statement= SELECT schema_name FROM information_schema.schemata send CREATE DATABASE d2; source include/kill_query_and_diff_master_slave.inc; -# Temporarily disabled, see BUG#44041, the ALTER DATABASE can affect the -# collation of other database on slave -#send ALTER DATABASE d1 -# DEFAULT CHARACTER SET = 'utf8'; -#source include/kill_query_and_diff_master_slave.inc; +send ALTER DATABASE d1 + DEFAULT CHARACTER SET = 'utf8'; +source include/kill_query_and_diff_master_slave.inc; send DROP DATABASE d1; source include/kill_query_and_diff_master_slave.inc; @@ -171,8 +167,8 @@ send CREATE EVENT e2 DO INSERT INTO test.t1 VALUES (2); source include/kill_query_and_diff_master_slave.inc; -# Temporarily disabled because of BUG#44171, killing ALTER EVENT can -# crash the server +# Temporarily disabled,see Bug#22587377-RPL.RPL_KILLED_DDL +# FAILS SPORADICALLY ON PB2 IN 5.5 AND 5.6 #send ALTER EVENT e1 # ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 2 DAY; #source include/kill_query_and_diff_master_slave.inc; @@ -201,16 +197,8 @@ source include/kill_query_and_diff_master_slave.inc; # function f2 probably does not exist because the CREATE query was # killed -# -# Temporarily disabled. Because of BUG#43353, KILL the query may -# result in function not found, and for 5.1, DROP statements will be -# logged if the function is not found on master, so the following DROP -# FUNCTION statement may be interrupted and not drop the function on -# master, but still get logged and executed on slave and cause -# inconsistence. Also disable the following DROP PROCEDURE IF EXITS -# below. -#send DROP FUNCTION IF EXISTS f2; -#source include/kill_query_and_diff_master_slave.inc; +send DROP FUNCTION IF EXISTS f2; +source include/kill_query_and_diff_master_slave.inc; ######## PROCEDURE ######## @@ -231,9 +219,8 @@ source include/kill_query_and_diff_master_slave.inc; send DROP PROCEDURE p1; source include/kill_query_and_diff_master_slave.inc; -# Temporarily disabled because of bug#43353, see comment above for DROP FUNCTION IF EXISTS -#send DROP PROCEDURE IF EXISTS p2; -#source include/kill_query_and_diff_master_slave.inc; +send DROP PROCEDURE IF EXISTS p2; +source include/kill_query_and_diff_master_slave.inc; ######## TABLE ######## @@ -261,9 +248,10 @@ source include/kill_query_and_diff_master_slave.inc; ######## SERVER ######## -# Tempoarily disabled, see bug#25705 +# Temporarily disabled, see Bug #22473427 - DROP SERVER FAILS +# AFTER ALTER SERVER+KILL QUERY -# --let $rpl_diff_statement= SELECT * FROM mysql.server WHERE name like \'s%\' +# --let $rpl_diff_statement= SELECT * FROM mysql.servers WHERE Server_name like \'s%\' # send CREATE SERVER s2 # FOREIGN DATA WRAPPER mysql diff --git a/mysql-test/suite/rpl/t/rpl_row_merge_engine.test b/mysql-test/suite/rpl/t/rpl_row_merge_engine.test index 5add8dc1cda..dcbb8b891d8 100644 --- a/mysql-test/suite/rpl/t/rpl_row_merge_engine.test +++ b/mysql-test/suite/rpl/t/rpl_row_merge_engine.test @@ -20,8 +20,10 @@ CREATE TABLE t1 (a int) ENGINE=MyISAM; CREATE TABLE t2 (a int) ENGINE=MyISAM; INSERT INTO t1 VALUES (1), (2), (3); INSERT INTO t2 VALUES (4), (5), (6); -CREATE TABLE IF NOT EXISTS t1_merge LIKE t1; -ALTER TABLE t1_merge ENGINE=MERGE UNION (t2, t1); +# Changed a little to check also an issue reported on BUG#20574550 +CREATE TEMPORARY TABLE IF NOT EXISTS tt1_merge LIKE t1; +ALTER TABLE tt1_merge ENGINE=MERGE UNION (t2, t1); +CREATE TABLE t1_merge LIKE tt1_merge; --sync_slave_with_master diff --git a/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL_innodb.test b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL_innodb.test new file mode 100644 index 00000000000..1a09b685249 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL_innodb.test @@ -0,0 +1,55 @@ +source include/have_innodb.inc; +source include/have_binlog_format_row.inc; +source include/master-slave.inc; +# +# BUG#20574550 +# CREATE TABLE LIKE <TEMP_TABLE> does not preserve original table storage +# engine when using row based replication +# +--connection master + +# Define temp_t1 and temp_t2 storage engines +--let $engine_temp_t1= InnoDB +--let $engine_temp_t2= MyISAM + +# Create the two temporary tables +--eval CREATE TEMPORARY TABLE temp_t1 (c1 INT) ENGINE=$engine_temp_t1 +--eval CREATE TEMPORARY TABLE temp_t2 (c1 INT) ENGINE=$engine_temp_t2 + +# Create t1 and t2 based on temporary tables +CREATE TABLE t1 LIKE temp_t1; +CREATE TABLE t2 LIKE temp_t2; +--sync_slave_with_master + +# On master +--connection master +# Assert that t1 and t2 have the same storage engines as temp_t1 and temp_t2 +--let $engine_t1= query_get_value(SHOW TABLE STATUS WHERE Name='t1', Engine, 1) +--let $assert_cond= "$engine_t1" = "$engine_temp_t1" +--let $assert_text= "t1 on master and temp_t1 have the same storage engine" +--source include/assert.inc + +--let $engine_t2= query_get_value(SHOW TABLE STATUS WHERE Name='t2', Engine, 1) +--let $assert_cond= "$engine_t2" = "$engine_temp_t2" +--let $assert_text= "t2 on master and temp_t2 have the same storage engine" +--source include/assert.inc + +# On slave +--connection slave +# Assert that t1 and t2 have the same storage engines as temp_t1 and temp_t2 +--let $engine_t1= query_get_value(SHOW TABLE STATUS WHERE Name='t1', Engine, 1) +--let $assert_cond= "$engine_t1" = "$engine_temp_t1" +--let $assert_text= "t1 on slave and temp_t1 have the same storage engine" +--source include/assert.inc + +--let $engine_t2= query_get_value(SHOW TABLE STATUS WHERE Name='t2', Engine, 1) +--let $assert_cond= "$engine_t2" = "$engine_temp_t2" +--let $assert_text= "t2 on slave and temp_t2 have the same storage engine" +--source include/assert.inc + +# Cleanup +--connection master +DROP TEMPORARY TABLE temp_t1, temp_t2; +DROP TABLE t1, t2; +--source include/rpl_end.inc + diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 41f33b8a7f2..fb18d60edd9 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -409,3 +409,8 @@ SELECT * FROM t1 WHERE a=0.9; SELECT * FROM t1 WHERE a IN (0.8,0.9); DROP TABLE t1; + +--echo # +--echo # MDEV-9372 select 100 between 1 and 9223372036854775808 returns false +--echo # +SELECT 100 BETWEEN 1 AND 9223372036854775808; diff --git a/mysql-test/t/cache_temporal_4265.test b/mysql-test/t/cache_temporal_4265.test index 6135438f023..c62f3c3c506 100644 --- a/mysql-test/t/cache_temporal_4265.test +++ b/mysql-test/t/cache_temporal_4265.test @@ -7,5 +7,16 @@ create table t1 (a date); insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04'); set debug_dbug='d,str_to_datetime_warn'; select * from t1 where a > date_add('2000-01-01', interval 5 day); +set debug_dbug=''; +drop table t1; + +# +# MDEV-9707 MAX(timestamp(6) column) in correlated sub-query returns non-existent row data in original table +# +create table t1 (id int not null, ut timestamp(6) not null); +insert into t1 values(1, '2001-01-01 00:00:00.2'); +insert into t1 values(1, '2001-01-01 00:00:00.1'); +select * from t1; +select (select max(m2.ut) from t1 m2 where m1.id <> 0) from t1 m1; drop table t1; diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index f536f556780..c127836d352 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -193,3 +193,12 @@ insert t1 values ('00:00:00'),('00:01:00'); select case t1.f1 when '00:00:00' then 1 end from t1; drop table t1; +--echo # +--echo # MDEV-9745 Crash with CASE WHEN TRUE THEN COALESCE(CAST(NULL AS UNSIGNED)) ELSE 4 END +--echo # +CREATE TABLE t1 SELECT CASE WHEN TRUE THEN COALESCE(CAST(NULL AS UNSIGNED)) ELSE 4 END AS a; +DESCRIBE t1; +DROP TABLE t1; +CREATE TABLE t1 SELECT CASE WHEN TRUE THEN COALESCE(CAST(NULL AS UNSIGNED)) ELSE 40 END AS a; +DESCRIBE t1; +DROP TABLE t1; diff --git a/mysql-test/t/ctype_cp850.test b/mysql-test/t/ctype_cp850.test new file mode 100644 index 00000000000..358829eb351 --- /dev/null +++ b/mysql-test/t/ctype_cp850.test @@ -0,0 +1,16 @@ +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # MDEV-9862 Illegal mix of collation, when comparing column with CASE expression +--echo # +SET NAMES cp850; +CREATE TABLE t1 (a CHAR(1) CHARACTER SET latin1); +SELECT a FROM t1 WHERE CASE a WHEN 'aaaa' THEN 'Y' WHEN 'aaaa' THEN 'Y' ELSE NULL END <> a; +DROP TABLE t1; + + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/events_2.test b/mysql-test/t/events_2.test index 48949d5630b..5443f76d1a1 100644 --- a/mysql-test/t/events_2.test +++ b/mysql-test/t/events_2.test @@ -67,10 +67,10 @@ select /*2*/ user, host, db, command, state, info select release_lock("test_lock2"); drop event закачка; -# Wait for release_lock("test_lock2") to complete, +# Wait for get_lock("test_lock2") to complete, # to avoid polluting the next test information_schema.processlist let $wait_condition= select count(*) = 0 from information_schema.processlist - where (state like 'User lock%' AND info like 'select get_lock%'); + where info='select get_lock("test_lock2", 20)'; --source include/wait_condition.inc diff --git a/mysql-test/t/fulltext3.test b/mysql-test/t/fulltext3.test index 1b6a07c540f..66f940b495e 100644 --- a/mysql-test/t/fulltext3.test +++ b/mysql-test/t/fulltext3.test @@ -32,3 +32,18 @@ INSERT INTO t1 VALUES(0xA3C2); DROP TABLE t1; # End of 5.1 tests + +# +# MDEV-9986 Full-text search of the utf8mb4 column causes crash +# +create table t1 ( + id varchar(255), + business_name text null collate utf8mb4_unicode_ci, + street_address text, + fulltext index ft (business_name), + fulltext index ft2 (street_address) +); +--error ER_FT_MATCHING_KEY_NOT_FOUND +select * from t1 where match (business_name, street_address) against ('some business name and address here'); +select * from t1 where match (business_name, street_address) against ('some business name and address here' in boolean mode); +drop table t1; diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index 2998742dbcc..5d1f87e74a2 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -484,6 +484,14 @@ SELECT -a FROM t1; --error ER_DATA_OUT_OF_RANGE SELECT -b FROM t1; +# try with two rows now +INSERT INTO t1 VALUES(0,0); + +--error ER_DATA_OUT_OF_RANGE +SELECT -a FROM t1; +--error ER_DATA_OUT_OF_RANGE +SELECT -b FROM t1; + DROP TABLE t1; # Decimal overflows diff --git a/mysql-test/t/insert_innodb.test b/mysql-test/t/insert_innodb.test new file mode 100644 index 00000000000..8c8d2690c11 --- /dev/null +++ b/mysql-test/t/insert_innodb.test @@ -0,0 +1,43 @@ +--source include/have_innodb.inc + +# +# MDEV-8979 IGNORE does not ignore the error 1452 +# + +--echo # +--echo # BUG#22037930: INSERT IGNORE FAILS TO IGNORE +--echo # FOREIGN KEY CONSTRAINT + +--echo # Setup. +CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE=INNODB; +CREATE TABLE t2 (fld2 INT, FOREIGN KEY (fld2) REFERENCES t1 (fld1)) +ENGINE=INNODB; +INSERT INTO t1 VALUES(0); +INSERT INTO t2 VALUES(0); + +--echo # Without fix, an error is reported. +INSERT IGNORE INTO t2 VALUES(1); +UPDATE IGNORE t2 SET fld2=20 WHERE fld2=0; +UPDATE IGNORE t1 SET fld1=20 WHERE fld1=0; + +--echo # Test for multi update. +UPDATE IGNORE t1, t2 SET t2.fld2= t2.fld2 + 3; +UPDATE IGNORE t1, t2 SET t1.fld1= t1.fld1 + 3; + +--echo # Reports an error since IGNORE is not used. +--error ER_NO_REFERENCED_ROW_2 +INSERT INTO t2 VALUES(1); + +--error ER_NO_REFERENCED_ROW_2 +UPDATE t2 SET fld2=20 WHERE fld2=0; + +--error ER_ROW_IS_REFERENCED_2 +UPDATE t1 SET fld1=20 WHERE fld1=0; + +--error ER_NO_REFERENCED_ROW_2 +UPDATE t1, t2 SET t2.fld2= t2.fld2 + 3; + +--error ER_ROW_IS_REFERENCED_2 +UPDATE t1, t2 SET t1.fld1= t1.fld1 + 3; + +DROP TABLE t2, t1; diff --git a/mysql-test/t/kill_processlist-6619.test b/mysql-test/t/kill_processlist-6619.test index d599d204dda..551d36e03fd 100644 --- a/mysql-test/t/kill_processlist-6619.test +++ b/mysql-test/t/kill_processlist-6619.test @@ -1,5 +1,5 @@ # -# 6619 SHOW PROCESSLIST returns empty result set after KILL QUERY +# MDEV-6619 SHOW PROCESSLIST returns empty result set after KILL QUERY # --source include/not_embedded.inc --source include/have_debug_sync.inc diff --git a/mysql-test/t/locale.test b/mysql-test/t/locale.test index 93e347b722d..5d1fd24d750 100644 --- a/mysql-test/t/locale.test +++ b/mysql-test/t/locale.test @@ -55,6 +55,14 @@ SELECT DATE_FORMAT('2001-01-06', '%w %a %W'); SELECT DATE_FORMAT('2001-01-07', '%w %a %W'); --echo End of 5.4 tests +# +# MDEV-9928 LC_TIME_NAMES=de_AT; unusual name for february +# +SET NAMES utf8; +SET lc_time_names=de_AT; +SELECT monthname('2001-01-01'); +SELECT monthname('2001-02-01'); +SELECT monthname('2001-03-01'); --echo # --echo # Start of 5.6 tests diff --git a/mysql-test/t/mdev6830-master.opt b/mysql-test/t/mdev6830-master.opt deleted file mode 100644 index 2a8c27d4731..00000000000 --- a/mysql-test/t/mdev6830-master.opt +++ /dev/null @@ -1 +0,0 @@ ---debug diff --git a/mysql-test/t/mdev6830.test b/mysql-test/t/mdev6830.test index 24565d04fed..3898d5bbef6 100644 --- a/mysql-test/t/mdev6830.test +++ b/mysql-test/t/mdev6830.test @@ -1,10 +1,10 @@ - +# +# MDEV-6830 Server crashes in best_access_path after a sequence of SELECTs invollving a temptable view +# --source include/have_debug.inc ---disable_warnings -drop table if exists t1,t2,t3; -drop view if exists v2,v3; ---enable_warnings +set @@debug_dbug= 'd,opt'; + CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM; CREATE TABLE t2 ( diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test index fd6e60c27fb..d25a4b95bf1 100644 --- a/mysql-test/t/partition_innodb_plugin.test +++ b/mysql-test/t/partition_innodb_plugin.test @@ -125,12 +125,8 @@ SEND; UPDATE `t``\""e` SET a = 12 WHERE a = 0; --echo # default connection connection default; -let $wait_timeout= 2; -let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST -WHERE ID = $id_1 AND STATE = 'Searching rows for update'; +let $wait_condition= SELECT COUNT(*)=2 FROM INFORMATION_SCHEMA.INNODB_LOCKS; --source include/wait_condition.inc -#--echo # tested wait condition $wait_condition_reps times -# INNODB_LOCKS only exists in innodb_plugin --sorted_result SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS GROUP BY lock_table; diff --git a/mysql-test/t/select_debug.test b/mysql-test/t/select_debug.test index 4b77f9fd047..49415400db3 100644 --- a/mysql-test/t/select_debug.test +++ b/mysql-test/t/select_debug.test @@ -10,7 +10,7 @@ create table t2 (a int); insert into t2 values (2), (3); set session join_cache_level=3; -set @@debug_dbug= 'd:t:O,/tmp/trace.out'; +set @@debug_dbug= 'd,opt'; explain select t1.b from t1,t2 where t1.b=t2.a; select t1.b from t1,t2 where t1.b=t2.a; diff --git a/mysql-test/t/set_password_plugin-9835.test b/mysql-test/t/set_password_plugin-9835.test new file mode 100644 index 00000000000..a10a339540f --- /dev/null +++ b/mysql-test/t/set_password_plugin-9835.test @@ -0,0 +1,128 @@ +# +# MDEV-9835 Valid password is not working after server restart. +# +# Various combinations of SET PASSWORD and not-empty mysql.user.plugin field +# +--source include/not_embedded.inc + +--enable_connect_log + +# The hash (old and new) is for 'test' +create user natauth@localhost identified via 'mysql_native_password' using '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29'; + +create user newpass@localhost identified by password '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29'; + +create user newpassnat@localhost identified via 'mysql_native_password'; +set password for newpassnat@localhost = '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29'; + +create user oldauth@localhost identified with 'mysql_old_password' using '378b243e220ca493'; + +create user oldpass@localhost identified by password '378b243e220ca493'; + +create user oldpassold@localhost identified with 'mysql_old_password'; +set password for oldpassold@localhost = '378b243e220ca493'; + +--sorted_result +select user, host, password, plugin, authentication_string from mysql.user where user != 'root'; + +--connect(con,localhost,natauth,test,) +select current_user(); +--disconnect con +--connect(con,localhost,newpass,test,) +select current_user(); +--disconnect con +--connect(con,localhost,newpassnat,test,) +select current_user(); +--disconnect con +--connect(con,localhost,oldauth,test,) +select current_user(); +--disconnect con +--connect(con,localhost,oldpass,test,) +select current_user(); +--disconnect con +--connect(con,localhost,oldpassold,test,) +select current_user(); +--disconnect con + +--connection default + +flush privileges; + +--connect(con,localhost,natauth,test,) +select current_user(); +--disconnect con +--connect(con,localhost,newpass,test,) +select current_user(); +--disconnect con +--connect(con,localhost,newpassnat,test,) +select current_user(); +--disconnect con +--connect(con,localhost,oldauth,test,) +select current_user(); +--disconnect con +--connect(con,localhost,oldpass,test,) +select current_user(); +--disconnect con +--connect(con,localhost,oldpassold,test,) +select current_user(); +--disconnect con + +--connection default + +# changing to the NEW password hash +set password for natauth@localhost = PASSWORD('test2'); +set password for newpass@localhost = PASSWORD('test2'); +set password for newpassnat@localhost = PASSWORD('test2'); +set password for oldauth@localhost = PASSWORD('test2'); +set password for oldpass@localhost = PASSWORD('test2'); +set password for oldpassold@localhost = PASSWORD('test2'); + +--sorted_result +select user, host, password, plugin, authentication_string from mysql.user where user != 'root'; + +--connect(con,localhost,natauth,test2,) +select current_user(); +--disconnect con +--connect(con,localhost,newpass,test2,) +select current_user(); +--disconnect con +--connect(con,localhost,newpassnat,test2,) +select current_user(); +--disconnect con +--connect(con,localhost,oldauth,test2,) +select current_user(); +--disconnect con +--connect(con,localhost,oldpass,test2,) +select current_user(); +--disconnect con +--connect(con,localhost,oldpassold,test2,) +select current_user(); +--disconnect con + +--connection default + +flush privileges; + +--connect(con,localhost,natauth,test2,) +select current_user(); +--disconnect con +--connect(con,localhost,newpass,test2,) +select current_user(); +--disconnect con +--connect(con,localhost,newpassnat,test2,) +select current_user(); +--disconnect con +--connect(con,localhost,oldauth,test2,) +select current_user(); +--disconnect con +--connect(con,localhost,oldpass,test2,) +select current_user(); +--disconnect con +--connect(con,localhost,oldpassold,test2,) +select current_user(); +--disconnect con + +--connection default +drop user natauth@localhost, newpass@localhost, newpassnat@localhost; +drop user oldauth@localhost, oldpass@localhost, oldpassold@localhost; + diff --git a/mysql-test/t/sp-threads.test b/mysql-test/t/sp-threads.test index e1012e2b72d..7a6d1258331 100644 --- a/mysql-test/t/sp-threads.test +++ b/mysql-test/t/sp-threads.test @@ -77,12 +77,15 @@ call bug9486(); connection con2root; lock tables t2 write; connection con1root; +let $con1root_id=`SELECT CONNECTION_ID()`; send call bug9486(); connection con2root; ---sleep 2 # There should be call statement in locked state. ---replace_column 1 # 3 localhost 6 # -show processlist; +let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE + id=$con1root_id AND state='Waiting for table metadata lock'; +--source include/wait_condition.inc +--replace_result $con1root_id con1root_id +eval SELECT state,info FROM information_schema.processlist WHERE id=$con1root_id; unlock tables; connection con1root; reap; diff --git a/mysql-test/t/ssl_timeout-9836.opt b/mysql-test/t/ssl_timeout-9836.opt new file mode 100644 index 00000000000..7a2696875b8 --- /dev/null +++ b/mysql-test/t/ssl_timeout-9836.opt @@ -0,0 +1 @@ +--loose-thread-handling=pool-of-threads diff --git a/mysql-test/t/ssl_timeout-9836.test b/mysql-test/t/ssl_timeout-9836.test new file mode 100644 index 00000000000..5b57917f3b8 --- /dev/null +++ b/mysql-test/t/ssl_timeout-9836.test @@ -0,0 +1,11 @@ +# +# MDEV-9836 Connection lost when using SSL +# +-- source include/have_ssl_communication.inc +connect(con1,localhost,root,,,,,SSL); +SET @@net_read_timeout=1; +SELECT 1; +# MDEV-9836 - YASSL bug - SSL connection lost if it has been idle, for longer than net_read_timeout +-- sleep 2 +SELECT 1; +disconnect con1; diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index c01adc1b233..696cfe67586 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -386,6 +386,36 @@ select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1; drop table t1; --echo # +--echo # MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null +--echo # +CREATE TABLE t1 ( + id BIGINT NOT NULL, + date_debut DATE NOT NULL, + date_fin DATE DEFAULT NULL); +CREATE TABLE t2( + id BIGINT NOT NULL, + date_debut DATE NOT NULL, + date_fin DATE DEFAULT NULL); +INSERT INTO t1 VALUES (1,'2016-01-01','2016-01-31'); +INSERT INTO t1 VALUES (2,'2016-02-01',null); +INSERT INTO t1 VALUES (3,'2016-03-01','2016-03-31'); +INSERT INTO t1 VALUES (4,'2016-04-01',null); + +INSERT INTO t2 VALUES (1,'2016-01-01','2016-01-31'); +INSERT INTO t2 VALUES (2,'2016-02-01','2016-01-28'); +INSERT INTO t2 VALUES (3,'2016-03-01',null); +INSERT INTO t2 VALUES (4,'2016-04-01',null); +SELECT t1.id, + GREATEST(t2.date_debut, t1.date_debut) AS date_debut, + LEAST(IFNULL(t2.date_fin, IFNULL(t1.date_fin, NULL)), + IFNULL(t1.date_fin, IFNULL(t2.date_fin, NULL))) AS date_fin +FROM t1 LEFT JOIN t2 ON (t1.id=t2.id); +DROP TABLE t1,t2; +SELECT + LEAST(COALESCE(DATE(NULL), DATE(NULL)), COALESCE(DATE(NULL), DATE(NULL))) AS d0, + LEAST(IFNULL(DATE(NULL), DATE(NULL)), IFNULL(DATE(NULL), DATE(NULL))) AS d1; + +--echo # --echo # MDEV-9511 Valgrind warnings 'Invalid read' in Field_newdate::cmp and Field_newdate::val_str --echo # CREATE TABLE t1 (f1 DATE, f2 VARCHAR(1)); diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index 195252a2df9..0ef0832602f 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -445,6 +445,14 @@ SELECT MAX(ts) = '2011-01-06 12:34:30' FROM t1; SELECT MAX(dt) = '2011-01-06 12:34:30' FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-9413 "datetime >= coalesce(c1(NULL))" doesn't return expected NULL +--echo # +CREATE TABLE t1(c1 TIMESTAMP(6) NULL DEFAULT NULL); +INSERT INTO t1 VALUES(NULL); +SELECT c1, '2016-06-13 20:00:00.000003' >= COALESCE( c1 ) FROM t1; +DROP TABLE t1; + --echo End of 5.5 tests --echo # diff --git a/mysql-test/t/wait_timeout_not_windows.test b/mysql-test/t/wait_timeout_not_windows.test new file mode 100644 index 00000000000..de4904fada2 --- /dev/null +++ b/mysql-test/t/wait_timeout_not_windows.test @@ -0,0 +1,16 @@ +source include/not_embedded.inc; +source include/not_windows.inc; + +# +# MDEV-7775 Wrong error message (Unknown error) when idle sessions are killed after wait_timeout +# +set global log_warnings=2; +connect (foo,localhost,root); +set @@wait_timeout=1; +sleep 2; +connection default; +let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_RANGE= -50; +let SEARCH_PATTERN= Aborted.*Got timeout reading communication packets; +source include/search_pattern_in_file.inc; +set global log_warnings=@@log_warnings; diff --git a/mysys/my_copy.c b/mysys/my_copy.c index 8af572b5518..bd23dfc48cd 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -18,7 +18,6 @@ #include "mysys_err.h" #include <my_dir.h> /* for stat */ #include <m_string.h> -#include "mysys_err.h" #if defined(HAVE_UTIME_H) #include <utime.h> #elif defined(HAVE_SYS_UTIME_H) diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index c37f4f145cf..3a3273d279b 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -310,6 +310,7 @@ void print_find_structs() add_structs_to_map(root_by_len,max_len); set_links(root_by_len,max_len); print_hash_map("sql_functions_map"); + free(hash_map); hash_map= 0; size_hash_map= 0; @@ -319,6 +320,7 @@ void print_find_structs() add_structs_to_map(root_by_len2,max_len2); set_links(root_by_len2,max_len2); print_hash_map("symbols_map"); + free(hash_map); } diff --git a/sql/handler.cc b/sql/handler.cc index 61d2b37c90f..136bc422a4f 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2009, 2013, Monty Program Ab. +/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. + Copyright (c) 2009, 2016, MariaDB 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 diff --git a/sql/handler.h b/sql/handler.h index 6ec9769036c..e2176f04933 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1,8 +1,8 @@ #ifndef HANDLER_INCLUDED #define HANDLER_INCLUDED /* - Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2014, Monty Program Ab. + Copyright (c) 2000, 2016, Oracle and/or its affiliates. + Copyright (c) 2009, 2016, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -419,7 +419,9 @@ static const uint MYSQL_START_TRANS_OPT_READ_WRITE = 4; /* Flags for method is_fatal_error */ #define HA_CHECK_DUP_KEY 1 #define HA_CHECK_DUP_UNIQUE 2 +#define HA_CHECK_FK_ERROR 4 #define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE) +#define HA_CHECK_ALL (~0U) enum legacy_db_type { @@ -2822,7 +2824,10 @@ public: ((flags & HA_CHECK_DUP_KEY) && (error == HA_ERR_FOUND_DUPP_KEY || error == HA_ERR_FOUND_DUPP_UNIQUE)) || - error == HA_ERR_AUTOINC_ERANGE) + error == HA_ERR_AUTOINC_ERANGE || + ((flags & HA_CHECK_FK_ERROR) && + (error == HA_ERR_ROW_IS_REFERENCED || + error == HA_ERR_NO_REFERENCED_ROW))) return FALSE; return TRUE; } @@ -4153,4 +4158,4 @@ inline const char *table_case_name(HA_CREATE_INFO *info, const char *name) void print_keydup_error(TABLE *table, KEY *key, const char *msg, myf errflag); void print_keydup_error(TABLE *table, KEY *key, myf errflag); -#endif +#endif /* HANDLER_INCLUDED */ diff --git a/sql/item.cc b/sql/item.cc index d9d1409572c..065204dc9c3 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2014, Oracle and/or its affiliates. + Copyright (c) 2000, 2016, Oracle and/or its affiliates. Copyright (c) 2010, 2016, MariaDB This program is free software; you can redistribute it and/or modify @@ -1306,8 +1306,8 @@ Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs) to it's possible that the converter will not be needed at all: PREPARE stmt FROM 'SELECT * FROM t1 WHERE field = ?'; - SET @@arg= 1; - EXECUTE stms USING @arg; + SET @arg= 1; + EXECUTE stmt USING @arg; In the above example result_type is STRING_RESULT at prepare time, and INT_RESULT at execution time. @@ -3835,7 +3835,7 @@ Item_param::eq(const Item *item, bool binary_cmp) const void Item_param::print(String *str, enum_query_type query_type) { - if (state == NO_VALUE) + if (state == NO_VALUE || query_type & QT_NO_DATA_EXPANSION) { str->append('?'); } @@ -6734,7 +6734,8 @@ Item *Item_field::update_value_transformer(uchar *select_arg) void Item_field::print(String *str, enum_query_type query_type) { - if (field && field->table->const_table) + if (field && field->table->const_table && + !(query_type & QT_NO_DATA_EXPANSION)) { print_value(str); return; diff --git a/sql/item.h b/sql/item.h index b45faaf45ce..e402112b725 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2363,7 +2363,7 @@ public: max_length= 0; name= name_par ? name_par : (char*) "NULL"; fixed= 1; - collation.set(cs, DERIVATION_IGNORABLE); + collation.set(cs, DERIVATION_IGNORABLE, MY_REPERTOIRE_ASCII); } enum Type type() const { return NULL_ITEM; } bool eq(const Item *item, bool binary_cmp) const { return null_eq(item); } diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index b2c580db507..e0dbf2c5a73 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -161,10 +161,11 @@ static int cmp_row_type(Item* item1, Item* item2) static int agg_cmp_type(Item_result *type, Item **items, uint nitems) { - uint i; + uint unsigned_count= items[0]->unsigned_flag; type[0]= items[0]->cmp_type(); - for (i= 1 ; i < nitems ; i++) + for (uint i= 1 ; i < nitems ; i++) { + unsigned_count+= items[i]->unsigned_flag; type[0]= item_cmp_type(type[0], items[i]->cmp_type()); /* When aggregating types of two row expressions we have to check @@ -176,6 +177,12 @@ static int agg_cmp_type(Item_result *type, Item **items, uint nitems) if (type[0] == ROW_RESULT && cmp_row_type(items[0], items[i])) return 1; // error found: invalid usage of rows } + /** + If all arguments are of INT type but have different unsigned_flag values, + switch to DECIMAL_RESULT. + */ + if (type[0] == INT_RESULT && unsigned_count != nitems && unsigned_count != 0) + type[0]= DECIMAL_RESULT; return 0; } @@ -2621,10 +2628,7 @@ bool Item_func_ifnull::date_op(MYSQL_TIME *ltime, uint fuzzydate) DBUG_ASSERT(fixed == 1); if (!args[0]->get_date_with_conversion(ltime, fuzzydate & ~TIME_FUZZY_DATES)) return (null_value= false); - if (!args[1]->get_date_with_conversion(ltime, fuzzydate & ~TIME_FUZZY_DATES)) - return (null_value= false); - bzero((char*) ltime,sizeof(*ltime)); - return null_value= !(fuzzydate & TIME_FUZZY_DATES); + return (null_value= args[1]->get_date_with_conversion(ltime, fuzzydate & ~TIME_FUZZY_DATES)); } @@ -3081,24 +3085,6 @@ bool Item_func_case::fix_fields(THD *thd, Item **ref) } -void Item_func_case::agg_str_lengths(Item* arg) -{ - fix_char_length(MY_MAX(max_char_length(), arg->max_char_length())); - set_if_bigger(decimals, arg->decimals); - unsigned_flag= unsigned_flag && arg->unsigned_flag; -} - - -void Item_func_case::agg_num_lengths(Item *arg) -{ - uint len= my_decimal_length_to_precision(arg->max_length, arg->decimals, - arg->unsigned_flag) - arg->decimals; - set_if_bigger(max_length, len); - set_if_bigger(decimals, arg->decimals); - unsigned_flag= unsigned_flag && arg->unsigned_flag; -} - - /** Check if (*place) and new_value points to different Items and call THD::change_item_tree() if needed. @@ -3164,17 +3150,7 @@ void Item_func_case::fix_length_and_dec() } else { - collation.set_numeric(); - max_length=0; - decimals=0; - unsigned_flag= TRUE; - for (uint i= 0; i < ncases; i+= 2) - agg_num_lengths(args[i + 1]); - if (else_expr_num != -1) - agg_num_lengths(args[else_expr_num]); - max_length= my_decimal_precision_to_length_no_truncation(max_length + - decimals, decimals, - unsigned_flag); + fix_attributes(agg, nagg); } /* @@ -3374,16 +3350,12 @@ double Item_func_coalesce::real_op() bool Item_func_coalesce::date_op(MYSQL_TIME *ltime,uint fuzzydate) { DBUG_ASSERT(fixed == 1); - null_value= 0; for (uint i= 0; i < arg_count; i++) { - bool res= args[i]->get_date_with_conversion(ltime, - fuzzydate & ~TIME_FUZZY_DATES); - if (!args[i]->null_value) - return res; + if (!args[i]->get_date_with_conversion(ltime, fuzzydate & ~TIME_FUZZY_DATES)) + return (null_value= false); } - bzero((char*) ltime,sizeof(*ltime)); - return null_value|= !(fuzzydate & TIME_FUZZY_DATES); + return (null_value= true); } @@ -3406,19 +3378,32 @@ void Item_func_coalesce::fix_length_and_dec() { cached_field_type= agg_field_type(args, arg_count); agg_result_type(&cached_result_type, args, arg_count); + fix_attributes(args, arg_count); +} + + +#if MYSQL_VERSION_ID > 100100 +#error Rename this to Item_hybrid_func::fix_attributes() when mering to 10.1 +#endif +void Item_func_hybrid_result_type::fix_attributes(Item **items, uint nitems) +{ switch (cached_result_type) { case STRING_RESULT: - if (count_string_result_length(cached_field_type, args, arg_count)) + if (count_string_result_length(field_type(), + items, nitems)) return; break; case DECIMAL_RESULT: - count_decimal_length(); + collation.set_numeric(); + count_decimal_length(items, nitems); break; case REAL_RESULT: - count_real_length(); + collation.set_numeric(); + count_real_length(items, nitems); break; case INT_RESULT: - count_only_length(args, arg_count); + collation.set_numeric(); + count_only_length(items, nitems); decimals= 0; break; case ROW_RESULT: diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index d109e412f0c..dbd96a89a24 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1274,8 +1274,6 @@ public: Item *find_item(String *str); CHARSET_INFO *compare_collation() { return cmp_collation.collation; } void cleanup(); - void agg_str_lengths(Item *arg); - void agg_num_lengths(Item *arg); }; /* diff --git a/sql/item_func.cc b/sql/item_func.cc index 6c205b6afa7..a4a2782c8c4 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -639,16 +639,16 @@ void Item_func::count_datetime_length(Item **item, uint nitems) result length/precision depends on argument ones. */ -void Item_func::count_decimal_length() +void Item_func::count_decimal_length(Item **item, uint nitems) { int max_int_part= 0; decimals= 0; unsigned_flag= 1; - for (uint i=0 ; i < arg_count ; i++) + for (uint i=0 ; i < nitems ; i++) { - set_if_bigger(decimals, args[i]->decimals); - set_if_bigger(max_int_part, args[i]->decimal_int_part()); - set_if_smaller(unsigned_flag, args[i]->unsigned_flag); + set_if_bigger(decimals, item[i]->decimals); + set_if_bigger(max_int_part, item[i]->decimal_int_part()); + set_if_smaller(unsigned_flag, item[i]->unsigned_flag); } int precision= MY_MIN(max_int_part + decimals, DECIMAL_MAX_PRECISION); fix_char_length(my_decimal_precision_to_length_no_truncation(precision, @@ -679,19 +679,19 @@ void Item_func::count_only_length(Item **item, uint nitems) result length/precision depends on argument ones. */ -void Item_func::count_real_length() +void Item_func::count_real_length(Item **item, uint nitems) { uint32 length= 0; decimals= 0; max_length= 0; - for (uint i=0 ; i < arg_count ; i++) + for (uint i=0 ; i < nitems ; i++) { if (decimals != NOT_FIXED_DEC) { - set_if_bigger(decimals, args[i]->decimals); - set_if_bigger(length, (args[i]->max_length - args[i]->decimals)); + set_if_bigger(decimals, item[i]->decimals); + set_if_bigger(length, (item[i]->max_length - item[i]->decimals)); } - set_if_bigger(max_length, args[i]->max_length); + set_if_bigger(max_length, item[i]->max_length); } if (decimals != NOT_FIXED_DEC) { @@ -809,7 +809,7 @@ void Item_num_op::fix_length_and_dec(void) if (r0 == REAL_RESULT || r1 == REAL_RESULT || r0 == STRING_RESULT || r1 ==STRING_RESULT) { - count_real_length(); + count_real_length(args, arg_count); max_length= float_length(decimals); cached_result_type= REAL_RESULT; } @@ -6305,6 +6305,8 @@ bool Item_func_match::fix_index() for (i=1; i < arg_count; i++) { + if (args[i]->type() != FIELD_ITEM) + goto err; item=(Item_field*)args[i]; for (keynr=0 ; keynr < fts ; keynr++) { diff --git a/sql/item_func.h b/sql/item_func.h index 0b3454fa4b0..3d0cdca4472 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1,7 +1,7 @@ #ifndef ITEM_FUNC_INCLUDED #define ITEM_FUNC_INCLUDED -/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2014, MariaDB +/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. + Copyright (c) 2009, 2016, MariaDB 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,6 +40,13 @@ protected: */ uint allowed_arg_cols; String *val_str_from_val_str_ascii(String *str, String *str2); + + void count_only_length(Item **item, uint nitems); + void count_real_length(Item **item, uint nitems); + void count_decimal_length(Item **item, uint nitems); + void count_datetime_length(Item **item, uint nitems); + bool count_string_result_length(enum_field_types field_type, + Item **item, uint nitems); public: uint arg_count; /* @@ -154,16 +161,10 @@ public: virtual void print(String *str, enum_query_type query_type); void print_op(String *str, enum_query_type query_type); void print_args(String *str, uint from, enum_query_type query_type); - void count_only_length(Item **item, uint nitems); - void count_real_length(); - void count_decimal_length(); inline bool get_arg0_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) { return (null_value=args[0]->get_date_with_conversion(ltime, fuzzy_date)); } - void count_datetime_length(Item **item, uint nitems); - bool count_string_result_length(enum_field_types field_type, - Item **item, uint nitems); inline bool get_arg0_time(MYSQL_TIME *ltime) { null_value= args[0]->get_time(ltime); @@ -253,7 +254,7 @@ public: char buf[256]; String str(buf, sizeof(buf), system_charset_info); str.length(0); - print(&str, QT_ORDINARY); + print(&str, QT_NO_DATA_EXPANSION); my_error(ER_DATA_OUT_OF_RANGE, MYF(0), type_name, str.c_ptr_safe()); } inline double raise_float_overflow() @@ -444,7 +445,7 @@ class Item_func_hybrid_result_type: public Item_func } protected: Item_result cached_result_type; - + void fix_attributes(Item **item, uint nitems); public: Item_func_hybrid_result_type() :Item_func(), cached_result_type(REAL_RESULT) { collation.set_numeric(); } diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 94be38e26ee..62d2198e221 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -1,8 +1,8 @@ #ifndef ITEM_GEOFUNC_INCLUDED #define ITEM_GEOFUNC_INCLUDED -/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. - Copyright (C) 2011, 2015 MariaDB +/* Copyright (c) 2000, 2016 Oracle and/or its affiliates. + Copyright (C) 2011, 2016, MariaDB 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 @@ -191,7 +191,7 @@ public: if (args[i]->fixed && args[i]->field_type() != MYSQL_TYPE_GEOMETRY) { String str; - args[i]->print(&str, QT_ORDINARY); + args[i]->print(&str, QT_NO_DATA_EXPANSION); str.append('\0'); my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "non geometric", str.ptr()); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5789e4b3cfe..177018dd171 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -281,7 +281,7 @@ const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"}; static const char *tc_heuristic_recover_names[]= { - "COMMIT", "ROLLBACK", NullS + "OFF", "COMMIT", "ROLLBACK", NullS }; static TYPELIB tc_heuristic_recover_typelib= { @@ -8660,6 +8660,7 @@ mysqld_get_one_option(int optid, log_error_file_ptr= const_cast<char*>(""); break; case OPT_IGNORE_DB_DIRECTORY: + opt_ignore_db_dirs= NULL; // will be set in ignore_db_dirs_process_additions if (*argument == 0) ignore_db_dirs_reset(); else diff --git a/sql/mysqld.h b/sql/mysqld.h index 673ef71cb7a..dbc65cd2a43 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -1,5 +1,5 @@ -/* Copyright (c) 2006, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2015, MariaDB +/* Copyright (c) 2006, 2016, Oracle and/or its affiliates. + Copyright (c) 2010, 2016, MariaDB 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 @@ -623,7 +623,13 @@ enum enum_query_type /// Without character set introducers. QT_WITHOUT_INTRODUCERS= (1 << 1), /// view internal representation (like QT_ORDINARY except ORDER BY clause) - QT_VIEW_INTERNAL= (1 << 2) + QT_VIEW_INTERNAL= (1 << 2), + /** + If an expression is constant, print the expression, not the value + it evaluates to. Should be used for error messages, so that they + don't reveal values. + */ + QT_NO_DATA_EXPANSION= (1 << 9), }; /* query_id */ diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 502e9ff83f2..8cc9469cd09 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2009, 2014, SkySQL Ab. +/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. + Copyright (c) 2009, 2016, MariaDB 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 @@ -742,9 +742,8 @@ static ACL_USER *find_user_wild(const char *host, const char *user, const char * static ACL_ROLE *find_acl_role(const char *user); static ROLE_GRANT_PAIR *find_role_grant_pair(const LEX_STRING *u, const LEX_STRING *h, const LEX_STRING *r); static ACL_USER_BASE *find_acl_user_base(const char *user, const char *host); -static bool update_user_table(THD *thd, TABLE *table, const char *host, - const char *user, const char *new_password, - uint new_password_len); +static bool update_user_table(THD *, TABLE *, const char *, const char *, const + char *, uint, bool); static my_bool acl_load(THD *thd, TABLE_LIST *tables); static my_bool grant_load(THD *thd, TABLE_LIST *tables); static inline void get_grantor(THD *thd, char* grantor); @@ -1035,7 +1034,6 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) grant_version++; /* Privileges updated */ init_sql_alloc(&acl_memroot, ACL_ALLOC_BLOCK_SIZE, 0, MYF(0)); - (void) my_init_dynamic_array(&acl_hosts,sizeof(ACL_HOST), 20, 50, MYF(0)); if (tables[0].table) // "host" table may not exist (e.g. in MySQL 5.6.7+) { if (init_read_record(&read_record_info, thd, table= tables[0].table, @@ -1097,11 +1095,6 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) NULL, 1, 1, FALSE)) goto end; table->use_all_columns(); - (void) my_init_dynamic_array(&acl_users,sizeof(ACL_USER), 50, 100, MYF(0)); - (void) my_hash_init2(&acl_roles,50, &my_charset_utf8_bin, - 0, 0, 0, (my_hash_get_key) acl_role_get_key, 0, - (void (*)(void *))free_acl_role, 0); - username_char_length= MY_MIN(table->field[1]->char_length(), USERNAME_CHAR_LENGTH); password_length= table->field[2]->field_length / @@ -1361,7 +1354,6 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) NULL, 1, 1, FALSE)) goto end; table->use_all_columns(); - (void) my_init_dynamic_array(&acl_dbs,sizeof(ACL_DB), 50, 100, MYF(0)); while (!(read_record_info.read_record(&read_record_info))) { ACL_DB db; @@ -1423,8 +1415,6 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) end_read_record(&read_record_info); freeze_size(&acl_dbs); - (void) my_init_dynamic_array(&acl_proxy_users, sizeof(ACL_PROXY_USER), - 50, 100, MYF(0)); if (tables[3].table) { if (init_read_record(&read_record_info, thd, table= tables[3].table, @@ -1461,10 +1451,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) NULL, 1, 1, FALSE)) goto end; table->use_all_columns(); - /* account for every role mapping */ - (void) my_hash_init2(&acl_roles_mappings, 50, system_charset_info, 0, 0, 0, - (my_hash_get_key) acl_role_map_get_key, 0, 0, 0); MEM_ROOT temp_root; init_alloc_root(&temp_root, ACL_ALLOC_BLOCK_SIZE, 0, MYF(0)); while (!(read_record_info.read_record(&read_record_info))) @@ -1503,6 +1490,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) return_val= FALSE; end: + end_read_record(&read_record_info); thd->variables.sql_mode= old_sql_mode; DBUG_RETURN(return_val); } @@ -1519,12 +1507,12 @@ void acl_free(bool end) delete_dynamic(&acl_proxy_users); my_hash_free(&acl_check_hosts); my_hash_free(&acl_roles_mappings); - plugin_unlock(0, native_password_plugin); - plugin_unlock(0, old_password_plugin); if (!end) acl_cache->clear(1); /* purecov: inspected */ else { + plugin_unlock(0, native_password_plugin); + plugin_unlock(0, old_password_plugin); delete acl_cache; acl_cache=0; } @@ -1605,6 +1593,15 @@ my_bool acl_reload(THD *thd) old_acl_roles_mappings= acl_roles_mappings; old_acl_proxy_users= acl_proxy_users; old_acl_dbs= acl_dbs; + my_init_dynamic_array(&acl_hosts, sizeof(ACL_HOST), 20, 50, MYF(0)); + my_init_dynamic_array(&acl_users, sizeof(ACL_USER), 50, 100, MYF(0)); + my_init_dynamic_array(&acl_dbs, sizeof(ACL_DB), 50, 100, MYF(0)); + my_init_dynamic_array(&acl_proxy_users, sizeof(ACL_PROXY_USER), 50, 100, MYF(0)); + my_hash_init2(&acl_roles,50, &my_charset_utf8_bin, + 0, 0, 0, (my_hash_get_key) acl_role_get_key, 0, + (void (*)(void *))free_acl_role, 0); + my_hash_init2(&acl_roles_mappings, 50, system_charset_info, 0, 0, 0, + (my_hash_get_key) acl_role_map_get_key, 0, 0, 0); old_mem= acl_memroot; delete_dynamic(&acl_wild_hosts); my_hash_free(&acl_check_hosts); @@ -2611,6 +2608,7 @@ bool change_password(THD *thd, const char *host, const char *user, enum_binlog_format save_binlog_format; uint new_password_len= (uint) strlen(new_password); bool result= 1; + bool use_salt= 0; DBUG_ENTER("change_password"); DBUG_PRINT("enter",("host: '%s' user: '%s' new_password: '%s'", host,user,new_password)); @@ -2668,6 +2666,7 @@ bool change_password(THD *thd, const char *host, const char *user, acl_user->auth_string.length= new_password_len; set_user_salt(acl_user, new_password, new_password_len); set_user_plugin(acl_user, new_password_len); + use_salt= 1; } else push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, @@ -2676,7 +2675,7 @@ bool change_password(THD *thd, const char *host, const char *user, if (update_user_table(thd, table, safe_str(acl_user->host.hostname), safe_str(acl_user->user.str), - new_password, new_password_len)) + new_password, new_password_len, use_salt)) { mysql_mutex_unlock(&acl_cache->lock); /* purecov: deadcode */ goto end; @@ -2972,7 +2971,8 @@ bool hostname_requires_resolving(const char *hostname) static bool update_user_table(THD *thd, TABLE *table, const char *host, const char *user, - const char *new_password, uint new_password_len) + const char *new_password, uint new_password_len, + bool reset_plugin) { char user_key[MAX_KEY_LENGTH]; int error; @@ -2995,6 +2995,11 @@ static bool update_user_table(THD *thd, TABLE *table, } store_record(table,record[1]); table->field[2]->store(new_password, new_password_len, system_charset_info); + if (reset_plugin && table->s->fields >= 41) + { + table->field[40]->reset(); + table->field[41]->reset(); + } if ((error=table->file->ha_update_row(table->record[1],table->record[0])) && error != HA_ERR_RECORD_IS_THE_SAME) { diff --git a/sql/sql_class.h b/sql/sql_class.h index e9f1d0a7a16..46eeeceb112 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2015, Oracle and/or its affiliates. + Copyright (c) 2000, 2016, Oracle and/or its affiliates. Copyright (c) 2009, 2016, MariaDB This program is free software; you can redistribute it and/or modify @@ -2100,6 +2100,18 @@ public: current_stmt_binlog_format == BINLOG_FORMAT_ROW); return current_stmt_binlog_format == BINLOG_FORMAT_ROW; } + /** + Determine if binlogging is disabled for this session + @retval 0 if the current statement binlogging is disabled + (could be because of binlog closed/binlog option + is set to false). + @retval 1 if the current statement will be binlogged + */ + inline bool is_current_stmt_binlog_disabled() const + { + return (!(variables.option_bits & OPTION_BIN_LOG) || + !mysql_bin_log.is_open()); + } enum binlog_filter_state { diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 4d2c48c83cc..c5a0d1464e7 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1196,7 +1196,8 @@ void end_connection(THD *thd) } if (!thd->killed && (net->error && net->vio != 0)) - thd->print_aborted_warning(1, ER(ER_UNKNOWN_ERROR)); + thd->print_aborted_warning(1, + thd->get_stmt_da()->is_error() ? thd->get_stmt_da()->message() : ER(ER_UNKNOWN_ERROR)); } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index def5560a011..d89f5cc44ea 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1,6 +1,6 @@ /* - Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2015, MariaDB + Copyright (c) 2000, 2016, Oracle and/or its affiliates. + Copyright (c) 2010, 2016, MariaDB 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 @@ -1588,9 +1588,10 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) else table->file->insert_id_for_cur_row= insert_id_for_cur_row; bool is_duplicate_key_error; - if (table->file->is_fatal_error(error, HA_CHECK_DUP)) + if (table->file->is_fatal_error(error, HA_CHECK_ALL)) goto err; - is_duplicate_key_error= table->file->is_fatal_error(error, 0); + is_duplicate_key_error= + table->file->is_fatal_error(error, HA_CHECK_ALL & ~HA_CHECK_DUP); if (!is_duplicate_key_error) { /* @@ -1718,7 +1719,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) error != HA_ERR_RECORD_IS_THE_SAME) { if (info->ignore && - !table->file->is_fatal_error(error, HA_CHECK_DUP_KEY)) + !table->file->is_fatal_error(error, HA_CHECK_ALL)) { if (!(thd->variables.old_behavior & OLD_MODE_NO_DUP_KEY_WARNINGS_WITH_IGNORE)) @@ -1848,7 +1849,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) { DEBUG_SYNC(thd, "write_row_noreplace"); if (!info->ignore || - table->file->is_fatal_error(error, HA_CHECK_DUP)) + table->file->is_fatal_error(error, HA_CHECK_ALL)) goto err; if (!(thd->variables.old_behavior & OLD_MODE_NO_DUP_KEY_WARNINGS_WITH_IGNORE)) diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 08687b20b00..5d631027900 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -1,6 +1,6 @@ /* - Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2015, MariaDB + Copyright (c) 2000, 2016, Oracle and/or its affiliates. + Copyright (c) 2010, 2016, MariaDB 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 @@ -255,6 +255,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, { DBUG_RETURN(TRUE); } + thd_proc_info(thd, "executing"); /* Let us emit an error if we are loading data to table which is used in subselect in SET clause like we do it for INSERT. diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc index d918d5c9cf4..8dc71452fa4 100644 --- a/sql/sql_locale.cc +++ b/sql/sql_locale.cc @@ -427,7 +427,7 @@ MY_LOCALE my_locale_da_DK /***** LOCALE BEGIN de_AT: German - Austria *****/ static const char *my_locale_month_names_de_AT[13] = - {"Jänner","Feber","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember", NullS }; + {"Jänner","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember", NullS }; static const char *my_locale_ab_month_names_de_AT[13] = {"Jän","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez", NullS }; static const char *my_locale_day_names_de_AT[8] = diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b91455888b8..fdaf3323366 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6029,6 +6029,7 @@ bool check_global_access(THD *thd, ulong want_access, bool no_errors) temporary table flag) @param alter_info [in] Initial list of columns and indexes for the table to be created + @param create_db [in] Database of the created table @retval false ok. @@ -6037,7 +6038,8 @@ bool check_global_access(THD *thd, ulong want_access, bool no_errors) */ bool check_fk_parent_table_access(THD *thd, HA_CREATE_INFO *create_info, - Alter_info *alter_info) + Alter_info *alter_info, + const char* create_db) { Key *key; List_iterator<Key> key_iterator(alter_info->key_list); @@ -6077,10 +6079,28 @@ bool check_fk_parent_table_access(THD *thd, return true; } } - else if (thd->lex->copy_db_to(&db_name.str, &db_name.length)) - return true; else - is_qualified_table_name= false; + { + if (!thd->db) + { + db_name.str= (char *) thd->memdup(create_db, strlen(create_db)+1); + db_name.length= strlen(create_db); + is_qualified_table_name= true; + + if(create_db && check_db_name(&db_name)) + { + my_error(ER_WRONG_DB_NAME, MYF(0), db_name.str); + return true; + } + } + else + { + if (thd->lex->copy_db_to(&db_name.str, &db_name.length)) + return true; + else + is_qualified_table_name= false; + } + } // if lower_case_table_names is set then convert tablename to lower case. if (lower_case_table_names) @@ -8200,7 +8220,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, goto err; } - if (check_fk_parent_table_access(thd, &lex->create_info, &lex->alter_info)) + if (check_fk_parent_table_access(thd, &lex->create_info, &lex->alter_info, create_table->db)) goto err; /* diff --git a/sql/sql_parse.h b/sql/sql_parse.h index 40ae5427133..7a55d8ac4a4 100644 --- a/sql/sql_parse.h +++ b/sql/sql_parse.h @@ -48,7 +48,8 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *create_table); bool check_fk_parent_table_access(THD *thd, HA_CREATE_INFO *create_info, - Alter_info *alter_info); + Alter_info *alter_info, + const char* create_db); bool parse_sql(THD *thd, Parser_state *parser_state, Object_creation_ctx *creation_ctx, bool do_pfs_digest=false); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 28f59047b43..f58738a4539 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2015 Oracle and/or its affiliates. +/* Copyright (c) 2000, 2016 Oracle and/or its affiliates. Copyright (c) 2009, 2016 MariaDB This program is free software; you can redistribute it and/or modify @@ -15437,6 +15437,14 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, Field *new_field; LINT_INIT(new_field); + /* + To preserve type or DATE/TIME and GEOMETRY fields, + they need to be handled separately. + */ + if (item->cmp_type() == TIME_RESULT || + item->field_type() == MYSQL_TYPE_GEOMETRY) + new_field= item->tmp_table_field_from_field_type(table, 1); + else switch (item->result_type()) { case REAL_RESULT: new_field= new Field_double(item->max_length, maybe_null, @@ -15459,18 +15467,11 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, case STRING_RESULT: DBUG_ASSERT(item->collation.collation); - /* - DATE/TIME and GEOMETRY fields have STRING_RESULT result type. - To preserve type they needed to be handled separately. - */ - if (item->cmp_type() == TIME_RESULT || - item->field_type() == MYSQL_TYPE_GEOMETRY) - new_field= item->tmp_table_field_from_field_type(table, 1); /* Make sure that the blob fits into a Field_varstring which has 2-byte lenght. */ - else if (item->max_length/item->collation.collation->mbmaxlen > 255 && + if (item->max_length/item->collation.collation->mbmaxlen > 255 && convert_blob_length <= Field_varstring::MAX_SIZE && convert_blob_length) new_field= new Field_varstring(convert_blob_length, maybe_null, @@ -24182,33 +24183,53 @@ static void print_join(THD *thd, /* List is reversed => we should reverse it before using */ List_iterator_fast<TABLE_LIST> ti(*tables); TABLE_LIST **table; - uint non_const_tables= 0; DBUG_ENTER("print_join"); + /* + If the QT_NO_DATA_EXPANSION flag is specified, we print the + original table list, including constant tables that have been + optimized away, as the constant tables may be referenced in the + expression printed by Item_field::print() when this flag is given. + Otherwise, only non-const tables are printed. + + Example: + + Original SQL: + select * from (select 1) t + + Printed without QT_NO_DATA_EXPANSION: + select '1' AS `1` from dual + + Printed with QT_NO_DATA_EXPANSION: + select `t`.`1` from (select 1 AS `1`) `t` + */ + const bool print_const_tables= (query_type & QT_NO_DATA_EXPANSION); + size_t tables_to_print= 0; + for (TABLE_LIST *t= ti++; t ; t= ti++) { - /* - See comment in print_table_array() about the second part of the - condition - */ - if (!t->optimized_away && !is_eliminated_table(eliminated_tables, t)) - non_const_tables++; + /* See comment in print_table_array() about the second condition */ + if (print_const_tables || !t->optimized_away) + if (!is_eliminated_table(eliminated_tables, t)) + tables_to_print++; } - if (!non_const_tables) + if (tables_to_print == 0) { str->append(STRING_WITH_LEN("dual")); DBUG_VOID_RETURN; // all tables were optimized away } ti.rewind(); - if (!(table= (TABLE_LIST **)thd->alloc(sizeof(TABLE_LIST*) * - non_const_tables))) + if (!(table= static_cast<TABLE_LIST **>(thd->alloc(sizeof(TABLE_LIST*) * + tables_to_print)))) DBUG_VOID_RETURN; // out of memory - TABLE_LIST *tmp, **t= table + (non_const_tables - 1); + TABLE_LIST *tmp, **t= table + (tables_to_print - 1); while ((tmp= ti++)) { - if (tmp->optimized_away || is_eliminated_table(eliminated_tables, tmp)) + if (tmp->optimized_away && !print_const_tables) + continue; + if (is_eliminated_table(eliminated_tables, tmp)) continue; *t--= tmp; } @@ -24228,7 +24249,7 @@ static void print_join(THD *thd, */ if ((*table)->sj_inner_tables) { - TABLE_LIST **end= table + non_const_tables; + TABLE_LIST **end= table + tables_to_print; for (TABLE_LIST **t2= table; t2!=end; t2++) { if (!(*t2)->sj_inner_tables) @@ -24241,7 +24262,7 @@ static void print_join(THD *thd, } } print_table_array(thd, eliminated_tables, str, table, - table + non_const_tables, query_type); + table + tables_to_print, query_type); DBUG_VOID_RETURN; } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 8ac914bdc40..7bf008870b9 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2015, Oracle and/or its affiliates. + Copyright (c) 2000, 2016, Oracle and/or its affiliates. Copyright (c) 2010, 2016, MariaDB This program is free software; you can redistribute it and/or modify @@ -5421,6 +5421,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, /* We have to write the query before we unlock the tables. */ + if (thd->is_current_stmt_binlog_disabled()) + goto err; + if (thd->is_current_stmt_binlog_format_row()) { /* @@ -5491,6 +5494,21 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, */ if (!table->view) { + /* + After opening a MERGE table add the children to the query list of + tables, so that children tables info can be used on "CREATE TABLE" + statement generation by the binary log. + Note that placeholders don't have the handler open. + */ + if (table->table->file->extra(HA_EXTRA_ADD_CHILDREN_LIST)) + goto err; + + /* + As the reference table is temporary and may not exist on slave, we must + force the ENGINE to be present into CREATE TABLE. + */ + create_info->used_fields|= HA_CREATE_USED_ENGINE; + int result __attribute__((unused))= show_create_table(thd, table, &query, create_info, WITH_DB_NAME); @@ -8434,7 +8452,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, till this point for the alter operation. */ if ((alter_info->flags & Alter_info::ADD_FOREIGN_KEY) && - check_fk_parent_table_access(thd, create_info, alter_info)) + check_fk_parent_table_access(thd, create_info, alter_info, new_db)) DBUG_RETURN(true); /* diff --git a/sql/sql_update.cc b/sql/sql_update.cc index a59e635afaa..2507c3fec53 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2011, 2015, MariaDB +/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. + Copyright (c) 2011, 2016, MariaDB 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 @@ -823,7 +823,7 @@ int mysql_update(THD *thd, error= 0; } else if (!ignore || - table->file->is_fatal_error(error, HA_CHECK_DUP_KEY)) + table->file->is_fatal_error(error, HA_CHECK_ALL)) { /* If (ignore && error is ignorable) we don't have to @@ -831,7 +831,7 @@ int mysql_update(THD *thd, */ myf flags= 0; - if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY)) + if (table->file->is_fatal_error(error, HA_CHECK_ALL)) flags|= ME_FATALERROR; /* Other handler errors are fatal */ prepare_record_for_error_message(error, table); @@ -2131,7 +2131,7 @@ int multi_update::send_data(List<Item> ¬_used_values) { updated--; if (!ignore || - table->file->is_fatal_error(error, HA_CHECK_DUP_KEY)) + table->file->is_fatal_error(error, HA_CHECK_ALL)) { /* If (ignore && error == is ignorable) we don't have to @@ -2139,7 +2139,7 @@ int multi_update::send_data(List<Item> ¬_used_values) */ myf flags= 0; - if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY)) + if (table->file->is_fatal_error(error, HA_CHECK_ALL)) flags|= ME_FATALERROR; /* Other handler errors are fatal */ prepare_record_for_error_message(error, table); @@ -2414,7 +2414,7 @@ int multi_update::do_updates() local_error != HA_ERR_RECORD_IS_THE_SAME) { if (!ignore || - table->file->is_fatal_error(local_error, HA_CHECK_DUP_KEY)) + table->file->is_fatal_error(local_error, HA_CHECK_ALL)) { err_table= table; goto err; diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index 3ed97f5f082..dbfdc2c8ef9 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 the Free Software @@ -1183,7 +1183,7 @@ dict_create_index_step( >= UNIV_FORMAT_B); node->index = dict_index_get_if_in_cache_low(index_id); - ut_a(err == DB_SUCCESS ? node->index != NULL : node->index == NULL); + ut_a((node->index == NULL) == (err != DB_SUCCESS)); if (err != DB_SUCCESS) { diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 6befe3b2d7a..766f8411ca1 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. 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 @@ -197,7 +197,8 @@ static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param, ftbw= (FTB_WORD *)alloc_root(&ftb_param->ftb->mem_root, sizeof(FTB_WORD) + (info->trunc ? HA_MAX_KEY_BUFF : - word_len * ftb_param->ftb->charset->mbmaxlen + + (word_len + 1) * + ftb_param->ftb->charset->mbmaxlen + HA_FT_WLEN + ftb_param->ftb->info->s->rec_reflength)); ftbw->len= word_len + 1; diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 93722162d86..1a575a2ceea 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -1,4 +1,5 @@ /* Copyright (c) 2000, 2011, Oracle and/or its affiliates + Copyright (c) 2009, 2016, MariaDB 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 diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake index c011349c714..40fd27e9c74 100644 --- a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake +++ b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake @@ -61,12 +61,13 @@ endmacro(set_cflags_if_supported_named) ## adds a compiler flag if the compiler supports it macro(set_cflags_if_supported) foreach(flag ${ARGN}) - check_c_compiler_flag(${flag} HAVE_C_${flag}) - if (HAVE_C_${flag}) + STRING(REGEX REPLACE "[-,= ]" "_" res ${flag}) + check_c_compiler_flag(${flag} HAVE_C_${res}) + if (HAVE_C_${res}) set(CMAKE_C_FLAGS "${flag} ${CMAKE_C_FLAGS}") endif () - check_cxx_compiler_flag(${flag} HAVE_CXX_${flag}) - if (HAVE_CXX_${flag}) + check_cxx_compiler_flag(${flag} HAVE_CXX_${res}) + if (HAVE_CXX_${res}) set(CMAKE_CXX_FLAGS "${flag} ${CMAKE_CXX_FLAGS}") endif () endforeach(flag) @@ -75,8 +76,9 @@ endmacro(set_cflags_if_supported) ## adds a linker flag if the compiler supports it macro(set_ldflags_if_supported) foreach(flag ${ARGN}) - check_cxx_compiler_flag(${flag} HAVE_${flag}) - if (HAVE_${flag}) + STRING(REGEX REPLACE "[-,= ]" "_" res ${flag}) + check_cxx_compiler_flag(${flag} HAVE_${res}) + if (HAVE_${res}) set(CMAKE_EXE_LINKER_FLAGS "${flag} ${CMAKE_EXE_LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "${flag} ${CMAKE_SHARED_LINKER_FLAGS}") endif () @@ -104,8 +106,8 @@ set_cflags_if_supported( if (CMAKE_CXX_FLAGS MATCHES -fno-implicit-templates) # must append this because mysql sets -fno-implicit-templates and we need to override it - check_cxx_compiler_flag(-fimplicit-templates HAVE_CXX_-fimplicit-templates) - if (HAVE_CXX_-fimplicit-templates) + check_cxx_compiler_flag(-fimplicit-templates HAVE_CXX_IMPLICIT_TEMPLATES) + if (HAVE_CXX_IMPLICIT_TEMPLATES) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fimplicit-templates") endif () endif() |