mirror of
https://github.com/MariaDB/server.git
synced 2025-01-26 16:54:15 +01:00
Merge 10.5 into 10.6
This commit is contained in:
commit
09a1f0075a
627 changed files with 34558 additions and 13768 deletions
.gitignoreappveyor.yml
client
cmake
configure.cmakedebian
additions
mariadb-plugin-columnstore.installmariadb-server-10.6.installmariadb-server-10.6.mysql-server.logrotatemariadb-server-10.6.postinstmariadb-test.installrulesextra
include
libmariadblibmysqld
man
mysql-test
include
lib
main
alter_table.resultalter_table.testaria_icp_debug.resultaria_icp_debug.testbackup_locks.resultbackup_locks.testblackhole.resultblackhole.testbootstrap_innodb.resultbootstrap_innodb.testcase.resultderived_cond_pushdown.resulterrors.resulterrors.testfunc_group.resultfunc_json.resultfunc_json.testfunc_math.resultfunc_math.testfunc_test.resultfunc_test.testgrant5.resultgrant5.testimplicit_commit.resultimplicit_commit.testindex_intersect_innodb.resultindex_merge_myisam.resultinnodb_ext_key,off.rdiffinnodb_ext_key.resultinnodb_ext_key.testinnodb_icp_debug.resultinnodb_icp_debug.testkill.resultkill.testlimit_rows_examined.resultlimit_rows_examined.testlock_view.resultlock_view.testlog_tables.resultlog_tables.testmulti_update_big.resultmulti_update_big.testmyisam_icp_debug.resultmyisam_icp_debug.testmysql_json_table_recreate.optmysql_json_table_recreate.resultmysql_json_table_recreate.testmysql_upgrade.resultmysql_upgrade.testmysql_upgrade_mysql_json_datatype.resultmysql_upgrade_mysql_json_datatype.testmysqldump.resultmysqldump.testopt_trace_index_merge_innodb.resultorder_by.resultorder_by.testparser.resultparser.testparser_precedence.resultparser_precedence.testpartition.result
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -101,6 +101,7 @@ packaging/rpm-uln/mysql.10.0.11.spec
|
|||
packaging/solaris/postinstall-solaris
|
||||
extra/pcre2
|
||||
plugin/auth_pam/auth_pam_tool
|
||||
plugin/auth_pam/config_auth_pam.h
|
||||
plugin/aws_key_management/aws-sdk-cpp
|
||||
plugin/aws_key_management/aws_sdk_cpp
|
||||
plugin/aws_key_management/aws_sdk_cpp-prefix
|
||||
|
|
|
@ -3,7 +3,7 @@ version: build-{build}~branch-{branch}
|
|||
before_build:
|
||||
- md %APPVEYOR_BUILD_FOLDER%\win_build
|
||||
- cd %APPVEYOR_BUILD_FOLDER%\win_build
|
||||
- cmake .. -G "Visual Studio 15 2017 Win64" -DWITH_UNIT_TESTS=0 -DWITH_MARIABACKUP=0 -DMYSQL_MAINTAINER_MODE=ERR -DPLUGIN_ROCKSDB=NO -DPLUGIN_CONNECT=NO -DBISON_EXECUTABLE=C:\cygwin64\bin\bison
|
||||
- cmake .. -DWITH_UNIT_TESTS=0 -DWITH_MARIABACKUP=0 -DMYSQL_MAINTAINER_MODE=ERR -DPLUGIN_ROCKSDB=NO -DPLUGIN_CONNECT=NO -DBISON_EXECUTABLE=C:\cygwin64\bin\bison
|
||||
|
||||
build:
|
||||
project: win_build\MySQL.sln
|
||||
|
@ -18,4 +18,4 @@ test_script:
|
|||
- cd %APPVEYOR_BUILD_FOLDER%\win_build\mysql-test
|
||||
- perl mysql-test-run.pl --force --max-test-fail=10 --parallel=4 --testcase-timeout=10 --skip-test-list=unstable-tests --suite=main
|
||||
|
||||
image: Visual Studio 2017
|
||||
image: Visual Studio 2019
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "client_priv.h"
|
||||
#include <sslopt-vars.h>
|
||||
#include "../scripts/mysql_fix_privilege_tables_sql.c"
|
||||
#include <../scripts/mysql_fix_privilege_tables_sql.c>
|
||||
|
||||
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
|
||||
|
||||
|
@ -1182,7 +1182,7 @@ static int check_version_match(void)
|
|||
extract_variable_from_show(&ds_version, version_str))
|
||||
{
|
||||
print_error("Version check failed. Got the following error when calling "
|
||||
"the 'mysql_upgrade' command line client", &ds_version);
|
||||
"the 'mysql' command line client", &ds_version);
|
||||
dynstr_free(&ds_version);
|
||||
return 1; /* Query failed */
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
|
||||
*/
|
||||
|
||||
#define DUMP_VERSION "10.17"
|
||||
#define DUMP_VERSION "10.18"
|
||||
|
||||
#include <my_global.h>
|
||||
#include <my_sys.h>
|
||||
|
@ -83,7 +83,8 @@
|
|||
#define IGNORE_NONE 0x00 /* no ignore */
|
||||
#define IGNORE_DATA 0x01 /* don't dump data for this table */
|
||||
#define IGNORE_INSERT_DELAYED 0x02 /* table doesn't support INSERT DELAYED */
|
||||
#define IGNORE_S3_TABLE 0x04
|
||||
#define IGNORE_SEQUENCE_TABLE 0x04 /* catch the SEQUENCE*/
|
||||
#define IGNORE_S3_TABLE 0x08
|
||||
|
||||
/* Chars needed to store LONGLONG, excluding trailing '\0'. */
|
||||
#define LONGLONG_LEN 20
|
||||
|
@ -2743,7 +2744,68 @@ static inline my_bool general_log_or_slow_log_tables(const char *db,
|
|||
!my_strcasecmp(charset_info, table, "slow_log") ||
|
||||
!my_strcasecmp(charset_info, table, "transaction_registry"));
|
||||
}
|
||||
/*
|
||||
get_sequence_structure-- retrievs sequence structure, prints out corresponding
|
||||
CREATE statement
|
||||
ARGS
|
||||
seq - sequence name
|
||||
db - db name
|
||||
*/
|
||||
|
||||
static void get_sequence_structure(const char *seq, const char *db)
|
||||
{
|
||||
|
||||
char table_buff[NAME_LEN*2+3];
|
||||
char *result_seq;
|
||||
FILE *sql_file= md_result_file;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
DBUG_ENTER("get_sequence_structure");
|
||||
DBUG_PRINT("enter", ("db: %s sequence: %s", db, seq));
|
||||
|
||||
verbose_msg("-- Retrieving sequence structure for %s...\n", seq);
|
||||
|
||||
result_seq= quote_name(seq, table_buff, 1);
|
||||
// Sequences as tables share same flags
|
||||
if (!opt_no_create_info)
|
||||
{
|
||||
char buff[20+FN_REFLEN];
|
||||
my_snprintf(buff, sizeof(buff), "SHOW CREATE SEQUENCE %s", result_seq);
|
||||
if (mysql_query_with_error_report(mysql, &result, buff))
|
||||
{
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
print_comment(sql_file, 0,
|
||||
"\n--\n-- Sequence structure for %s\n--\n\n",
|
||||
fix_for_comment(result_seq));
|
||||
if (opt_drop)
|
||||
{
|
||||
fprintf(sql_file, "DROP SEQUENCE IF EXISTS %s;\n", result_seq);
|
||||
check_io(sql_file);
|
||||
}
|
||||
|
||||
row= mysql_fetch_row(result);
|
||||
fprintf(sql_file, "%s;\n", row[1]);
|
||||
mysql_free_result(result);
|
||||
|
||||
// Restore next not cached value from sequence
|
||||
my_snprintf(buff, sizeof(buff), "SELECT next_not_cached_value FROM %s", result_seq);
|
||||
if (mysql_query_with_error_report(mysql, &result, buff))
|
||||
{
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
row= mysql_fetch_row(result);
|
||||
if (row[0])
|
||||
{
|
||||
fprintf(sql_file, "SELECT SETVAL(%s, %s, 0);\n", result_seq, row[0]);
|
||||
}
|
||||
// Sequences will not use inserts, so no need for REPLACE and LOCKS
|
||||
mysql_free_result(result);
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
/*
|
||||
get_table_structure -- retrievs database structure, prints out corresponding
|
||||
CREATE statement and fills out insert_pat if the table is the type we will
|
||||
|
@ -3745,6 +3807,14 @@ static void dump_table(char *table, char *db, const uchar *hash_key, size_t len)
|
|||
MYSQL_ROW row;
|
||||
DBUG_ENTER("dump_table");
|
||||
|
||||
/*
|
||||
Check does table has a sequence structure and if has apply different sql queries
|
||||
*/
|
||||
if (check_if_ignore_table(table, table_type) & IGNORE_SEQUENCE_TABLE)
|
||||
{
|
||||
get_sequence_structure(table, db);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
/*
|
||||
Make sure you get the create table info before the following check for
|
||||
--no-data flag below. Otherwise, the create table info won't be printed.
|
||||
|
@ -5730,7 +5800,7 @@ char check_if_ignore_table(const char *table_name, char *table_type)
|
|||
/* Check memory for quote_for_like() */
|
||||
DBUG_ASSERT(2*sizeof(table_name) < sizeof(show_name_buff));
|
||||
my_snprintf(buff, sizeof(buff),
|
||||
"SELECT engine FROM INFORMATION_SCHEMA.TABLES "
|
||||
"SELECT engine, table_type FROM INFORMATION_SCHEMA.TABLES "
|
||||
"WHERE table_schema = DATABASE() AND table_name = %s",
|
||||
quote_for_equal(table_name, show_name_buff));
|
||||
if (mysql_query_with_error_report(mysql, &res, buff))
|
||||
|
@ -5770,6 +5840,8 @@ char check_if_ignore_table(const char *table_name, char *table_type)
|
|||
strcmp(table_type,"MEMORY"))
|
||||
result= IGNORE_INSERT_DELAYED;
|
||||
}
|
||||
if (!strcmp(row[1],"SEQUENCE"))
|
||||
result|= IGNORE_SEQUENCE_TABLE;
|
||||
|
||||
if (!strcmp(table_type, "S3"))
|
||||
result|= IGNORE_S3_TABLE;
|
||||
|
|
|
@ -6,11 +6,11 @@ FUNCTION(MY_CHECK_AND_SET_LINKER_FLAG flag_to_set)
|
|||
RETURN()
|
||||
ENDIF()
|
||||
STRING(REGEX REPLACE "[-,= +]" "_" result "HAVE_LINK_FLAG_${flag_to_set}")
|
||||
SET(SAVE_CMAKE_REQUIRED_LINK_OPTIONS "${CMAKE_REQUIRED_LINK_OPTIONS}")
|
||||
SET(SAVE_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
|
||||
STRING(REGEX REPLACE "^-Wno-" "-W" flag_to_check ${flag_to_set})
|
||||
SET(CMAKE_REQUIRED_LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS} ${flag_to_check})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${flag_to_check})
|
||||
CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${result})
|
||||
SET(CMAKE_REQUIRED_LINK_OPTIONS "${SAVE_CMAKE_REQUIRED_LINK_OPTIONS}")
|
||||
SET(CMAKE_REQUIRED_LIBRARIES "${SAVE_CMAKE_REQUIRED_LIBRARIES}")
|
||||
IF (${result})
|
||||
FOREACH(linktype SHARED MODULE EXE)
|
||||
IF(ARGN)
|
||||
|
|
|
@ -17,7 +17,7 @@ MACRO (CHECK_JEMALLOC)
|
|||
|
||||
IF(WITH_JEMALLOC STREQUAL "static")
|
||||
SET(libname jemalloc_pic)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES pthread dl m)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES pthread ${CMAKE_DL_LIBS} m)
|
||||
SET(what bundled)
|
||||
ELSE()
|
||||
SET(libname jemalloc c)
|
||||
|
|
|
@ -323,11 +323,14 @@ MACRO(MERGE_LIBRARIES)
|
|||
ENDMACRO()
|
||||
|
||||
FUNCTION(GET_DEPENDEND_OS_LIBS target result)
|
||||
FOREACH(lib ${${target}_LIB_DEPENDS})
|
||||
IF(NOT TARGET ${lib})
|
||||
SET(ret ${ret} ${lib})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
GET_TARGET_PROPERTY(DEPS ${target} LINK_LIBRARIES)
|
||||
IF(DEPS)
|
||||
FOREACH(lib ${DEPS})
|
||||
IF(NOT TARGET ${lib})
|
||||
SET(ret ${ret} ${lib})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
SET(${result} ${ret} PARENT_SCOPE)
|
||||
ENDFUNCTION()
|
||||
|
||||
|
|
|
@ -104,11 +104,15 @@ MACRO(ENABLE_SANITIZERS)
|
|||
STRING(APPEND CMAKE_C_STANDARD_LIBRARIES " \"${${lib}_fullpath}\" ")
|
||||
STRING(APPEND CMAKE_CXX_STANDARD_LIBRARIES " \"${${lib}_fullpath}\" ")
|
||||
ENDFOREACH()
|
||||
|
||||
STRING(APPEND CMAKE_C_FLAGS ${SANITIZER_COMPILE_FLAGS})
|
||||
STRING(APPEND CMAKE_CXX_FLAGS ${SANITIZER_COMPILE_FLAGS})
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
IF(MSVC)
|
||||
IF(MSVC_VERSION LESS 1920)
|
||||
MESSAGE(FATAL_ERROR "Visual Studio q2019 or later is required")
|
||||
ENDIF()
|
||||
# Disable mingw based pkg-config found in Strawberry perl
|
||||
SET(PKG_CONFIG_EXECUTABLE 0 CACHE INTERNAL "")
|
||||
|
||||
|
@ -178,6 +182,9 @@ IF(MSVC)
|
|||
-Wno-deprecated-register -Wno-missing-braces \
|
||||
-Wno-unused-function -Wno-unused-local-typedef -msse4.2 "
|
||||
)
|
||||
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
|
||||
STRING(APPEND CLANG_CL_FLAGS "-mpclmul ")
|
||||
ENDIF()
|
||||
STRING(APPEND CMAKE_C_FLAGS " ${CLANG_CL_FLAGS} ${MSVC_CRT_TYPE}")
|
||||
STRING(APPEND CMAKE_CXX_FLAGS " ${CLANG_CL_FLAGS} ${MSVC_CRT_TYPE}")
|
||||
ENDIF()
|
||||
|
|
|
@ -126,7 +126,7 @@ MACRO (MYSQL_CHECK_SSL)
|
|||
SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBSOCKET})
|
||||
ENDIF()
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBDL})
|
||||
SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||
ENDIF()
|
||||
|
||||
MESSAGE_ONCE(OPENSSL_INCLUDE_DIR "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}")
|
||||
|
|
|
@ -130,7 +130,6 @@ IF(UNIX)
|
|||
MY_SEARCH_LIBS(bind "bind;socket" LIBBIND)
|
||||
MY_SEARCH_LIBS(crypt crypt LIBCRYPT)
|
||||
MY_SEARCH_LIBS(setsockopt socket LIBSOCKET)
|
||||
MY_SEARCH_LIBS(dlopen dl LIBDL)
|
||||
MY_SEARCH_LIBS(sched_yield rt LIBRT)
|
||||
IF(NOT LIBRT)
|
||||
MY_SEARCH_LIBS(clock_gettime rt LIBRT)
|
||||
|
@ -138,7 +137,7 @@ IF(UNIX)
|
|||
FIND_PACKAGE(Threads)
|
||||
|
||||
SET(CMAKE_REQUIRED_LIBRARIES
|
||||
${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${LIBEXECINFO})
|
||||
${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${LIBEXECINFO})
|
||||
# Need explicit pthread for gcc -fsanitize=address
|
||||
IF(CMAKE_USE_PTHREADS_INIT AND CMAKE_C_FLAGS MATCHES "-fsanitize=")
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} pthread)
|
||||
|
|
2
debian/additions/mariadb-report
vendored
2
debian/additions/mariadb-report
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env perl -w
|
||||
#!/usr/bin/perl
|
||||
|
||||
# mariadb-report v4.0 Oct 23 2015
|
||||
# renamed to from mysqlreport in 2020
|
||||
|
|
1
debian/mariadb-plugin-columnstore.install
vendored
1
debian/mariadb-plugin-columnstore.install
vendored
|
@ -55,6 +55,7 @@ usr/bin/mariadb-columnstore-start.sh
|
|||
usr/bin/mariadb-columnstore-stop.sh
|
||||
usr/bin/mariadb-command-line.sh
|
||||
usr/bin/master-rep-columnstore.sh
|
||||
usr/bin/mcs-savebrm.py
|
||||
usr/bin/mcs-loadbrm.py
|
||||
usr/bin/mcs-stop-controllernode.sh
|
||||
usr/bin/mcsGetConfig
|
||||
|
|
1
debian/mariadb-server-10.6.install
vendored
1
debian/mariadb-server-10.6.install
vendored
|
@ -61,6 +61,7 @@ usr/lib/mysql/plugin/query_response_time.so
|
|||
usr/lib/mysql/plugin/server_audit.so
|
||||
usr/lib/mysql/plugin/simple_password_check.so
|
||||
usr/lib/mysql/plugin/sql_errlog.so
|
||||
usr/lib/mysql/plugin/type_mysql_json.so
|
||||
usr/lib/mysql/plugin/wsrep_info.so
|
||||
usr/share/doc/mariadb-server-10.6/mariadbd.sym.gz
|
||||
usr/share/man/man1/aria_chk.1
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
sharedscripts
|
||||
postrotate
|
||||
test -x /usr/bin/mysqladmin || exit 0
|
||||
if [ -f `my_print_defaults --mariadbd | grep -oP "pid-file=\K[^$]+"` ]; then
|
||||
if [ -f `my_print_defaults --mysqld | grep -oP "pid-file=\K[^$]+"` ]; then
|
||||
# If this fails, check debian.conf!
|
||||
mysqladmin --defaults-file=/etc/mysql/debian.cnf --local flush-error-log \
|
||||
flush-engine-log flush-general-log flush-slow-log
|
||||
|
|
13
debian/mariadb-server-10.6.postinst
vendored
13
debian/mariadb-server-10.6.postinst
vendored
|
@ -103,6 +103,19 @@ EOF
|
|||
rmdir $mysql_upgradedir 2>/dev/null || true
|
||||
|
||||
done
|
||||
# Upgrading from mysql.com needs might have the root user as auth_socket.
|
||||
# auto.cnf is a sign of a mysql install, that doesn't exist in mariadb.
|
||||
# We use lsof to protect against concurrent access by mysqld (mariadb has
|
||||
# its own projection). We make sure we're not doing this on a MySQL-8.0
|
||||
# directory.
|
||||
# This direct update is needed to enable an authentication mechanism to
|
||||
# perform mariadb-upgrade, (MDEV-22678). To keep the impact minimal, we
|
||||
# skip innodb and set key-buffer-size to 0 as it isn't reused.
|
||||
if [ -f "$mysql_datadir"/auto.cnf ] && [ -f "$mysql_datadir"/mysql/user.MYD ] &&
|
||||
[ ! lsof -nt "$mysql_datadir"/mysql/user.MYD > /dev/null ] && [ ! -f "$mysql_datadir"/undo_001 ]; then
|
||||
echo "UPDATE mysql.user SET plugin='unix_socket' WHERE plugin='auth_socket';" |
|
||||
/usr/sbin/mariadbd --skip-innodb --key_buffer_size=0 --default-storage-engine=MyISAM --bootstrap 2> /dev/null
|
||||
fi
|
||||
|
||||
# Ensure the existence and right permissions for the database and
|
||||
# log files. Use mkdir option 'Z' to create with correct SELinux context.
|
||||
|
|
1
debian/mariadb-test.install
vendored
1
debian/mariadb-test.install
vendored
|
@ -8,6 +8,7 @@ usr/lib/*/libmariadb3/plugin/qa_auth_interface.so
|
|||
usr/lib/mysql/plugin/adt_null.so
|
||||
usr/lib/mysql/plugin/auth_0x0100.so
|
||||
usr/lib/mysql/plugin/auth_test_plugin.so
|
||||
usr/lib/mysql/plugin/test_sql_service.so
|
||||
usr/lib/mysql/plugin/daemon_example.ini
|
||||
usr/lib/mysql/plugin/debug_key_management.so
|
||||
usr/lib/mysql/plugin/dialog_examples.so
|
||||
|
|
1
debian/rules
vendored
1
debian/rules
vendored
|
@ -165,6 +165,7 @@ endif
|
|||
# load from the libmariadb path as well
|
||||
ln -s ../../../mysql/plugin/auth_test_plugin.so $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb3/plugin/auth_test_plugin.so
|
||||
ln -s ../../../mysql/plugin/qa_auth_interface.so $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb3/plugin/qa_auth_interface.so
|
||||
ln -s ../../../mysql/plugin/test_sql_service.so $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb3/plugin/test_sql_service.so
|
||||
# Move test plugins that are only needed by the client to the libmariadb path
|
||||
mv -v $(TMP)/usr/lib/mysql/plugin/qa_auth_client.so $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb3/plugin/
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ ENDFOREACH()
|
|||
IF(CMAKE_VERSION LESS "3.0")
|
||||
SET(GIT_TAG "1.0.8")
|
||||
ELSE()
|
||||
SET(GIT_TAG "1.2.11")
|
||||
SET(GIT_TAG "1.8.29")
|
||||
ENDIF()
|
||||
|
||||
IF(MSVC_CRT_TYPE MATCHES "/MD")
|
||||
|
|
|
@ -961,7 +961,7 @@ run_data_threads(datadir_iter_t *it, os_thread_func_t func, uint n)
|
|||
data_threads[i].n_thread = i + 1;
|
||||
data_threads[i].count = &count;
|
||||
data_threads[i].count_mutex = &count_mutex;
|
||||
os_thread_create(func, data_threads + i, &data_threads[i].id);
|
||||
data_threads[i].id = os_thread_create(func, data_threads + i);
|
||||
}
|
||||
|
||||
/* Wait for threads to exit */
|
||||
|
@ -1382,7 +1382,7 @@ out:
|
|||
|
||||
void backup_fix_ddl(void);
|
||||
|
||||
static lsn_t get_current_lsn(MYSQL *connection)
|
||||
lsn_t get_current_lsn(MYSQL *connection)
|
||||
{
|
||||
static const char lsn_prefix[] = "\nLog sequence number ";
|
||||
lsn_t lsn = 0;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#define XTRABACKUP_BACKUP_COPY_H
|
||||
|
||||
#include <my_global.h>
|
||||
#include <mysql.h>
|
||||
#include "datasink.h"
|
||||
|
||||
/* special files */
|
||||
|
@ -48,4 +49,7 @@ is_path_separator(char);
|
|||
bool
|
||||
directory_exists(const char *dir, bool create);
|
||||
|
||||
lsn_t
|
||||
get_current_lsn(MYSQL *connection);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -75,7 +75,6 @@ bool have_multi_threaded_slave = false;
|
|||
bool have_gtid_slave = false;
|
||||
|
||||
/* Kill long selects */
|
||||
os_thread_id_t kill_query_thread_id;
|
||||
os_event_t kill_query_thread_started;
|
||||
os_event_t kill_query_thread_stopped;
|
||||
os_event_t kill_query_thread_stop;
|
||||
|
@ -856,7 +855,7 @@ start_query_killer()
|
|||
kill_query_thread_started = os_event_create(0);
|
||||
kill_query_thread_stopped = os_event_create(0);
|
||||
|
||||
os_thread_create(kill_query_thread, NULL, &kill_query_thread_id);
|
||||
os_thread_create(kill_query_thread);
|
||||
|
||||
os_event_wait(kill_query_thread_started);
|
||||
}
|
||||
|
|
|
@ -93,8 +93,6 @@ xb_fil_node_close_file(
|
|||
mutex_enter(&fil_system.mutex);
|
||||
|
||||
ut_ad(node);
|
||||
ut_a(node->n_pending == 0);
|
||||
ut_a(node->n_pending_flushes == 0);
|
||||
ut_a(!node->being_extended);
|
||||
|
||||
if (!node->is_open()) {
|
||||
|
@ -108,20 +106,10 @@ xb_fil_node_close_file(
|
|||
ut_a(ret);
|
||||
|
||||
node->handle = OS_FILE_CLOSED;
|
||||
mutex_exit(&fil_system.mutex);
|
||||
|
||||
ut_a(fil_system.n_open > 0);
|
||||
fil_system.n_open--;
|
||||
|
||||
if (node->space->purpose == FIL_TYPE_TABLESPACE &&
|
||||
fil_is_user_tablespace_id(node->space->id)) {
|
||||
|
||||
ut_a(UT_LIST_GET_LEN(fil_system.LRU) > 0);
|
||||
|
||||
/* The node is in the LRU list, remove it */
|
||||
UT_LIST_REMOVE(fil_system.LRU, node);
|
||||
}
|
||||
|
||||
mutex_exit(&fil_system.mutex);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
@ -180,18 +168,8 @@ xb_fil_cur_open(
|
|||
|
||||
return(XB_FIL_CUR_SKIP);
|
||||
}
|
||||
mutex_enter(&fil_system.mutex);
|
||||
|
||||
fil_system.n_open++;
|
||||
|
||||
if (node->space->purpose == FIL_TYPE_TABLESPACE &&
|
||||
fil_is_user_tablespace_id(node->space->id)) {
|
||||
|
||||
/* Put the node to the LRU list */
|
||||
UT_LIST_ADD_FIRST(fil_system.LRU, node);
|
||||
}
|
||||
|
||||
mutex_exit(&fil_system.mutex);
|
||||
}
|
||||
|
||||
ut_ad(node->is_open());
|
||||
|
@ -427,7 +405,7 @@ xb_fil_cur_read(
|
|||
retry_count = 10;
|
||||
ret = XB_FIL_CUR_SUCCESS;
|
||||
|
||||
fil_space_t *space = fil_space_acquire_for_io(cursor->space_id);
|
||||
fil_space_t *space = fil_space_t::get(cursor->space_id);
|
||||
|
||||
if (!space) {
|
||||
return XB_FIL_CUR_ERROR;
|
||||
|
@ -476,7 +454,7 @@ read_retry:
|
|||
|
||||
posix_fadvise(cursor->file, offset, to_read, POSIX_FADV_DONTNEED);
|
||||
func_exit:
|
||||
space->release_for_io();
|
||||
space->release();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
|
|
@ -503,7 +503,7 @@ static os_event_t dbug_start_query_thread(
|
|||
par->expect_errno = expected_errno;
|
||||
par->done_event = os_event_create(0);
|
||||
par->con = xb_mysql_connect();
|
||||
os_thread_create(dbug_execute_in_new_connection, par, 0);
|
||||
os_thread_create(dbug_execute_in_new_connection, par);
|
||||
|
||||
if (!wait_state)
|
||||
return par->done_event;
|
||||
|
@ -1251,7 +1251,7 @@ struct my_option xb_server_options[] =
|
|||
"Data file autoextend increment in megabytes",
|
||||
(G_PTR*) &sys_tablespace_auto_extend_increment,
|
||||
(G_PTR*) &sys_tablespace_auto_extend_increment,
|
||||
0, GET_ULONG, REQUIRED_ARG, 8L, 1L, 1000L, 0, 1L, 0},
|
||||
0, GET_UINT, REQUIRED_ARG, 8, 1, 1000, 0, 1, 0},
|
||||
{"innodb_data_file_path", OPT_INNODB_DATA_FILE_PATH,
|
||||
"Path to individual files and their sizes.", &innobase_data_file_path,
|
||||
&innobase_data_file_path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
@ -2283,7 +2283,7 @@ check_if_skip_database(
|
|||
if (databases_exclude_hash.array &&
|
||||
find_filter_in_hashtable(name, &databases_exclude_hash,
|
||||
&database) &&
|
||||
!database->has_tables) {
|
||||
(!database->has_tables || !databases_include_hash.array)) {
|
||||
/* Database is found and there are no tables specified,
|
||||
skip entire db. */
|
||||
return DATABASE_SKIP;
|
||||
|
@ -2453,17 +2453,24 @@ xb_get_copy_action(const char *dflt)
|
|||
return(action);
|
||||
}
|
||||
|
||||
/* TODO: We may tune the behavior (e.g. by fil_aio)*/
|
||||
|
||||
static
|
||||
my_bool
|
||||
xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=0, ulonglong max_size=ULLONG_MAX)
|
||||
/** Copy innodb data file to the specified destination.
|
||||
|
||||
@param[in] node file node of a tablespace
|
||||
@param[in] thread_n thread id, used in the text of diagnostic messages
|
||||
@param[in] dest_name destination file name
|
||||
@param[in] write_filter write filter to copy data, can be pass-through filter
|
||||
for full backup, pages filter for incremental backup, etc.
|
||||
|
||||
@return FALSE on success and TRUE on error */
|
||||
static my_bool xtrabackup_copy_datafile(fil_node_t *node, uint thread_n,
|
||||
const char *dest_name,
|
||||
const xb_write_filt_t &write_filter)
|
||||
{
|
||||
char dst_name[FN_REFLEN];
|
||||
ds_file_t *dstfile = NULL;
|
||||
xb_fil_cur_t cursor;
|
||||
xb_fil_cur_result_t res;
|
||||
xb_write_filt_t *write_filter = NULL;
|
||||
xb_write_filt_ctxt_t write_filt_ctxt;
|
||||
const char *action;
|
||||
xb_read_filt_t *read_filter;
|
||||
|
@ -2487,6 +2494,8 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
|
|||
return(FALSE);
|
||||
}
|
||||
|
||||
memset(&write_filt_ctxt, 0, sizeof(xb_write_filt_ctxt_t));
|
||||
|
||||
bool was_dropped;
|
||||
pthread_mutex_lock(&backup_mutex);
|
||||
was_dropped = (ddl_tracker.drops.find(node->space->id) != ddl_tracker.drops.end());
|
||||
|
@ -2507,7 +2516,7 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
|
|||
read_filter = &rf_bitmap;
|
||||
}
|
||||
|
||||
res = xb_fil_cur_open(&cursor, read_filter, node, thread_n,max_size);
|
||||
res = xb_fil_cur_open(&cursor, read_filter, node, thread_n, ULLONG_MAX);
|
||||
if (res == XB_FIL_CUR_SKIP) {
|
||||
goto skip;
|
||||
} else if (res == XB_FIL_CUR_ERROR) {
|
||||
|
@ -2518,18 +2527,10 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
|
|||
sizeof dst_name - 1);
|
||||
dst_name[sizeof dst_name - 1] = '\0';
|
||||
|
||||
/* Setup the page write filter */
|
||||
if (xtrabackup_incremental) {
|
||||
write_filter = &wf_incremental;
|
||||
} else {
|
||||
write_filter = &wf_write_through;
|
||||
}
|
||||
ut_a(write_filter.process != NULL);
|
||||
|
||||
memset(&write_filt_ctxt, 0, sizeof(xb_write_filt_ctxt_t));
|
||||
ut_a(write_filter->process != NULL);
|
||||
|
||||
if (write_filter->init != NULL &&
|
||||
!write_filter->init(&write_filt_ctxt, dst_name, &cursor)) {
|
||||
if (write_filter.init != NULL &&
|
||||
!write_filter.init(&write_filt_ctxt, dst_name, &cursor)) {
|
||||
msg (thread_n, "mariabackup: error: failed to initialize page write filter.");
|
||||
goto error;
|
||||
}
|
||||
|
@ -2550,7 +2551,7 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
|
|||
|
||||
/* The main copy loop */
|
||||
while ((res = xb_fil_cur_read(&cursor)) == XB_FIL_CUR_SUCCESS) {
|
||||
if (!write_filter->process(&write_filt_ctxt, dstfile)) {
|
||||
if (!write_filter.process(&write_filt_ctxt, dstfile)) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
@ -2559,8 +2560,8 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (write_filter->finalize
|
||||
&& !write_filter->finalize(&write_filt_ctxt, dstfile)) {
|
||||
if (write_filter.finalize
|
||||
&& !write_filter.finalize(&write_filt_ctxt, dstfile)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -2574,8 +2575,8 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
|
|||
if (ds_close(dstfile)) {
|
||||
rc = TRUE;
|
||||
}
|
||||
if (write_filter && write_filter->deinit) {
|
||||
write_filter->deinit(&write_filt_ctxt);
|
||||
if (write_filter.deinit) {
|
||||
write_filter.deinit(&write_filt_ctxt);
|
||||
}
|
||||
return(rc);
|
||||
|
||||
|
@ -2584,8 +2585,8 @@ error:
|
|||
if (dstfile != NULL) {
|
||||
ds_close(dstfile);
|
||||
}
|
||||
if (write_filter && write_filter->deinit) {
|
||||
write_filter->deinit(&write_filt_ctxt);;
|
||||
if (write_filter.deinit) {
|
||||
write_filter.deinit(&write_filt_ctxt);;
|
||||
}
|
||||
msg(thread_n, "mariabackup: xtrabackup_copy_datafile() failed.");
|
||||
return(TRUE); /*ERROR*/
|
||||
|
@ -2595,8 +2596,8 @@ skip:
|
|||
if (dstfile != NULL) {
|
||||
ds_close(dstfile);
|
||||
}
|
||||
if (write_filter && write_filter->deinit) {
|
||||
write_filter->deinit(&write_filt_ctxt);
|
||||
if (write_filter.deinit) {
|
||||
write_filter.deinit(&write_filt_ctxt);
|
||||
}
|
||||
msg(thread_n,"Warning: We assume the table was dropped during xtrabackup execution and ignore the tablespace %s", node_name);
|
||||
return(FALSE);
|
||||
|
@ -2642,7 +2643,7 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last)
|
|||
/* We got a full log block. */
|
||||
scanned_lsn += data_len;
|
||||
} else if (data_len >= log_sys.trailer_offset()
|
||||
|| data_len <= LOG_BLOCK_HDR_SIZE) {
|
||||
|| data_len < LOG_BLOCK_HDR_SIZE) {
|
||||
/* We got a garbage block (abrupt end of the log). */
|
||||
msg(0,"garbage block: " LSN_PF ",%zu",scanned_lsn, data_len);
|
||||
break;
|
||||
|
@ -2703,7 +2704,7 @@ static bool xtrabackup_copy_logfile(bool last = false)
|
|||
|
||||
xtrabackup_io_throttling();
|
||||
|
||||
log_mutex_enter();
|
||||
mysql_mutex_lock(&log_sys.mutex);
|
||||
lsn_t lsn= start_lsn;
|
||||
for (int retries= 0; retries < 100; retries++) {
|
||||
if (log_sys.log.read_log_seg(&lsn, end_lsn)
|
||||
|
@ -2727,7 +2728,7 @@ static bool xtrabackup_copy_logfile(bool last = false)
|
|||
mutex_exit(&recv_sys.mutex);
|
||||
}
|
||||
|
||||
log_mutex_exit();
|
||||
mysql_mutex_unlock(&log_sys.mutex);
|
||||
|
||||
if (!start_lsn) {
|
||||
const char *reason = recv_sys.found_corrupt_log
|
||||
|
@ -2787,10 +2788,10 @@ static os_thread_ret_t DECLARE_THREAD(log_copying_thread)(void*)
|
|||
break;
|
||||
}
|
||||
|
||||
log_mutex_enter();
|
||||
mysql_mutex_lock(&log_sys.mutex);
|
||||
bool completed = metadata_to_lsn
|
||||
&& metadata_to_lsn <= log_copy_scanned_lsn;
|
||||
log_mutex_exit();
|
||||
mysql_mutex_unlock(&log_sys.mutex);
|
||||
if (completed) {
|
||||
break;
|
||||
}
|
||||
|
@ -2859,8 +2860,14 @@ static void dbug_mariabackup_event(const char *event,const char *key)
|
|||
|
||||
}
|
||||
#define DBUG_MARIABACKUP_EVENT(A, B) DBUG_EXECUTE_IF("mariabackup_events", dbug_mariabackup_event(A,B););
|
||||
#define DBUG_MB_INJECT_CODE(EVENT, KEY, CODE) \
|
||||
DBUG_EXECUTE_IF("mariabackup_inject_code", {\
|
||||
char *env = getenv(EVENT); \
|
||||
if (env && !strcmp(env, KEY)) { CODE } \
|
||||
})
|
||||
#else
|
||||
#define DBUG_MARIABACKUP_EVENT(A,B)
|
||||
#define DBUG_MB_INJECT_CODE(EVENT, KEY, CODE)
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -2885,10 +2892,12 @@ DECLARE_THREAD(data_copy_thread_func)(
|
|||
|
||||
while ((node = datafiles_iter_next(ctxt->it)) != NULL) {
|
||||
DBUG_MARIABACKUP_EVENT("before_copy", node->space->name);
|
||||
DBUG_MB_INJECT_CODE("wait_innodb_redo_before_copy", node->space->name,
|
||||
backup_wait_for_lsn(get_current_lsn(mysql_connection)););
|
||||
/* copy the datafile */
|
||||
if(xtrabackup_copy_datafile(node, num)) {
|
||||
if (xtrabackup_copy_datafile(node, num, NULL,
|
||||
xtrabackup_incremental ? wf_incremental : wf_write_through))
|
||||
die("failed to copy datafile.");
|
||||
}
|
||||
|
||||
DBUG_MARIABACKUP_EVENT("after_copy", node->space->name);
|
||||
|
||||
|
@ -3003,6 +3012,8 @@ void
|
|||
xb_fil_io_init()
|
||||
{
|
||||
fil_system.create(srv_file_per_table ? 50000 : 5000);
|
||||
fil_system.freeze_space_list = 1;
|
||||
fil_system.space_id_reuse_warned = true;
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -3078,24 +3089,16 @@ xb_load_single_table_tablespace(
|
|||
bool is_empty_file = file->exists() && file->is_empty_file();
|
||||
|
||||
if (err == DB_SUCCESS && file->space_id() != SRV_TMP_SPACE_ID) {
|
||||
os_offset_t node_size = os_file_get_size(file->handle());
|
||||
os_offset_t n_pages;
|
||||
|
||||
ut_a(node_size != (os_offset_t) -1);
|
||||
|
||||
n_pages = node_size / fil_space_t::physical_size(file->flags());
|
||||
|
||||
space = fil_space_create(
|
||||
space = fil_space_t::create(
|
||||
name, file->space_id(), file->flags(),
|
||||
FIL_TYPE_TABLESPACE, NULL/* TODO: crypt_data */);
|
||||
|
||||
ut_a(space != NULL);
|
||||
|
||||
space->add(file->filepath(), OS_FILE_CLOSED, ulint(n_pages),
|
||||
false, false);
|
||||
/* by opening the tablespace we forcing node and space objects
|
||||
in the cache to be populated with fields from space header */
|
||||
space->open();
|
||||
space->add(file->filepath(), file->detach(), 0, false, false);
|
||||
mutex_enter(&fil_system.mutex);
|
||||
space->read_page0();
|
||||
mutex_exit(&fil_system.mutex);
|
||||
|
||||
if (srv_operation == SRV_OPERATION_RESTORE_DELTA
|
||||
|| xb_close_files) {
|
||||
|
@ -3397,30 +3400,11 @@ xb_load_tablespaces()
|
|||
return(DB_SUCCESS);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
Initialize the tablespace memory cache and populate it by scanning for and
|
||||
opening data files.
|
||||
@returns DB_SUCCESS or error code.*/
|
||||
static
|
||||
dberr_t
|
||||
xb_data_files_init()
|
||||
/** Destroy the tablespace memory cache. */
|
||||
static void xb_data_files_close()
|
||||
{
|
||||
xb_fil_io_init();
|
||||
|
||||
return(xb_load_tablespaces());
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
Destroy the tablespace memory cache. */
|
||||
static
|
||||
void
|
||||
xb_data_files_close()
|
||||
{
|
||||
ut_ad(!os_thread_count);
|
||||
fil_close_all_files();
|
||||
if (buf_dblwr) {
|
||||
buf_dblwr_free();
|
||||
}
|
||||
fil_space_t::close_all();
|
||||
buf_dblwr.close();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -3865,7 +3849,7 @@ static bool xtrabackup_backup_low()
|
|||
{
|
||||
ulint max_cp_field;
|
||||
|
||||
log_mutex_enter();
|
||||
mysql_mutex_lock(&log_sys.mutex);
|
||||
|
||||
if (recv_find_max_checkpoint(&max_cp_field) == DB_SUCCESS
|
||||
&& log_sys.log.format != 0) {
|
||||
|
@ -3882,7 +3866,7 @@ static bool xtrabackup_backup_low()
|
|||
} else {
|
||||
msg("Error: recv_find_max_checkpoint() failed.");
|
||||
}
|
||||
log_mutex_exit();
|
||||
mysql_mutex_unlock(&log_sys.mutex);
|
||||
}
|
||||
|
||||
stop_backup_threads();
|
||||
|
@ -4009,7 +3993,6 @@ fail:
|
|||
}
|
||||
srv_thread_pool_init();
|
||||
sync_check_init();
|
||||
ut_d(sync_check_enable());
|
||||
/* Reset the system variables in the recovery module. */
|
||||
trx_pool_init();
|
||||
recv_sys.create();
|
||||
|
@ -4052,26 +4035,23 @@ fail:
|
|||
/* definition from recv_recovery_from_checkpoint_start() */
|
||||
ulint max_cp_field;
|
||||
|
||||
/* start back ground thread to copy newer log */
|
||||
os_thread_id_t log_copying_thread_id;
|
||||
|
||||
/* get current checkpoint_lsn */
|
||||
/* Look for the latest checkpoint from any of the log groups */
|
||||
|
||||
log_mutex_enter();
|
||||
mysql_mutex_lock(&log_sys.mutex);
|
||||
|
||||
reread_log_header:
|
||||
dberr_t err = recv_find_max_checkpoint(&max_cp_field);
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
msg("Error: cannot read redo log header");
|
||||
log_mutex_exit();
|
||||
mysql_mutex_unlock(&log_sys.mutex);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (log_sys.log.format == 0) {
|
||||
msg("Error: cannot process redo log before MariaDB 10.2.2");
|
||||
log_mutex_exit();
|
||||
mysql_mutex_unlock(&log_sys.mutex);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -4088,7 +4068,7 @@ reread_log_header:
|
|||
!= mach_read_from_8(buf + LOG_CHECKPOINT_OFFSET))
|
||||
goto reread_log_header;
|
||||
|
||||
log_mutex_exit();
|
||||
mysql_mutex_unlock(&log_sys.mutex);
|
||||
|
||||
xtrabackup_init_datasinks();
|
||||
|
||||
|
@ -4144,14 +4124,11 @@ reread_log_header:
|
|||
log_copying_running = true;
|
||||
/* start io throttle */
|
||||
if(xtrabackup_throttle) {
|
||||
os_thread_id_t io_watching_thread_id;
|
||||
|
||||
io_ticket = xtrabackup_throttle;
|
||||
wait_throttle = os_event_create(0);
|
||||
io_watching_thread_running = true;
|
||||
|
||||
os_thread_create(io_watching_thread, NULL,
|
||||
&io_watching_thread_id);
|
||||
os_thread_create(io_watching_thread);
|
||||
}
|
||||
|
||||
/* Populate fil_system with tablespaces to copy */
|
||||
|
@ -4174,7 +4151,7 @@ fail_before_log_copying_thread_start:
|
|||
DBUG_MARIABACKUP_EVENT("before_innodb_log_copy_thread_started",0);
|
||||
|
||||
log_copying_stop = os_event_create(0);
|
||||
os_thread_create(log_copying_thread, NULL, &log_copying_thread_id);
|
||||
os_thread_create(log_copying_thread);
|
||||
|
||||
/* FLUSH CHANGED_PAGE_BITMAPS call */
|
||||
if (!flush_changed_page_bitmaps()) {
|
||||
|
@ -4216,8 +4193,8 @@ fail_before_log_copying_thread_start:
|
|||
data_threads[i].num = i+1;
|
||||
data_threads[i].count = &count;
|
||||
data_threads[i].count_mutex = &count_mutex;
|
||||
os_thread_create(data_copy_thread_func, data_threads + i,
|
||||
&data_threads[i].id);
|
||||
data_threads[i].id = os_thread_create(data_copy_thread_func,
|
||||
data_threads + i);
|
||||
}
|
||||
|
||||
/* Wait for threads to exit */
|
||||
|
@ -4430,7 +4407,7 @@ void backup_fix_ddl(void)
|
|||
continue;
|
||||
std::string dest_name(node->space->name);
|
||||
dest_name.append(".new");
|
||||
xtrabackup_copy_datafile(node, 0, dest_name.c_str()/*, do_full_copy ? ULONGLONG_MAX:UNIV_PAGE_SIZE */);
|
||||
xtrabackup_copy_datafile(node, 0, dest_name.c_str(), wf_write_through);
|
||||
}
|
||||
|
||||
datafiles_iter_free(it);
|
||||
|
@ -4611,7 +4588,23 @@ xb_delta_open_matching_space(
|
|||
return file;
|
||||
}
|
||||
|
||||
log_mutex_enter();
|
||||
if (!info.space_id && fil_system.sys_space) {
|
||||
fil_node_t *node
|
||||
= UT_LIST_GET_FIRST(fil_system.sys_space->chain);
|
||||
for (; node; node = UT_LIST_GET_NEXT(chain, node)) {
|
||||
if (!strcmp(node->name, real_name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (node && node->handle != OS_FILE_CLOSED) {
|
||||
*success = true;
|
||||
return node->handle;
|
||||
}
|
||||
msg("mariabackup: Cannot find file %s\n", real_name);
|
||||
return OS_FILE_CLOSED;
|
||||
}
|
||||
|
||||
mysql_mutex_lock(&log_sys.mutex);
|
||||
if (!fil_is_user_tablespace_id(info.space_id)) {
|
||||
found:
|
||||
/* open the file and return its handle */
|
||||
|
@ -4624,7 +4617,7 @@ found:
|
|||
msg("mariabackup: Cannot open file %s\n", real_name);
|
||||
}
|
||||
exit:
|
||||
log_mutex_exit();
|
||||
mysql_mutex_unlock(&log_sys.mutex);
|
||||
return file;
|
||||
}
|
||||
|
||||
|
@ -4708,8 +4701,8 @@ exit:
|
|||
ut_ad(fil_space_t::zip_size(flags) == info.zip_size);
|
||||
ut_ad(fil_space_t::physical_size(flags) == info.page_size);
|
||||
|
||||
if (fil_space_create(dest_space_name, info.space_id, flags,
|
||||
FIL_TYPE_TABLESPACE, 0)) {
|
||||
if (fil_space_t::create(dest_space_name, info.space_id, flags,
|
||||
FIL_TYPE_TABLESPACE, 0)) {
|
||||
*success = xb_space_create_file(real_name, info.space_id,
|
||||
flags, &file);
|
||||
} else {
|
||||
|
@ -4902,7 +4895,7 @@ xtrabackup_apply_delta(
|
|||
space->chain);
|
||||
bool fail = !strcmp(n->name, dst_path)
|
||||
&& !fil_space_extend(
|
||||
space, (ulint)n_pages);
|
||||
space, uint32_t(n_pages));
|
||||
if (fail) goto error;
|
||||
}
|
||||
}
|
||||
|
@ -4929,7 +4922,7 @@ xtrabackup_apply_delta(
|
|||
os_file_close(src_file);
|
||||
os_file_delete(0,src_path);
|
||||
}
|
||||
if (dst_file != OS_FILE_CLOSED)
|
||||
if (dst_file != OS_FILE_CLOSED && info.space_id)
|
||||
os_file_close(dst_file);
|
||||
return TRUE;
|
||||
|
||||
|
@ -4937,7 +4930,7 @@ error:
|
|||
aligned_free(incremental_buffer);
|
||||
if (src_file != OS_FILE_CLOSED)
|
||||
os_file_close(src_file);
|
||||
if (dst_file != OS_FILE_CLOSED)
|
||||
if (dst_file != OS_FILE_CLOSED && info.space_id)
|
||||
os_file_close(dst_file);
|
||||
msg("Error: xtrabackup_apply_delta(): "
|
||||
"failed to apply %s to %s.\n", src_path, dst_path);
|
||||
|
@ -4987,22 +4980,66 @@ static void rename_force(const char *from, const char *to) {
|
|||
rename_file(from,to);
|
||||
}
|
||||
|
||||
/* During prepare phase, rename ".new" files , that were created in backup_fix_ddl(),
|
||||
to ".ibd".*/
|
||||
static ibool prepare_handle_new_files(
|
||||
const char* data_home_dir, /*!<in: path to datadir */
|
||||
const char* db_name, /*!<in: database name */
|
||||
const char* file_name, /*!<in: file name with suffix */
|
||||
void *)
|
||||
{
|
||||
|
||||
/** During prepare phase, rename ".new" files, that were created in
|
||||
backup_fix_ddl() and backup_optimized_ddl_op(), to ".ibd". In the case of
|
||||
incremental backup, i.e. of arg argument is set, move ".new" files to
|
||||
destination directory and rename them to ".ibd", remove existing ".ibd.delta"
|
||||
and ".idb.meta" files in incremental directory to avoid applying delta to
|
||||
".ibd" file.
|
||||
|
||||
@param[in] data_home_dir path to datadir
|
||||
@param[in] db_name database name
|
||||
@param[in] file_name file name with suffix
|
||||
@param[in] arg destination path, used in incremental backup to notify, that
|
||||
*.new file must be moved to destibation directory
|
||||
|
||||
@return true */
|
||||
static ibool prepare_handle_new_files(const char *data_home_dir,
|
||||
const char *db_name,
|
||||
const char *file_name, void *arg)
|
||||
{
|
||||
const char *dest_dir = static_cast<const char *>(arg);
|
||||
std::string src_path = std::string(data_home_dir) + '/' + std::string(db_name) + '/' + file_name;
|
||||
std::string dest_path = src_path;
|
||||
/* Copy "*.new" files from incremental to base dir for incremental backup */
|
||||
std::string dest_path=
|
||||
dest_dir ? std::string(dest_dir) + '/' + std::string(db_name) +
|
||||
'/' + file_name : src_path;
|
||||
|
||||
size_t index = dest_path.find(".new");
|
||||
DBUG_ASSERT(index != std::string::npos);
|
||||
dest_path.replace(index, 4, ".ibd");
|
||||
dest_path.replace(index, strlen(".ibd"), ".ibd");
|
||||
rename_force(src_path.c_str(),dest_path.c_str());
|
||||
|
||||
if (dest_dir) {
|
||||
/* remove delta and meta files to avoid delta applying for new file */
|
||||
index = src_path.find(".new");
|
||||
DBUG_ASSERT(index != std::string::npos);
|
||||
src_path.replace(index, std::string::npos, ".ibd.delta");
|
||||
if (access(src_path.c_str(), R_OK) == 0) {
|
||||
msg("Removing %s", src_path.c_str());
|
||||
if (my_delete(src_path.c_str(), MYF(MY_WME)))
|
||||
die("Can't remove %s, errno %d", src_path.c_str(), errno);
|
||||
}
|
||||
src_path.replace(index, std::string::npos, ".ibd.meta");
|
||||
if (access(src_path.c_str(), R_OK) == 0) {
|
||||
msg("Removing %s", src_path.c_str());
|
||||
if (my_delete(src_path.c_str(), MYF(MY_WME)))
|
||||
die("Can't remove %s, errno %d", src_path.c_str(), errno);
|
||||
}
|
||||
|
||||
/* add table name to the container to avoid it's deletion at the end of
|
||||
prepare */
|
||||
std::string table_name = std::string(db_name) + '/'
|
||||
+ std::string(file_name, file_name + strlen(file_name) - strlen(".new"));
|
||||
xb_filter_entry_t *table = static_cast<xb_filter_entry_t *>
|
||||
(malloc(sizeof(xb_filter_entry_t) + table_name.size() + 1));
|
||||
table->name = ((char*)table) + sizeof(xb_filter_entry_t);
|
||||
strcpy(table->name, table_name.c_str());
|
||||
HASH_INSERT(xb_filter_entry_t, name_hash, &inc_dir_tables_hash,
|
||||
ut_fold_string(table->name), table);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -5039,17 +5076,18 @@ rm_if_not_found(
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
Function enumerates files in datadir (provided by path) which are matched
|
||||
/** Function enumerates files in datadir (provided by path) which are matched
|
||||
by provided suffix. For each entry callback is called.
|
||||
|
||||
@param[in] path datadir path
|
||||
@param[in] suffix suffix to match against
|
||||
@param[in] func callback
|
||||
@param[in] func_arg arguments for the above callback
|
||||
|
||||
@return FALSE if callback for some entry returned FALSE */
|
||||
static
|
||||
ibool
|
||||
xb_process_datadir(
|
||||
const char* path, /*!<in: datadir path */
|
||||
const char* suffix, /*!<in: suffix to match
|
||||
against */
|
||||
handle_datadir_entry_func_t func) /*!<in: callback */
|
||||
static ibool xb_process_datadir(const char *path, const char *suffix,
|
||||
handle_datadir_entry_func_t func,
|
||||
void *func_arg = NULL)
|
||||
{
|
||||
ulint ret;
|
||||
char dbpath[OS_FILE_MAX_PATH+2];
|
||||
|
@ -5084,7 +5122,7 @@ xb_process_datadir(
|
|||
suffix)) {
|
||||
if (!func(
|
||||
path, NULL,
|
||||
fileinfo.name, NULL))
|
||||
fileinfo.name, func_arg))
|
||||
{
|
||||
os_file_closedir(dbdir);
|
||||
return(FALSE);
|
||||
|
@ -5148,7 +5186,7 @@ next_file_item_1:
|
|||
if (!func(
|
||||
path,
|
||||
dbinfo.name,
|
||||
fileinfo.name, NULL))
|
||||
fileinfo.name, func_arg))
|
||||
{
|
||||
os_file_closedir(dbdir);
|
||||
os_file_closedir(dir);
|
||||
|
@ -5308,6 +5346,10 @@ static bool xtrabackup_prepare_func(char** argv)
|
|||
|
||||
fil_path_to_mysql_datadir = ".";
|
||||
|
||||
ut_ad(xtrabackup_incremental == xtrabackup_incremental_dir);
|
||||
if (xtrabackup_incremental)
|
||||
inc_dir_tables_hash.create(1000);
|
||||
|
||||
/* Fix DDL for prepare. Process .del,.ren, and .new files.
|
||||
The order in which files are processed, is important
|
||||
(see MDEV-18185, MDEV-18201)
|
||||
|
@ -5319,6 +5361,8 @@ static bool xtrabackup_prepare_func(char** argv)
|
|||
if (xtrabackup_incremental_dir) {
|
||||
xb_process_datadir(xtrabackup_incremental_dir, ".new.meta", prepare_handle_new_files);
|
||||
xb_process_datadir(xtrabackup_incremental_dir, ".new.delta", prepare_handle_new_files);
|
||||
xb_process_datadir(xtrabackup_incremental_dir, ".new",
|
||||
prepare_handle_new_files, (void *)".");
|
||||
}
|
||||
else {
|
||||
xb_process_datadir(".", ".new", prepare_handle_new_files);
|
||||
|
@ -5383,7 +5427,6 @@ static bool xtrabackup_prepare_func(char** argv)
|
|||
}
|
||||
|
||||
sync_check_init();
|
||||
ut_d(sync_check_enable());
|
||||
recv_sys.create();
|
||||
log_sys.create();
|
||||
recv_sys.recovery_on = true;
|
||||
|
@ -5392,16 +5435,15 @@ static bool xtrabackup_prepare_func(char** argv)
|
|||
srv_allow_writes_event = os_event_create(0);
|
||||
os_event_set(srv_allow_writes_event);
|
||||
#endif
|
||||
dberr_t err = xb_data_files_init();
|
||||
if (err != DB_SUCCESS) {
|
||||
xb_fil_io_init();
|
||||
if (dberr_t err = xb_load_tablespaces()) {
|
||||
msg("mariabackup: error: xb_data_files_init() failed "
|
||||
"with error %s\n", ut_strerr(err));
|
||||
goto error_cleanup;
|
||||
}
|
||||
|
||||
inc_dir_tables_hash.create(1000);
|
||||
|
||||
ok = xtrabackup_apply_deltas();
|
||||
ok = fil_system.sys_space->open(false)
|
||||
&& xtrabackup_apply_deltas();
|
||||
|
||||
xb_data_files_close();
|
||||
|
||||
|
@ -5431,6 +5473,8 @@ static bool xtrabackup_prepare_func(char** argv)
|
|||
goto error_cleanup;
|
||||
}
|
||||
|
||||
fil_system.freeze_space_list = 0;
|
||||
|
||||
/* increase IO threads */
|
||||
if (srv_n_file_io_threads < 10) {
|
||||
srv_n_read_io_threads = 4;
|
||||
|
@ -5452,6 +5496,8 @@ static bool xtrabackup_prepare_func(char** argv)
|
|||
goto error_cleanup;
|
||||
}
|
||||
|
||||
ut_ad(!fil_system.freeze_space_list);
|
||||
|
||||
if (ok) {
|
||||
msg("Last binlog file %s, position %lld",
|
||||
trx_sys.recovered_binlog_filename,
|
||||
|
|
|
@ -1175,7 +1175,7 @@ extern struct charset_info_st my_charset_utf8mb3_general_nopad_ci;
|
|||
extern struct charset_info_st my_charset_utf8mb3_general_mysql500_ci;
|
||||
extern struct charset_info_st my_charset_utf8mb3_unicode_ci;
|
||||
extern struct charset_info_st my_charset_utf8mb3_unicode_nopad_ci;
|
||||
extern struct charset_info_st my_charset_utf8mb4_bin;
|
||||
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_bin;
|
||||
extern struct charset_info_st my_charset_utf8mb4_general_ci;
|
||||
extern struct charset_info_st my_charset_utf8mb4_nopad_bin;
|
||||
extern struct charset_info_st my_charset_utf8mb4_general_nopad_ci;
|
||||
|
|
|
@ -426,12 +426,10 @@ void safe_mutex_free_deadlock_data(safe_mutex_t *mp);
|
|||
#define MYF_NO_DEADLOCK_DETECTION 2
|
||||
|
||||
#ifdef SAFE_MUTEX
|
||||
#define safe_mutex_assert_owner(mp) \
|
||||
DBUG_ASSERT((mp)->count > 0 && \
|
||||
pthread_equal(pthread_self(), (mp)->thread))
|
||||
#define safe_mutex_assert_not_owner(mp) \
|
||||
DBUG_ASSERT(! (mp)->count || \
|
||||
! pthread_equal(pthread_self(), (mp)->thread))
|
||||
#define safe_mutex_is_owner(mp) ((mp)->count > 0 && \
|
||||
pthread_equal(pthread_self(), (mp)->thread))
|
||||
#define safe_mutex_assert_owner(mp) DBUG_ASSERT(safe_mutex_is_owner(mp))
|
||||
#define safe_mutex_assert_not_owner(mp) DBUG_ASSERT(!safe_mutex_is_owner(mp))
|
||||
#define safe_mutex_setflags(mp, F) do { (mp)->create_flags|= (F); } while (0)
|
||||
#define my_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
|
||||
#define my_cond_wait(A,B) safe_cond_wait((A), (B), __FILE__, __LINE__)
|
||||
|
|
|
@ -463,18 +463,19 @@ typedef struct st_io_cache /* Used when caching files */
|
|||
partial.
|
||||
*/
|
||||
int seek_not_done,error;
|
||||
/* buffer_length is memory size allocated for buffer or write_buffer */
|
||||
/* length of the buffer used for storing un-encrypted data */
|
||||
size_t buffer_length;
|
||||
/* read_length is the same as buffer_length except when we use async io */
|
||||
size_t read_length;
|
||||
myf myflags; /* Flags used to my_read/my_write */
|
||||
/*
|
||||
alloced_buffer is 1 if the buffer was allocated by init_io_cache() and
|
||||
0 if it was supplied by the user.
|
||||
alloced_buffer is set to the size of the buffer allocated for the IO_CACHE.
|
||||
Includes the overhead(storing key to ecnrypt and decrypt) for encryption.
|
||||
Set to 0 if nothing is allocated.
|
||||
Currently READ_NET is the only one that will use a buffer allocated
|
||||
somewhere else
|
||||
*/
|
||||
my_bool alloced_buffer;
|
||||
size_t alloced_buffer;
|
||||
} IO_CACHE;
|
||||
|
||||
typedef int (*qsort2_cmp)(const void *, const void *, const void *);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (c) 2008, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2020, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
|
@ -262,6 +263,7 @@ typedef struct st_mysql_cond mysql_cond_t;
|
|||
*/
|
||||
#ifndef DISABLE_MYSQL_THREAD_H
|
||||
|
||||
#define mysql_mutex_is_owner(M) safe_mutex_is_owner(&(M)->m_mutex)
|
||||
/**
|
||||
@def mysql_mutex_assert_owner(M)
|
||||
Wrapper, to use safe_mutex_assert_owner with instrumented mutexes.
|
||||
|
|
|
@ -18,13 +18,16 @@
|
|||
#define MYSQL_SERVER_SUFFIX_DEF "@MYSQL_SERVER_SUFFIX@"
|
||||
#define FRM_VER @DOT_FRM_VERSION@
|
||||
#define MYSQL_VERSION_ID @MYSQL_VERSION_ID@
|
||||
#define MYSQL_PORT @MYSQL_TCP_PORT@
|
||||
#define MARIADB_PORT @MYSQL_TCP_PORT@
|
||||
#define MYSQL_PORT_DEFAULT @MYSQL_TCP_PORT_DEFAULT@
|
||||
#define MYSQL_UNIX_ADDR "@MYSQL_UNIX_ADDR@"
|
||||
#define MARIADB_UNIX_ADDR "@MYSQL_UNIX_ADDR@"
|
||||
#define MYSQL_CONFIG_NAME "my"
|
||||
#define MYSQL_COMPILATION_COMMENT "@COMPILATION_COMMENT@"
|
||||
#define SERVER_MATURITY_LEVEL @SERVER_MATURITY_LEVEL@
|
||||
|
||||
#define MYSQL_PORT MARIADB_PORT
|
||||
#define MYSQL_UNIX_ADDR MARIADB_UNIX_ADDR
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
#define WSREP_PATCH_VERSION "@WSREP_PATCH_VERSION@"
|
||||
#endif
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit a746c3af449a8754e78ad7971e59e79af7957cdb
|
||||
Subproject commit 62427520a5ba20e42fe51f5045062a7a9cadb466
|
|
@ -159,7 +159,7 @@ ENDIF()
|
|||
SET(LIBS
|
||||
dbug strings mysys mysys_ssl pcre2-8 vio
|
||||
${ZLIB_LIBRARY} ${SSL_LIBRARIES}
|
||||
${LIBWRAP} ${LIBCRYPT} ${LIBDL}
|
||||
${LIBWRAP} ${LIBCRYPT} ${CMAKE_DL_LIBS}
|
||||
${EMBEDDED_PLUGIN_LIBS}
|
||||
sql_embedded
|
||||
)
|
||||
|
|
|
@ -332,7 +332,7 @@ static my_bool emb_read_query_result(MYSQL *mysql)
|
|||
static int emb_stmt_execute(MYSQL_STMT *stmt)
|
||||
{
|
||||
DBUG_ENTER("emb_stmt_execute");
|
||||
uchar header[5];
|
||||
uchar header[9];
|
||||
THD *thd;
|
||||
my_bool res;
|
||||
|
||||
|
@ -344,6 +344,7 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
|
|||
|
||||
int4store(header, stmt->stmt_id);
|
||||
header[4]= (uchar) stmt->flags;
|
||||
header[5]= header[6]= header[7]= header[8]= 0; // safety
|
||||
thd= (THD*)stmt->mysql->thd;
|
||||
thd->client_param_count= stmt->param_count;
|
||||
thd->client_params= stmt->params;
|
||||
|
|
|
@ -57,13 +57,13 @@ all would be imported into a table named
|
|||
patient\&.
|
||||
.PP
|
||||
.PP
|
||||
\fBmysqldump\fR
|
||||
\fBmysqlimport\fR
|
||||
supports the following options, which can be specified on the command line or in the
|
||||
[mysqldump]
|
||||
[mysqlimport]
|
||||
and
|
||||
[client]
|
||||
option file groups\&.
|
||||
\fBmysqldump\fR
|
||||
\fBmysqlimport\fR
|
||||
also supports the options for processing option files\&.
|
||||
.sp
|
||||
.RS 4
|
||||
|
@ -267,17 +267,17 @@ Empty the table before importing the text file\&.
|
|||
.sp -1
|
||||
.IP \(bu 2.3
|
||||
.\}
|
||||
.\" mysqldump: fields-terminated-by option
|
||||
.\" fields-terminated-by option: mysqldump
|
||||
.\" mysqlimport: fields-terminated-by option
|
||||
.\" fields-terminated-by option: mysqlimport
|
||||
\fB\-\-fields\-terminated\-by=\&.\&.\&.\fR,
|
||||
.\" mysqldump: fields-enclosed-by option
|
||||
.\" fields-enclosed-by option: mysqldump
|
||||
.\" mysqlimport: fields-enclosed-by option
|
||||
.\" fields-enclosed-by option: mysqlimport
|
||||
\fB\-\-fields\-enclosed\-by=\&.\&.\&.\fR,
|
||||
.\" mysqldump: fields-optionally-enclosed-by option
|
||||
.\" fields-optionally-enclosed-by option: mysqldump
|
||||
.\" mysqlimport: fields-optionally-enclosed-by option
|
||||
.\" fields-optionally-enclosed-by option: mysqlimport
|
||||
\fB\-\-fields\-optionally\-enclosed\-by=\&.\&.\&.\fR,
|
||||
.\" mysqldump: fields-escaped-by option
|
||||
.\" fields-escaped-by option: mysqldump
|
||||
.\" mysqlimport: fields-escaped-by option
|
||||
.\" fields-escaped-by option: mysqlimport
|
||||
\fB\-\-fields\-escaped\-by=\&.\&.\&.\fR
|
||||
.sp
|
||||
These options have the same meaning as the corresponding clauses for
|
||||
|
@ -379,8 +379,8 @@ lines of the data file\&.
|
|||
.sp -1
|
||||
.IP \(bu 2.3
|
||||
.\}
|
||||
.\" mysqldump: lines-terminated-by option
|
||||
.\" lines-terminated-by option: mysqldump
|
||||
.\" mysqlimport: lines-terminated-by option
|
||||
.\" lines-terminated-by option: mysqlimport
|
||||
\fB\-\-lines\-terminated\-by=\&.\&.\&.\fR
|
||||
.sp
|
||||
This option has the same meaning as the corresponding clause for
|
||||
|
|
7
mysql-test/include/have_static_innodb.inc
Normal file
7
mysql-test/include/have_static_innodb.inc
Normal file
|
@ -0,0 +1,7 @@
|
|||
source include/have_innodb.inc;
|
||||
|
||||
if (!`select count(*) from information_schema.plugins
|
||||
where plugin_name = 'innodb' and plugin_status = 'active' and
|
||||
plugin_library is null`) {
|
||||
skip Need compiled-in InnoDB;
|
||||
}
|
50
mysql-test/include/icp_debug_kill.inc
Normal file
50
mysql-test/include/icp_debug_kill.inc
Normal file
|
@ -0,0 +1,50 @@
|
|||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/count_sessions.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t0,t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t0(a int primary key);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
|
||||
create table t1(a int primary key);
|
||||
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
|
||||
|
||||
create table t2 (
|
||||
kp1 int,
|
||||
kp2 int,
|
||||
col char(100),
|
||||
key(kp1, kp2)
|
||||
);
|
||||
insert into t2 select a, a, a from t1;
|
||||
|
||||
select engine from information_schema.tables
|
||||
where table_schema=database() and table_name='t2';
|
||||
|
||||
explain
|
||||
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
|
||||
|
||||
let $target_id= `select connection_id()`;
|
||||
|
||||
set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go';
|
||||
send
|
||||
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
|
||||
|
||||
connect (con1, localhost, root,,);
|
||||
connection con1;
|
||||
set debug_sync='now WAIT_FOR at_icp_check';
|
||||
evalp kill query $target_id;
|
||||
set debug_sync='now SIGNAL go';
|
||||
|
||||
connection default;
|
||||
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
set debug_sync='RESET';
|
||||
|
||||
disconnect con1;
|
||||
drop table t0,t1,t2;
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
|
@ -35,6 +35,7 @@ BEGIN
|
|||
AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP'
|
||||
AND variable_name not like 'GTID%POS'
|
||||
AND variable_name != 'GTID_BINLOG_STATE'
|
||||
AND variable_name != 'THREAD_POOL_SIZE'
|
||||
ORDER BY variable_name;
|
||||
|
||||
-- Dump all databases, there should be none
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
TRUE
|
||||
NULL
|
68
mysql-test/include/rowid_filter_debug_kill.inc
Normal file
68
mysql-test/include/rowid_filter_debug_kill.inc
Normal file
|
@ -0,0 +1,68 @@
|
|||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/count_sessions.inc
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-22761 KILL QUERY during rowid_filter, crashes
|
||||
--echo #
|
||||
|
||||
create table t0(a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
|
||||
create table t1(a int);
|
||||
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
|
||||
|
||||
# 100 rows
|
||||
create table t2(a int);
|
||||
insert into t2 select A.a + B.a* 10 from t0 A, t0 B;
|
||||
|
||||
# 10K rows
|
||||
CREATE TABLE t3 (
|
||||
key1 int ,
|
||||
key2 int,
|
||||
filler varchar(255),
|
||||
KEY (key1),
|
||||
KEY (key2)
|
||||
);
|
||||
select engine from information_schema.tables
|
||||
where table_schema=database() and table_name='t3';
|
||||
|
||||
insert into t3
|
||||
select
|
||||
A.a,
|
||||
A.a,
|
||||
'filler-data-filler-data'
|
||||
from
|
||||
t0 A, t1 B;
|
||||
|
||||
analyze table t2,t3;
|
||||
|
||||
explain
|
||||
select * from t2, t3
|
||||
where
|
||||
t3.key1=t2.a and t3.key2 in (2,3);
|
||||
|
||||
let $target_id= `select connection_id()`;
|
||||
|
||||
set debug_sync='handler_rowid_filter_check SIGNAL at_rowid_filter_check WAIT_FOR go';
|
||||
send
|
||||
select * from t2, t3
|
||||
where
|
||||
t3.key1=t2.a and t3.key2 in (2,3);
|
||||
|
||||
connect (con1, localhost, root,,);
|
||||
connection con1;
|
||||
set debug_sync='now WAIT_FOR at_rowid_filter_check';
|
||||
evalp kill query $target_id;
|
||||
set debug_sync='now SIGNAL go';
|
||||
|
||||
connection default;
|
||||
disconnect con1;
|
||||
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
set debug_sync='RESET';
|
||||
|
||||
drop table t0,t1,t2,t3;
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
|
@ -26,7 +26,7 @@ ENDIF()
|
|||
|
||||
IF(WITH_WSREP)
|
||||
ADD_EXECUTABLE(wsrep_check_version wsrep_check_version.c)
|
||||
TARGET_LINK_LIBRARIES(wsrep_check_version ${LIBDL})
|
||||
TARGET_LINK_LIBRARIES(wsrep_check_version ${CMAKE_DL_LIBS})
|
||||
ENDIF()
|
||||
|
||||
IF(NOT INSTALL_MYSQLTESTDIR)
|
||||
|
|
|
@ -745,7 +745,7 @@ sub collect_one_test_case {
|
|||
if ( $enable_disabled )
|
||||
{
|
||||
# User has selected to run all disabled tests
|
||||
mtr_report(" - $tinfo->{name} wil be run although it's been disabled\n",
|
||||
mtr_report(" - $tinfo->{name} will be run although it's been disabled\n",
|
||||
" due to '$disable'");
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2521,6 +2521,17 @@ t2 CREATE TABLE `t2` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2, t1;
|
||||
#
|
||||
# MDEV-18163: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
|
||||
# m_lock_type != 2' failed in handler::ha_rnd_next(); / Assertion
|
||||
# `table_list->table' failed in find_field_in_table_ref / ERROR 1901
|
||||
# (on optimized builds)
|
||||
#
|
||||
CREATE TABLE t1 (k1 varchar(10) DEFAULT 5);
|
||||
CREATE TABLE t2 (i1 int);
|
||||
ALTER TABLE t1 ALTER COLUMN k1 SET DEFAULT (SELECT 1 FROM t2 limit 1);
|
||||
ERROR HY000: Function or expression 'select ...' cannot be used in the DEFAULT clause of `k1`
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
|
@ -3322,5 +3333,28 @@ Note 1176 Key 'x' doesn't exist in table 't1'
|
|||
unlock tables;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-23852 alter table rename column to uppercase doesn't work
|
||||
#
|
||||
create table t1 (abc int);
|
||||
alter table t1 rename column abc to Abc, algorithm=copy;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`Abc` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
alter table t1 rename column abc to ABc, algorithm=inplace;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`ABc` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
alter table t1 rename column abc to ABC;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`ABC` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
||||
|
|
|
@ -2036,6 +2036,20 @@ ALTER TABLE t2 DROP CONSTRAINT PRIMARY KEY;
|
|||
SHOW CREATE TABLE t2;
|
||||
DROP TABLE t2, t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18163: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
|
||||
--echo # m_lock_type != 2' failed in handler::ha_rnd_next(); / Assertion
|
||||
--echo # `table_list->table' failed in find_field_in_table_ref / ERROR 1901
|
||||
--echo # (on optimized builds)
|
||||
--echo #
|
||||
|
||||
|
||||
CREATE TABLE t1 (k1 varchar(10) DEFAULT 5);
|
||||
CREATE TABLE t2 (i1 int);
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
ALTER TABLE t1 ALTER COLUMN k1 SET DEFAULT (SELECT 1 FROM t2 limit 1);
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
@ -2529,6 +2543,18 @@ alter table t1 rename key if exists x to xx;
|
|||
unlock tables;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-23852 alter table rename column to uppercase doesn't work
|
||||
--echo #
|
||||
create table t1 (abc int);
|
||||
alter table t1 rename column abc to Abc, algorithm=copy;
|
||||
show create table t1;
|
||||
alter table t1 rename column abc to ABc, algorithm=inplace;
|
||||
show create table t1;
|
||||
alter table t1 rename column abc to ABC;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
|
34
mysql-test/main/aria_icp_debug.result
Normal file
34
mysql-test/main/aria_icp_debug.result
Normal file
|
@ -0,0 +1,34 @@
|
|||
set default_storage_engine=aria;
|
||||
drop table if exists t0,t1,t2;
|
||||
create table t0(a int primary key);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1(a int primary key);
|
||||
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
|
||||
create table t2 (
|
||||
kp1 int,
|
||||
kp2 int,
|
||||
col char(100),
|
||||
key(kp1, kp2)
|
||||
);
|
||||
insert into t2 select a, a, a from t1;
|
||||
select engine from information_schema.tables
|
||||
where table_schema=database() and table_name='t2';
|
||||
engine
|
||||
Aria
|
||||
explain
|
||||
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range kp1 kp1 5 NULL 10 Using index condition
|
||||
set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go';
|
||||
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
|
||||
connect con1, localhost, root,,;
|
||||
connection con1;
|
||||
set debug_sync='now WAIT_FOR at_icp_check';
|
||||
kill query $target_id;
|
||||
set debug_sync='now SIGNAL go';
|
||||
connection default;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
set debug_sync='RESET';
|
||||
disconnect con1;
|
||||
drop table t0,t1,t2;
|
||||
set default_storage_engine=default;
|
5
mysql-test/main/aria_icp_debug.test
Normal file
5
mysql-test/main/aria_icp_debug.test
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
set default_storage_engine=aria;
|
||||
--source include/icp_debug_kill.inc
|
||||
set default_storage_engine=default;
|
||||
|
|
@ -39,8 +39,129 @@ MDL_INTENTION_EXCLUSIVE Schema metadata lock test
|
|||
select * from t1;
|
||||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
backup unlock;
|
||||
#
|
||||
# BACKUP LOCK and BACKUP UNLOCK are not allowed in procedures.
|
||||
#
|
||||
CREATE PROCEDURE p_BACKUP_LOCK()
|
||||
BEGIN
|
||||
BACKUP LOCK;
|
||||
END|
|
||||
ERROR 0A000: BACKUP LOCK is not allowed in stored procedures
|
||||
CREATE PROCEDURE p_BACKUP_UNLOCK()
|
||||
BEGIN
|
||||
BACKUP UNLOCK;
|
||||
END|
|
||||
ERROR 0A000: BACKUP UNLOCK is not allowed in stored procedures
|
||||
#
|
||||
# BACKUP STAGE doesn't work when a BACKUP LOCK is active.
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
BACKUP LOCK t1;
|
||||
BACKUP STAGE START;
|
||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||
BACKUP UNLOCK;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# FLUSH TABLES WITH READ LOCK is not allowed when BACKUP LOCK is active.
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
BACKUP LOCK t1;
|
||||
FLUSH TABLES t1 WITH READ LOCK;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
BACKUP UNLOCK;
|
||||
BACKUP LOCK t1;
|
||||
FLUSH TABLES WITH READ LOCK;
|
||||
BACKUP UNLOCK;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-20945 BACKUP UNLOCK assertion failures.
|
||||
#
|
||||
# Scenario 1.
|
||||
CREATE TABLE t1 (a INT);
|
||||
BACKUP LOCK t1;
|
||||
FLUSH TABLE t1 WITH READ LOCK;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
UNLOCK TABLES;
|
||||
BACKUP UNLOCK;
|
||||
DROP TABLE t1;
|
||||
# Scenario 2.
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (b INT);
|
||||
LOCK TABLES t2 AS a2 WRITE;
|
||||
BACKUP LOCK t1;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
UNLOCK TABLES;
|
||||
INSERT INTO t1 VALUES(0);
|
||||
# restart
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
# Scenario 3.
|
||||
CREATE TEMPORARY TABLE t3 (c INT);
|
||||
BACKUP LOCK t1;
|
||||
SET @@SESSION.profiling=ON;
|
||||
CREATE TABLE t1 (c INT);
|
||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||
LOCK TABLES t3 AS a1 READ, t1 AS a3 READ, t3 AS a5 READ LOCAL;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
UNLOCK TABLE;
|
||||
# restart
|
||||
# Scenario 4.
|
||||
CREATE TABLE t (c INT);
|
||||
BACKUP LOCK not_existing.t;
|
||||
LOCK TABLES t WRITE;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
UNLOCK TABLES;
|
||||
# restart
|
||||
DROP TABLE t;
|
||||
# Scenario 5.
|
||||
BACKUP LOCK t1;
|
||||
CREATE TABLE t2 (c1 TIME, c2 TIME, c3 DATE, KEY(c1, c2));
|
||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||
LOCK TABLE t2 READ;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
# restart
|
||||
# Scenario 6.
|
||||
BACKUP LOCK t;
|
||||
CREATE VIEW v AS SELECT 1;
|
||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||
LOCK TABLES v READ;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
START TRANSACTION READ ONLY;
|
||||
BACKUP LOCK t;
|
||||
# restart
|
||||
# Scenario 7.
|
||||
SET SQL_MODE='';
|
||||
SET STATEMENT max_statement_time=180 FOR BACKUP LOCK test.u;
|
||||
CREATE TABLE t (a INT) ENGINE=Aria;
|
||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS s (c INT) ENGINE=Aria;
|
||||
LOCK TABLES s AS a READ LOCAL,t AS b WRITE;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
SET STATEMENT max_statement_time=180 FOR BACKUP LOCK test.u;
|
||||
# restart
|
||||
#
|
||||
connection con1;
|
||||
connection default;
|
||||
disconnect con1;
|
||||
show tables;
|
||||
Tables_in_test
|
||||
#
|
||||
# MDEV-22879 SIGSEGV (or hang) in free/my_free from
|
||||
# _ma_end_block_record (on optimized builds)
|
||||
#
|
||||
SET STATEMENT max_statement_time=20 FOR BACKUP LOCK test.t1;
|
||||
CREATE TABLE IF NOT EXISTS t3 (c1 CHAR(1) BINARY,c2 SMALLINT(10),c3 NUMERIC(1,0), PRIMARY KEY(c1(1))) ENGINE=InnoDB;
|
||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||
BACKUP UNLOCK;
|
||||
CREATE TABLE IF NOT EXISTS t3 (c1 CHAR(1) BINARY,c2 SMALLINT(10),c3 NUMERIC(1,0), PRIMARY KEY(c1(1))) ENGINE=InnoDB;
|
||||
SET STATEMENT max_statement_time=20 FOR BACKUP LOCK test.t1;
|
||||
LOCK TABLES t3 AS a2 WRITE, t3 AS a1 READ LOCAL;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
DROP TABLE t3;
|
||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||
BACKUP UNLOCK;
|
||||
DROP TABLE t3;
|
||||
#
|
||||
# End of MariaDB 10.4 tests
|
||||
#
|
||||
|
|
|
@ -43,8 +43,150 @@ SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.me
|
|||
--error ER_LOCK_DEADLOCK
|
||||
select * from t1;
|
||||
backup unlock;
|
||||
|
||||
--echo #
|
||||
--echo # BACKUP LOCK and BACKUP UNLOCK are not allowed in procedures.
|
||||
--echo #
|
||||
delimiter |;
|
||||
--error ER_SP_BADSTATEMENT
|
||||
CREATE PROCEDURE p_BACKUP_LOCK()
|
||||
BEGIN
|
||||
BACKUP LOCK;
|
||||
END|
|
||||
--error ER_SP_BADSTATEMENT
|
||||
CREATE PROCEDURE p_BACKUP_UNLOCK()
|
||||
BEGIN
|
||||
BACKUP UNLOCK;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
--echo #
|
||||
--echo # BACKUP STAGE doesn't work when a BACKUP LOCK is active.
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT);
|
||||
BACKUP LOCK t1;
|
||||
--error ER_CANT_UPDATE_WITH_READLOCK
|
||||
BACKUP STAGE START;
|
||||
BACKUP UNLOCK;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # FLUSH TABLES WITH READ LOCK is not allowed when BACKUP LOCK is active.
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT);
|
||||
BACKUP LOCK t1;
|
||||
--error ER_LOCK_OR_ACTIVE_TRANSACTION
|
||||
FLUSH TABLES t1 WITH READ LOCK;
|
||||
BACKUP UNLOCK;
|
||||
|
||||
BACKUP LOCK t1;
|
||||
FLUSH TABLES WITH READ LOCK;
|
||||
BACKUP UNLOCK;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-20945 BACKUP UNLOCK assertion failures.
|
||||
--echo #
|
||||
|
||||
--echo # Scenario 1.
|
||||
CREATE TABLE t1 (a INT);
|
||||
BACKUP LOCK t1;
|
||||
--error ER_LOCK_OR_ACTIVE_TRANSACTION
|
||||
FLUSH TABLE t1 WITH READ LOCK;
|
||||
UNLOCK TABLES;
|
||||
BACKUP UNLOCK; # Shouldn't trigger an assertion.
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Scenario 2.
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (b INT);
|
||||
LOCK TABLES t2 AS a2 WRITE;
|
||||
--error ER_LOCK_OR_ACTIVE_TRANSACTION
|
||||
BACKUP LOCK t1;
|
||||
UNLOCK TABLES;
|
||||
INSERT INTO t1 VALUES(0);
|
||||
--source include/restart_mysqld.inc
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
||||
--echo # Scenario 3.
|
||||
CREATE TEMPORARY TABLE t3 (c INT);
|
||||
BACKUP LOCK t1; # Table `t1` doesn't exist.
|
||||
SET @@SESSION.profiling=ON;
|
||||
--error ER_CANT_UPDATE_WITH_READLOCK
|
||||
CREATE TABLE t1 (c INT);
|
||||
--error ER_LOCK_OR_ACTIVE_TRANSACTION
|
||||
LOCK TABLES t3 AS a1 READ, t1 AS a3 READ, t3 AS a5 READ LOCAL;
|
||||
UNLOCK TABLE;
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
--echo # Scenario 4.
|
||||
CREATE TABLE t (c INT);
|
||||
BACKUP LOCK not_existing.t;
|
||||
--error ER_LOCK_OR_ACTIVE_TRANSACTION
|
||||
LOCK TABLES t WRITE;
|
||||
UNLOCK TABLES;
|
||||
--source include/restart_mysqld.inc
|
||||
DROP TABLE t;
|
||||
|
||||
--echo # Scenario 5.
|
||||
BACKUP LOCK t1;
|
||||
--error ER_CANT_UPDATE_WITH_READLOCK
|
||||
CREATE TABLE t2 (c1 TIME, c2 TIME, c3 DATE, KEY(c1, c2));
|
||||
--error ER_LOCK_OR_ACTIVE_TRANSACTION
|
||||
LOCK TABLE t2 READ;
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
--echo # Scenario 6.
|
||||
BACKUP LOCK t;
|
||||
--error ER_CANT_UPDATE_WITH_READLOCK
|
||||
CREATE VIEW v AS SELECT 1;
|
||||
--error ER_LOCK_OR_ACTIVE_TRANSACTION
|
||||
LOCK TABLES v READ;
|
||||
START TRANSACTION READ ONLY;
|
||||
BACKUP LOCK t;
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
--echo # Scenario 7.
|
||||
SET SQL_MODE='';
|
||||
SET STATEMENT max_statement_time=180 FOR BACKUP LOCK test.u;
|
||||
--error ER_CANT_UPDATE_WITH_READLOCK
|
||||
CREATE TABLE t (a INT) ENGINE=Aria;
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS s (c INT) ENGINE=Aria;
|
||||
--error ER_LOCK_OR_ACTIVE_TRANSACTION
|
||||
LOCK TABLES s AS a READ LOCAL,t AS b WRITE;
|
||||
--let $q= `SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE`
|
||||
SET STATEMENT max_statement_time=180 FOR BACKUP LOCK test.u;
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
--echo #
|
||||
|
||||
connection con1;
|
||||
--reap
|
||||
connection default;
|
||||
disconnect con1;
|
||||
show tables;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-22879 SIGSEGV (or hang) in free/my_free from
|
||||
--echo # _ma_end_block_record (on optimized builds)
|
||||
--echo #
|
||||
|
||||
SET STATEMENT max_statement_time=20 FOR BACKUP LOCK test.t1;
|
||||
--error ER_CANT_UPDATE_WITH_READLOCK
|
||||
CREATE TABLE IF NOT EXISTS t3 (c1 CHAR(1) BINARY,c2 SMALLINT(10),c3 NUMERIC(1,0), PRIMARY KEY(c1(1))) ENGINE=InnoDB;
|
||||
BACKUP UNLOCK;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS t3 (c1 CHAR(1) BINARY,c2 SMALLINT(10),c3 NUMERIC(1,0), PRIMARY KEY(c1(1))) ENGINE=InnoDB;
|
||||
SET STATEMENT max_statement_time=20 FOR BACKUP LOCK test.t1;
|
||||
--error ER_LOCK_OR_ACTIVE_TRANSACTION
|
||||
LOCK TABLES t3 AS a2 WRITE, t3 AS a1 READ LOCAL;
|
||||
--error ER_CANT_UPDATE_WITH_READLOCK
|
||||
DROP TABLE t3;
|
||||
BACKUP UNLOCK;
|
||||
DROP TABLE t3;
|
||||
|
||||
--echo #
|
||||
--echo # End of MariaDB 10.4 tests
|
||||
--echo #
|
||||
|
|
|
@ -24,3 +24,9 @@ SELECT 0 FROM t1 FORCE INDEX FOR GROUP BY(a) WHERE a = 0 OR b = 0 AND c = 0;
|
|||
0
|
||||
DROP TABLE t1;
|
||||
End of 5.6 tests
|
||||
CREATE TABLE `t` (
|
||||
`a` varchar(3000) NOT NULL default '',
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=BLACKHOLE;
|
||||
DROP TABLE `t`;
|
||||
End of 10.1 tests
|
||||
|
|
|
@ -38,3 +38,19 @@ SELECT 0 FROM t1 FORCE INDEX FOR GROUP BY(a) WHERE a = 0 OR b = 0 AND c = 0;
|
|||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.6 tests
|
||||
|
||||
#
|
||||
# MDEV-24017 / bug 53588 test case.
|
||||
#
|
||||
# Create long enough index (between 1000 and 3500). 1000 is the old value,
|
||||
# 3500 is innodb value (see ha_innobase::max_supported_key_length()). Without
|
||||
# the fix the test will fail with "Specified key was too long" error.
|
||||
#
|
||||
CREATE TABLE `t` (
|
||||
`a` varchar(3000) NOT NULL default '',
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=BLACKHOLE;
|
||||
|
||||
DROP TABLE `t`;
|
||||
|
||||
--echo End of 10.1 tests
|
||||
|
|
8
mysql-test/main/bootstrap_innodb.result
Normal file
8
mysql-test/main/bootstrap_innodb.result
Normal file
|
@ -0,0 +1,8 @@
|
|||
create table t1(a int) engine=innodb;
|
||||
# restart
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
5
|
||||
drop table t1;
|
27
mysql-test/main/bootstrap_innodb.test
Normal file
27
mysql-test/main/bootstrap_innodb.test
Normal file
|
@ -0,0 +1,27 @@
|
|||
source include/have_static_innodb.inc;
|
||||
source include/not_embedded.inc;
|
||||
|
||||
let $datadir= `select @@datadir`;
|
||||
|
||||
create table t1(a int) engine=innodb;
|
||||
source include/shutdown_mysqld.inc;
|
||||
|
||||
write_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
|
||||
use test;
|
||||
insert t1 values (1);
|
||||
start transaction;
|
||||
insert t1 values (2);
|
||||
savepoint s1;
|
||||
insert t1 values (3);
|
||||
savepoint s2;
|
||||
insert t1 values (4);
|
||||
rollback to savepoint s1;
|
||||
insert t1 values (5);
|
||||
commit;
|
||||
EOF
|
||||
exec $MYSQLD_BOOTSTRAP_CMD --datadir=$datadir --innodb < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
|
||||
|
||||
source include/start_mysqld.inc;
|
||||
select * from t1;
|
||||
drop table t1;
|
|
@ -517,12 +517,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN a ELSE
|
|||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and (case 'a' when 'a' then `test`.`t1`.`a` else 'a' end) = 'a'
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and case 'a' when 'a' then `test`.`t1`.`a` else 'a' end = 'a'
|
||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN 'a' ELSE a END='a';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and (case 'a' when 'a' then 'a' else `test`.`t1`.`a` end) = 'a'
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and case 'a' when 'a' then 'a' else `test`.`t1`.`a` end = 'a'
|
||||
ALTER TABLE t1 MODIFY a VARBINARY(10);
|
||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE a WHEN 'a' THEN 'a' ELSE 'a' END='a';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
|
@ -570,7 +570,7 @@ CASE WHEN a THEN b ELSE 1 END=3;
|
|||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (case `test`.`t1`.`a` when `test`.`t1`.`b` then 1 end) = 1 and (case when `test`.`t1`.`a` then `test`.`t1`.`b` else 1 end) = 3
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where case `test`.`t1`.`a` when `test`.`t1`.`b` then 1 end = 1 and case when `test`.`t1`.`a` then `test`.`t1`.`b` else 1 end = 3
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.3 test
|
||||
|
|
|
@ -10024,11 +10024,11 @@ EXPLAIN
|
|||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "case when (tab2.max_a = 1 or tab2.max_a = 2) then 1 else 0 end = 1",
|
||||
"attached_condition": "case when tab2.max_a = 1 or tab2.max_a = 2 then 1 else 0 end = 1",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 3,
|
||||
"having_condition": "case when (max_a = 1 or max_a = 2) then 1 else 0 end = 1",
|
||||
"having_condition": "case when max_a = 1 or max_a = 2 then 1 else 0 end = 1",
|
||||
"filesort": {
|
||||
"sort_key": "t1.b",
|
||||
"temporary_table": {
|
||||
|
@ -10073,11 +10073,11 @@ EXPLAIN
|
|||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "case when (tab2.max_a = 1 or tab2.max_a > 2 and tab2.max_a < 4) then 1 else 0 end = 1",
|
||||
"attached_condition": "case when tab2.max_a = 1 or tab2.max_a > 2 and tab2.max_a < 4 then 1 else 0 end = 1",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 3,
|
||||
"having_condition": "case when (max_a = 1 or max_a > 2 and max_a < 4) then 1 else 0 end = 1",
|
||||
"having_condition": "case when max_a = 1 or max_a > 2 and max_a < 4 then 1 else 0 end = 1",
|
||||
"filesort": {
|
||||
"sort_key": "t1.b",
|
||||
"temporary_table": {
|
||||
|
@ -10122,11 +10122,11 @@ EXPLAIN
|
|||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "case when (tab2.max_a > 1 and (tab2.max_a = 2 or tab2.max_a > 2)) then 1 else 0 end = 1",
|
||||
"attached_condition": "case when tab2.max_a > 1 and (tab2.max_a = 2 or tab2.max_a > 2) then 1 else 0 end = 1",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 3,
|
||||
"having_condition": "case when (max_a > 1 and (max_a = 2 or max_a > 2)) then 1 else 0 end = 1",
|
||||
"having_condition": "case when max_a > 1 and (max_a = 2 or max_a > 2) then 1 else 0 end = 1",
|
||||
"filesort": {
|
||||
"sort_key": "t1.b",
|
||||
"temporary_table": {
|
||||
|
@ -10171,7 +10171,7 @@ EXPLAIN
|
|||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "case when (tab2.b = 2 or tab2.b = 4) then 1 else 0 end = 1",
|
||||
"attached_condition": "case when tab2.b = 2 or tab2.b = 4 then 1 else 0 end = 1",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 3,
|
||||
|
@ -10183,7 +10183,7 @@ EXPLAIN
|
|||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "case when (t1.b = 2 or t1.b = 4) then 1 else 0 end = 1"
|
||||
"attached_condition": "case when t1.b = 2 or t1.b = 4 then 1 else 0 end = 1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,3 +196,38 @@ ERROR 22003: BIGINT value is out of range in '-73 * -2465717823867977728'
|
|||
SELECT UPDATEXML(-73 * -2465717823867977728,@@global.long_query_time,null);
|
||||
ERROR 22003: BIGINT value is out of range in '-73 * -2465717823867977728'
|
||||
# End of 10.3 tests
|
||||
#
|
||||
# MDEV-23518: Syntax error in ond SP results in misleading
|
||||
# message on SHOW CREATE PROCEDURE
|
||||
#
|
||||
CREATE PROCEDURE P1 ()
|
||||
BEGIN NOT ATOMIC
|
||||
IF (SELECT 2) THEN
|
||||
SELECT 4;
|
||||
END IF ;
|
||||
END;
|
||||
$$
|
||||
select name,db,body from mysql.proc where name = "P1";
|
||||
name db body
|
||||
P1 test BEGIN NOT ATOMIC
|
||||
IF (SELECT 2) THEN
|
||||
SELECT 4;
|
||||
END IF ;
|
||||
END
|
||||
update mysql.proc set body_utf8="BEGIN NOT ATOMIC
|
||||
IF (SELECT 2) OR foo = 3 THEN
|
||||
SELECT 4;
|
||||
END IF ;
|
||||
END", body="BEGIN NOT ATOMIC
|
||||
IF (SELECT 2) OR foo = 3 THEN
|
||||
SELECT 4;
|
||||
END IF ;
|
||||
END"where name = "P1";
|
||||
show create procedure P1;
|
||||
ERROR HY000: Failed to load routine test.P1 (internal code -6). For more details, run SHOW WARNINGS
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Error 1327 Undeclared variable: foo
|
||||
Error 1457 Failed to load routine test.P1 (internal code -6). For more details, run SHOW WARNINGS
|
||||
drop procedure P1;
|
||||
# End of 10.4 tests
|
||||
|
|
|
@ -246,3 +246,39 @@ SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,nu
|
|||
SELECT UPDATEXML(-73 * -2465717823867977728,@@global.long_query_time,null);
|
||||
|
||||
-- echo # End of 10.3 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-23518: Syntax error in ond SP results in misleading
|
||||
--echo # message on SHOW CREATE PROCEDURE
|
||||
--echo #
|
||||
|
||||
DELIMITER $$;
|
||||
|
||||
CREATE PROCEDURE P1 ()
|
||||
BEGIN NOT ATOMIC
|
||||
IF (SELECT 2) THEN
|
||||
SELECT 4;
|
||||
END IF ;
|
||||
END;
|
||||
$$
|
||||
|
||||
DELIMITER ;$$
|
||||
|
||||
select name,db,body from mysql.proc where name = "P1";
|
||||
update mysql.proc set body_utf8="BEGIN NOT ATOMIC
|
||||
IF (SELECT 2) OR foo = 3 THEN
|
||||
SELECT 4;
|
||||
END IF ;
|
||||
END", body="BEGIN NOT ATOMIC
|
||||
IF (SELECT 2) OR foo = 3 THEN
|
||||
SELECT 4;
|
||||
END IF ;
|
||||
END"where name = "P1";
|
||||
|
||||
--error ER_SP_PROC_TABLE_CORRUPT
|
||||
show create procedure P1;
|
||||
show warnings;
|
||||
|
||||
drop procedure P1;
|
||||
|
||||
-- echo # End of 10.4 tests
|
||||
|
|
|
@ -1186,13 +1186,13 @@ i count(*) std(e1/e2)
|
|||
3 4 0.00000000
|
||||
select std(s1/s2) from bug22555;
|
||||
std(s1/s2)
|
||||
0.21328517
|
||||
0.21325764
|
||||
select std(o1/o2) from bug22555;
|
||||
std(o1/o2)
|
||||
0.2132576358664934
|
||||
select std(e1/e2) from bug22555;
|
||||
std(e1/e2)
|
||||
0.21328517
|
||||
0.21325764
|
||||
set @saved_div_precision_increment=@@div_precision_increment;
|
||||
set div_precision_increment=19;
|
||||
select i, count(*), std(s1/s2) from bug22555 group by i order by i;
|
||||
|
|
|
@ -898,6 +898,11 @@ NULL
|
|||
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]');
|
||||
JSON_MERGE_PATCH(NULL, '[1,2,3]')
|
||||
[1, 2, 3]
|
||||
SELECT JSON_MERGE_PATCH(NULL, 'a');
|
||||
JSON_MERGE_PATCH(NULL, 'a')
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 4038 Syntax error in JSON text in argument 2 to function 'json_merge_patch' at position 1
|
||||
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}');
|
||||
JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}')
|
||||
{"d": "e"}
|
||||
|
@ -1354,6 +1359,11 @@ e JSON_OBJECTAGG(B.a, B.v)
|
|||
0 {"a1":"1", "a1":"1", "a1":"1"}
|
||||
0 {"a2":"2", "a2":"2", "a2":"2"}
|
||||
1 {"b1":"3", "b1":"3", "b1":"3"}
|
||||
CREATE VIEW v AS SELECT JSON_OBJECTAGG(a, e) FROM t1;
|
||||
SELECT * FROM v;
|
||||
JSON_OBJECTAGG(a, e)
|
||||
{"a1":0, "a2":0, "b1":1}
|
||||
DROP VIEW v;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.5 tests
|
||||
|
|
|
@ -528,6 +528,7 @@ DROP TABLE merge_t;
|
|||
|
||||
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}');
|
||||
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]');
|
||||
SELECT JSON_MERGE_PATCH(NULL, 'a');
|
||||
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}');
|
||||
|
||||
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
||||
|
@ -849,6 +850,10 @@ INSERT INTO t1 VALUES (0, 'a1', '1') , (0, 'a2', '2') , (1, 'b1', '3');
|
|||
EXPLAIN SELECT B.e, JSON_OBJECTAGG(B.a, B.v) FROM t1 A, t1 B GROUP BY B.e, B.a;
|
||||
SELECT B.e, JSON_OBJECTAGG(B.a, B.v) FROM t1 A, t1 B GROUP BY B.e, B.a;
|
||||
|
||||
CREATE VIEW v AS SELECT JSON_OBJECTAGG(a, e) FROM t1;
|
||||
SELECT * FROM v;
|
||||
|
||||
DROP VIEW v;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
|
|
|
@ -1765,11 +1765,6 @@ select 0=0, 0=-0, 0.0= -0.0, 0.0 = -(0.0), 0.0E1=-0.0E1, 0.0E1=-(0.0E1);
|
|||
select CRC32(NULL), CRC32(''), CRC32('MySQL'), CRC32('mysql'), CRC32('01234567'), CRC32('012345678'), CRC32(REPEAT('ABCDEfghij', 20)), CRC32(REPEAT('0123456789', 200));
|
||||
CRC32(NULL) CRC32('') CRC32('MySQL') CRC32('mysql') CRC32('01234567') CRC32('012345678') CRC32(REPEAT('ABCDEfghij', 20)) CRC32(REPEAT('0123456789', 200))
|
||||
NULL 0 3259397556 2501908538 763378421 939184570 3823776386 1428305034
|
||||
explain extended select (3-2)+1, (3/2)*1, 3-(2+1), 3/(2*1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select 3 - 2 + 1 AS `(3-2)+1`,3 / 2 * 1 AS `(3/2)*1`,3 - (2 + 1) AS `3-(2+1)`,3 / (2 * 1) AS `3/(2*1)`
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
|
|
|
@ -793,11 +793,6 @@ select 0=0, 0=-0, 0.0= -0.0, 0.0 = -(0.0), 0.0E1=-0.0E1, 0.0E1=-(0.0E1);
|
|||
|
||||
select CRC32(NULL), CRC32(''), CRC32('MySQL'), CRC32('mysql'), CRC32('01234567'), CRC32('012345678'), CRC32(REPEAT('ABCDEfghij', 20)), CRC32(REPEAT('0123456789', 200));
|
||||
|
||||
#
|
||||
# MDEV-13673 Bad result in view
|
||||
#
|
||||
explain extended select (3-2)+1, (3/2)*1, 3-(2+1), 3/(2*1);
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
|
|
@ -89,15 +89,6 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
Warnings:
|
||||
Note 1003 select -1 AS `- a` from dual
|
||||
drop table t1;
|
||||
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
|
||||
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
|
||||
0 1
|
||||
select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
|
||||
1 and 2 between 2 and 10 2 between 2 and 10 and 1
|
||||
1 1
|
||||
select 1 and 0 or 2, 2 or 1 and 0;
|
||||
1 and 0 or 2 2 or 1 and 0
|
||||
1 1
|
||||
select _koi8r'a' = _koi8r'A';
|
||||
_koi8r'a' = _koi8r'A'
|
||||
1
|
||||
|
@ -273,16 +264,6 @@ NULL
|
|||
select mod(NULL, 2.0) as 'NULL';
|
||||
NULL
|
||||
NULL
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 values (1,2), (2,3), (3,4), (4,5);
|
||||
select * from t1 where a not between 1 and 2;
|
||||
a b
|
||||
3 4
|
||||
4 5
|
||||
select * from t1 where a not between 1 and 2 and b not between 3 and 4;
|
||||
a b
|
||||
4 5
|
||||
drop table t1;
|
||||
SELECT GREATEST(1,NULL) FROM DUAL;
|
||||
GREATEST(1,NULL)
|
||||
NULL
|
||||
|
|
|
@ -35,14 +35,6 @@ select - a from t1;
|
|||
explain extended select - a from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Wrong usage of functions
|
||||
#
|
||||
|
||||
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
|
||||
select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
|
||||
select 1 and 0 or 2, 2 or 1 and 0;
|
||||
|
||||
#
|
||||
# Coercibility
|
||||
#
|
||||
|
@ -141,15 +133,6 @@ select mod(NULL, 2) as 'NULL';
|
|||
select mod(NULL, 2.0) as 'NULL';
|
||||
|
||||
|
||||
#
|
||||
# Bug#6726: NOT BETWEEN parse failure
|
||||
#
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 values (1,2), (2,3), (3,4), (4,5);
|
||||
select * from t1 where a not between 1 and 2;
|
||||
select * from t1 where a not between 1 and 2 and b not between 3 and 4;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test for bug #12791: one of the arguments of LEAST/GREATEST is NULL
|
||||
#
|
||||
|
|
|
@ -39,6 +39,42 @@ disconnect u1;
|
|||
drop user u1@localhost;
|
||||
drop database mysqltest1;
|
||||
#
|
||||
# MDEV-22313: Neither SHOW CREATE USER nor SHOW GRANTS prints a user's default role
|
||||
#
|
||||
CREATE ROLE test_role;
|
||||
CREATE USER test_user;
|
||||
GRANT test_role TO test_user;
|
||||
SET DEFAULT ROLE test_role FOR test_user;
|
||||
SHOW GRANTS FOR test_user;
|
||||
Grants for test_user@%
|
||||
GRANT `test_role` TO `test_user`@`%`
|
||||
GRANT USAGE ON *.* TO `test_user`@`%`
|
||||
SET DEFAULT ROLE test_role FOR 'test_user'@'%'
|
||||
SET DEFAULT ROLE NONE for test_user;
|
||||
SHOW GRANTS FOR test_user;
|
||||
Grants for test_user@%
|
||||
GRANT `test_role` TO `test_user`@`%`
|
||||
GRANT USAGE ON *.* TO `test_user`@`%`
|
||||
connect test_user, localhost, test_user;
|
||||
SET ROLE test_role;
|
||||
SET DEFAULT ROLE test_role;
|
||||
SHOW GRANTS;
|
||||
Grants for test_user@%
|
||||
GRANT `test_role` TO `test_user`@`%`
|
||||
GRANT USAGE ON *.* TO `test_user`@`%`
|
||||
GRANT USAGE ON *.* TO `test_role`
|
||||
SET DEFAULT ROLE test_role FOR 'test_user'@'%'
|
||||
SET DEFAULT ROLE NONE;
|
||||
SHOW GRANTS;
|
||||
Grants for test_user@%
|
||||
GRANT `test_role` TO `test_user`@`%`
|
||||
GRANT USAGE ON *.* TO `test_user`@`%`
|
||||
GRANT USAGE ON *.* TO `test_role`
|
||||
disconnect test_user;
|
||||
connection default;
|
||||
DROP USER test_user;
|
||||
DROP ROLE test_role;
|
||||
#
|
||||
# MDEV-20076: SHOW GRANTS does not quote role names properly
|
||||
#
|
||||
create role 'role1';
|
||||
|
|
|
@ -51,6 +51,27 @@ disconnect u1;
|
|||
drop user u1@localhost;
|
||||
drop database mysqltest1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-22313: Neither SHOW CREATE USER nor SHOW GRANTS prints a user's default role
|
||||
--echo #
|
||||
CREATE ROLE test_role;
|
||||
CREATE USER test_user;
|
||||
GRANT test_role TO test_user;
|
||||
SET DEFAULT ROLE test_role FOR test_user;
|
||||
SHOW GRANTS FOR test_user;
|
||||
SET DEFAULT ROLE NONE for test_user;
|
||||
SHOW GRANTS FOR test_user;
|
||||
connect test_user, localhost, test_user;
|
||||
SET ROLE test_role;
|
||||
SET DEFAULT ROLE test_role;
|
||||
SHOW GRANTS;
|
||||
SET DEFAULT ROLE NONE;
|
||||
SHOW GRANTS;
|
||||
disconnect test_user;
|
||||
connection default;
|
||||
DROP USER test_user;
|
||||
DROP ROLE test_role;
|
||||
|
||||
#
|
||||
# End of 10.1 tests
|
||||
#
|
||||
|
|
|
@ -1035,6 +1035,16 @@ YES
|
|||
# SQLCOM_BACKUP
|
||||
#
|
||||
#
|
||||
# SQLCOM_BACKUP_LOCK
|
||||
#
|
||||
INSERT INTO db1.trans VALUES (1);
|
||||
BACKUP LOCK t1;
|
||||
ROLLBACK;
|
||||
BACKUP UNLOCK;
|
||||
CALL db1.test_if_commit();
|
||||
IMPLICIT COMMIT
|
||||
YES
|
||||
#
|
||||
# SQLCOM_SHOW_ARCHIVE
|
||||
#
|
||||
#
|
||||
|
|
|
@ -1114,6 +1114,16 @@ source include/implicit_commit_helper.inc;
|
|||
# backup database db1 to 'backup_db1.ba';
|
||||
#source include/implicit_commit_helper.inc;
|
||||
|
||||
--echo #
|
||||
--echo # SQLCOM_BACKUP_LOCK
|
||||
--echo #
|
||||
|
||||
INSERT INTO db1.trans VALUES (1);
|
||||
BACKUP LOCK t1;
|
||||
ROLLBACK;
|
||||
BACKUP UNLOCK;
|
||||
CALL db1.test_if_commit();
|
||||
|
||||
--echo #
|
||||
--echo # SQLCOM_SHOW_ARCHIVE
|
||||
--echo #
|
||||
|
|
|
@ -81,7 +81,7 @@ EXPLAIN
|
|||
SELECT * FROM City
|
||||
WHERE Name LIKE 'M%' AND Population > 300000;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City index_merge Population,Name Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where
|
||||
1 SIMPLE City range Population,Name Name 35 NULL # Using index condition; Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City
|
||||
WHERE Name LIKE 'M%' AND Population > 7000000;
|
||||
|
@ -381,7 +381,7 @@ EXPLAIN
|
|||
SELECT * FROM City
|
||||
WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City index_merge Population,Name,Country Name,Population,Country # NULL # Using sort_intersect(Name,Population,Country); Using where
|
||||
1 SIMPLE City range Population,Name,Country Name # NULL # Using index condition; Using where
|
||||
SELECT * FROM City USE INDEX ()
|
||||
WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%';
|
||||
ID Name Country Population
|
||||
|
@ -721,7 +721,7 @@ EXPLAIN
|
|||
SELECT * FROM City
|
||||
WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City index_merge Population,Country,Name Name,Population,Country 35,4,3 NULL # Using sort_intersect(Name,Population,Country); Using where
|
||||
1 SIMPLE City range Population,Country,Name Name 35 NULL # Using index condition; Using where
|
||||
EXPLAIN
|
||||
SELECT * FROM City
|
||||
WHERE ID BETWEEN 1 AND 500 AND Population > 700000 AND Country LIKE 'C%';
|
||||
|
@ -732,7 +732,7 @@ SELECT * FROM City
|
|||
WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
|
||||
AND Country BETWEEN 'S' AND 'Z';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where
|
||||
1 SIMPLE City range PRIMARY,Population,Country PRIMARY 4 NULL # Using where
|
||||
SELECT * FROM City WHERE
|
||||
Name LIKE 'C%' AND Population > 1000000;
|
||||
ID Name Country Population
|
||||
|
|
|
@ -1689,7 +1689,7 @@ EXPLAIN
|
|||
SELECT * FROM t1 FORCE KEY (PRIMARY , i , c1 , c2)
|
||||
WHERE pk = 255 OR i = 22 OR (pk IN (1 , 136) AND c2 IN ('c' , 'w') AND (c1 NOT BETWEEN 'e' AND 'i' OR c2 > 'g')) OR pk != 1 ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY,c1,i,c2 NULL NULL NULL 69 Using where
|
||||
1 SIMPLE t1 index_merge PRIMARY,c1,i,c2 PRIMARY,i 0,5 NULL 69 Using sort_union(PRIMARY,i); Using where
|
||||
DROP TABLE t1;
|
||||
set optimizer_switch= @optimizer_switch_save;
|
||||
#
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
--- innodb_ext_key.result
|
||||
+++ innodb_ext_key,off.result
|
||||
@@ -9,7 +9,7 @@
|
||||
explain
|
||||
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
-1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 const,const 1 Using index
|
||||
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 const 5 Using where
|
||||
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
|
||||
flush status;
|
||||
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
|
||||
count(*)
|
||||
|
@ -12,7 +14,7 @@
|
|||
Handler_read_key 1
|
||||
Handler_read_last 0
|
||||
-Handler_read_next 1
|
||||
+Handler_read_next 5
|
||||
+Handler_read_next 6
|
||||
Handler_read_prev 0
|
||||
Handler_read_retry 0
|
||||
Handler_read_rnd 0
|
||||
|
@ -93,7 +95,7 @@
|
|||
where l_shipdate='1992-07-01' and l_orderkey=130;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 const 5 Using where
|
||||
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
|
||||
flush status;
|
||||
select max(l_linenumber) from lineitem
|
||||
where l_shipdate='1992-07-01' and l_orderkey=130;
|
||||
|
@ -102,7 +104,7 @@
|
|||
Handler_read_key 1
|
||||
Handler_read_last 0
|
||||
-Handler_read_next 0
|
||||
+Handler_read_next 5
|
||||
+Handler_read_next 6
|
||||
Handler_read_prev 0
|
||||
Handler_read_retry 0
|
||||
Handler_read_rnd 0
|
||||
|
@ -132,8 +134,8 @@
|
|||
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
|
||||
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
-1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where
|
||||
+1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 4,4 NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where
|
||||
-1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate # NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where
|
||||
+1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate # NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where
|
||||
flush status;
|
||||
select l_orderkey, l_linenumber
|
||||
from lineitem use index (i_l_shipdate, i_l_receiptdate)
|
||||
|
@ -154,21 +156,18 @@
|
|||
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
|
||||
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
-1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,i_l_receiptdate 8,8 NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where
|
||||
+1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,PRIMARY,i_l_receiptdate,PRIMARY 4,4,4,4 NULL 2 Using union(intersect(i_l_shipdate,PRIMARY),intersect(i_l_receiptdate,PRIMARY)); Using where
|
||||
-1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,i_l_receiptdate # NULL # Using
|
||||
+1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,PRIMARY,i_l_receiptdate,PRIMARY # NULL # Using
|
||||
flush status;
|
||||
select l_orderkey, l_linenumber from lineitem
|
||||
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
|
||||
@@ -223,7 +223,7 @@
|
||||
Handler_read_first 0
|
||||
Handler_read_key 2
|
||||
Handler_read_last 0
|
||||
@@ -220,12 +220,12 @@
|
||||
5959 3
|
||||
show status like 'handler_read_next';
|
||||
Variable_name Value
|
||||
-Handler_read_next 3
|
||||
+Handler_read_next 9
|
||||
Handler_read_prev 0
|
||||
Handler_read_retry 0
|
||||
Handler_read_rnd 3
|
||||
@@ -233,7 +233,7 @@
|
||||
explain
|
||||
select max(l_orderkey) from lineitem
|
||||
where l_partkey between 1 and 10 group by l_partkey;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
|
@ -177,7 +176,7 @@
|
|||
flush status;
|
||||
select max(l_orderkey) from lineitem
|
||||
where l_partkey between 1 and 10 group by l_partkey;
|
||||
@@ -251,9 +251,9 @@
|
||||
@@ -243,9 +243,9 @@
|
||||
show status like 'handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
|
@ -190,7 +189,7 @@
|
|||
Handler_read_prev 0
|
||||
Handler_read_retry 0
|
||||
Handler_read_rnd 0
|
||||
@@ -263,7 +263,7 @@
|
||||
@@ -255,7 +255,7 @@
|
||||
select max(l_orderkey) from lineitem
|
||||
where l_suppkey in (1,4) group by l_suppkey;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
|
@ -199,7 +198,7 @@
|
|||
flush status;
|
||||
select max(l_orderkey) from lineitem
|
||||
where l_suppkey in (1,4) group by l_suppkey;
|
||||
@@ -273,9 +273,9 @@
|
||||
@@ -265,9 +265,9 @@
|
||||
show status like 'handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
|
@ -212,7 +211,7 @@
|
|||
Handler_read_prev 0
|
||||
Handler_read_retry 0
|
||||
Handler_read_rnd 0
|
||||
@@ -291,7 +291,7 @@
|
||||
@@ -283,7 +283,7 @@
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE part range i_p_retailprice i_p_retailprice 9 NULL # Using where; Using index
|
||||
1 SIMPLE orders ref PRIMARY,i_o_orderdate i_o_orderdate 4 const # Using index
|
||||
|
@ -221,7 +220,7 @@
|
|||
flush status;
|
||||
select o_orderkey, p_partkey
|
||||
from part use index (i_p_retailprice),
|
||||
@@ -305,7 +305,7 @@
|
||||
@@ -297,7 +297,7 @@
|
||||
Handler_read_first 0
|
||||
Handler_read_key 3
|
||||
Handler_read_last 0
|
||||
|
@ -230,7 +229,7 @@
|
|||
Handler_read_prev 0
|
||||
Handler_read_retry 0
|
||||
Handler_read_rnd 0
|
||||
@@ -322,8 +322,8 @@
|
||||
@@ -314,8 +314,8 @@
|
||||
select * from t0, part ignore index (primary)
|
||||
where p_partkey=t0.a and p_size=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
|
@ -241,7 +240,7 @@
|
|||
select * from t0, part ignore index (primary)
|
||||
where p_partkey=t0.a and p_size=1;
|
||||
a p_partkey p_name p_mfgr p_brand p_type p_size p_container p_retailprice p_comment
|
||||
@@ -502,7 +502,7 @@
|
||||
@@ -494,7 +494,7 @@
|
||||
select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
|
||||
|
@ -250,7 +249,7 @@
|
|||
drop table t1,t2,t3;
|
||||
#
|
||||
# Bug mdev-4340: performance regression with extended_keys=on
|
||||
@@ -722,13 +722,13 @@
|
||||
@@ -714,13 +714,13 @@
|
||||
select * from t1 force index(index_date_updated)
|
||||
where index_date_updated= 10 and index_id < 800;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
|
@ -266,7 +265,7 @@
|
|||
drop table t0,t1,t2;
|
||||
#
|
||||
# MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff'
|
||||
@@ -763,11 +763,12 @@
|
||||
@@ -755,11 +755,12 @@
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
|
@ -282,7 +281,7 @@
|
|||
"rows": 1,
|
||||
"filtered": 100,
|
||||
"index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
|
||||
@@ -796,8 +797,8 @@
|
||||
@@ -788,8 +789,8 @@
|
||||
"access_type": "range",
|
||||
"possible_keys": ["k1"],
|
||||
"key": "k1",
|
||||
|
|
|
@ -26,12 +26,12 @@ Handler_read_rnd 0
|
|||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 0
|
||||
explain
|
||||
select count(*) from lineitem
|
||||
select count(*) from lineitem use index(primary)
|
||||
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE lineitem const PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 8 const,const 1
|
||||
1 SIMPLE lineitem const PRIMARY PRIMARY 8 const,const 1
|
||||
flush status;
|
||||
select count(*) from lineitem
|
||||
select count(*) from lineitem use index(primary)
|
||||
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
|
||||
count(*)
|
||||
1
|
||||
|
@ -183,7 +183,7 @@ from lineitem use index (i_l_shipdate, i_l_receiptdate)
|
|||
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
|
||||
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where
|
||||
1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate # NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where
|
||||
flush status;
|
||||
select l_orderkey, l_linenumber
|
||||
from lineitem use index (i_l_shipdate, i_l_receiptdate)
|
||||
|
@ -209,7 +209,7 @@ select l_orderkey, l_linenumber from lineitem
|
|||
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
|
||||
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,i_l_receiptdate 8,8 NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where
|
||||
1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,i_l_receiptdate # NULL # Using
|
||||
flush status;
|
||||
select l_orderkey, l_linenumber from lineitem
|
||||
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
|
||||
|
@ -218,17 +218,9 @@ l_orderkey l_linenumber
|
|||
130 2
|
||||
5603 2
|
||||
5959 3
|
||||
show status like 'handler_read%';
|
||||
show status like 'handler_read_next';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 2
|
||||
Handler_read_last 0
|
||||
Handler_read_next 3
|
||||
Handler_read_prev 0
|
||||
Handler_read_retry 0
|
||||
Handler_read_rnd 3
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 0
|
||||
explain
|
||||
select max(l_orderkey) from lineitem
|
||||
where l_partkey between 1 and 10 group by l_partkey;
|
||||
|
|
|
@ -17,6 +17,7 @@ use dbt3_s001;
|
|||
--disable_result_log
|
||||
--disable_warnings
|
||||
--source include/dbt3_s001.inc
|
||||
ANALYZE TABLE lineitem PERSISTENT FOR COLUMNS() INDEXES();
|
||||
--enable_warnings
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
|
@ -28,10 +29,10 @@ select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
|
|||
show status like 'handler_read%';
|
||||
|
||||
explain
|
||||
select count(*) from lineitem
|
||||
select count(*) from lineitem use index(primary)
|
||||
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
|
||||
flush status;
|
||||
select count(*) from lineitem
|
||||
select count(*) from lineitem use index(primary)
|
||||
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
|
||||
show status like 'handler_read%';
|
||||
|
||||
|
@ -85,6 +86,7 @@ select l_orderkey, l_linenumber
|
|||
or l_receiptdate='1992-07-01' and l_orderkey=5603;
|
||||
show status like 'handler_read%';
|
||||
|
||||
--replace_column 7 #
|
||||
explain
|
||||
select l_orderkey, l_linenumber
|
||||
from lineitem use index (i_l_shipdate, i_l_receiptdate)
|
||||
|
@ -97,6 +99,7 @@ select l_orderkey, l_linenumber
|
|||
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
|
||||
show status like 'handler_read%';
|
||||
|
||||
--replace_column 7 # 9 # 10 Using
|
||||
explain
|
||||
select l_orderkey, l_linenumber from lineitem
|
||||
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
|
||||
|
@ -105,7 +108,7 @@ flush status;
|
|||
select l_orderkey, l_linenumber from lineitem
|
||||
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
|
||||
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
|
||||
show status like 'handler_read%';
|
||||
show status like 'handler_read_next';
|
||||
|
||||
--replace_column 9 #
|
||||
explain
|
||||
|
|
34
mysql-test/main/innodb_icp_debug.result
Normal file
34
mysql-test/main/innodb_icp_debug.result
Normal file
|
@ -0,0 +1,34 @@
|
|||
set default_storage_engine=innodb;
|
||||
drop table if exists t0,t1,t2;
|
||||
create table t0(a int primary key);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1(a int primary key);
|
||||
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
|
||||
create table t2 (
|
||||
kp1 int,
|
||||
kp2 int,
|
||||
col char(100),
|
||||
key(kp1, kp2)
|
||||
);
|
||||
insert into t2 select a, a, a from t1;
|
||||
select engine from information_schema.tables
|
||||
where table_schema=database() and table_name='t2';
|
||||
engine
|
||||
InnoDB
|
||||
explain
|
||||
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range kp1 kp1 5 NULL 11 Using index condition
|
||||
set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go';
|
||||
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
|
||||
connect con1, localhost, root,,;
|
||||
connection con1;
|
||||
set debug_sync='now WAIT_FOR at_icp_check';
|
||||
kill query $target_id;
|
||||
set debug_sync='now SIGNAL go';
|
||||
connection default;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
set debug_sync='RESET';
|
||||
disconnect con1;
|
||||
drop table t0,t1,t2;
|
||||
set default_storage_engine=default;
|
6
mysql-test/main/innodb_icp_debug.test
Normal file
6
mysql-test/main/innodb_icp_debug.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
--source include/have_innodb.inc
|
||||
|
||||
set default_storage_engine=innodb;
|
||||
--source include/icp_debug_kill.inc
|
||||
set default_storage_engine=default;
|
||||
|
|
@ -375,8 +375,7 @@ SELECT SLEEP(1000);
|
|||
connection con1;
|
||||
KILL QUERY ID @id;
|
||||
connection default;
|
||||
SLEEP(1000)
|
||||
1
|
||||
ERROR 70100: Query execution was interrupted
|
||||
KILL QUERY ID 0;
|
||||
ERROR HY000: Unknown query id: 0
|
||||
#
|
||||
|
@ -392,8 +391,7 @@ ERROR HY000: You are not owner of query ID
|
|||
connection con1;
|
||||
KILL QUERY ID @id;
|
||||
connection default;
|
||||
SLEEP(1000)
|
||||
1
|
||||
ERROR 70100: Query execution was interrupted
|
||||
disconnect con5;
|
||||
DROP USER u1@localhost;
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
|
|
|
@ -606,6 +606,7 @@ let $wait_condition= SELECT @id:=QUERY_ID FROM INFORMATION_SCHEMA.PROCESSLIST WH
|
|||
source include/wait_condition.inc;
|
||||
KILL QUERY ID @id;
|
||||
connection default;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
|
||||
--error ER_NO_SUCH_QUERY
|
||||
|
@ -632,6 +633,7 @@ connection con1;
|
|||
KILL QUERY ID @id;
|
||||
|
||||
connection default;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
disconnect con5;
|
||||
DROP USER u1@localhost;
|
||||
|
|
|
@ -865,6 +865,21 @@ Warning 1931 Query execution was interrupted. The query examined at least 22 row
|
|||
drop view v;
|
||||
drop table t1, t2;
|
||||
#
|
||||
# 10.1 Test
|
||||
#
|
||||
# MDEV-17729: Assertion `! is_set() || m_can_overwrite_status'
|
||||
# failed in Diagnostics_area::set_error_status
|
||||
#
|
||||
set @old_mode= @@sql_mode;
|
||||
CREATE TABLE t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,k INT, c CHAR(20));
|
||||
INSERT INTO t1 (k,c) VALUES(0,'0'), (0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0');
|
||||
SET @@sql_mode='STRICT_TRANS_TABLES';
|
||||
INSERT INTO t1 (c) SELECT k FROM t1 LIMIT ROWS EXAMINED 2;
|
||||
Warnings:
|
||||
Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
|
||||
SET @@sql_mode=@old_mode;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-18117: Crash with Explain extended when using limit rows examined
|
||||
#
|
||||
create table t1 (c1 char(2));
|
||||
|
@ -879,3 +894,4 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c2` = `test`.`t1`.`c1`
|
||||
drop table t1,t2;
|
||||
# End of 10.4 tests
|
||||
|
|
|
@ -578,6 +578,23 @@ EXECUTE ps;
|
|||
drop view v;
|
||||
drop table t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # 10.1 Test
|
||||
--echo #
|
||||
--echo # MDEV-17729: Assertion `! is_set() || m_can_overwrite_status'
|
||||
--echo # failed in Diagnostics_area::set_error_status
|
||||
--echo #
|
||||
set @old_mode= @@sql_mode;
|
||||
|
||||
CREATE TABLE t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,k INT, c CHAR(20));
|
||||
INSERT INTO t1 (k,c) VALUES(0,'0'), (0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0');
|
||||
|
||||
SET @@sql_mode='STRICT_TRANS_TABLES';
|
||||
INSERT INTO t1 (c) SELECT k FROM t1 LIMIT ROWS EXAMINED 2;
|
||||
|
||||
SET @@sql_mode=@old_mode;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18117: Crash with Explain extended when using limit rows examined
|
||||
--echo #
|
||||
|
@ -589,3 +606,5 @@ insert into t2 values ('bb'), ('cc'), ('dd'), ('ff');
|
|||
explain extended
|
||||
select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2;
|
||||
drop table t1,t2;
|
||||
|
||||
--echo # End of 10.4 tests
|
||||
|
|
231
mysql-test/main/lock_view.result
Normal file
231
mysql-test/main/lock_view.result
Normal file
|
@ -0,0 +1,231 @@
|
|||
create database mysqltest1;
|
||||
create database mysqltest2;
|
||||
create database mysqltest3;
|
||||
create user invoker@localhost;
|
||||
create user definer@localhost;
|
||||
grant select,show view on mysqltest1.* to invoker@localhost;
|
||||
grant select,show view on mysqltest1.* to definer@localhost;
|
||||
grant select,show view on mysqltest2.* to invoker@localhost;
|
||||
grant select,show view on mysqltest2.* to definer@localhost;
|
||||
grant select,show view on mysqltest3.* to invoker@localhost;
|
||||
grant select on performance_schema.* to definer@localhost;
|
||||
create table mysqltest1.t1 (a int);
|
||||
create definer=definer@localhost view mysqltest2.v2 as select * from mysqltest1.t1;
|
||||
create definer=definer@localhost view mysqltest3.v3 as select * from mysqltest2.v2;
|
||||
create definer=definer@localhost view mysqltest3.v3is as select schema_name from information_schema.schemata order by schema_name;
|
||||
create definer=definer@localhost view mysqltest3.v3ps as select user from performance_schema.users where current_connections>0 order by user;
|
||||
create definer=definer@localhost view mysqltest3.v3nt as select 1;
|
||||
create definer=definer@localhost sql security invoker view mysqltest3.v3i as select * from mysqltest1.t1;
|
||||
|
||||
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */;
|
||||
|
||||
USE `mysqltest1`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin1 */;
|
||||
|
||||
USE `mysqltest2`;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` tinyint NOT NULL
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin1 */;
|
||||
|
||||
USE `mysqltest3`;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v3` (
|
||||
`a` tinyint NOT NULL
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v3i` (
|
||||
`a` tinyint NOT NULL
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v3is` (
|
||||
`schema_name` tinyint NOT NULL
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v3nt` (
|
||||
`1` tinyint NOT NULL
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v3ps` (
|
||||
`user` tinyint NOT NULL
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
USE `mysqltest1`;
|
||||
|
||||
USE `mysqltest2`;
|
||||
/*!50001 DROP TABLE IF EXISTS `v2`*/;
|
||||
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
||||
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
||||
/*!50001 SET character_set_client = latin1 */;
|
||||
/*!50001 SET character_set_results = latin1 */;
|
||||
/*!50001 SET collation_connection = latin1_swedish_ci */;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`definer`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v2` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` */;
|
||||
/*!50001 SET character_set_client = @saved_cs_client */;
|
||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
|
||||
USE `mysqltest3`;
|
||||
/*!50001 DROP TABLE IF EXISTS `v3`*/;
|
||||
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
||||
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
||||
/*!50001 SET character_set_client = latin1 */;
|
||||
/*!50001 SET character_set_results = latin1 */;
|
||||
/*!50001 SET collation_connection = latin1_swedish_ci */;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`definer`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v3` AS select `v2`.`a` AS `a` from `mysqltest2`.`v2` */;
|
||||
/*!50001 SET character_set_client = @saved_cs_client */;
|
||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v3i`*/;
|
||||
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
||||
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
||||
/*!50001 SET character_set_client = latin1 */;
|
||||
/*!50001 SET character_set_results = latin1 */;
|
||||
/*!50001 SET collation_connection = latin1_swedish_ci */;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`definer`@`localhost` SQL SECURITY INVOKER */
|
||||
/*!50001 VIEW `v3i` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` */;
|
||||
/*!50001 SET character_set_client = @saved_cs_client */;
|
||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v3is`*/;
|
||||
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
||||
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
||||
/*!50001 SET character_set_client = latin1 */;
|
||||
/*!50001 SET character_set_results = latin1 */;
|
||||
/*!50001 SET collation_connection = latin1_swedish_ci */;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`definer`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v3is` AS select `information_schema`.`schemata`.`SCHEMA_NAME` AS `schema_name` from `information_schema`.`schemata` order by `information_schema`.`schemata`.`SCHEMA_NAME` */;
|
||||
/*!50001 SET character_set_client = @saved_cs_client */;
|
||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v3nt`*/;
|
||||
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
||||
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
||||
/*!50001 SET character_set_client = latin1 */;
|
||||
/*!50001 SET character_set_results = latin1 */;
|
||||
/*!50001 SET collation_connection = latin1_swedish_ci */;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`definer`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v3nt` AS select 1 AS `1` */;
|
||||
/*!50001 SET character_set_client = @saved_cs_client */;
|
||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v3ps`*/;
|
||||
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
||||
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
||||
/*!50001 SET character_set_client = latin1 */;
|
||||
/*!50001 SET character_set_results = latin1 */;
|
||||
/*!50001 SET collation_connection = latin1_swedish_ci */;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`definer`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v3ps` AS select `performance_schema`.`users`.`USER` AS `user` from `performance_schema`.`users` where `performance_schema`.`users`.`CURRENT_CONNECTIONS` > 0 order by `performance_schema`.`users`.`USER` */;
|
||||
/*!50001 SET character_set_client = @saved_cs_client */;
|
||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
connect inv,localhost,invoker;
|
||||
lock table mysqltest3.v3 write;
|
||||
ERROR 42000: Access denied for user 'invoker'@'localhost' to database 'mysqltest3'
|
||||
disconnect inv;
|
||||
connection default;
|
||||
grant lock tables on mysqltest3.* to invoker@localhost;
|
||||
connect inv,localhost,invoker;
|
||||
show create view mysqltest3.v3;
|
||||
View Create View character_set_client collation_connection
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`definer`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v3` AS select `v2`.`a` AS `a` from `mysqltest2`.`v2` latin1 latin1_swedish_ci
|
||||
show create view mysqltest3.v3is;
|
||||
View Create View character_set_client collation_connection
|
||||
v3is CREATE ALGORITHM=UNDEFINED DEFINER=`definer`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v3is` AS select `information_schema`.`schemata`.`SCHEMA_NAME` AS `schema_name` from `information_schema`.`schemata` order by `information_schema`.`schemata`.`SCHEMA_NAME` latin1 latin1_swedish_ci
|
||||
show create view mysqltest3.v3ps;
|
||||
View Create View character_set_client collation_connection
|
||||
v3ps CREATE ALGORITHM=UNDEFINED DEFINER=`definer`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v3ps` AS select `performance_schema`.`users`.`USER` AS `user` from `performance_schema`.`users` where `performance_schema`.`users`.`CURRENT_CONNECTIONS` > 0 order by `performance_schema`.`users`.`USER` latin1 latin1_swedish_ci
|
||||
show create view mysqltest3.v3nt;
|
||||
View Create View character_set_client collation_connection
|
||||
v3nt CREATE ALGORITHM=UNDEFINED DEFINER=`definer`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v3nt` AS select 1 AS `1` latin1 latin1_swedish_ci
|
||||
show create view mysqltest3.v3i;
|
||||
View Create View character_set_client collation_connection
|
||||
v3i CREATE ALGORITHM=UNDEFINED DEFINER=`definer`@`localhost` SQL SECURITY INVOKER VIEW `mysqltest3`.`v3i` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
|
||||
lock table mysqltest3.v3 write;
|
||||
ERROR HY000: View 'mysqltest3.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
lock table mysqltest3.v3i write;
|
||||
ERROR HY000: View 'mysqltest3.v3i' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
lock table mysqltest3.v3is write;
|
||||
select * from mysqltest3.v3is;
|
||||
schema_name
|
||||
information_schema
|
||||
mysqltest1
|
||||
mysqltest2
|
||||
performance_schema
|
||||
test
|
||||
lock table mysqltest3.v3ps write;
|
||||
select * from mysqltest3.v3ps;
|
||||
user
|
||||
NULL
|
||||
invoker
|
||||
root
|
||||
lock table mysqltest3.v3nt write;
|
||||
select * from mysqltest3.v3nt;
|
||||
1
|
||||
1
|
||||
disconnect inv;
|
||||
connection default;
|
||||
grant lock tables on mysqltest2.* to invoker@localhost;
|
||||
connect inv,localhost,invoker;
|
||||
lock table mysqltest3.v3 write;
|
||||
ERROR HY000: View 'mysqltest3.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
lock table mysqltest3.v3i write;
|
||||
ERROR HY000: View 'mysqltest3.v3i' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
disconnect inv;
|
||||
connection default;
|
||||
grant lock tables on mysqltest1.* to definer@localhost;
|
||||
connect inv,localhost,invoker;
|
||||
lock table mysqltest3.v3 write;
|
||||
select * from mysqltest3.v3;
|
||||
a
|
||||
lock table mysqltest3.v3i write;
|
||||
ERROR HY000: View 'mysqltest3.v3i' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
disconnect inv;
|
||||
connection default;
|
||||
grant lock tables on mysqltest1.* to invoker@localhost;
|
||||
connect inv,localhost,invoker;
|
||||
lock table mysqltest3.v3i write;
|
||||
select * from mysqltest3.v3i;
|
||||
a
|
||||
disconnect inv;
|
||||
connection default;
|
||||
drop user invoker@localhost;
|
||||
drop user definer@localhost;
|
||||
drop database mysqltest1;
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest3;
|
76
mysql-test/main/lock_view.test
Normal file
76
mysql-test/main/lock_view.test
Normal file
|
@ -0,0 +1,76 @@
|
|||
source include/not_embedded.inc;
|
||||
#
|
||||
# LOCK TABLES and privileges on views
|
||||
#
|
||||
create database mysqltest1;
|
||||
create database mysqltest2;
|
||||
create database mysqltest3;
|
||||
create user invoker@localhost;
|
||||
create user definer@localhost;
|
||||
grant select,show view on mysqltest1.* to invoker@localhost;
|
||||
grant select,show view on mysqltest1.* to definer@localhost;
|
||||
grant select,show view on mysqltest2.* to invoker@localhost;
|
||||
grant select,show view on mysqltest2.* to definer@localhost;
|
||||
grant select,show view on mysqltest3.* to invoker@localhost;
|
||||
grant select on performance_schema.* to definer@localhost;
|
||||
create table mysqltest1.t1 (a int);
|
||||
create definer=definer@localhost view mysqltest2.v2 as select * from mysqltest1.t1;
|
||||
create definer=definer@localhost view mysqltest3.v3 as select * from mysqltest2.v2;
|
||||
create definer=definer@localhost view mysqltest3.v3is as select schema_name from information_schema.schemata order by schema_name;
|
||||
create definer=definer@localhost view mysqltest3.v3ps as select user from performance_schema.users where current_connections>0 order by user;
|
||||
create definer=definer@localhost view mysqltest3.v3nt as select 1;
|
||||
create definer=definer@localhost sql security invoker view mysqltest3.v3i as select * from mysqltest1.t1;
|
||||
|
||||
exec $MYSQL_DUMP --compact -B mysqltest1 mysqltest2 mysqltest3;
|
||||
|
||||
connect inv,localhost,invoker;
|
||||
error ER_DBACCESS_DENIED_ERROR;
|
||||
lock table mysqltest3.v3 write;
|
||||
disconnect inv;
|
||||
connection default;
|
||||
|
||||
grant lock tables on mysqltest3.* to invoker@localhost;
|
||||
connect inv,localhost,invoker;
|
||||
show create view mysqltest3.v3;
|
||||
show create view mysqltest3.v3is;
|
||||
show create view mysqltest3.v3ps;
|
||||
show create view mysqltest3.v3nt;
|
||||
show create view mysqltest3.v3i;
|
||||
error ER_VIEW_INVALID;
|
||||
lock table mysqltest3.v3 write;
|
||||
error ER_VIEW_INVALID;
|
||||
lock table mysqltest3.v3i write;
|
||||
lock table mysqltest3.v3is write; select * from mysqltest3.v3is;
|
||||
lock table mysqltest3.v3ps write; select * from mysqltest3.v3ps;
|
||||
lock table mysqltest3.v3nt write; select * from mysqltest3.v3nt;
|
||||
disconnect inv;
|
||||
connection default;
|
||||
|
||||
grant lock tables on mysqltest2.* to invoker@localhost;
|
||||
connect inv,localhost,invoker;
|
||||
error ER_VIEW_INVALID;
|
||||
lock table mysqltest3.v3 write;
|
||||
error ER_VIEW_INVALID;
|
||||
lock table mysqltest3.v3i write;
|
||||
disconnect inv;
|
||||
connection default;
|
||||
|
||||
grant lock tables on mysqltest1.* to definer@localhost;
|
||||
connect inv,localhost,invoker;
|
||||
lock table mysqltest3.v3 write; select * from mysqltest3.v3;
|
||||
error ER_VIEW_INVALID;
|
||||
lock table mysqltest3.v3i write;
|
||||
disconnect inv;
|
||||
connection default;
|
||||
|
||||
grant lock tables on mysqltest1.* to invoker@localhost;
|
||||
connect inv,localhost,invoker;
|
||||
lock table mysqltest3.v3i write; select * from mysqltest3.v3i;
|
||||
disconnect inv;
|
||||
connection default;
|
||||
|
||||
drop user invoker@localhost;
|
||||
drop user definer@localhost;
|
||||
drop database mysqltest1;
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest3;
|
|
@ -380,6 +380,14 @@ slow_log
|
|||
slow_log_new
|
||||
drop table slow_log_new, general_log_new;
|
||||
use test;
|
||||
SET GLOBAL LOG_OUTPUT = 'FILE';
|
||||
SET GLOBAL slow_query_log = 1;
|
||||
SET GLOBAL general_log = 1;
|
||||
ALTER TABLE mysql.slow_log ADD COLUMN comment_text TEXT NOT NULL;
|
||||
ALTER TABLE mysql.general_log ADD COLUMN comment_text TEXT NOT NULL;
|
||||
SET GLOBAL LOG_OUTPUT = 'NONE';
|
||||
ALTER TABLE mysql.slow_log DROP COLUMN comment_text;
|
||||
ALTER TABLE mysql.general_log DROP COLUMN comment_text;
|
||||
SET GLOBAL LOG_OUTPUT = 'TABLE';
|
||||
SET GLOBAL general_log = 0;
|
||||
FLUSH LOGS;
|
||||
|
|
|
@ -54,7 +54,7 @@ select * from general_log where argument like '%general_log%';
|
|||
|
||||
#
|
||||
# Check some basic queries interfering with the log tables.
|
||||
# In our test we'll use a tbale with verbose comments to the short
|
||||
# In our test we'll use a table with verbose comments to the short
|
||||
# command type names, used in the tables
|
||||
#
|
||||
|
||||
|
@ -474,6 +474,24 @@ show tables like "%log%";
|
|||
drop table slow_log_new, general_log_new;
|
||||
use test;
|
||||
|
||||
#
|
||||
# Bug#69953 / MDEV-4851
|
||||
# Log tables should be modifable on LOG_OUTPUT != TABLE
|
||||
#
|
||||
#
|
||||
|
||||
SET GLOBAL LOG_OUTPUT = 'FILE';
|
||||
SET GLOBAL slow_query_log = 1;
|
||||
SET GLOBAL general_log = 1;
|
||||
|
||||
ALTER TABLE mysql.slow_log ADD COLUMN comment_text TEXT NOT NULL;
|
||||
ALTER TABLE mysql.general_log ADD COLUMN comment_text TEXT NOT NULL;
|
||||
|
||||
SET GLOBAL LOG_OUTPUT = 'NONE';
|
||||
ALTER TABLE mysql.slow_log DROP COLUMN comment_text;
|
||||
ALTER TABLE mysql.general_log DROP COLUMN comment_text;
|
||||
|
||||
|
||||
#
|
||||
# Bug#27857 (Log tables supplies the wrong value for generating
|
||||
# AUTO_INCREMENT numbers)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
DROP TABLE IF EXISTS t1,t2;
|
||||
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
|
||||
# The protocolling of many inserts into t1 is suppressed.
|
||||
INSERT INTO t1 SELECT seq,seq FROM seq_1_to_2097152;
|
||||
ALTER TABLE t1 ADD INDEX i1(a);
|
||||
DELETE FROM t1 WHERE a > 2000000;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
--source include/long_test.inc
|
||||
--source include/have_sequence.inc
|
||||
|
||||
#
|
||||
# Test of update statement that uses many tables.
|
||||
|
@ -40,25 +41,9 @@ if (`SELECT '$BIG_TEST' = '' AND $need_big = 1`)
|
|||
# Bug#1820 Rows not deleted from second table on multi-table delete
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
|
||||
--echo # The protocolling of many inserts into t1 is suppressed.
|
||||
--disable_query_log
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4);
|
||||
let $1=19;
|
||||
set @d=4;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
eval INSERT INTO t1 SELECT a+@d,b+@d FROM t1;
|
||||
eval SET @d=@d*2;
|
||||
dec $1;
|
||||
}
|
||||
commit;
|
||||
--enable_query_log
|
||||
INSERT INTO t1 SELECT seq,seq FROM seq_1_to_2097152;
|
||||
|
||||
ALTER TABLE t1 ADD INDEX i1(a);
|
||||
DELETE FROM t1 WHERE a > 2000000;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
|
|
32
mysql-test/main/myisam_icp_debug.result
Normal file
32
mysql-test/main/myisam_icp_debug.result
Normal file
|
@ -0,0 +1,32 @@
|
|||
drop table if exists t0,t1,t2;
|
||||
create table t0(a int primary key);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1(a int primary key);
|
||||
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
|
||||
create table t2 (
|
||||
kp1 int,
|
||||
kp2 int,
|
||||
col char(100),
|
||||
key(kp1, kp2)
|
||||
);
|
||||
insert into t2 select a, a, a from t1;
|
||||
select engine from information_schema.tables
|
||||
where table_schema=database() and table_name='t2';
|
||||
engine
|
||||
MyISAM
|
||||
explain
|
||||
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range kp1 kp1 5 NULL 11 Using index condition
|
||||
set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go';
|
||||
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
|
||||
connect con1, localhost, root,,;
|
||||
connection con1;
|
||||
set debug_sync='now WAIT_FOR at_icp_check';
|
||||
kill query $target_id;
|
||||
set debug_sync='now SIGNAL go';
|
||||
connection default;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
set debug_sync='RESET';
|
||||
disconnect con1;
|
||||
drop table t0,t1,t2;
|
1
mysql-test/main/myisam_icp_debug.test
Normal file
1
mysql-test/main/myisam_icp_debug.test
Normal file
|
@ -0,0 +1 @@
|
|||
--source include/icp_debug_kill.inc
|
1
mysql-test/main/mysql_json_table_recreate.opt
Normal file
1
mysql-test/main/mysql_json_table_recreate.opt
Normal file
|
@ -0,0 +1 @@
|
|||
--plugin-load=$TYPE_MYSQL_JSON_SO
|
171
mysql-test/main/mysql_json_table_recreate.result
Normal file
171
mysql-test/main/mysql_json_table_recreate.result
Normal file
|
@ -0,0 +1,171 @@
|
|||
#
|
||||
# The following test takes 2 tables containing a JSON column and attempts
|
||||
# to repair them.
|
||||
#
|
||||
# The tables header is (Description, Expected, Actual), where description
|
||||
# shows a brief description what the JSON value is testing in the MariaDB
|
||||
# implementation. Expected is the longtext string and actual is the JSON
|
||||
# column that needs to be converted to MariaDB's representation of
|
||||
# LONGTEXT.
|
||||
#
|
||||
call mtr.add_suppression("Table rebuild required");
|
||||
call mtr.add_suppression("is marked as crashed");
|
||||
call mtr.add_suppression("Checking");
|
||||
SET NAMES utf8;
|
||||
#
|
||||
# Check that only ALTER TABLE ... FORCE is allowed on a MySQL 5.7 table
|
||||
# with a JSON column.
|
||||
#
|
||||
show create table tempty;
|
||||
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.tempty` FORCE" or dump/reload to fix it!
|
||||
select * from tempty;
|
||||
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.tempty` FORCE" or dump/reload to fix it!
|
||||
alter table tempty force;
|
||||
show create table tempty;
|
||||
Table Create Table
|
||||
tempty CREATE TABLE `tempty` (
|
||||
`t` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
show create table mysql_json_test;
|
||||
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test` FORCE" or dump/reload to fix it!
|
||||
select * from mysql_json_test;
|
||||
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test` FORCE" or dump/reload to fix it!
|
||||
LOCK TABLES mysql_json_test WRITE;
|
||||
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test` FORCE" or dump/reload to fix it!
|
||||
alter table mysql_json_test force;
|
||||
select description, expected, actual, expected = actual from mysql_json_test;
|
||||
description expected actual expected = actual
|
||||
Array LITERALS: ["prefix", false, "suffix", 1] ["prefix", false, "suffix", 1] 1
|
||||
Array LITERALS: ["prefix", null, "suffix", 1] ["prefix", null, "suffix", 1] 1
|
||||
Array LITERALS: ["prefix", true, "suffix", 1] ["prefix", true, "suffix", 1] 1
|
||||
DateTime as Raw Value: "2015-01-15 23:24:25.000000" "2015-01-15 23:24:25.000000" 1
|
||||
DateTime as Raw Value: "2015-01-15 23:24:25.000000" "2015-01-15 23:24:25.000000" 1
|
||||
DateTime as Raw Value: "2015-01-15" "2015-01-15" 1
|
||||
DateTime as Raw Value: "23:24:25.000000" "23:24:25.000000" 1
|
||||
Empty JSON Object/Array: [] [] 1
|
||||
Empty JSON Object/Array: {} {} 1
|
||||
GeoJSON {"type": "GeometryCollection", "geometries": []} {"type": "GeometryCollection", "geometries": []} 1
|
||||
GeoJSON {"type": "LineString", "coordinates": [[0, 5], [5, 10], [10, 15]]} {"type": "LineString", "coordinates": [[0, 5], [5, 10], [10, 15]]} 1
|
||||
GeoJSON {"type": "MultiPoint", "coordinates": [[1, 1], [2, 2], [3, 3]]} {"type": "MultiPoint", "coordinates": [[1, 1], [2, 2], [3, 3]]} 1
|
||||
GeoJSON {"type": "Point", "coordinates": [11.1111, 12.22222]} {"type": "Point", "coordinates": [11.1111, 12.22222]} 1
|
||||
JSON LITERALS: {"val": false} {"val": false} 1
|
||||
JSON LITERALS: {"val": null} {"val": null} 1
|
||||
JSON LITERALS: {"val": true} {"val": true} 1
|
||||
Opaque Types: opaque_mysql_type_binary "base64:type254:YWJjAAAAAAAAAA==" "base64:type254:YWJjAAAAAAAAAA==" 1
|
||||
Opaque Types: opaque_mysql_type_bit "base64:type16:yv4=" "base64:type16:yv4=" 1
|
||||
Opaque Types: opaque_mysql_type_blob "base64:type252:yv66vg==" "base64:type252:yv66vg==" 1
|
||||
Opaque Types: opaque_mysql_type_date "2015-01-15" "2015-01-15" 1
|
||||
Opaque Types: opaque_mysql_type_datetime "2015-01-15 23:24:25.000000" "2015-01-15 23:24:25.000000" 1
|
||||
Opaque Types: opaque_mysql_type_enum "b" "b" 1
|
||||
Opaque Types: opaque_mysql_type_geom {"type": "Point", "coordinates": [1, 1]} {"type": "Point", "coordinates": [1, 1]} 1
|
||||
Opaque Types: opaque_mysql_type_longblob "base64:type251:yv66vg==" "base64:type251:yv66vg==" 1
|
||||
Opaque Types: opaque_mysql_type_mediumblob "base64:type250:yv66vg==" "base64:type250:yv66vg==" 1
|
||||
Opaque Types: opaque_mysql_type_set "b,c" "b,c" 1
|
||||
Opaque Types: opaque_mysql_type_time "23:24:25.000000" "23:24:25.000000" 1
|
||||
Opaque Types: opaque_mysql_type_tinyblob "base64:type249:yv66vg==" "base64:type249:yv66vg==" 1
|
||||
Opaque Types: opaque_mysql_type_varbinary "base64:type15:YWJj" "base64:type15:YWJj" 1
|
||||
Opaque Types: opaque_mysql_type_varchar "base64:type15:Zm9v" "base64:type15:Zm9v" 1
|
||||
Opaque Types: opaque_mysql_type_year "base64:type13:MjAxOQ==" "base64:type13:MjAxOQ==" 1
|
||||
Raw LITERALS: false false 1
|
||||
Raw LITERALS: null null 1
|
||||
Raw LITERALS: true true 1
|
||||
Raw doubles as JSON -2.2250738585072014e-308 -2.2250738585072014e-308 1
|
||||
Raw doubles as JSON -5678.987 -5678.987 1
|
||||
Raw doubles as JSON 0.0 0.0 1
|
||||
Raw doubles as JSON 2.2250738585072014e-308 2.2250738585072014e-308 1
|
||||
Raw doubles as JSON 3.14 3.14 1
|
||||
Raw integers as JSON -127 -127 1
|
||||
Raw integers as JSON -2147483648 -2147483648 1
|
||||
Raw integers as JSON -32768 -32768 1
|
||||
Raw integers as JSON -9223372036854775807 -9223372036854775807 1
|
||||
Raw integers as JSON 0 0 1
|
||||
Raw integers as JSON 128 128 1
|
||||
Raw integers as JSON 18446744073709551615 18446744073709551615 1
|
||||
Raw integers as JSON 2147483647 2147483647 1
|
||||
Raw integers as JSON 32767 32767 1
|
||||
Raw integers as JSON 4294967295 4294967295 1
|
||||
Raw integers as JSON 65535 65535 1
|
||||
Raw integers as JSON 65536 65536 1
|
||||
Raw integers as JSON 9223372036854775807 9223372036854775807 1
|
||||
Simple Array as Base Key [1, 2, 3, 4, 5, [], "a", "b", "c"] [1, 2, 3, 4, 5, [], "a", "b", "c"] 1
|
||||
Simple Array as Value {"a": [1, 2], "b": ["x", "y"]} {"a": [1, 2], "b": ["x", "y"]} 1
|
||||
Simple JSON test {"key1": "val1", "key2": "val2"} {"key1": "val1", "key2": "val2"} 1
|
||||
Special Characters: "" "" 1
|
||||
Special Characters: "'" "'" 1
|
||||
Special Characters: "'" "'" 1
|
||||
Special Characters: "'" "'" 1
|
||||
Special Characters: "''" "''" 1
|
||||
Special Characters: "\"" "\"" 1
|
||||
Special Characters: "\\" "\\" 1
|
||||
Special Characters: "\\b" "\\b" 1
|
||||
Special Characters: "\b" "\b" 1
|
||||
Special Characters: "\f" "\f" 1
|
||||
Special Characters: "\n" "\n" 1
|
||||
Special Characters: "\r" "\r" 1
|
||||
Special Characters: "\t" "\t" 1
|
||||
Special Characters: "f" "f" 1
|
||||
Special Characters: "key1 - with \" val " "key1 - with \" val " 1
|
||||
Special Characters: "q" "q" 1
|
||||
Special Characters: "some_string" "some_string" 1
|
||||
Special Characters: ["a ' b", "c ' d"] ["a ' b", "c ' d"] 1
|
||||
Special Characters: ["a \" b", "c \" d"] ["a \" b", "c \" d"] 1
|
||||
Special Characters: ["a \\ b", "c \\ d"] ["a \\ b", "c \\ d"] 1
|
||||
Special Characters: ["a \b b", "c \b d"] ["a \b b", "c \b d"] 1
|
||||
Special Characters: ["a \f b", "c \f d"] ["a \f b", "c \f d"] 1
|
||||
Special Characters: ["a \r b", "c \r d"] ["a \r b", "c \r d"] 1
|
||||
Special Characters: ["a \t b", "c \t d"] ["a \t b", "c \t d"] 1
|
||||
Special Characters: {"[": "]"} {"[": "]"} 1
|
||||
Special Characters: {"key ' key": "val ' val"} {"key ' key": "val ' val"} 1
|
||||
Special Characters: {"key \" key": "val \" val"} {"key \" key": "val \" val"} 1
|
||||
Special Characters: {"key \\ key": "val \\ val"} {"key \\ key": "val \\ val"} 1
|
||||
Special Characters: {"key \\0 key": "val \n val"} {"key \\0 key": "val \n val"} 1
|
||||
Special Characters: {"key \\Z key": "val ' val"} {"key \\Z key": "val ' val"} 1
|
||||
Special Characters: {"key \b key": "val \b val"} {"key \b key": "val \b val"} 1
|
||||
Special Characters: {"key \f key": "val \f val"} {"key \f key": "val \f val"} 1
|
||||
Special Characters: {"key \n key": "val \n val"} {"key \n key": "val \n val"} 1
|
||||
Special Characters: {"key \r key": "val \r val"} {"key \r key": "val \r val"} 1
|
||||
Special Characters: {"key \t key": "val \t val"} {"key \t key": "val \t val"} 1
|
||||
Special Characters: {"key1 and \n\"key2\"": "val1\t val2"} {"key1 and \n\"key2\"": "val1\t val2"} 1
|
||||
Special Characters: {"{": "}"} {"{": "}"} 1
|
||||
Special Characters: {"{": "}"} {"{": "}"} 1
|
||||
Special String Cases: [""] [""] 1
|
||||
Special String Cases: {"": ""} {"": ""} 1
|
||||
Timestamp as RawValue "2019-12-26 19:56:03.000000" "2019-12-26 19:56:03.000000" 1
|
||||
UTF8 Characters: "Anel Husaković - test: đžšćč" "Anel Husaković - test: đžšćč" 1
|
||||
UTF8 Characters: {"Name": "Anel Husaković - test: đžšćč"} {"Name": "Anel Husaković - test: đžšćč"} 1
|
||||
UTF8 Characters: {"Person": "EMP", "details": {"Name": "Anel Husaković - test: đžšćč"}} {"Person": "EMP", "details": {"Name": "Anel Husaković - test: đžšćč"}} 1
|
||||
UTF8 Characters: {"details": {"Name": "Anel Husaković - test: đžšćč"}, "\"Anel Husaković - test: đžšćč\"": "EMP"} {"details": {"Name": "Anel Husaković - test: đžšćč"}, "\"Anel Husaković - test: đžšćč\"": "EMP"} 1
|
||||
#
|
||||
# A quick check that all rows match from the original MySQL Table.
|
||||
#
|
||||
select count(*) as 'Total_Number_of_Tests',
|
||||
sum(expected = actual) as 'Succesful_Tests'
|
||||
from mysql_json_test;
|
||||
Total_Number_of_Tests Succesful_Tests
|
||||
100 100
|
||||
show create table mysql_json_test;
|
||||
Table Create Table
|
||||
mysql_json_test CREATE TABLE `mysql_json_test` (
|
||||
`description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`expected` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`actual` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
show create table mysql_json_test_big;
|
||||
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test_big` FORCE" or dump/reload to fix it!
|
||||
select * from mysql_json_test_big;
|
||||
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test_big` FORCE" or dump/reload to fix it!
|
||||
#
|
||||
# This test checks the long format implementation of MySQL's JSON
|
||||
# Not printing the actual contents as they are not readable by a human,
|
||||
# just compare the strings, make sure they match.
|
||||
#
|
||||
alter table mysql_json_test_big force;
|
||||
select count(*) as 'Total_Number_of_Tests',
|
||||
sum(expected = actual) as 'Succesful_Tests',
|
||||
sum(JSON_VALID(actual)) as 'String_is_valid_JSON'
|
||||
from mysql_json_test_big;
|
||||
Total_Number_of_Tests Succesful_Tests String_is_valid_JSON
|
||||
1 1 1
|
||||
drop table tempty;
|
||||
drop table mysql_json_test;
|
||||
drop table mysql_json_test_big;
|
93
mysql-test/main/mysql_json_table_recreate.test
Normal file
93
mysql-test/main/mysql_json_table_recreate.test
Normal file
|
@ -0,0 +1,93 @@
|
|||
--source include/have_utf8.inc
|
||||
|
||||
if (!$TYPE_MYSQL_JSON_SO) {
|
||||
skip Need MYSQL_JSON plugin;
|
||||
}
|
||||
|
||||
--echo #
|
||||
--echo # The following test takes 2 tables containing a JSON column and attempts
|
||||
--echo # to repair them.
|
||||
--echo #
|
||||
--echo # The tables header is (Description, Expected, Actual), where description
|
||||
--echo # shows a brief description what the JSON value is testing in the MariaDB
|
||||
--echo # implementation. Expected is the longtext string and actual is the JSON
|
||||
--echo # column that needs to be converted to MariaDB's representation of
|
||||
--echo # LONGTEXT.
|
||||
--echo #
|
||||
|
||||
|
||||
call mtr.add_suppression("Table rebuild required");
|
||||
call mtr.add_suppression("is marked as crashed");
|
||||
call mtr.add_suppression("Checking");
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
|
||||
SET NAMES utf8;
|
||||
|
||||
--copy_file std_data/mysql_json/tempty.frm $MYSQLD_DATADIR/test/tempty.frm
|
||||
--copy_file std_data/mysql_json/tempty.MYI $MYSQLD_DATADIR/test/tempty.MYI
|
||||
--copy_file std_data/mysql_json/tempty.MYD $MYSQLD_DATADIR/test/tempty.MYD
|
||||
|
||||
--copy_file std_data/mysql_json/mysql_json_test.frm $MYSQLD_DATADIR/test/mysql_json_test.frm
|
||||
--copy_file std_data/mysql_json/mysql_json_test.MYI $MYSQLD_DATADIR/test/mysql_json_test.MYI
|
||||
--copy_file std_data/mysql_json/mysql_json_test.MYD $MYSQLD_DATADIR/test/mysql_json_test.MYD
|
||||
|
||||
--copy_file std_data/mysql_json/mysql_json_test_big.frm $MYSQLD_DATADIR/test/mysql_json_test_big.frm
|
||||
--copy_file std_data/mysql_json/mysql_json_test_big.MYI $MYSQLD_DATADIR/test/mysql_json_test_big.MYI
|
||||
--copy_file std_data/mysql_json/mysql_json_test_big.MYD $MYSQLD_DATADIR/test/mysql_json_test_big.MYD
|
||||
|
||||
--echo #
|
||||
--echo # Check that only ALTER TABLE ... FORCE is allowed on a MySQL 5.7 table
|
||||
--echo # with a JSON column.
|
||||
--echo #
|
||||
|
||||
--error ER_TABLE_NEEDS_REBUILD
|
||||
show create table tempty;
|
||||
--error ER_TABLE_NEEDS_REBUILD
|
||||
select * from tempty;
|
||||
|
||||
alter table tempty force;
|
||||
show create table tempty;
|
||||
|
||||
--error ER_TABLE_NEEDS_REBUILD
|
||||
show create table mysql_json_test;
|
||||
--error ER_TABLE_NEEDS_REBUILD
|
||||
select * from mysql_json_test;
|
||||
|
||||
--error ER_TABLE_NEEDS_REBUILD
|
||||
LOCK TABLES mysql_json_test WRITE;
|
||||
|
||||
alter table mysql_json_test force;
|
||||
|
||||
--sorted_result
|
||||
select description, expected, actual, expected = actual from mysql_json_test;
|
||||
|
||||
--echo #
|
||||
--echo # A quick check that all rows match from the original MySQL Table.
|
||||
--echo #
|
||||
select count(*) as 'Total_Number_of_Tests',
|
||||
sum(expected = actual) as 'Succesful_Tests'
|
||||
from mysql_json_test;
|
||||
|
||||
show create table mysql_json_test;
|
||||
|
||||
--error ER_TABLE_NEEDS_REBUILD
|
||||
show create table mysql_json_test_big;
|
||||
--error ER_TABLE_NEEDS_REBUILD
|
||||
select * from mysql_json_test_big;
|
||||
|
||||
--echo #
|
||||
--echo # This test checks the long format implementation of MySQL's JSON
|
||||
--echo # Not printing the actual contents as they are not readable by a human,
|
||||
--echo # just compare the strings, make sure they match.
|
||||
--echo #
|
||||
alter table mysql_json_test_big force;
|
||||
|
||||
select count(*) as 'Total_Number_of_Tests',
|
||||
sum(expected = actual) as 'Succesful_Tests',
|
||||
sum(JSON_VALID(actual)) as 'String_is_valid_JSON'
|
||||
from mysql_json_test_big;
|
||||
|
||||
drop table tempty;
|
||||
drop table mysql_json_test;
|
||||
drop table mysql_json_test_big;
|
|
@ -145,7 +145,7 @@ test
|
|||
Phase 7/7: Running 'FLUSH PRIVILEGES'
|
||||
OK
|
||||
DROP USER mysqltest1@'%';
|
||||
Version check failed. Got the following error when calling the 'mysql_upgrade' command line client
|
||||
Version check failed. Got the following error when calling the 'mysql' command line client
|
||||
ERROR 1045 (28000): Access denied for user 'mysqltest1'@'localhost' (using password: YES)
|
||||
FATAL ERROR: Upgrade failed
|
||||
Run mysql_upgrade with a non existing server socket
|
||||
|
@ -412,7 +412,7 @@ OK
|
|||
# Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR
|
||||
#
|
||||
Run mysql_upgrade with unauthorized access
|
||||
Version check failed. Got the following error when calling the 'mysql_upgrade' command line client
|
||||
Version check failed. Got the following error when calling the 'mysql' command line client
|
||||
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
|
||||
FATAL ERROR: Upgrade failed
|
||||
#
|
||||
|
@ -570,6 +570,128 @@ t1 CREATE TABLE `t1` (
|
|||
DROP TABLE test.t1;
|
||||
SET GLOBAL enforce_storage_engine=NULL;
|
||||
# End of 10.1 tests
|
||||
#
|
||||
# MDEV-23201 'Roles' are created incorrectly on an install that was previously MySQL 5.7
|
||||
#
|
||||
#
|
||||
DROP VIEW mysql.user;
|
||||
FLUSH TABLES mysql.user;
|
||||
FLUSH PRIVILEGES;
|
||||
SHOW CREATE TABLE mysql.user;
|
||||
Table Create Table
|
||||
user CREATE TABLE `user` (
|
||||
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`User` char(32) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`ssl_cipher` blob NOT NULL,
|
||||
`x509_issuer` blob NOT NULL,
|
||||
`x509_subject` blob NOT NULL,
|
||||
`max_questions` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`max_updates` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`max_connections` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`max_user_connections` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`plugin` char(64) COLLATE utf8_bin NOT NULL DEFAULT 'mysql_native_password',
|
||||
`authentication_string` text COLLATE utf8_bin DEFAULT NULL,
|
||||
`password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
`password_last_changed` timestamp NULL DEFAULT NULL,
|
||||
`password_lifetime` smallint(5) unsigned DEFAULT NULL,
|
||||
`account_locked` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
PRIMARY KEY (`Host`,`User`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
|
||||
Phase 1/7: Checking and upgrading mysql database
|
||||
Processing databases
|
||||
mysql
|
||||
mysql.column_stats OK
|
||||
mysql.columns_priv OK
|
||||
mysql.db OK
|
||||
mysql.event OK
|
||||
mysql.func OK
|
||||
mysql.global_priv OK
|
||||
mysql.gtid_slave_pos OK
|
||||
mysql.help_category OK
|
||||
mysql.help_keyword OK
|
||||
mysql.help_relation OK
|
||||
mysql.help_topic OK
|
||||
mysql.index_stats OK
|
||||
mysql.innodb_index_stats OK
|
||||
mysql.innodb_table_stats OK
|
||||
mysql.plugin OK
|
||||
mysql.proc OK
|
||||
mysql.procs_priv OK
|
||||
mysql.proxies_priv OK
|
||||
mysql.roles_mapping OK
|
||||
mysql.servers OK
|
||||
mysql.table_stats OK
|
||||
mysql.tables_priv OK
|
||||
mysql.time_zone OK
|
||||
mysql.time_zone_leap_second OK
|
||||
mysql.time_zone_name OK
|
||||
mysql.time_zone_transition OK
|
||||
mysql.time_zone_transition_type OK
|
||||
mysql.transaction_registry OK
|
||||
mysql.user OK
|
||||
Upgrading from a version before MariaDB-10.1
|
||||
Phase 2/7: Installing used storage engines
|
||||
Checking for tables with unknown storage engine
|
||||
Phase 3/7: Fixing views
|
||||
Phase 4/7: Running 'mysql_fix_privilege_tables'
|
||||
Phase 5/7: Fixing table and database names
|
||||
Phase 6/7: Checking and upgrading tables
|
||||
Processing databases
|
||||
information_schema
|
||||
mtr
|
||||
mtr.global_suppressions OK
|
||||
mtr.test_suppressions OK
|
||||
performance_schema
|
||||
test
|
||||
Phase 7/7: Running 'FLUSH PRIVILEGES'
|
||||
OK
|
||||
SHOW CREATE TABLE mysql.user;
|
||||
View Create View character_set_client collation_connection
|
||||
user CREATE ALGORITHM=UNDEFINED DEFINER=`mariadb.sys`@`localhost` SQL SECURITY DEFINER VIEW `mysql`.`user` AS select `mysql`.`global_priv`.`Host` AS `Host`,`mysql`.`global_priv`.`User` AS `User`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,'N' AS `password_expired`,elt(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `mysql`.`global_priv` latin1 latin1_swedish_ci
|
||||
CREATE ROLE `aRole`;
|
||||
SET ROLE `aRole`;
|
||||
FLUSH PRIVILEGES;
|
||||
SET ROLE `aRole`;
|
||||
SELECT `User`, `is_role` FROM `mysql`.`user`;
|
||||
User is_role
|
||||
mariadb.sys N
|
||||
root N
|
||||
root N
|
||||
root N
|
||||
root N
|
||||
aRole Y
|
||||
DROP ROLE `aRole`;
|
||||
FLUSH PRIVILEGES;
|
||||
# End of 10.2 tests
|
||||
#
|
||||
# Ensure that mysql_upgrade correctly sets truncate_versioning_priv
|
||||
|
|
|
@ -219,6 +219,37 @@ SET GLOBAL enforce_storage_engine=NULL;
|
|||
|
||||
--echo # End of 10.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-23201 'Roles' are created incorrectly on an install that was previously MySQL 5.7
|
||||
--echo #
|
||||
--echo #
|
||||
|
||||
--exec $MYSQL_DUMP --result-file $MYSQLTEST_VARDIR/tmp/user.sql mysql user
|
||||
DROP VIEW mysql.user;
|
||||
|
||||
--copy_file std_data/mysql57user.frm $MYSQLD_DATADIR/mysql/user.frm
|
||||
--copy_file std_data/mysql57user.MYI $MYSQLD_DATADIR/mysql/user.MYI
|
||||
--copy_file std_data/mysql57user.MYD $MYSQLD_DATADIR/mysql/user.MYD
|
||||
FLUSH TABLES mysql.user;
|
||||
FLUSH PRIVILEGES;
|
||||
SHOW CREATE TABLE mysql.user;
|
||||
|
||||
--exec $MYSQL_UPGRADE --force 2>&1
|
||||
SHOW CREATE TABLE mysql.user;
|
||||
|
||||
CREATE ROLE `aRole`;
|
||||
SET ROLE `aRole`;
|
||||
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
SET ROLE `aRole`;
|
||||
SELECT `User`, `is_role` FROM `mysql`.`user`;
|
||||
|
||||
DROP ROLE `aRole`;
|
||||
--exec $MYSQL mysql < $MYSQLTEST_VARDIR/tmp/user.sql
|
||||
FLUSH PRIVILEGES;
|
||||
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
|
||||
|
||||
--echo # End of 10.2 tests
|
||||
|
||||
--echo #
|
||||
|
|
106
mysql-test/main/mysql_upgrade_mysql_json_datatype.result
Normal file
106
mysql-test/main/mysql_upgrade_mysql_json_datatype.result
Normal file
|
@ -0,0 +1,106 @@
|
|||
call mtr.add_suppression("Table rebuild required");
|
||||
call mtr.add_suppression("is marked as crashed");
|
||||
call mtr.add_suppression("Checking");
|
||||
SET NAMES utf8;
|
||||
set sql_mode="";
|
||||
install soname 'type_mysql_json';
|
||||
show create table tempty;
|
||||
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.tempty` FORCE" or dump/reload to fix it!
|
||||
show create table mysql_json_test;
|
||||
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test` FORCE" or dump/reload to fix it!
|
||||
show create table mysql_json_test_big;
|
||||
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test_big` FORCE" or dump/reload to fix it!
|
||||
# Run mysql_upgrade to fix the tables containing JSON.
|
||||
Phase 1/7: Checking and upgrading mysql database
|
||||
Processing databases
|
||||
mysql
|
||||
mysql.column_stats OK
|
||||
mysql.columns_priv OK
|
||||
mysql.db OK
|
||||
mysql.event OK
|
||||
mysql.func OK
|
||||
mysql.global_priv OK
|
||||
mysql.gtid_slave_pos OK
|
||||
mysql.help_category OK
|
||||
mysql.help_keyword OK
|
||||
mysql.help_relation OK
|
||||
mysql.help_topic OK
|
||||
mysql.index_stats OK
|
||||
mysql.innodb_index_stats OK
|
||||
mysql.innodb_table_stats OK
|
||||
mysql.plugin OK
|
||||
mysql.proc OK
|
||||
mysql.procs_priv OK
|
||||
mysql.proxies_priv OK
|
||||
mysql.roles_mapping OK
|
||||
mysql.servers OK
|
||||
mysql.table_stats OK
|
||||
mysql.tables_priv OK
|
||||
mysql.time_zone OK
|
||||
mysql.time_zone_leap_second OK
|
||||
mysql.time_zone_name OK
|
||||
mysql.time_zone_transition OK
|
||||
mysql.time_zone_transition_type OK
|
||||
mysql.transaction_registry OK
|
||||
Phase 2/7: Installing used storage engines... Skipped
|
||||
Phase 3/7: Fixing views
|
||||
mysql.user OK
|
||||
Phase 4/7: Running 'mysql_fix_privilege_tables'
|
||||
Phase 5/7: Fixing table and database names
|
||||
Phase 6/7: Checking and upgrading tables
|
||||
Processing databases
|
||||
information_schema
|
||||
mtr
|
||||
mtr.global_suppressions OK
|
||||
mtr.test_suppressions OK
|
||||
performance_schema
|
||||
test
|
||||
test.mysql_json_test Needs upgrade
|
||||
test.mysql_json_test_big Needs upgrade
|
||||
test.tempty Needs upgrade
|
||||
|
||||
Repairing tables
|
||||
test.mysql_json_test OK
|
||||
test.mysql_json_test_big OK
|
||||
test.tempty OK
|
||||
Phase 7/7: Running 'FLUSH PRIVILEGES'
|
||||
OK
|
||||
#
|
||||
# Now check if the table structure is correct and that the data
|
||||
# is still present.
|
||||
#
|
||||
show create table tempty;
|
||||
Table Create Table
|
||||
tempty CREATE TABLE `tempty` (
|
||||
`t` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
show create table mysql_json_test;
|
||||
Table Create Table
|
||||
mysql_json_test CREATE TABLE `mysql_json_test` (
|
||||
`description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`expected` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`actual` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
show create table mysql_json_test_big;
|
||||
Table Create Table
|
||||
mysql_json_test_big CREATE TABLE `mysql_json_test_big` (
|
||||
`description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`expected` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`actual` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
select count(*) as 'Total_Number_of_Tests',
|
||||
sum(expected = actual) as 'Succesful_Tests',
|
||||
sum(JSON_VALID(actual)) as 'String_is_valid_JSON'
|
||||
from mysql_json_test;
|
||||
Total_Number_of_Tests Succesful_Tests String_is_valid_JSON
|
||||
100 100 100
|
||||
select count(*) as 'Total_Number_of_Tests',
|
||||
sum(expected = actual) as 'Succesful_Tests',
|
||||
sum(JSON_VALID(actual)) as 'String_is_valid_JSON'
|
||||
from mysql_json_test_big;
|
||||
Total_Number_of_Tests Succesful_Tests String_is_valid_JSON
|
||||
1 1 1
|
||||
drop table tempty;
|
||||
drop table mysql_json_test;
|
||||
drop table mysql_json_test_big;
|
||||
uninstall soname 'type_mysql_json';
|
67
mysql-test/main/mysql_upgrade_mysql_json_datatype.test
Normal file
67
mysql-test/main/mysql_upgrade_mysql_json_datatype.test
Normal file
|
@ -0,0 +1,67 @@
|
|||
-- source include/mysql_upgrade_preparation.inc
|
||||
-- source include/have_working_dns.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
if (!$TYPE_MYSQL_JSON_SO) {
|
||||
skip Need MYSQL_JSON plugin;
|
||||
}
|
||||
|
||||
call mtr.add_suppression("Table rebuild required");
|
||||
call mtr.add_suppression("is marked as crashed");
|
||||
call mtr.add_suppression("Checking");
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
SET NAMES utf8;
|
||||
|
||||
--copy_file std_data/mysql_json/tempty.frm $MYSQLD_DATADIR/test/tempty.frm
|
||||
--copy_file std_data/mysql_json/tempty.MYI $MYSQLD_DATADIR/test/tempty.MYI
|
||||
--copy_file std_data/mysql_json/tempty.MYD $MYSQLD_DATADIR/test/tempty.MYD
|
||||
|
||||
--copy_file std_data/mysql_json/mysql_json_test.frm $MYSQLD_DATADIR/test/mysql_json_test.frm
|
||||
--copy_file std_data/mysql_json/mysql_json_test.MYI $MYSQLD_DATADIR/test/mysql_json_test.MYI
|
||||
--copy_file std_data/mysql_json/mysql_json_test.MYD $MYSQLD_DATADIR/test/mysql_json_test.MYD
|
||||
|
||||
--copy_file std_data/mysql_json/mysql_json_test_big.frm $MYSQLD_DATADIR/test/mysql_json_test_big.frm
|
||||
--copy_file std_data/mysql_json/mysql_json_test_big.MYI $MYSQLD_DATADIR/test/mysql_json_test_big.MYI
|
||||
--copy_file std_data/mysql_json/mysql_json_test_big.MYD $MYSQLD_DATADIR/test/mysql_json_test_big.MYD
|
||||
|
||||
|
||||
set sql_mode="";
|
||||
|
||||
install soname 'type_mysql_json';
|
||||
|
||||
--error ER_TABLE_NEEDS_REBUILD
|
||||
show create table tempty;
|
||||
--error ER_TABLE_NEEDS_REBUILD
|
||||
show create table mysql_json_test;
|
||||
--error ER_TABLE_NEEDS_REBUILD
|
||||
show create table mysql_json_test_big;
|
||||
|
||||
--echo # Run mysql_upgrade to fix the tables containing JSON.
|
||||
--exec $MYSQL_UPGRADE --force 2>&1
|
||||
|
||||
--echo #
|
||||
--echo # Now check if the table structure is correct and that the data
|
||||
--echo # is still present.
|
||||
--echo #
|
||||
|
||||
show create table tempty;
|
||||
show create table mysql_json_test;
|
||||
show create table mysql_json_test_big;
|
||||
|
||||
select count(*) as 'Total_Number_of_Tests',
|
||||
sum(expected = actual) as 'Succesful_Tests',
|
||||
sum(JSON_VALID(actual)) as 'String_is_valid_JSON'
|
||||
from mysql_json_test;
|
||||
|
||||
select count(*) as 'Total_Number_of_Tests',
|
||||
sum(expected = actual) as 'Succesful_Tests',
|
||||
sum(JSON_VALID(actual)) as 'String_is_valid_JSON'
|
||||
from mysql_json_test_big;
|
||||
|
||||
drop table tempty;
|
||||
drop table mysql_json_test;
|
||||
drop table mysql_json_test_big;
|
||||
|
||||
uninstall soname 'type_mysql_json';
|
||||
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
|
|
@ -5905,4 +5905,122 @@ invisible int(11) YES NULL
|
|||
a b c & $!@#$%^&*( ) int(11) YES 4 INVISIBLE
|
||||
ds=~!@ \# $% ^ & * ( ) _ - = + int(11) YES 5 INVISIBLE
|
||||
drop database d;
|
||||
#
|
||||
# MDEV-21786:
|
||||
# mysqldump will forget sequence definition details on --no-data dump
|
||||
#
|
||||
create database d;
|
||||
CREATE SEQUENCE d.s1 START WITH 100 INCREMENT BY 10 MINVALUE=100 MAXVALUE=1100 CYCLE;
|
||||
CREATE SEQUENCE d.s2 START WITH 200 INCREMENT BY 20 MINVALUE=200 MAXVALUE=1200 CYCLE;
|
||||
CREATE SEQUENCE d.s3 START WITH 300 INCREMENT BY 30 MINVALUE=300 MAXVALUE=1300 CYCLE;
|
||||
CREATE SEQUENCE d.s4 START WITH 400 INCREMENT BY 40 MINVALUE=400 MAXVALUE=1400 CYCLE;
|
||||
SELECT NEXTVAL(d.s1),NEXTVAL(d.s2),NEXTVAL(d.s3), NEXTVAL(d.s4);
|
||||
NEXTVAL(d.s1) NEXTVAL(d.s2) NEXTVAL(d.s3) NEXTVAL(d.s4)
|
||||
100 200 300 400
|
||||
# Show create before dump
|
||||
show create sequence d.s1;
|
||||
Table Create Table
|
||||
s1 CREATE SEQUENCE `s1` start with 100 minvalue 100 maxvalue 1100 increment by 10 cache 1000 cycle ENGINE=MyISAM
|
||||
show create sequence d.s2;
|
||||
Table Create Table
|
||||
s2 CREATE SEQUENCE `s2` start with 200 minvalue 200 maxvalue 1200 increment by 20 cache 1000 cycle ENGINE=MyISAM
|
||||
show create sequence d.s3;
|
||||
Table Create Table
|
||||
s3 CREATE SEQUENCE `s3` start with 300 minvalue 300 maxvalue 1300 increment by 30 cache 1000 cycle ENGINE=MyISAM
|
||||
show create sequence d.s4;
|
||||
Table Create Table
|
||||
s4 CREATE SEQUENCE `s4` start with 400 minvalue 400 maxvalue 1400 increment by 40 cache 1000 cycle ENGINE=MyISAM
|
||||
# Dump sequence without `--no-data`
|
||||
# Restore from mysqldump
|
||||
SETVAL(`s1`, 1101, 0)
|
||||
1101
|
||||
SETVAL(`s2`, 1201, 0)
|
||||
1201
|
||||
SETVAL(`s3`, 1301, 0)
|
||||
1301
|
||||
SETVAL(`s4`, 1401, 0)
|
||||
1401
|
||||
# Show create after restore
|
||||
show create sequence d.s1;
|
||||
Table Create Table
|
||||
s1 CREATE SEQUENCE `s1` start with 100 minvalue 100 maxvalue 1100 increment by 10 cache 1000 cycle ENGINE=MyISAM
|
||||
show create sequence d.s2;
|
||||
Table Create Table
|
||||
s2 CREATE SEQUENCE `s2` start with 200 minvalue 200 maxvalue 1200 increment by 20 cache 1000 cycle ENGINE=MyISAM
|
||||
show create sequence d.s3;
|
||||
Table Create Table
|
||||
s3 CREATE SEQUENCE `s3` start with 300 minvalue 300 maxvalue 1300 increment by 30 cache 1000 cycle ENGINE=MyISAM
|
||||
show create sequence d.s4;
|
||||
Table Create Table
|
||||
s4 CREATE SEQUENCE `s4` start with 400 minvalue 400 maxvalue 1400 increment by 40 cache 1000 cycle ENGINE=MyISAM
|
||||
SELECT NEXTVAL(d.s1),NEXTVAL(d.s2),NEXTVAL(d.s3), NEXTVAL(d.s4);
|
||||
NEXTVAL(d.s1) NEXTVAL(d.s2) NEXTVAL(d.s3) NEXTVAL(d.s4)
|
||||
100 200 300 400
|
||||
# Dump sequence with `--no-data`
|
||||
# Restore from mysqldump
|
||||
SETVAL(`s1`, 1101, 0)
|
||||
1101
|
||||
SETVAL(`s2`, 1201, 0)
|
||||
1201
|
||||
SETVAL(`s3`, 1301, 0)
|
||||
1301
|
||||
SETVAL(`s4`, 1401, 0)
|
||||
1401
|
||||
# Show create after restore `--no-data`
|
||||
show create sequence d.s1;
|
||||
Table Create Table
|
||||
s1 CREATE SEQUENCE `s1` start with 100 minvalue 100 maxvalue 1100 increment by 10 cache 1000 cycle ENGINE=MyISAM
|
||||
show create sequence d.s2;
|
||||
Table Create Table
|
||||
s2 CREATE SEQUENCE `s2` start with 200 minvalue 200 maxvalue 1200 increment by 20 cache 1000 cycle ENGINE=MyISAM
|
||||
show create sequence d.s3;
|
||||
Table Create Table
|
||||
s3 CREATE SEQUENCE `s3` start with 300 minvalue 300 maxvalue 1300 increment by 30 cache 1000 cycle ENGINE=MyISAM
|
||||
show create sequence d.s4;
|
||||
Table Create Table
|
||||
s4 CREATE SEQUENCE `s4` start with 400 minvalue 400 maxvalue 1400 increment by 40 cache 1000 cycle ENGINE=MyISAM
|
||||
SELECT NEXTVAL(d.s1),NEXTVAL(d.s2),NEXTVAL(d.s3), NEXTVAL(d.s4);
|
||||
NEXTVAL(d.s1) NEXTVAL(d.s2) NEXTVAL(d.s3) NEXTVAL(d.s4)
|
||||
100 200 300 400
|
||||
# Restore to different database than original
|
||||
create database d2;
|
||||
SETVAL(`s1`, 1101, 0)
|
||||
1101
|
||||
SETVAL(`s2`, 1201, 0)
|
||||
1201
|
||||
SETVAL(`s3`, 1301, 0)
|
||||
1301
|
||||
SETVAL(`s4`, 1401, 0)
|
||||
1401
|
||||
show create sequence d2.s1;
|
||||
Table Create Table
|
||||
s1 CREATE SEQUENCE `s1` start with 100 minvalue 100 maxvalue 1100 increment by 10 cache 1000 cycle ENGINE=MyISAM
|
||||
drop sequence d.s1, d.s2, d.s3, d.s4;
|
||||
drop database d;
|
||||
drop database d2;
|
||||
#
|
||||
# MDEV-20070
|
||||
# mysqldump won't work correct on sequences
|
||||
#
|
||||
DROP DATABASE IF EXISTS test1;
|
||||
Warnings:
|
||||
Note 1008 Can't drop database 'test1'; database doesn't exist
|
||||
DROP DATABASE IF EXISTS test2;
|
||||
Warnings:
|
||||
Note 1008 Can't drop database 'test2'; database doesn't exist
|
||||
CREATE DATABASE test1;
|
||||
CREATE DATABASE test2;
|
||||
USE test1;
|
||||
CREATE SEQUENCE seq_t_i INCREMENT 5 START WITH 1;
|
||||
CREATE TABLE t(
|
||||
i integer DEFAULT nextval(seq_t_i),
|
||||
j integer
|
||||
);
|
||||
INSERT INTO t VALUES (1,1),(2,2),(3,3),(4,4);
|
||||
# Dump database 1
|
||||
# Restore from database 1 to database 2
|
||||
SETVAL(`seq_t_i`, 1, 0)
|
||||
1
|
||||
DROP DATABASE IF EXISTS test1;
|
||||
DROP DATABASE IF EXISTS test2;
|
||||
# End of 10.3 tests
|
||||
|
|
|
@ -2793,4 +2793,87 @@ select * from t3;
|
|||
desc t3;
|
||||
drop database d;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-21786:
|
||||
--echo # mysqldump will forget sequence definition details on --no-data dump
|
||||
--echo #
|
||||
create database d;
|
||||
|
||||
CREATE SEQUENCE d.s1 START WITH 100 INCREMENT BY 10 MINVALUE=100 MAXVALUE=1100 CYCLE;
|
||||
CREATE SEQUENCE d.s2 START WITH 200 INCREMENT BY 20 MINVALUE=200 MAXVALUE=1200 CYCLE;
|
||||
CREATE SEQUENCE d.s3 START WITH 300 INCREMENT BY 30 MINVALUE=300 MAXVALUE=1300 CYCLE;
|
||||
CREATE SEQUENCE d.s4 START WITH 400 INCREMENT BY 40 MINVALUE=400 MAXVALUE=1400 CYCLE;
|
||||
SELECT NEXTVAL(d.s1),NEXTVAL(d.s2),NEXTVAL(d.s3), NEXTVAL(d.s4);
|
||||
|
||||
--echo # Show create before dump
|
||||
show create sequence d.s1;
|
||||
show create sequence d.s2;
|
||||
show create sequence d.s3;
|
||||
show create sequence d.s4;
|
||||
|
||||
--echo # Dump sequence without `--no-data`
|
||||
--exec $MYSQL_DUMP --databases d > $MYSQLTEST_VARDIR/tmp/dump1.sql
|
||||
--echo # Restore from mysqldump
|
||||
--exec $MYSQL -Dd < $MYSQLTEST_VARDIR/tmp/dump1.sql
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/dump1.sql
|
||||
|
||||
--echo # Show create after restore
|
||||
show create sequence d.s1;
|
||||
show create sequence d.s2;
|
||||
show create sequence d.s3;
|
||||
show create sequence d.s4;
|
||||
SELECT NEXTVAL(d.s1),NEXTVAL(d.s2),NEXTVAL(d.s3), NEXTVAL(d.s4);
|
||||
|
||||
--echo # Dump sequence with `--no-data`
|
||||
--exec $MYSQL_DUMP --databases d --no-data > $MYSQLTEST_VARDIR/tmp/dump-no-data.sql
|
||||
--echo # Restore from mysqldump
|
||||
--exec $MYSQL -Dd < $MYSQLTEST_VARDIR/tmp/dump-no-data.sql
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/dump-no-data.sql
|
||||
|
||||
--echo # Show create after restore `--no-data`
|
||||
show create sequence d.s1;
|
||||
show create sequence d.s2;
|
||||
show create sequence d.s3;
|
||||
show create sequence d.s4;
|
||||
SELECT NEXTVAL(d.s1),NEXTVAL(d.s2),NEXTVAL(d.s3), NEXTVAL(d.s4);
|
||||
|
||||
--echo # Restore to different database than original
|
||||
--exec $MYSQL_DUMP d > $MYSQLTEST_VARDIR/tmp/dumpd.sql
|
||||
create database d2;
|
||||
--exec $MYSQL d2 < $MYSQLTEST_VARDIR/tmp/dumpd.sql
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/dumpd.sql
|
||||
show create sequence d2.s1;
|
||||
|
||||
drop sequence d.s1, d.s2, d.s3, d.s4;
|
||||
drop database d;
|
||||
drop database d2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-20070
|
||||
--echo # mysqldump won't work correct on sequences
|
||||
--echo #
|
||||
|
||||
DROP DATABASE IF EXISTS test1;
|
||||
DROP DATABASE IF EXISTS test2;
|
||||
CREATE DATABASE test1;
|
||||
CREATE DATABASE test2;
|
||||
USE test1;
|
||||
CREATE SEQUENCE seq_t_i INCREMENT 5 START WITH 1;
|
||||
CREATE TABLE t(
|
||||
i integer DEFAULT nextval(seq_t_i),
|
||||
j integer
|
||||
);
|
||||
INSERT INTO t VALUES (1,1),(2,2),(3,3),(4,4);
|
||||
|
||||
--echo # Dump database 1
|
||||
--exec $MYSQL_DUMP test1 > $MYSQLTEST_VARDIR/tmp/dumptest1.sql
|
||||
--echo # Restore from database 1 to database 2
|
||||
|
||||
--error 1
|
||||
--exec $MYSQL test2 < $MYSQLTEST_VARDIR/tmp/dumptest1.sql
|
||||
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql
|
||||
DROP DATABASE IF EXISTS test1;
|
||||
DROP DATABASE IF EXISTS test2;
|
||||
|
||||
--echo # End of 10.3 tests
|
||||
|
|
|
@ -117,7 +117,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
|
|||
"using_mrr": false,
|
||||
"index_only": false,
|
||||
"rows": 1000,
|
||||
"cost": 201.6536043,
|
||||
"cost": 204.27,
|
||||
"chosen": true
|
||||
},
|
||||
{
|
||||
|
@ -137,8 +137,8 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
|
|||
"index": "key1",
|
||||
"index_scan_cost": 1.000146475,
|
||||
"cumulated_index_scan_cost": 1.000146475,
|
||||
"disk_sweep_cost": 1.001383604,
|
||||
"cumulative_total_cost": 2.00153008,
|
||||
"disk_sweep_cost": 1.004153686,
|
||||
"cumulative_total_cost": 2.004300162,
|
||||
"usable": true,
|
||||
"matching_rows_now": 1,
|
||||
"intersect_covering_with_this_index": false,
|
||||
|
|
|
@ -3509,6 +3509,26 @@ NULLIF(GROUP_CONCAT(v1), null)
|
|||
C
|
||||
B
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-24033: SIGSEGV in __memcmp_avx2_movbe from queue_insert | SIGSEGV in __memcmp_avx2_movbe from native_compare
|
||||
#
|
||||
SET @save_max_length_for_sort_data=@@max_length_for_sort_data;
|
||||
SET @save_max_sort_length= @@max_sort_length;
|
||||
SET @save_sql_select_limit= @@sql_select_limit;
|
||||
CREATE TABLE t1 (a DECIMAL(64,0), b INT);
|
||||
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
|
||||
SET max_length_for_sort_data= 30;
|
||||
SET sql_select_limit = 3;
|
||||
SET max_sort_length=8;
|
||||
SELECT * FROM t1 ORDER BY a+1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
SET max_length_for_sort_data=@save_max_length_for_sort_data;
|
||||
SET max_sort_length= @save_max_sort_length;
|
||||
SET sql_select_limit= @save_sql_select_limit;
|
||||
DROP TABLE t1;
|
||||
# End of 10.2 tests
|
||||
#
|
||||
# MDEV-16214: Incorrect plan taken by the optimizer , uses INDEX instead of ref access with ORDER BY
|
||||
|
@ -4123,6 +4143,127 @@ f
|
|||
baz
|
||||
foo
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-24015: SQL Error (1038): Out of sort memory when enough memory for the
|
||||
# sort buffer is provided
|
||||
#
|
||||
CREATE TABLE t1 (a VARCHAR(100), b INT);
|
||||
CREATE TABLE t2 (a VARCHAR(100), b INT);
|
||||
INSERT INTO t1 SELECT 'abc', seq FROM seq_1_to_50;
|
||||
INSERT INTO t2 SELECT seq, seq FROM seq_1_to_50;
|
||||
set @save_sort_buffer_size= @@sort_buffer_size;
|
||||
set sort_buffer_size=2000;
|
||||
ANALYZE FORMAT=JSON
|
||||
SELECT (SELECT sum(t2.b) FROM t2 WHERE t1.b=t2.b GROUP BY t2.a) FROM t1;
|
||||
ANALYZE
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"r_loops": 1,
|
||||
"r_total_time_ms": "REPLACED",
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"r_loops": 1,
|
||||
"rows": 50,
|
||||
"r_rows": 50,
|
||||
"r_table_time_ms": "REPLACED",
|
||||
"r_other_time_ms": "REPLACED",
|
||||
"filtered": 100,
|
||||
"r_filtered": 100
|
||||
},
|
||||
"subqueries": [
|
||||
{
|
||||
"expression_cache": {
|
||||
"r_loops": 50,
|
||||
"r_hit_ratio": 0,
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"r_loops": 50,
|
||||
"r_total_time_ms": "REPLACED",
|
||||
"filesort": {
|
||||
"sort_key": "t2.a",
|
||||
"r_loops": 50,
|
||||
"r_total_time_ms": "REPLACED",
|
||||
"r_used_priority_queue": false,
|
||||
"r_output_rows": 1,
|
||||
"r_buffer_size": "REPLACED" across executions)",
|
||||
"r_sort_mode": "sort_key,rowid",
|
||||
"temporary_table": {
|
||||
"table": {
|
||||
"table_name": "t2",
|
||||
"access_type": "ALL",
|
||||
"r_loops": 50,
|
||||
"rows": 50,
|
||||
"r_rows": 50,
|
||||
"r_table_time_ms": "REPLACED",
|
||||
"r_other_time_ms": "REPLACED",
|
||||
"filtered": 100,
|
||||
"r_filtered": 2,
|
||||
"attached_condition": "t1.b = t2.b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
SELECT (SELECT sum(t2.b) FROM t2 WHERE t1.b=t2.b GROUP BY t2.a) FROM t1;
|
||||
(SELECT sum(t2.b) FROM t2 WHERE t1.b=t2.b GROUP BY t2.a)
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37
|
||||
38
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50
|
||||
set sort_buffer_size= @save_sort_buffer_size;
|
||||
DROP TABLE t1,t2;
|
||||
# End of 10.5 tests
|
||||
#
|
||||
# MDEV-13694: Wrong result upon GROUP BY with orderby_uses_equalities=on
|
||||
|
|
|
@ -2274,6 +2274,27 @@ ORDER BY id+1 DESC;
|
|||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-24033: SIGSEGV in __memcmp_avx2_movbe from queue_insert | SIGSEGV in __memcmp_avx2_movbe from native_compare
|
||||
--echo #
|
||||
|
||||
SET @save_max_length_for_sort_data=@@max_length_for_sort_data;
|
||||
SET @save_max_sort_length= @@max_sort_length;
|
||||
SET @save_sql_select_limit= @@sql_select_limit;
|
||||
|
||||
CREATE TABLE t1 (a DECIMAL(64,0), b INT);
|
||||
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
|
||||
|
||||
SET max_length_for_sort_data= 30;
|
||||
SET sql_select_limit = 3;
|
||||
SET max_sort_length=8;
|
||||
SELECT * FROM t1 ORDER BY a+1;
|
||||
|
||||
SET max_length_for_sort_data=@save_max_length_for_sort_data;
|
||||
SET max_sort_length= @save_max_sort_length;
|
||||
SET sql_select_limit= @save_sql_select_limit;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # End of 10.2 tests
|
||||
|
||||
--echo #
|
||||
|
@ -2556,6 +2577,26 @@ INSERT t1 VALUES ('foo','bar'),('baz','qux');
|
|||
SELECT COALESCE(a, b) AS f FROM t1 ORDER BY f;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-24015: SQL Error (1038): Out of sort memory when enough memory for the
|
||||
--echo # sort buffer is provided
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(100), b INT);
|
||||
CREATE TABLE t2 (a VARCHAR(100), b INT);
|
||||
|
||||
INSERT INTO t1 SELECT 'abc', seq FROM seq_1_to_50;
|
||||
INSERT INTO t2 SELECT seq, seq FROM seq_1_to_50;
|
||||
|
||||
set @save_sort_buffer_size= @@sort_buffer_size;
|
||||
set sort_buffer_size=2000;
|
||||
--source include/analyze-format.inc
|
||||
ANALYZE FORMAT=JSON
|
||||
SELECT (SELECT sum(t2.b) FROM t2 WHERE t1.b=t2.b GROUP BY t2.a) FROM t1;
|
||||
SELECT (SELECT sum(t2.b) FROM t2 WHERE t1.b=t2.b GROUP BY t2.a) FROM t1;
|
||||
|
||||
set sort_buffer_size= @save_sort_buffer_size;
|
||||
DROP TABLE t1,t2;
|
||||
--echo # End of 10.5 tests
|
||||
|
||||
--echo #
|
||||
|
|
|
@ -1318,6 +1318,23 @@ t1 CREATE TABLE `t1` (
|
|||
UNIQUE KEY `id` (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create or replace view v1 as select 1 between (2 between 3 and 4) and 5;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
view_definition
|
||||
select 1 between 2 between 3 and 4 and 5 AS `1 between (2 between 3 and 4) and 5`
|
||||
create or replace view v1 as select 1 between (2 in (3,4)) and 5;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
view_definition
|
||||
select 1 between 2 in (3,4) and 5 AS `1 between (2 in (3,4)) and 5`
|
||||
create or replace view v1 as select 1 between (2 like 3) and 4;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
view_definition
|
||||
select 1 between 2 like 3 and 4 AS `1 between (2 like 3) and 4`
|
||||
create or replace view v1 as select 1 not between (2 like 3) and 4;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
view_definition
|
||||
select 1 not between 2 like 3 and 4 AS `1 not between (2 like 3) and 4`
|
||||
drop view v1;
|
||||
#
|
||||
# MDEV-10343 Providing compatibility for basic SQL data types
|
||||
#
|
||||
|
@ -1808,7 +1825,7 @@ EXECUTE IMMEDIATE 'if(`systeminfo /FO LIST';
|
|||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`systeminfo /FO LIST' at line 1
|
||||
EXECUTE IMMEDIATE 'if(`systeminfo';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`systeminfo' at line 1
|
||||
End of 10.3 tests
|
||||
# End of 10.3 tests
|
||||
#
|
||||
# MDEV-19540: 10.4 allow lock options with SELECT in brackets
|
||||
# which previous version do not
|
||||
|
|
|
@ -1346,6 +1346,20 @@ create table t1 ( id serial );
|
|||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BETWEEN syntax
|
||||
#
|
||||
create or replace view v1 as select 1 between (2 between 3 and 4) and 5;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
create or replace view v1 as select 1 between (2 in (3,4)) and 5;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
create or replace view v1 as select 1 between (2 like 3) and 4;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
create or replace view v1 as select 1 not between (2 like 3) and 4;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
|
||||
drop view v1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-10343 Providing compatibility for basic SQL data types
|
||||
--echo #
|
||||
|
@ -1552,7 +1566,7 @@ EXECUTE IMMEDIATE 'if(`systeminfo /FO LIST';
|
|||
--error ER_PARSE_ERROR
|
||||
EXECUTE IMMEDIATE 'if(`systeminfo';
|
||||
|
||||
--echo End of 10.3 tests
|
||||
--echo # End of 10.3 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-19540: 10.4 allow lock options with SELECT in brackets
|
||||
|
|
|
@ -1,748 +0,0 @@
|
|||
drop table if exists t1_30237_bool;
|
||||
set sql_mode=NO_UNSIGNED_SUBTRACTION;
|
||||
create table t1_30237_bool(A boolean, B boolean, C boolean);
|
||||
insert into t1_30237_bool values
|
||||
(FALSE, FALSE, FALSE),
|
||||
(FALSE, FALSE, NULL),
|
||||
(FALSE, FALSE, TRUE),
|
||||
(FALSE, NULL, FALSE),
|
||||
(FALSE, NULL, NULL),
|
||||
(FALSE, NULL, TRUE),
|
||||
(FALSE, TRUE, FALSE),
|
||||
(FALSE, TRUE, NULL),
|
||||
(FALSE, TRUE, TRUE),
|
||||
(NULL, FALSE, FALSE),
|
||||
(NULL, FALSE, NULL),
|
||||
(NULL, FALSE, TRUE),
|
||||
(NULL, NULL, FALSE),
|
||||
(NULL, NULL, NULL),
|
||||
(NULL, NULL, TRUE),
|
||||
(NULL, TRUE, FALSE),
|
||||
(NULL, TRUE, NULL),
|
||||
(NULL, TRUE, TRUE),
|
||||
(TRUE, FALSE, FALSE),
|
||||
(TRUE, FALSE, NULL),
|
||||
(TRUE, FALSE, TRUE),
|
||||
(TRUE, NULL, FALSE),
|
||||
(TRUE, NULL, NULL),
|
||||
(TRUE, NULL, TRUE),
|
||||
(TRUE, TRUE, FALSE),
|
||||
(TRUE, TRUE, NULL),
|
||||
(TRUE, TRUE, TRUE) ;
|
||||
Testing OR, XOR, AND
|
||||
select A, B, A OR B, A XOR B, A AND B
|
||||
from t1_30237_bool where C is null order by A, B;
|
||||
A B A OR B A XOR B A AND B
|
||||
NULL NULL NULL NULL NULL
|
||||
NULL 0 NULL NULL 0
|
||||
NULL 1 1 NULL NULL
|
||||
0 NULL NULL NULL 0
|
||||
0 0 0 0 0
|
||||
0 1 1 1 0
|
||||
1 NULL 1 NULL NULL
|
||||
1 0 1 1 0
|
||||
1 1 1 0 1
|
||||
Testing that OR is associative
|
||||
select A, B, C, (A OR B) OR C, A OR (B OR C), A OR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A OR B) OR C A OR (B OR C) A OR B OR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 1 1 1
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 1 1 1
|
||||
NULL 1 NULL 1 1 1
|
||||
NULL 1 0 1 1 1
|
||||
NULL 1 1 1 1 1
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 1 1 1
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL 1 1 1
|
||||
0 1 0 1 1 1
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL 1 1 1
|
||||
1 NULL 0 1 1 1
|
||||
1 NULL 1 1 1 1
|
||||
1 0 NULL 1 1 1
|
||||
1 0 0 1 1 1
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL 1 1 1
|
||||
1 1 0 1 1 1
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A OR B) OR C) != (A OR (B OR C));
|
||||
count(*)
|
||||
0
|
||||
Testing that XOR is associative
|
||||
select A, B, C, (A XOR B) XOR C, A XOR (B XOR C), A XOR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A XOR B) XOR C A XOR (B XOR C) A XOR B XOR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 NULL NULL NULL
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 NULL NULL NULL
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 1 1 1
|
||||
0 1 1 0 0 0
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL NULL NULL NULL
|
||||
1 0 0 1 1 1
|
||||
1 0 1 0 0 0
|
||||
1 1 NULL NULL NULL NULL
|
||||
1 1 0 0 0 0
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) XOR C) != (A XOR (B XOR C));
|
||||
count(*)
|
||||
0
|
||||
Testing that AND is associative
|
||||
select A, B, C, (A AND B) AND C, A AND (B AND C), A AND B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A AND B) AND C A AND (B AND C) A AND B AND C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 0 0 0
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL 0 0 0
|
||||
NULL 0 0 0 0 0
|
||||
NULL 0 1 0 0 0
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 0 0 0
|
||||
NULL 1 1 NULL NULL NULL
|
||||
0 NULL NULL 0 0 0
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 0 0 0
|
||||
0 0 NULL 0 0 0
|
||||
0 0 0 0 0 0
|
||||
0 0 1 0 0 0
|
||||
0 1 NULL 0 0 0
|
||||
0 1 0 0 0 0
|
||||
0 1 1 0 0 0
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 0 0 0
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL 0 0 0
|
||||
1 0 0 0 0 0
|
||||
1 0 1 0 0 0
|
||||
1 1 NULL NULL NULL NULL
|
||||
1 1 0 0 0 0
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) AND C) != (A AND (B AND C));
|
||||
count(*)
|
||||
0
|
||||
Testing that AND has precedence over OR
|
||||
select A, B, C, (A OR B) AND C, A OR (B AND C), A OR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A OR B) AND C A OR (B AND C) A OR B AND C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 0 NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 NULL NULL
|
||||
NULL 0 1 NULL NULL NULL
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 0 NULL NULL
|
||||
NULL 1 1 1 1 1
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL 0 0 0
|
||||
0 0 0 0 0 0
|
||||
0 0 1 0 0 0
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL NULL 1 1
|
||||
1 NULL 0 0 1 1
|
||||
1 NULL 1 1 1 1
|
||||
1 0 NULL NULL 1 1
|
||||
1 0 0 0 1 1
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL NULL 1 1
|
||||
1 1 0 0 1 1
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B AND C)) != (A OR B AND C);
|
||||
count(*)
|
||||
0
|
||||
select A, B, C, (A AND B) OR C, A AND (B OR C), A AND B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A AND B) OR C A AND (B OR C) A AND B OR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 1 NULL 1
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 0 0
|
||||
NULL 0 1 1 NULL 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 1 NULL 1
|
||||
0 NULL NULL NULL 0 NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 1 0 1
|
||||
0 0 NULL NULL 0 NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 0 1
|
||||
0 1 NULL NULL 0 NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 0 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 1 1 1
|
||||
1 0 NULL NULL NULL NULL
|
||||
1 0 0 0 0 0
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL 1 1 1
|
||||
1 1 0 1 1 1
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) OR C) != (A AND B OR C);
|
||||
count(*)
|
||||
0
|
||||
Testing that AND has precedence over XOR
|
||||
select A, B, C, (A XOR B) AND C, A XOR (B AND C), A XOR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A XOR B) AND C A XOR (B AND C) A XOR B AND C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 0 NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 NULL NULL
|
||||
NULL 0 1 NULL NULL NULL
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 0 NULL NULL
|
||||
NULL 1 1 NULL NULL NULL
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL 0 0 0
|
||||
0 0 0 0 0 0
|
||||
0 0 1 0 0 0
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 0 1 1
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL NULL 1 1
|
||||
1 0 0 0 1 1
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL 0 NULL NULL
|
||||
1 1 0 0 1 1
|
||||
1 1 1 0 0 0
|
||||
select count(*) from t1_30237_bool
|
||||
where (A XOR (B AND C)) != (A XOR B AND C);
|
||||
count(*)
|
||||
0
|
||||
select A, B, C, (A AND B) XOR C, A AND (B XOR C), A AND B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A AND B) XOR C A AND (B XOR C) A AND B XOR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 0 0
|
||||
NULL 0 1 1 NULL 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 NULL 0 NULL
|
||||
0 NULL NULL NULL 0 NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 1 0 1
|
||||
0 0 NULL NULL 0 NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 0 1
|
||||
0 1 NULL NULL 0 NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 0 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL NULL NULL NULL
|
||||
1 0 0 0 0 0
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL NULL NULL NULL
|
||||
1 1 0 1 1 1
|
||||
1 1 1 0 0 0
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) XOR C) != (A AND B XOR C);
|
||||
count(*)
|
||||
0
|
||||
Testing that XOR has precedence over OR
|
||||
select A, B, C, (A XOR B) OR C, A XOR (B OR C), A XOR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A XOR B) OR C A XOR (B OR C) A XOR B OR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 1 NULL 1
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 1 NULL 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 1 NULL 1
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 1 1 1
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL 1 1 1
|
||||
0 1 0 1 1 1
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 1 0 1
|
||||
1 0 NULL 1 NULL 1
|
||||
1 0 0 1 1 1
|
||||
1 0 1 1 0 1
|
||||
1 1 NULL NULL 0 NULL
|
||||
1 1 0 0 0 0
|
||||
1 1 1 1 0 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) OR C) != (A XOR B OR C);
|
||||
count(*)
|
||||
0
|
||||
select A, B, C, (A OR B) XOR C, A OR (B XOR C), A OR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A OR B) XOR C A OR (B XOR C) A OR B XOR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 NULL 1 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 1 1 1
|
||||
NULL 1 1 0 NULL NULL
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 1 1 1
|
||||
0 1 1 0 0 0
|
||||
1 NULL NULL NULL 1 1
|
||||
1 NULL 0 1 1 1
|
||||
1 NULL 1 0 1 1
|
||||
1 0 NULL NULL 1 1
|
||||
1 0 0 1 1 1
|
||||
1 0 1 0 1 1
|
||||
1 1 NULL NULL 1 1
|
||||
1 1 0 1 1 1
|
||||
1 1 1 0 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B XOR C)) != (A OR B XOR C);
|
||||
count(*)
|
||||
0
|
||||
drop table t1_30237_bool;
|
||||
Testing that NOT has precedence over OR
|
||||
select (NOT FALSE) OR TRUE, NOT (FALSE OR TRUE), NOT FALSE OR TRUE;
|
||||
(NOT FALSE) OR TRUE NOT (FALSE OR TRUE) NOT FALSE OR TRUE
|
||||
1 0 1
|
||||
Testing that NOT has precedence over XOR
|
||||
select (NOT FALSE) XOR FALSE, NOT (FALSE XOR FALSE), NOT FALSE XOR FALSE;
|
||||
(NOT FALSE) XOR FALSE NOT (FALSE XOR FALSE) NOT FALSE XOR FALSE
|
||||
1 1 1
|
||||
Testing that NOT has precedence over AND
|
||||
select (NOT FALSE) AND FALSE, NOT (FALSE AND FALSE), NOT FALSE AND FALSE;
|
||||
(NOT FALSE) AND FALSE NOT (FALSE AND FALSE) NOT FALSE AND FALSE
|
||||
0 1 0
|
||||
Testing that NOT is associative
|
||||
select NOT NOT TRUE, NOT NOT NOT FALSE;
|
||||
NOT NOT TRUE NOT NOT NOT FALSE
|
||||
1 1
|
||||
Testing that IS has precedence over NOT
|
||||
select (NOT NULL) IS TRUE, NOT (NULL IS TRUE), NOT NULL IS TRUE;
|
||||
(NOT NULL) IS TRUE NOT (NULL IS TRUE) NOT NULL IS TRUE
|
||||
0 1 1
|
||||
select (NOT NULL) IS NOT TRUE, NOT (NULL IS NOT TRUE), NOT NULL IS NOT TRUE;
|
||||
(NOT NULL) IS NOT TRUE NOT (NULL IS NOT TRUE) NOT NULL IS NOT TRUE
|
||||
1 0 0
|
||||
select (NOT NULL) IS FALSE, NOT (NULL IS FALSE), NOT NULL IS FALSE;
|
||||
(NOT NULL) IS FALSE NOT (NULL IS FALSE) NOT NULL IS FALSE
|
||||
0 1 1
|
||||
select (NOT NULL) IS NOT FALSE, NOT (NULL IS NOT FALSE), NOT NULL IS NOT FALSE;
|
||||
(NOT NULL) IS NOT FALSE NOT (NULL IS NOT FALSE) NOT NULL IS NOT FALSE
|
||||
1 0 0
|
||||
select (NOT TRUE) IS UNKNOWN, NOT (TRUE IS UNKNOWN), NOT TRUE IS UNKNOWN;
|
||||
(NOT TRUE) IS UNKNOWN NOT (TRUE IS UNKNOWN) NOT TRUE IS UNKNOWN
|
||||
0 1 1
|
||||
select (NOT TRUE) IS NOT UNKNOWN, NOT (TRUE IS NOT UNKNOWN), NOT TRUE IS NOT UNKNOWN;
|
||||
(NOT TRUE) IS NOT UNKNOWN NOT (TRUE IS NOT UNKNOWN) NOT TRUE IS NOT UNKNOWN
|
||||
1 0 0
|
||||
select (NOT TRUE) IS NULL, NOT (TRUE IS NULL), NOT TRUE IS NULL;
|
||||
(NOT TRUE) IS NULL NOT (TRUE IS NULL) NOT TRUE IS NULL
|
||||
0 1 1
|
||||
select (NOT TRUE) IS NOT NULL, NOT (TRUE IS NOT NULL), NOT TRUE IS NOT NULL;
|
||||
(NOT TRUE) IS NOT NULL NOT (TRUE IS NOT NULL) NOT TRUE IS NOT NULL
|
||||
1 0 0
|
||||
Testing that IS [NOT] TRUE/FALSE/UNKNOWN predicates are not associative
|
||||
select TRUE IS TRUE IS TRUE IS TRUE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS TRUE IS TRUE' at line 1
|
||||
select FALSE IS NOT TRUE IS NOT TRUE IS NOT TRUE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS NOT TRUE IS NOT TRUE' at line 1
|
||||
select NULL IS FALSE IS FALSE IS FALSE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS FALSE IS FALSE' at line 1
|
||||
select TRUE IS NOT FALSE IS NOT FALSE IS NOT FALSE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS NOT FALSE IS NOT FALSE' at line 1
|
||||
select FALSE IS UNKNOWN IS UNKNOWN IS UNKNOWN;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS UNKNOWN IS UNKNOWN' at line 1
|
||||
select TRUE IS NOT UNKNOWN IS NOT UNKNOWN IS NOT UNKNOWN;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS NOT UNKNOWN IS NOT UNKNOWN' at line 1
|
||||
Testing that IS [NOT] NULL predicates are associative
|
||||
select FALSE IS NULL IS NULL IS NULL;
|
||||
FALSE IS NULL IS NULL IS NULL
|
||||
0
|
||||
select TRUE IS NOT NULL IS NOT NULL IS NOT NULL;
|
||||
TRUE IS NOT NULL IS NOT NULL IS NOT NULL
|
||||
1
|
||||
Testing that comparison operators are left associative
|
||||
select 1 <=> 2 <=> 2, (1 <=> 2) <=> 2, 1 <=> (2 <=> 2);
|
||||
1 <=> 2 <=> 2 (1 <=> 2) <=> 2 1 <=> (2 <=> 2)
|
||||
0 0 1
|
||||
select 1 = 2 = 2, (1 = 2) = 2, 1 = (2 = 2);
|
||||
1 = 2 = 2 (1 = 2) = 2 1 = (2 = 2)
|
||||
0 0 1
|
||||
select 1 != 2 != 3, (1 != 2) != 3, 1 != (2 != 3);
|
||||
1 != 2 != 3 (1 != 2) != 3 1 != (2 != 3)
|
||||
1 1 0
|
||||
select 1 <> 2 <> 3, (1 <> 2) <> 3, 1 <> (2 <> 3);
|
||||
1 <> 2 <> 3 (1 <> 2) <> 3 1 <> (2 <> 3)
|
||||
1 1 0
|
||||
select 1 < 2 < 3, (1 < 2) < 3, 1 < (2 < 3);
|
||||
1 < 2 < 3 (1 < 2) < 3 1 < (2 < 3)
|
||||
1 1 0
|
||||
select 3 <= 2 <= 1, (3 <= 2) <= 1, 3 <= (2 <= 1);
|
||||
3 <= 2 <= 1 (3 <= 2) <= 1 3 <= (2 <= 1)
|
||||
1 1 0
|
||||
select 1 > 2 > 3, (1 > 2) > 3, 1 > (2 > 3);
|
||||
1 > 2 > 3 (1 > 2) > 3 1 > (2 > 3)
|
||||
0 0 1
|
||||
select 1 >= 2 >= 3, (1 >= 2) >= 3, 1 >= (2 >= 3);
|
||||
1 >= 2 >= 3 (1 >= 2) >= 3 1 >= (2 >= 3)
|
||||
0 0 1
|
||||
Testing that | is associative
|
||||
select 0xF0 | 0x0F | 0x55, (0xF0 | 0x0F) | 0x55, 0xF0 | (0x0F | 0x55);
|
||||
0xF0 | 0x0F | 0x55 (0xF0 | 0x0F) | 0x55 0xF0 | (0x0F | 0x55)
|
||||
255 255 255
|
||||
Testing that & is associative
|
||||
select 0xF5 & 0x5F & 0x55, (0xF5 & 0x5F) & 0x55, 0xF5 & (0x5F & 0x55);
|
||||
0xF5 & 0x5F & 0x55 (0xF5 & 0x5F) & 0x55 0xF5 & (0x5F & 0x55)
|
||||
85 85 85
|
||||
Testing that << is left associative
|
||||
select 4 << 3 << 2, (4 << 3) << 2, 4 << (3 << 2);
|
||||
4 << 3 << 2 (4 << 3) << 2 4 << (3 << 2)
|
||||
128 128 16384
|
||||
Testing that >> is left associative
|
||||
select 256 >> 3 >> 2, (256 >> 3) >> 2, 256 >> (3 >> 2);
|
||||
256 >> 3 >> 2 (256 >> 3) >> 2 256 >> (3 >> 2)
|
||||
8 8 256
|
||||
Testing that & has precedence over |
|
||||
select 0xF0 & 0x0F | 0x55, (0xF0 & 0x0F) | 0x55, 0xF0 & (0x0F | 0x55);
|
||||
0xF0 & 0x0F | 0x55 (0xF0 & 0x0F) | 0x55 0xF0 & (0x0F | 0x55)
|
||||
85 85 80
|
||||
select 0x55 | 0xF0 & 0x0F, (0x55 | 0xF0) & 0x0F, 0x55 | (0xF0 & 0x0F);
|
||||
0x55 | 0xF0 & 0x0F (0x55 | 0xF0) & 0x0F 0x55 | (0xF0 & 0x0F)
|
||||
85 5 85
|
||||
Testing that << has precedence over |
|
||||
select 0x0F << 4 | 0x0F, (0x0F << 4) | 0x0F, 0x0F << (4 | 0x0F);
|
||||
0x0F << 4 | 0x0F (0x0F << 4) | 0x0F 0x0F << (4 | 0x0F)
|
||||
255 255 491520
|
||||
select 0x0F | 0x0F << 4, (0x0F | 0x0F) << 4, 0x0F | (0x0F << 4);
|
||||
0x0F | 0x0F << 4 (0x0F | 0x0F) << 4 0x0F | (0x0F << 4)
|
||||
255 240 255
|
||||
Testing that >> has precedence over |
|
||||
select 0xF0 >> 4 | 0xFF, (0xF0 >> 4) | 0xFF, 0xF0 >> (4 | 0xFF);
|
||||
0xF0 >> 4 | 0xFF (0xF0 >> 4) | 0xFF 0xF0 >> (4 | 0xFF)
|
||||
255 255 0
|
||||
select 0xFF | 0xF0 >> 4, (0xFF | 0xF0) >> 4, 0xFF | (0xF0 >> 4);
|
||||
0xFF | 0xF0 >> 4 (0xFF | 0xF0) >> 4 0xFF | (0xF0 >> 4)
|
||||
255 15 255
|
||||
Testing that << has precedence over &
|
||||
select 0x0F << 4 & 0xF0, (0x0F << 4) & 0xF0, 0x0F << (4 & 0xF0);
|
||||
0x0F << 4 & 0xF0 (0x0F << 4) & 0xF0 0x0F << (4 & 0xF0)
|
||||
240 240 15
|
||||
select 0xF0 & 0x0F << 4, (0xF0 & 0x0F) << 4, 0xF0 & (0x0F << 4);
|
||||
0xF0 & 0x0F << 4 (0xF0 & 0x0F) << 4 0xF0 & (0x0F << 4)
|
||||
240 0 240
|
||||
Testing that >> has precedence over &
|
||||
select 0xF0 >> 4 & 0x55, (0xF0 >> 4) & 0x55, 0xF0 >> (4 & 0x55);
|
||||
0xF0 >> 4 & 0x55 (0xF0 >> 4) & 0x55 0xF0 >> (4 & 0x55)
|
||||
5 5 15
|
||||
select 0x0F & 0xF0 >> 4, (0x0F & 0xF0) >> 4, 0x0F & (0xF0 >> 4);
|
||||
0x0F & 0xF0 >> 4 (0x0F & 0xF0) >> 4 0x0F & (0xF0 >> 4)
|
||||
15 0 15
|
||||
Testing that >> and << have the same precedence
|
||||
select 0xFF >> 4 << 2, (0xFF >> 4) << 2, 0xFF >> (4 << 2);
|
||||
0xFF >> 4 << 2 (0xFF >> 4) << 2 0xFF >> (4 << 2)
|
||||
60 60 0
|
||||
select 0x0F << 4 >> 2, (0x0F << 4) >> 2, 0x0F << (4 >> 2);
|
||||
0x0F << 4 >> 2 (0x0F << 4) >> 2 0x0F << (4 >> 2)
|
||||
60 60 30
|
||||
Testing that binary + is associative
|
||||
select 1 + 2 + 3, (1 + 2) + 3, 1 + (2 + 3);
|
||||
1 + 2 + 3 (1 + 2) + 3 1 + (2 + 3)
|
||||
6 6 6
|
||||
Testing that binary - is left associative
|
||||
select 1 - 2 - 3, (1 - 2) - 3, 1 - (2 - 3);
|
||||
1 - 2 - 3 (1 - 2) - 3 1 - (2 - 3)
|
||||
-4 -4 2
|
||||
Testing that binary + and binary - have the same precedence
|
||||
select 1 + 2 - 3, (1 + 2) - 3, 1 + (2 - 3);
|
||||
1 + 2 - 3 (1 + 2) - 3 1 + (2 - 3)
|
||||
0 0 0
|
||||
select 1 - 2 + 3, (1 - 2) + 3, 1 - (2 + 3);
|
||||
1 - 2 + 3 (1 - 2) + 3 1 - (2 + 3)
|
||||
2 2 -4
|
||||
Testing that binary + has precedence over |
|
||||
select 0xF0 + 0x0F | 0x55, (0xF0 + 0x0F) | 0x55, 0xF0 + (0x0F | 0x55);
|
||||
0xF0 + 0x0F | 0x55 (0xF0 + 0x0F) | 0x55 0xF0 + (0x0F | 0x55)
|
||||
255 255 335
|
||||
select 0x55 | 0xF0 + 0x0F, (0x55 | 0xF0) + 0x0F, 0x55 | (0xF0 + 0x0F);
|
||||
0x55 | 0xF0 + 0x0F (0x55 | 0xF0) + 0x0F 0x55 | (0xF0 + 0x0F)
|
||||
255 260 255
|
||||
Testing that binary + has precedence over &
|
||||
select 0xF0 + 0x0F & 0x55, (0xF0 + 0x0F) & 0x55, 0xF0 + (0x0F & 0x55);
|
||||
0xF0 + 0x0F & 0x55 (0xF0 + 0x0F) & 0x55 0xF0 + (0x0F & 0x55)
|
||||
85 85 245
|
||||
select 0x55 & 0xF0 + 0x0F, (0x55 & 0xF0) + 0x0F, 0x55 & (0xF0 + 0x0F);
|
||||
0x55 & 0xF0 + 0x0F (0x55 & 0xF0) + 0x0F 0x55 & (0xF0 + 0x0F)
|
||||
85 95 85
|
||||
Testing that binary + has precedence over <<
|
||||
select 2 + 3 << 4, (2 + 3) << 4, 2 + (3 << 4);
|
||||
2 + 3 << 4 (2 + 3) << 4 2 + (3 << 4)
|
||||
80 80 50
|
||||
select 3 << 4 + 2, (3 << 4) + 2, 3 << (4 + 2);
|
||||
3 << 4 + 2 (3 << 4) + 2 3 << (4 + 2)
|
||||
192 50 192
|
||||
Testing that binary + has precedence over >>
|
||||
select 4 + 3 >> 2, (4 + 3) >> 2, 4 + (3 >> 2);
|
||||
4 + 3 >> 2 (4 + 3) >> 2 4 + (3 >> 2)
|
||||
1 1 4
|
||||
select 3 >> 2 + 1, (3 >> 2) + 1, 3 >> (2 + 1);
|
||||
3 >> 2 + 1 (3 >> 2) + 1 3 >> (2 + 1)
|
||||
0 1 0
|
||||
Testing that binary - has precedence over |
|
||||
select 0xFF - 0x0F | 0x55, (0xFF - 0x0F) | 0x55, 0xFF - (0x0F | 0x55);
|
||||
0xFF - 0x0F | 0x55 (0xFF - 0x0F) | 0x55 0xFF - (0x0F | 0x55)
|
||||
245 245 160
|
||||
select 0x55 | 0xFF - 0xF0, (0x55 | 0xFF) - 0xF0, 0x55 | (0xFF - 0xF0);
|
||||
0x55 | 0xFF - 0xF0 (0x55 | 0xFF) - 0xF0 0x55 | (0xFF - 0xF0)
|
||||
95 15 95
|
||||
Testing that binary - has precedence over &
|
||||
select 0xFF - 0xF0 & 0x55, (0xFF - 0xF0) & 0x55, 0xFF - (0xF0 & 0x55);
|
||||
0xFF - 0xF0 & 0x55 (0xFF - 0xF0) & 0x55 0xFF - (0xF0 & 0x55)
|
||||
5 5 175
|
||||
select 0x55 & 0xFF - 0xF0, (0x55 & 0xFF) - 0xF0, 0x55 & (0xFF - 0xF0);
|
||||
0x55 & 0xFF - 0xF0 (0x55 & 0xFF) - 0xF0 0x55 & (0xFF - 0xF0)
|
||||
5 -155 5
|
||||
Testing that binary - has precedence over <<
|
||||
select 16 - 3 << 2, (16 - 3) << 2, 16 - (3 << 2);
|
||||
16 - 3 << 2 (16 - 3) << 2 16 - (3 << 2)
|
||||
52 52 4
|
||||
select 4 << 3 - 2, (4 << 3) - 2, 4 << (3 - 2);
|
||||
4 << 3 - 2 (4 << 3) - 2 4 << (3 - 2)
|
||||
8 30 8
|
||||
Testing that binary - has precedence over >>
|
||||
select 16 - 3 >> 2, (16 - 3) >> 2, 16 - (3 >> 2);
|
||||
16 - 3 >> 2 (16 - 3) >> 2 16 - (3 >> 2)
|
||||
3 3 16
|
||||
select 16 >> 3 - 2, (16 >> 3) - 2, 16 >> (3 - 2);
|
||||
16 >> 3 - 2 (16 >> 3) - 2 16 >> (3 - 2)
|
||||
8 0 8
|
||||
Testing that * is associative
|
||||
select 2 * 3 * 4, (2 * 3) * 4, 2 * (3 * 4);
|
||||
2 * 3 * 4 (2 * 3) * 4 2 * (3 * 4)
|
||||
24 24 24
|
||||
Testing that * has precedence over |
|
||||
select 2 * 0x40 | 0x0F, (2 * 0x40) | 0x0F, 2 * (0x40 | 0x0F);
|
||||
2 * 0x40 | 0x0F (2 * 0x40) | 0x0F 2 * (0x40 | 0x0F)
|
||||
143 143 158
|
||||
select 0x0F | 2 * 0x40, (0x0F | 2) * 0x40, 0x0F | (2 * 0x40);
|
||||
0x0F | 2 * 0x40 (0x0F | 2) * 0x40 0x0F | (2 * 0x40)
|
||||
143 960 143
|
||||
Testing that * has precedence over &
|
||||
select 2 * 0x40 & 0x55, (2 * 0x40) & 0x55, 2 * (0x40 & 0x55);
|
||||
2 * 0x40 & 0x55 (2 * 0x40) & 0x55 2 * (0x40 & 0x55)
|
||||
0 0 128
|
||||
select 0xF0 & 2 * 0x40, (0xF0 & 2) * 0x40, 0xF0 & (2 * 0x40);
|
||||
0xF0 & 2 * 0x40 (0xF0 & 2) * 0x40 0xF0 & (2 * 0x40)
|
||||
128 0 128
|
||||
Testing that * has precedence over <<
|
||||
select 5 * 3 << 4, (5 * 3) << 4, 5 * (3 << 4);
|
||||
5 * 3 << 4 (5 * 3) << 4 5 * (3 << 4)
|
||||
240 240 240
|
||||
select 2 << 3 * 4, (2 << 3) * 4, 2 << (3 * 4);
|
||||
2 << 3 * 4 (2 << 3) * 4 2 << (3 * 4)
|
||||
8192 64 8192
|
||||
Testing that * has precedence over >>
|
||||
select 3 * 4 >> 2, (3 * 4) >> 2, 3 * (4 >> 2);
|
||||
3 * 4 >> 2 (3 * 4) >> 2 3 * (4 >> 2)
|
||||
3 3 3
|
||||
select 4 >> 2 * 3, (4 >> 2) * 3, 4 >> (2 * 3);
|
||||
4 >> 2 * 3 (4 >> 2) * 3 4 >> (2 * 3)
|
||||
0 3 0
|
||||
Testing that * has precedence over binary +
|
||||
select 2 * 3 + 4, (2 * 3) + 4, 2 * (3 + 4);
|
||||
2 * 3 + 4 (2 * 3) + 4 2 * (3 + 4)
|
||||
10 10 14
|
||||
select 2 + 3 * 4, (2 + 3) * 4, 2 + (3 * 4);
|
||||
2 + 3 * 4 (2 + 3) * 4 2 + (3 * 4)
|
||||
14 20 14
|
||||
Testing that * has precedence over binary -
|
||||
select 4 * 3 - 2, (4 * 3) - 2, 4 * (3 - 2);
|
||||
4 * 3 - 2 (4 * 3) - 2 4 * (3 - 2)
|
||||
10 10 4
|
||||
select 4 - 3 * 2, (4 - 3) * 2, 4 - (3 * 2);
|
||||
4 - 3 * 2 (4 - 3) * 2 4 - (3 * 2)
|
||||
-2 2 -2
|
||||
Testing that / is left associative
|
||||
select 15 / 5 / 3, (15 / 5) / 3, 15 / (5 / 3);
|
||||
15 / 5 / 3 (15 / 5) / 3 15 / (5 / 3)
|
||||
1.00000000 1.00000000 8.9998
|
||||
Testing that / has precedence over |
|
||||
select 105 / 5 | 2, (105 / 5) | 2, 105 / (5 | 2);
|
||||
105 / 5 | 2 (105 / 5) | 2 105 / (5 | 2)
|
||||
23 23 15.0000
|
||||
select 105 | 2 / 5, (105 | 2) / 5, 105 | (2 / 5);
|
||||
105 | 2 / 5 (105 | 2) / 5 105 | (2 / 5)
|
||||
105 21.4000 105
|
||||
Testing that / has precedence over &
|
||||
select 105 / 5 & 0x0F, (105 / 5) & 0x0F, 105 / (5 & 0x0F);
|
||||
105 / 5 & 0x0F (105 / 5) & 0x0F 105 / (5 & 0x0F)
|
||||
5 5 21.0000
|
||||
select 0x0F & 105 / 5, (0x0F & 105) / 5, 0x0F & (105 / 5);
|
||||
0x0F & 105 / 5 (0x0F & 105) / 5 0x0F & (105 / 5)
|
||||
5 1.8000 5
|
||||
Testing that / has precedence over <<
|
||||
select 0x80 / 4 << 2, (0x80 / 4) << 2, 0x80 / (4 << 2);
|
||||
0x80 / 4 << 2 (0x80 / 4) << 2 0x80 / (4 << 2)
|
||||
128 128 8.0000
|
||||
select 0x80 << 4 / 2, (0x80 << 4) / 2, 0x80 << (4 / 2);
|
||||
0x80 << 4 / 2 (0x80 << 4) / 2 0x80 << (4 / 2)
|
||||
512 1024.0000 512
|
||||
Testing that / has precedence over >>
|
||||
select 0x80 / 4 >> 2, (0x80 / 4) >> 2, 0x80 / (4 >> 2);
|
||||
0x80 / 4 >> 2 (0x80 / 4) >> 2 0x80 / (4 >> 2)
|
||||
8 8 128.0000
|
||||
select 0x80 >> 4 / 2, (0x80 >> 4) / 2, 0x80 >> (4 / 2);
|
||||
0x80 >> 4 / 2 (0x80 >> 4) / 2 0x80 >> (4 / 2)
|
||||
32 4.0000 32
|
||||
Testing that / has precedence over binary +
|
||||
select 0x80 / 2 + 2, (0x80 / 2) + 2, 0x80 / (2 + 2);
|
||||
0x80 / 2 + 2 (0x80 / 2) + 2 0x80 / (2 + 2)
|
||||
66.0000 66.0000 32.0000
|
||||
select 0x80 + 2 / 2, (0x80 + 2) / 2, 0x80 + (2 / 2);
|
||||
0x80 + 2 / 2 (0x80 + 2) / 2 0x80 + (2 / 2)
|
||||
129.0000 65.0000 129.0000
|
||||
Testing that / has precedence over binary -
|
||||
select 0x80 / 4 - 2, (0x80 / 4) - 2, 0x80 / (4 - 2);
|
||||
0x80 / 4 - 2 (0x80 / 4) - 2 0x80 / (4 - 2)
|
||||
30.0000 30.0000 64.0000
|
||||
select 0x80 - 4 / 2, (0x80 - 4) / 2, 0x80 - (4 / 2);
|
||||
0x80 - 4 / 2 (0x80 - 4) / 2 0x80 - (4 / 2)
|
||||
126.0000 62.0000 126.0000
|
||||
Testing that ^ is associative
|
||||
select 0xFF ^ 0xF0 ^ 0x0F, (0xFF ^ 0xF0) ^ 0x0F, 0xFF ^ (0xF0 ^ 0x0F);
|
||||
0xFF ^ 0xF0 ^ 0x0F (0xFF ^ 0xF0) ^ 0x0F 0xFF ^ (0xF0 ^ 0x0F)
|
||||
0 0 0
|
||||
select 0xFF ^ 0xF0 ^ 0x55, (0xFF ^ 0xF0) ^ 0x55, 0xFF ^ (0xF0 ^ 0x55);
|
||||
0xFF ^ 0xF0 ^ 0x55 (0xFF ^ 0xF0) ^ 0x55 0xFF ^ (0xF0 ^ 0x55)
|
||||
90 90 90
|
||||
Testing that ^ has precedence over |
|
||||
select 0xFF ^ 0xF0 | 0x0F, (0xFF ^ 0xF0) | 0x0F, 0xFF ^ (0xF0 | 0x0F);
|
||||
0xFF ^ 0xF0 | 0x0F (0xFF ^ 0xF0) | 0x0F 0xFF ^ (0xF0 | 0x0F)
|
||||
15 15 0
|
||||
select 0xF0 | 0xFF ^ 0xF0, (0xF0 | 0xFF) ^ 0xF0, 0xF0 | (0xFF ^ 0xF0);
|
||||
0xF0 | 0xFF ^ 0xF0 (0xF0 | 0xFF) ^ 0xF0 0xF0 | (0xFF ^ 0xF0)
|
||||
255 15 255
|
||||
Testing that ^ has precedence over &
|
||||
select 0xFF ^ 0xF0 & 0x0F, (0xFF ^ 0xF0) & 0x0F, 0xFF ^ (0xF0 & 0x0F);
|
||||
0xFF ^ 0xF0 & 0x0F (0xFF ^ 0xF0) & 0x0F 0xFF ^ (0xF0 & 0x0F)
|
||||
15 15 255
|
||||
select 0x0F & 0xFF ^ 0xF0, (0x0F & 0xFF) ^ 0xF0, 0x0F & (0xFF ^ 0xF0);
|
||||
0x0F & 0xFF ^ 0xF0 (0x0F & 0xFF) ^ 0xF0 0x0F & (0xFF ^ 0xF0)
|
||||
15 255 15
|
||||
Testing that ^ has precedence over <<
|
||||
select 0xFF ^ 0xF0 << 2, (0xFF ^ 0xF0) << 2, 0xFF ^ (0xF0 << 2);
|
||||
0xFF ^ 0xF0 << 2 (0xFF ^ 0xF0) << 2 0xFF ^ (0xF0 << 2)
|
||||
60 60 831
|
||||
select 0x0F << 2 ^ 0xFF, (0x0F << 2) ^ 0xFF, 0x0F << (2 ^ 0xFF);
|
||||
0x0F << 2 ^ 0xFF (0x0F << 2) ^ 0xFF 0x0F << (2 ^ 0xFF)
|
||||
0 195 0
|
||||
Testing that ^ has precedence over >>
|
||||
select 0xFF ^ 0xF0 >> 2, (0xFF ^ 0xF0) >> 2, 0xFF ^ (0xF0 >> 2);
|
||||
0xFF ^ 0xF0 >> 2 (0xFF ^ 0xF0) >> 2 0xFF ^ (0xF0 >> 2)
|
||||
3 3 195
|
||||
select 0xFF >> 2 ^ 0xF0, (0xFF >> 2) ^ 0xF0, 0xFF >> (2 ^ 0xF0);
|
||||
0xFF >> 2 ^ 0xF0 (0xFF >> 2) ^ 0xF0 0xFF >> (2 ^ 0xF0)
|
||||
0 207 0
|
||||
Testing that ^ has precedence over binary +
|
||||
select 0xFF ^ 0xF0 + 0x0F, (0xFF ^ 0xF0) + 0x0F, 0xFF ^ (0xF0 + 0x0F);
|
||||
0xFF ^ 0xF0 + 0x0F (0xFF ^ 0xF0) + 0x0F 0xFF ^ (0xF0 + 0x0F)
|
||||
30 30 0
|
||||
select 0x0F + 0xFF ^ 0xF0, (0x0F + 0xFF) ^ 0xF0, 0x0F + (0xFF ^ 0xF0);
|
||||
0x0F + 0xFF ^ 0xF0 (0x0F + 0xFF) ^ 0xF0 0x0F + (0xFF ^ 0xF0)
|
||||
30 510 30
|
||||
Testing that ^ has precedence over binary -
|
||||
select 0xFF ^ 0xF0 - 1, (0xFF ^ 0xF0) - 1, 0xFF ^ (0xF0 - 1);
|
||||
0xFF ^ 0xF0 - 1 (0xFF ^ 0xF0) - 1 0xFF ^ (0xF0 - 1)
|
||||
14 14 16
|
||||
select 0x55 - 0x0F ^ 0x55, (0x55 - 0x0F) ^ 0x55, 0x55 - (0x0F ^ 0x55);
|
||||
0x55 - 0x0F ^ 0x55 (0x55 - 0x0F) ^ 0x55 0x55 - (0x0F ^ 0x55)
|
||||
-5 19 -5
|
||||
Testing that ^ has precedence over *
|
||||
select 0xFF ^ 0xF0 * 2, (0xFF ^ 0xF0) * 2, 0xFF ^ (0xF0 * 2);
|
||||
0xFF ^ 0xF0 * 2 (0xFF ^ 0xF0) * 2 0xFF ^ (0xF0 * 2)
|
||||
30 30 287
|
||||
select 2 * 0xFF ^ 0xF0, (2 * 0xFF) ^ 0xF0, 2 * (0xFF ^ 0xF0);
|
||||
2 * 0xFF ^ 0xF0 (2 * 0xFF) ^ 0xF0 2 * (0xFF ^ 0xF0)
|
||||
30 270 30
|
||||
Testing that ^ has precedence over /
|
||||
select 0xFF ^ 0xF0 / 2, (0xFF ^ 0xF0) / 2, 0xFF ^ (0xF0 / 2);
|
||||
0xFF ^ 0xF0 / 2 (0xFF ^ 0xF0) / 2 0xFF ^ (0xF0 / 2)
|
||||
7.5000 7.5000 135
|
||||
select 0xF2 / 2 ^ 0xF0, (0xF2 / 2) ^ 0xF0, 0xF2 / (2 ^ 0xF0);
|
||||
0xF2 / 2 ^ 0xF0 (0xF2 / 2) ^ 0xF0 0xF2 / (2 ^ 0xF0)
|
||||
1.0000 137 1.0000
|
||||
Testing that ^ has precedence over %
|
||||
select 0xFF ^ 0xF0 % 0x20, (0xFF ^ 0xF0) % 0x20, 0xFF ^ (0xF0 % 0x20);
|
||||
0xFF ^ 0xF0 % 0x20 (0xFF ^ 0xF0) % 0x20 0xFF ^ (0xF0 % 0x20)
|
||||
15 15 239
|
||||
select 0xFF % 0x20 ^ 0xF0, (0xFF % 0x20) ^ 0xF0, 0xFF % (0x20 ^ 0xF0);
|
||||
0xFF % 0x20 ^ 0xF0 (0xFF % 0x20) ^ 0xF0 0xFF % (0x20 ^ 0xF0)
|
||||
47 239 47
|
||||
Testing that ^ has precedence over DIV
|
||||
select 0xFF ^ 0xF0 DIV 2, (0xFF ^ 0xF0) DIV 2, 0xFF ^ (0xF0 DIV 2);
|
||||
0xFF ^ 0xF0 DIV 2 (0xFF ^ 0xF0) DIV 2 0xFF ^ (0xF0 DIV 2)
|
||||
7 7 135
|
||||
select 0xF2 DIV 2 ^ 0xF0, (0xF2 DIV 2) ^ 0xF0, 0xF2 DIV (2 ^ 0xF0);
|
||||
0xF2 DIV 2 ^ 0xF0 (0xF2 DIV 2) ^ 0xF0 0xF2 DIV (2 ^ 0xF0)
|
||||
1 137 1
|
||||
Testing that ^ has precedence over MOD
|
||||
select 0xFF ^ 0xF0 MOD 0x20, (0xFF ^ 0xF0) MOD 0x20, 0xFF ^ (0xF0 MOD 0x20);
|
||||
0xFF ^ 0xF0 MOD 0x20 (0xFF ^ 0xF0) MOD 0x20 0xFF ^ (0xF0 MOD 0x20)
|
||||
15 15 239
|
||||
select 0xFF MOD 0x20 ^ 0xF0, (0xFF MOD 0x20) ^ 0xF0, 0xFF MOD (0x20 ^ 0xF0);
|
||||
0xFF MOD 0x20 ^ 0xF0 (0xFF MOD 0x20) ^ 0xF0 0xFF MOD (0x20 ^ 0xF0)
|
||||
47 239 47
|
|
@ -1,335 +0,0 @@
|
|||
|
||||
--disable_warnings
|
||||
drop table if exists t1_30237_bool;
|
||||
--enable_warnings
|
||||
|
||||
set sql_mode=NO_UNSIGNED_SUBTRACTION;
|
||||
|
||||
create table t1_30237_bool(A boolean, B boolean, C boolean);
|
||||
|
||||
insert into t1_30237_bool values
|
||||
(FALSE, FALSE, FALSE),
|
||||
(FALSE, FALSE, NULL),
|
||||
(FALSE, FALSE, TRUE),
|
||||
(FALSE, NULL, FALSE),
|
||||
(FALSE, NULL, NULL),
|
||||
(FALSE, NULL, TRUE),
|
||||
(FALSE, TRUE, FALSE),
|
||||
(FALSE, TRUE, NULL),
|
||||
(FALSE, TRUE, TRUE),
|
||||
(NULL, FALSE, FALSE),
|
||||
(NULL, FALSE, NULL),
|
||||
(NULL, FALSE, TRUE),
|
||||
(NULL, NULL, FALSE),
|
||||
(NULL, NULL, NULL),
|
||||
(NULL, NULL, TRUE),
|
||||
(NULL, TRUE, FALSE),
|
||||
(NULL, TRUE, NULL),
|
||||
(NULL, TRUE, TRUE),
|
||||
(TRUE, FALSE, FALSE),
|
||||
(TRUE, FALSE, NULL),
|
||||
(TRUE, FALSE, TRUE),
|
||||
(TRUE, NULL, FALSE),
|
||||
(TRUE, NULL, NULL),
|
||||
(TRUE, NULL, TRUE),
|
||||
(TRUE, TRUE, FALSE),
|
||||
(TRUE, TRUE, NULL),
|
||||
(TRUE, TRUE, TRUE) ;
|
||||
|
||||
--echo Testing OR, XOR, AND
|
||||
select A, B, A OR B, A XOR B, A AND B
|
||||
from t1_30237_bool where C is null order by A, B;
|
||||
|
||||
--echo Testing that OR is associative
|
||||
select A, B, C, (A OR B) OR C, A OR (B OR C), A OR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A OR B) OR C) != (A OR (B OR C));
|
||||
|
||||
--echo Testing that XOR is associative
|
||||
select A, B, C, (A XOR B) XOR C, A XOR (B XOR C), A XOR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) XOR C) != (A XOR (B XOR C));
|
||||
|
||||
--echo Testing that AND is associative
|
||||
select A, B, C, (A AND B) AND C, A AND (B AND C), A AND B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) AND C) != (A AND (B AND C));
|
||||
|
||||
--echo Testing that AND has precedence over OR
|
||||
select A, B, C, (A OR B) AND C, A OR (B AND C), A OR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B AND C)) != (A OR B AND C);
|
||||
select A, B, C, (A AND B) OR C, A AND (B OR C), A AND B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) OR C) != (A AND B OR C);
|
||||
|
||||
--echo Testing that AND has precedence over XOR
|
||||
select A, B, C, (A XOR B) AND C, A XOR (B AND C), A XOR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where (A XOR (B AND C)) != (A XOR B AND C);
|
||||
select A, B, C, (A AND B) XOR C, A AND (B XOR C), A AND B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) XOR C) != (A AND B XOR C);
|
||||
|
||||
--echo Testing that XOR has precedence over OR
|
||||
select A, B, C, (A XOR B) OR C, A XOR (B OR C), A XOR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) OR C) != (A XOR B OR C);
|
||||
select A, B, C, (A OR B) XOR C, A OR (B XOR C), A OR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B XOR C)) != (A OR B XOR C);
|
||||
|
||||
drop table t1_30237_bool;
|
||||
|
||||
--echo Testing that NOT has precedence over OR
|
||||
select (NOT FALSE) OR TRUE, NOT (FALSE OR TRUE), NOT FALSE OR TRUE;
|
||||
|
||||
--echo Testing that NOT has precedence over XOR
|
||||
select (NOT FALSE) XOR FALSE, NOT (FALSE XOR FALSE), NOT FALSE XOR FALSE;
|
||||
|
||||
--echo Testing that NOT has precedence over AND
|
||||
select (NOT FALSE) AND FALSE, NOT (FALSE AND FALSE), NOT FALSE AND FALSE;
|
||||
|
||||
--echo Testing that NOT is associative
|
||||
select NOT NOT TRUE, NOT NOT NOT FALSE;
|
||||
|
||||
--echo Testing that IS has precedence over NOT
|
||||
select (NOT NULL) IS TRUE, NOT (NULL IS TRUE), NOT NULL IS TRUE;
|
||||
select (NOT NULL) IS NOT TRUE, NOT (NULL IS NOT TRUE), NOT NULL IS NOT TRUE;
|
||||
select (NOT NULL) IS FALSE, NOT (NULL IS FALSE), NOT NULL IS FALSE;
|
||||
select (NOT NULL) IS NOT FALSE, NOT (NULL IS NOT FALSE), NOT NULL IS NOT FALSE;
|
||||
select (NOT TRUE) IS UNKNOWN, NOT (TRUE IS UNKNOWN), NOT TRUE IS UNKNOWN;
|
||||
select (NOT TRUE) IS NOT UNKNOWN, NOT (TRUE IS NOT UNKNOWN), NOT TRUE IS NOT UNKNOWN;
|
||||
select (NOT TRUE) IS NULL, NOT (TRUE IS NULL), NOT TRUE IS NULL;
|
||||
select (NOT TRUE) IS NOT NULL, NOT (TRUE IS NOT NULL), NOT TRUE IS NOT NULL;
|
||||
|
||||
--echo Testing that IS [NOT] TRUE/FALSE/UNKNOWN predicates are not associative
|
||||
# Documenting existing behavior in 5.0.48
|
||||
-- error ER_PARSE_ERROR
|
||||
select TRUE IS TRUE IS TRUE IS TRUE;
|
||||
-- error ER_PARSE_ERROR
|
||||
select FALSE IS NOT TRUE IS NOT TRUE IS NOT TRUE;
|
||||
-- error ER_PARSE_ERROR
|
||||
select NULL IS FALSE IS FALSE IS FALSE;
|
||||
-- error ER_PARSE_ERROR
|
||||
select TRUE IS NOT FALSE IS NOT FALSE IS NOT FALSE;
|
||||
-- error ER_PARSE_ERROR
|
||||
select FALSE IS UNKNOWN IS UNKNOWN IS UNKNOWN;
|
||||
-- error ER_PARSE_ERROR
|
||||
select TRUE IS NOT UNKNOWN IS NOT UNKNOWN IS NOT UNKNOWN;
|
||||
|
||||
--echo Testing that IS [NOT] NULL predicates are associative
|
||||
# Documenting existing behavior in 5.0.48
|
||||
select FALSE IS NULL IS NULL IS NULL;
|
||||
select TRUE IS NOT NULL IS NOT NULL IS NOT NULL;
|
||||
|
||||
--echo Testing that comparison operators are left associative
|
||||
select 1 <=> 2 <=> 2, (1 <=> 2) <=> 2, 1 <=> (2 <=> 2);
|
||||
select 1 = 2 = 2, (1 = 2) = 2, 1 = (2 = 2);
|
||||
select 1 != 2 != 3, (1 != 2) != 3, 1 != (2 != 3);
|
||||
select 1 <> 2 <> 3, (1 <> 2) <> 3, 1 <> (2 <> 3);
|
||||
select 1 < 2 < 3, (1 < 2) < 3, 1 < (2 < 3);
|
||||
select 3 <= 2 <= 1, (3 <= 2) <= 1, 3 <= (2 <= 1);
|
||||
select 1 > 2 > 3, (1 > 2) > 3, 1 > (2 > 3);
|
||||
select 1 >= 2 >= 3, (1 >= 2) >= 3, 1 >= (2 >= 3);
|
||||
|
||||
-- echo Testing that | is associative
|
||||
select 0xF0 | 0x0F | 0x55, (0xF0 | 0x0F) | 0x55, 0xF0 | (0x0F | 0x55);
|
||||
|
||||
-- echo Testing that & is associative
|
||||
select 0xF5 & 0x5F & 0x55, (0xF5 & 0x5F) & 0x55, 0xF5 & (0x5F & 0x55);
|
||||
|
||||
-- echo Testing that << is left associative
|
||||
select 4 << 3 << 2, (4 << 3) << 2, 4 << (3 << 2);
|
||||
|
||||
-- echo Testing that >> is left associative
|
||||
select 256 >> 3 >> 2, (256 >> 3) >> 2, 256 >> (3 >> 2);
|
||||
|
||||
--echo Testing that & has precedence over |
|
||||
select 0xF0 & 0x0F | 0x55, (0xF0 & 0x0F) | 0x55, 0xF0 & (0x0F | 0x55);
|
||||
select 0x55 | 0xF0 & 0x0F, (0x55 | 0xF0) & 0x0F, 0x55 | (0xF0 & 0x0F);
|
||||
|
||||
--echo Testing that << has precedence over |
|
||||
select 0x0F << 4 | 0x0F, (0x0F << 4) | 0x0F, 0x0F << (4 | 0x0F);
|
||||
select 0x0F | 0x0F << 4, (0x0F | 0x0F) << 4, 0x0F | (0x0F << 4);
|
||||
|
||||
--echo Testing that >> has precedence over |
|
||||
select 0xF0 >> 4 | 0xFF, (0xF0 >> 4) | 0xFF, 0xF0 >> (4 | 0xFF);
|
||||
select 0xFF | 0xF0 >> 4, (0xFF | 0xF0) >> 4, 0xFF | (0xF0 >> 4);
|
||||
|
||||
--echo Testing that << has precedence over &
|
||||
select 0x0F << 4 & 0xF0, (0x0F << 4) & 0xF0, 0x0F << (4 & 0xF0);
|
||||
select 0xF0 & 0x0F << 4, (0xF0 & 0x0F) << 4, 0xF0 & (0x0F << 4);
|
||||
|
||||
--echo Testing that >> has precedence over &
|
||||
select 0xF0 >> 4 & 0x55, (0xF0 >> 4) & 0x55, 0xF0 >> (4 & 0x55);
|
||||
select 0x0F & 0xF0 >> 4, (0x0F & 0xF0) >> 4, 0x0F & (0xF0 >> 4);
|
||||
|
||||
--echo Testing that >> and << have the same precedence
|
||||
select 0xFF >> 4 << 2, (0xFF >> 4) << 2, 0xFF >> (4 << 2);
|
||||
select 0x0F << 4 >> 2, (0x0F << 4) >> 2, 0x0F << (4 >> 2);
|
||||
|
||||
--echo Testing that binary + is associative
|
||||
select 1 + 2 + 3, (1 + 2) + 3, 1 + (2 + 3);
|
||||
|
||||
--echo Testing that binary - is left associative
|
||||
select 1 - 2 - 3, (1 - 2) - 3, 1 - (2 - 3);
|
||||
|
||||
--echo Testing that binary + and binary - have the same precedence
|
||||
# evaluated left to right
|
||||
select 1 + 2 - 3, (1 + 2) - 3, 1 + (2 - 3);
|
||||
select 1 - 2 + 3, (1 - 2) + 3, 1 - (2 + 3);
|
||||
|
||||
--echo Testing that binary + has precedence over |
|
||||
select 0xF0 + 0x0F | 0x55, (0xF0 + 0x0F) | 0x55, 0xF0 + (0x0F | 0x55);
|
||||
select 0x55 | 0xF0 + 0x0F, (0x55 | 0xF0) + 0x0F, 0x55 | (0xF0 + 0x0F);
|
||||
|
||||
--echo Testing that binary + has precedence over &
|
||||
select 0xF0 + 0x0F & 0x55, (0xF0 + 0x0F) & 0x55, 0xF0 + (0x0F & 0x55);
|
||||
select 0x55 & 0xF0 + 0x0F, (0x55 & 0xF0) + 0x0F, 0x55 & (0xF0 + 0x0F);
|
||||
|
||||
--echo Testing that binary + has precedence over <<
|
||||
select 2 + 3 << 4, (2 + 3) << 4, 2 + (3 << 4);
|
||||
select 3 << 4 + 2, (3 << 4) + 2, 3 << (4 + 2);
|
||||
|
||||
--echo Testing that binary + has precedence over >>
|
||||
select 4 + 3 >> 2, (4 + 3) >> 2, 4 + (3 >> 2);
|
||||
select 3 >> 2 + 1, (3 >> 2) + 1, 3 >> (2 + 1);
|
||||
|
||||
--echo Testing that binary - has precedence over |
|
||||
select 0xFF - 0x0F | 0x55, (0xFF - 0x0F) | 0x55, 0xFF - (0x0F | 0x55);
|
||||
select 0x55 | 0xFF - 0xF0, (0x55 | 0xFF) - 0xF0, 0x55 | (0xFF - 0xF0);
|
||||
|
||||
--echo Testing that binary - has precedence over &
|
||||
select 0xFF - 0xF0 & 0x55, (0xFF - 0xF0) & 0x55, 0xFF - (0xF0 & 0x55);
|
||||
select 0x55 & 0xFF - 0xF0, (0x55 & 0xFF) - 0xF0, 0x55 & (0xFF - 0xF0);
|
||||
|
||||
--echo Testing that binary - has precedence over <<
|
||||
select 16 - 3 << 2, (16 - 3) << 2, 16 - (3 << 2);
|
||||
select 4 << 3 - 2, (4 << 3) - 2, 4 << (3 - 2);
|
||||
|
||||
--echo Testing that binary - has precedence over >>
|
||||
select 16 - 3 >> 2, (16 - 3) >> 2, 16 - (3 >> 2);
|
||||
select 16 >> 3 - 2, (16 >> 3) - 2, 16 >> (3 - 2);
|
||||
|
||||
--echo Testing that * is associative
|
||||
select 2 * 3 * 4, (2 * 3) * 4, 2 * (3 * 4);
|
||||
|
||||
--echo Testing that * has precedence over |
|
||||
select 2 * 0x40 | 0x0F, (2 * 0x40) | 0x0F, 2 * (0x40 | 0x0F);
|
||||
select 0x0F | 2 * 0x40, (0x0F | 2) * 0x40, 0x0F | (2 * 0x40);
|
||||
|
||||
--echo Testing that * has precedence over &
|
||||
select 2 * 0x40 & 0x55, (2 * 0x40) & 0x55, 2 * (0x40 & 0x55);
|
||||
select 0xF0 & 2 * 0x40, (0xF0 & 2) * 0x40, 0xF0 & (2 * 0x40);
|
||||
|
||||
--echo Testing that * has precedence over <<
|
||||
# Actually, can't prove it for the first case,
|
||||
# since << is a multiplication by a power of 2,
|
||||
# and * is associative
|
||||
select 5 * 3 << 4, (5 * 3) << 4, 5 * (3 << 4);
|
||||
select 2 << 3 * 4, (2 << 3) * 4, 2 << (3 * 4);
|
||||
|
||||
--echo Testing that * has precedence over >>
|
||||
# >> is a multiplication by a (negative) power of 2,
|
||||
# see above.
|
||||
select 3 * 4 >> 2, (3 * 4) >> 2, 3 * (4 >> 2);
|
||||
select 4 >> 2 * 3, (4 >> 2) * 3, 4 >> (2 * 3);
|
||||
|
||||
--echo Testing that * has precedence over binary +
|
||||
select 2 * 3 + 4, (2 * 3) + 4, 2 * (3 + 4);
|
||||
select 2 + 3 * 4, (2 + 3) * 4, 2 + (3 * 4);
|
||||
|
||||
--echo Testing that * has precedence over binary -
|
||||
select 4 * 3 - 2, (4 * 3) - 2, 4 * (3 - 2);
|
||||
select 4 - 3 * 2, (4 - 3) * 2, 4 - (3 * 2);
|
||||
|
||||
--echo Testing that / is left associative
|
||||
select 15 / 5 / 3, (15 / 5) / 3, 15 / (5 / 3);
|
||||
|
||||
--echo Testing that / has precedence over |
|
||||
select 105 / 5 | 2, (105 / 5) | 2, 105 / (5 | 2);
|
||||
select 105 | 2 / 5, (105 | 2) / 5, 105 | (2 / 5);
|
||||
|
||||
--echo Testing that / has precedence over &
|
||||
select 105 / 5 & 0x0F, (105 / 5) & 0x0F, 105 / (5 & 0x0F);
|
||||
select 0x0F & 105 / 5, (0x0F & 105) / 5, 0x0F & (105 / 5);
|
||||
|
||||
--echo Testing that / has precedence over <<
|
||||
select 0x80 / 4 << 2, (0x80 / 4) << 2, 0x80 / (4 << 2);
|
||||
select 0x80 << 4 / 2, (0x80 << 4) / 2, 0x80 << (4 / 2);
|
||||
|
||||
--echo Testing that / has precedence over >>
|
||||
select 0x80 / 4 >> 2, (0x80 / 4) >> 2, 0x80 / (4 >> 2);
|
||||
select 0x80 >> 4 / 2, (0x80 >> 4) / 2, 0x80 >> (4 / 2);
|
||||
|
||||
--echo Testing that / has precedence over binary +
|
||||
select 0x80 / 2 + 2, (0x80 / 2) + 2, 0x80 / (2 + 2);
|
||||
select 0x80 + 2 / 2, (0x80 + 2) / 2, 0x80 + (2 / 2);
|
||||
|
||||
--echo Testing that / has precedence over binary -
|
||||
select 0x80 / 4 - 2, (0x80 / 4) - 2, 0x80 / (4 - 2);
|
||||
select 0x80 - 4 / 2, (0x80 - 4) / 2, 0x80 - (4 / 2);
|
||||
|
||||
# TODO: %, DIV, MOD
|
||||
|
||||
--echo Testing that ^ is associative
|
||||
select 0xFF ^ 0xF0 ^ 0x0F, (0xFF ^ 0xF0) ^ 0x0F, 0xFF ^ (0xF0 ^ 0x0F);
|
||||
select 0xFF ^ 0xF0 ^ 0x55, (0xFF ^ 0xF0) ^ 0x55, 0xFF ^ (0xF0 ^ 0x55);
|
||||
|
||||
--echo Testing that ^ has precedence over |
|
||||
select 0xFF ^ 0xF0 | 0x0F, (0xFF ^ 0xF0) | 0x0F, 0xFF ^ (0xF0 | 0x0F);
|
||||
select 0xF0 | 0xFF ^ 0xF0, (0xF0 | 0xFF) ^ 0xF0, 0xF0 | (0xFF ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over &
|
||||
select 0xFF ^ 0xF0 & 0x0F, (0xFF ^ 0xF0) & 0x0F, 0xFF ^ (0xF0 & 0x0F);
|
||||
select 0x0F & 0xFF ^ 0xF0, (0x0F & 0xFF) ^ 0xF0, 0x0F & (0xFF ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over <<
|
||||
select 0xFF ^ 0xF0 << 2, (0xFF ^ 0xF0) << 2, 0xFF ^ (0xF0 << 2);
|
||||
select 0x0F << 2 ^ 0xFF, (0x0F << 2) ^ 0xFF, 0x0F << (2 ^ 0xFF);
|
||||
|
||||
--echo Testing that ^ has precedence over >>
|
||||
select 0xFF ^ 0xF0 >> 2, (0xFF ^ 0xF0) >> 2, 0xFF ^ (0xF0 >> 2);
|
||||
select 0xFF >> 2 ^ 0xF0, (0xFF >> 2) ^ 0xF0, 0xFF >> (2 ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over binary +
|
||||
select 0xFF ^ 0xF0 + 0x0F, (0xFF ^ 0xF0) + 0x0F, 0xFF ^ (0xF0 + 0x0F);
|
||||
select 0x0F + 0xFF ^ 0xF0, (0x0F + 0xFF) ^ 0xF0, 0x0F + (0xFF ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over binary -
|
||||
select 0xFF ^ 0xF0 - 1, (0xFF ^ 0xF0) - 1, 0xFF ^ (0xF0 - 1);
|
||||
select 0x55 - 0x0F ^ 0x55, (0x55 - 0x0F) ^ 0x55, 0x55 - (0x0F ^ 0x55);
|
||||
|
||||
--echo Testing that ^ has precedence over *
|
||||
select 0xFF ^ 0xF0 * 2, (0xFF ^ 0xF0) * 2, 0xFF ^ (0xF0 * 2);
|
||||
select 2 * 0xFF ^ 0xF0, (2 * 0xFF) ^ 0xF0, 2 * (0xFF ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over /
|
||||
select 0xFF ^ 0xF0 / 2, (0xFF ^ 0xF0) / 2, 0xFF ^ (0xF0 / 2);
|
||||
select 0xF2 / 2 ^ 0xF0, (0xF2 / 2) ^ 0xF0, 0xF2 / (2 ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over %
|
||||
select 0xFF ^ 0xF0 % 0x20, (0xFF ^ 0xF0) % 0x20, 0xFF ^ (0xF0 % 0x20);
|
||||
select 0xFF % 0x20 ^ 0xF0, (0xFF % 0x20) ^ 0xF0, 0xFF % (0x20 ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over DIV
|
||||
select 0xFF ^ 0xF0 DIV 2, (0xFF ^ 0xF0) DIV 2, 0xFF ^ (0xF0 DIV 2);
|
||||
select 0xF2 DIV 2 ^ 0xF0, (0xF2 DIV 2) ^ 0xF0, 0xF2 DIV (2 ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over MOD
|
||||
select 0xFF ^ 0xF0 MOD 0x20, (0xFF ^ 0xF0) MOD 0x20, 0xFF ^ (0xF0 MOD 0x20);
|
||||
select 0xFF MOD 0x20 ^ 0xF0, (0xFF MOD 0x20) ^ 0xF0, 0xFF MOD (0x20 ^ 0xF0);
|
||||
|
|
@ -2807,5 +2807,16 @@ id
|
|||
16
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-5628: Assertion `! is_set()' or `!is_set() ||
|
||||
# (m_status == DA_OK_BULK && is_bulk_op())' fails on UPDATE on a
|
||||
# partitioned table with subquery (MySQL:71630)
|
||||
#
|
||||
CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2;
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# End of 10.1 tests
|
||||
#
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue