Merge 10.4 into 10.5
This commit is contained in:
commit
898521e2dd
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
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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")
|
||||
|
@ -2461,17 +2461,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;
|
||||
@ -2515,7 +2522,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) {
|
||||
@ -2526,18 +2533,11 @@ 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;
|
||||
}
|
||||
|
||||
memset(&write_filt_ctxt, 0, sizeof(xb_write_filt_ctxt_t));
|
||||
ut_a(write_filter->process != NULL);
|
||||
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;
|
||||
}
|
||||
@ -2558,7 +2558,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;
|
||||
}
|
||||
}
|
||||
@ -2567,8 +2567,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;
|
||||
}
|
||||
|
||||
@ -2582,8 +2582,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);
|
||||
|
||||
@ -2592,8 +2592,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*/
|
||||
@ -2603,8 +2603,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);
|
||||
@ -2894,9 +2894,9 @@ DECLARE_THREAD(data_copy_thread_func)(
|
||||
while ((node = datafiles_iter_next(ctxt->it)) != NULL) {
|
||||
DBUG_MARIABACKUP_EVENT("before_copy", node->space->name);
|
||||
/* 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);
|
||||
|
||||
@ -4406,7 +4406,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);
|
||||
@ -4979,22 +4979,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;
|
||||
}
|
||||
|
||||
@ -5031,17 +5075,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];
|
||||
@ -5076,7 +5121,7 @@ xb_process_datadir(
|
||||
suffix)) {
|
||||
if (!func(
|
||||
path, NULL,
|
||||
fileinfo.name, NULL))
|
||||
fileinfo.name, func_arg))
|
||||
{
|
||||
os_file_closedir(dbdir);
|
||||
return(FALSE);
|
||||
@ -5140,7 +5185,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);
|
||||
@ -5300,6 +5345,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)
|
||||
@ -5311,6 +5360,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);
|
||||
@ -5390,8 +5441,6 @@ static bool xtrabackup_prepare_func(char** argv)
|
||||
goto error_cleanup;
|
||||
}
|
||||
|
||||
inc_dir_tables_hash.create(1000);
|
||||
|
||||
ok = fil_system.sys_space->open(false)
|
||||
&& xtrabackup_apply_deltas();
|
||||
|
||||
|
@ -459,18 +459,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 *);
|
||||
|
@ -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 0cdc1656a70c52103b4329debf9ed02ccacfb3c2
|
@ -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
|
||||
)
|
||||
|
@ -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)
|
||||
|
@ -146,3 +146,22 @@ 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
|
||||
#
|
||||
|
@ -167,3 +167,26 @@ connection con1;
|
||||
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 #
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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"}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
#
|
||||
|
@ -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
|
||||
|
@ -132,8 +132,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 +154,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 +174,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 +187,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 +196,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 +209,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 +218,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 +227,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 +238,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 +247,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 +263,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 +279,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",
|
||||
|
@ -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;
|
||||
|
@ -85,6 +85,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 +98,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 +107,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
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
8019
mysql-test/main/precedence.result
Normal file
8019
mysql-test/main/precedence.result
Normal file
File diff suppressed because it is too large
Load Diff
4788
mysql-test/main/precedence.test
Normal file
4788
mysql-test/main/precedence.test
Normal file
File diff suppressed because it is too large
Load Diff
60
mysql-test/main/precedence_bugs.result
Normal file
60
mysql-test/main/precedence_bugs.result
Normal file
@ -0,0 +1,60 @@
|
||||
#
|
||||
# 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;
|
||||
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;
|
||||
#
|
||||
# MDEV-13673 Bad result in view
|
||||
#
|
||||
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)`
|
||||
#
|
||||
# MDEV-11784 View is created with invalid definition which causes ERROR 1241 (21000): Operand should contain 1 column(s)
|
||||
#
|
||||
create table t1 (i int, j int);
|
||||
insert t1 values (1,1),(2,2);
|
||||
create view v1 as select (2, 3) not in (select i, j from t1);
|
||||
select * from v1;
|
||||
(2, 3) not in (select i, j from t1)
|
||||
1
|
||||
show create view v1;
|
||||
View v1
|
||||
Create View CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select !((2,3) in (select `t1`.`i`,`t1`.`j` from `t1`)) AS `(2, 3) not in (select i, j from t1)`
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-23656 view: removal of parentheses results in wrong result
|
||||
#
|
||||
create table t1 (a int, b decimal(10,2));
|
||||
insert into t1 values (1, 10.2);
|
||||
create view v1 as select avg(b) / (2 + a) from t1;
|
||||
show create view v1;
|
||||
View v1
|
||||
Create View CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select avg(`t1`.`b`) / (2 + `t1`.`a`) AS `avg(b) / (2 + a)` from `t1`
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-17408 VIEW is incorrectly defined for a combination of = and BETWEEN
|
||||
#
|
||||
create view v1 as select 1 like (now() between '2000-01-01' and '2012-12-12' );
|
||||
show create view v1;
|
||||
View v1
|
||||
Create View CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 like (current_timestamp() between '2000-01-01' and '2012-12-12') AS `1 like (now() between '2000-01-01' and '2012-12-12' )`
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
drop view v1;
|
41
mysql-test/main/precedence_bugs.test
Normal file
41
mysql-test/main/precedence_bugs.test
Normal file
@ -0,0 +1,41 @@
|
||||
--echo #
|
||||
--echo # Bug#6726: NOT BETWEEN parse failure
|
||||
--echo #
|
||||
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;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-13673 Bad result in view
|
||||
--echo #
|
||||
explain extended select (3-2)+1, (3/2)*1, 3-(2+1), 3/(2*1);
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-11784 View is created with invalid definition which causes ERROR 1241 (21000): Operand should contain 1 column(s)
|
||||
--echo #
|
||||
create table t1 (i int, j int);
|
||||
insert t1 values (1,1),(2,2);
|
||||
create view v1 as select (2, 3) not in (select i, j from t1);
|
||||
select * from v1;
|
||||
query_vertical show create view v1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-23656 view: removal of parentheses results in wrong result
|
||||
--echo #
|
||||
create table t1 (a int, b decimal(10,2));
|
||||
insert into t1 values (1, 10.2);
|
||||
create view v1 as select avg(b) / (2 + a) from t1;
|
||||
query_vertical show create view v1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17408 VIEW is incorrectly defined for a combination of = and BETWEEN
|
||||
--echo #
|
||||
create view v1 as select 1 like (now() between '2000-01-01' and '2012-12-12' );
|
||||
query_vertical show create view v1;
|
||||
drop view v1;
|
@ -1738,7 +1738,7 @@ EXPLAIN
|
||||
"key_length": "9",
|
||||
"used_key_parts": ["o_totaldiscount"],
|
||||
"rows": 39,
|
||||
"filtered": 1.949866652,
|
||||
"filtered": "REPLACED",
|
||||
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
|
||||
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
|
||||
},
|
||||
@ -1756,7 +1756,7 @@ EXPLAIN
|
||||
"used_key_parts": ["l_orderkey"],
|
||||
"ref": ["dbt3_s001.orders.o_orderkey"],
|
||||
"rows": 4,
|
||||
"filtered": 3.047460556,
|
||||
"filtered": "REPLACED",
|
||||
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
|
||||
}
|
||||
}
|
||||
@ -1768,8 +1768,8 @@ o_totaldiscount BETWEEN 18000 AND 20000 AND
|
||||
o_totalprice BETWEEN 200000 AND 220000 AND
|
||||
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 41.00 1.95 2.44 Using index condition; Using where
|
||||
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.00 3.05 66.67 Using where
|
||||
1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 41.00 # 2.44 Using index condition; Using where
|
||||
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.00 # 66.67 Using where
|
||||
set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate
|
||||
FROM v1, lineitem
|
||||
WHERE o_orderkey=l_orderkey AND
|
||||
@ -1799,7 +1799,7 @@ ANALYZE
|
||||
"r_rows": 41,
|
||||
"r_table_time_ms": "REPLACED",
|
||||
"r_other_time_ms": "REPLACED",
|
||||
"filtered": 1.949866652,
|
||||
"filtered": "REPLACED",
|
||||
"r_filtered": 2.43902439,
|
||||
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
|
||||
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
|
||||
@ -1822,7 +1822,7 @@ ANALYZE
|
||||
"r_rows": 6,
|
||||
"r_table_time_ms": "REPLACED",
|
||||
"r_other_time_ms": "REPLACED",
|
||||
"filtered": 3.047460556,
|
||||
"filtered": "REPLACED",
|
||||
"r_filtered": 66.66666667,
|
||||
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
|
||||
}
|
||||
@ -1871,7 +1871,7 @@ EXPLAIN
|
||||
"key_length": "9",
|
||||
"used_key_parts": ["o_totaldiscount"],
|
||||
"rows": 39,
|
||||
"filtered": 1.949866652,
|
||||
"filtered": "REPLACED",
|
||||
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
|
||||
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
|
||||
},
|
||||
@ -1889,7 +1889,7 @@ EXPLAIN
|
||||
"used_key_parts": ["l_orderkey"],
|
||||
"ref": ["dbt3_s001.orders.o_orderkey"],
|
||||
"rows": 4,
|
||||
"filtered": 3.047460556,
|
||||
"filtered": "REPLACED",
|
||||
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
|
||||
}
|
||||
}
|
||||
@ -1901,8 +1901,8 @@ o_totaldiscount BETWEEN 18000 AND 20000 AND
|
||||
o_totalprice BETWEEN 200000 AND 220000 AND
|
||||
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 41.00 1.95 2.44 Using index condition; Using where
|
||||
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.00 3.05 66.67 Using where
|
||||
1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 41.00 # 2.44 Using index condition; Using where
|
||||
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.00 # 66.67 Using where
|
||||
set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate
|
||||
FROM v1, lineitem
|
||||
WHERE o_orderkey=l_orderkey AND
|
||||
@ -1932,7 +1932,7 @@ ANALYZE
|
||||
"r_rows": 41,
|
||||
"r_table_time_ms": "REPLACED",
|
||||
"r_other_time_ms": "REPLACED",
|
||||
"filtered": 1.949866652,
|
||||
"filtered": "REPLACED",
|
||||
"r_filtered": 2.43902439,
|
||||
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
|
||||
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
|
||||
@ -1955,7 +1955,7 @@ ANALYZE
|
||||
"r_rows": 6,
|
||||
"r_table_time_ms": "REPLACED",
|
||||
"r_other_time_ms": "REPLACED",
|
||||
"filtered": 3.047460556,
|
||||
"filtered": "REPLACED",
|
||||
"r_filtered": 66.66666667,
|
||||
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
|
||||
}
|
||||
|
@ -216,17 +216,21 @@ WHERE o_orderkey=l_orderkey AND
|
||||
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
|
||||
|
||||
eval $with_filter EXPLAIN $q7;
|
||||
--replace_regex /"filtered": [0-9e\.\-+]*,/"filtered": "REPLACED",/
|
||||
eval $with_filter EXPLAIN FORMAT=JSON $q7;
|
||||
--replace_column 11 #
|
||||
eval $with_filter ANALYZE $q7;
|
||||
--source include/analyze-format.inc
|
||||
--replace_regex /("(r_(total|table|other)_time_ms|r_buffer_size|r_filling_time_ms|filtered)": )[^, \n]*/\1"REPLACED"/
|
||||
eval $with_filter ANALYZE FORMAT=JSON $q7;
|
||||
--sorted_result
|
||||
eval $with_filter $q7;
|
||||
|
||||
eval $without_filter EXPLAIN $q7;
|
||||
--replace_regex /"filtered": [0-9e\.\-+]*,/"filtered": "REPLACED",/
|
||||
eval $without_filter EXPLAIN FORMAT=JSON $q7;
|
||||
--replace_column 11 #
|
||||
eval $without_filter ANALYZE $q7;
|
||||
--source include/analyze-format.inc
|
||||
--replace_regex /("(r_(total|table|other)_time_ms|r_buffer_size|r_filling_time_ms|filtered)": )[^, \n]*/\1"REPLACED"/
|
||||
eval $without_filter ANALYZE FORMAT=JSON $q7;
|
||||
--sorted_result
|
||||
eval $without_filter $q7;
|
||||
|
@ -1687,7 +1687,7 @@ EXPLAIN
|
||||
"key_length": "9",
|
||||
"used_key_parts": ["o_totaldiscount"],
|
||||
"rows": 41,
|
||||
"filtered": 2.071111202,
|
||||
"filtered": "REPLACED",
|
||||
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
|
||||
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
|
||||
},
|
||||
@ -1705,7 +1705,7 @@ EXPLAIN
|
||||
"used_key_parts": ["l_orderkey"],
|
||||
"ref": ["dbt3_s001.orders.o_orderkey"],
|
||||
"rows": 4,
|
||||
"filtered": 3.047460556,
|
||||
"filtered": "REPLACED",
|
||||
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
|
||||
}
|
||||
}
|
||||
@ -1717,8 +1717,8 @@ o_totaldiscount BETWEEN 18000 AND 20000 AND
|
||||
o_totalprice BETWEEN 200000 AND 220000 AND
|
||||
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 41.00 2.07 2.44 Using index condition; Using where
|
||||
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.00 3.05 66.67 Using where
|
||||
1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 41.00 # 2.44 Using index condition; Using where
|
||||
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.00 # 66.67 Using where
|
||||
set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate
|
||||
FROM v1, lineitem
|
||||
WHERE o_orderkey=l_orderkey AND
|
||||
@ -1748,7 +1748,7 @@ ANALYZE
|
||||
"r_rows": 41,
|
||||
"r_table_time_ms": "REPLACED",
|
||||
"r_other_time_ms": "REPLACED",
|
||||
"filtered": 2.071111202,
|
||||
"filtered": "REPLACED",
|
||||
"r_filtered": 2.43902439,
|
||||
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
|
||||
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
|
||||
@ -1771,7 +1771,7 @@ ANALYZE
|
||||
"r_rows": 6,
|
||||
"r_table_time_ms": "REPLACED",
|
||||
"r_other_time_ms": "REPLACED",
|
||||
"filtered": 3.047460556,
|
||||
"filtered": "REPLACED",
|
||||
"r_filtered": 66.66666667,
|
||||
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
|
||||
}
|
||||
@ -1820,7 +1820,7 @@ EXPLAIN
|
||||
"key_length": "9",
|
||||
"used_key_parts": ["o_totaldiscount"],
|
||||
"rows": 41,
|
||||
"filtered": 2.071111202,
|
||||
"filtered": "REPLACED",
|
||||
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
|
||||
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
|
||||
},
|
||||
@ -1838,7 +1838,7 @@ EXPLAIN
|
||||
"used_key_parts": ["l_orderkey"],
|
||||
"ref": ["dbt3_s001.orders.o_orderkey"],
|
||||
"rows": 4,
|
||||
"filtered": 3.047460556,
|
||||
"filtered": "REPLACED",
|
||||
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
|
||||
}
|
||||
}
|
||||
@ -1850,8 +1850,8 @@ o_totaldiscount BETWEEN 18000 AND 20000 AND
|
||||
o_totalprice BETWEEN 200000 AND 220000 AND
|
||||
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 41.00 2.07 2.44 Using index condition; Using where
|
||||
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.00 3.05 66.67 Using where
|
||||
1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 41.00 # 2.44 Using index condition; Using where
|
||||
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.00 # 66.67 Using where
|
||||
set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate
|
||||
FROM v1, lineitem
|
||||
WHERE o_orderkey=l_orderkey AND
|
||||
@ -1881,7 +1881,7 @@ ANALYZE
|
||||
"r_rows": 41,
|
||||
"r_table_time_ms": "REPLACED",
|
||||
"r_other_time_ms": "REPLACED",
|
||||
"filtered": 2.071111202,
|
||||
"filtered": "REPLACED",
|
||||
"r_filtered": 2.43902439,
|
||||
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
|
||||
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
|
||||
@ -1904,7 +1904,7 @@ ANALYZE
|
||||
"r_rows": 6,
|
||||
"r_table_time_ms": "REPLACED",
|
||||
"r_other_time_ms": "REPLACED",
|
||||
"filtered": 3.047460556,
|
||||
"filtered": "REPLACED",
|
||||
"r_filtered": 66.66666667,
|
||||
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 Using index
|
||||
1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index
|
||||
1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (14%) Using where; Using rowid filter
|
||||
1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where
|
||||
1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey 9 dbt3_s001.supplier.s_suppkey,dbt3_s001.orders.o_orderkey 1
|
||||
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue
|
||||
from customer, orders, lineitem, supplier, nation, region
|
||||
where c_custkey = o_custkey and l_orderkey = o_orderkey
|
||||
@ -213,7 +213,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 Using index
|
||||
1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index
|
||||
1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (14%) Using where; Using rowid filter
|
||||
1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where
|
||||
1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey 9 dbt3_s001.supplier.s_suppkey,dbt3_s001.orders.o_orderkey 1
|
||||
select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue
|
||||
from customer, orders, lineitem, supplier, nation, region
|
||||
where c_custkey = o_custkey and l_orderkey = o_orderkey
|
||||
|
@ -6608,17 +6608,6 @@ INSERT INTO v (f1, f3) VALUES (1,1), (2,2);
|
||||
ERROR HY000: Can not modify more than one base table through a join view 'test.v'
|
||||
drop view v;
|
||||
drop tables t1,t2,t3;
|
||||
create table t1 (i int, j int);
|
||||
insert t1 values (1,1),(2,2);
|
||||
create view v1 as select (2, 3) not in (select i, j from t1);
|
||||
select * from v1;
|
||||
(2, 3) not in (select i, j from t1)
|
||||
1
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select !((2,3) in (select `t1`.`i`,`t1`.`j` from `t1`)) AS `(2, 3) not in (select i, j from t1)` latin1 latin1_swedish_ci
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-10704: Assertion `field->field->table == table_arg'
|
||||
# failed in fill_record(THD*, TABLE*, List<Item>&, List<Item>&,
|
||||
|
@ -6303,17 +6303,6 @@ INSERT INTO v (f1, f3) VALUES (1,1), (2,2);
|
||||
drop view v;
|
||||
drop tables t1,t2,t3;
|
||||
|
||||
#
|
||||
# MDEV-11784 View is created with invalid definition which causes ERROR 1241 (21000): Operand should contain 1 column(s)
|
||||
#
|
||||
create table t1 (i int, j int);
|
||||
insert t1 values (1,1),(2,2);
|
||||
create view v1 as select (2, 3) not in (select i, j from t1);
|
||||
select * from v1;
|
||||
show create view v1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-10704: Assertion `field->field->table == table_arg'
|
||||
--echo # failed in fill_record(THD*, TABLE*, List<Item>&, List<Item>&,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,9 +5,31 @@
|
||||
source include/have_file_key_management_plugin.inc;
|
||||
source include/have_sequence.inc;
|
||||
source include/have_innodb.inc;
|
||||
|
||||
|
||||
select @@encrypt_tmp_files;
|
||||
|
||||
--source main/win.test
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-23867: select crash in compute_window_func
|
||||
--echo #
|
||||
|
||||
set @save_sort_buffer_size=@@sort_buffer_size;
|
||||
|
||||
set sort_buffer_size= 2000;
|
||||
CREATE TABLE t1( a INT, b INT, c INT);
|
||||
INSERT INTO t1 select seq, seq, seq from seq_1_to_5000;
|
||||
CREATE TABLE t2( a INT, b INT, c INT);
|
||||
INSERT INTO t2 SELECT a, b, ROW_NUMBER() OVER (PARTITION BY b) FROM t1;
|
||||
SELECT COUNT(*), MAX(c) FROM t2;
|
||||
CREATE TABLE t3( a INT, b INT, c INT);
|
||||
INSERT INTO t3 SELECT a, b, SUM(a) OVER () FROM t1;
|
||||
SELECT COUNT(*), MAX(c) FROM t3;
|
||||
set @@sort_buffer_size=@save_sort_buffer_size;
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
--echo # end of 10.2 test
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-22556: Incorrect result for window function when using encrypt-tmp-files=ON
|
||||
--echo #
|
||||
@ -21,3 +43,5 @@ select count(*) from (select a, b, c, ROW_NUMBER() OVER (PARTITION BY a) FROM t1
|
||||
set @@sort_buffer_size=@save_sort_buffer_size;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo # End of 10.4 tests
|
||||
|
@ -16,6 +16,7 @@ MDEV-16509 : MDEV-21523 galera.MDEV-16509
|
||||
MDEV-20225 : MDEV-20886 galera.MDEV-20225
|
||||
MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently with Galera/replication victim kill
|
||||
MW-328A : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
|
||||
MW-328A : MDEV-22666?
|
||||
MW-328B : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
|
||||
MW-329 : MDEV-19962 Galera test failure on MW-329
|
||||
galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults
|
||||
@ -40,6 +41,7 @@ galera_toi_truncate : MDEV-22996 Hang on galera_toi_truncate test case
|
||||
galera_var_node_address : MDEV-20485 Galera test failure
|
||||
galera_var_notify_cmd : MDEV-21905 Galera test galera_var_notify_cmd causes hang
|
||||
galera_var_reject_queries : assertion in inline_mysql_socket_send
|
||||
galera_var_replicate_myisam_on : MDEV-24062 Galera test failure on galera_var_replicate_myisam_on
|
||||
galera_var_retry_autocommit: MDEV-18181 Galera test failure on galera.galera_var_retry_autocommit
|
||||
galera_wan : MDEV-17259 Test failure on galera.galera_wan
|
||||
lp1376747-4 : MDEV-21911 Galera test failure on lp1376747-4
|
||||
@ -47,4 +49,3 @@ partition : MDEV-19958 Galera test failure on galera.partition
|
||||
query_cache: MDEV-15805 Test failure on galera.query_cache
|
||||
sql_log_bin : MDEV-21491 galera.sql_log_bin
|
||||
versioning_trx_id : MDEV-18590 galera.versioning_trx_id
|
||||
MW-328A : MDEV-22666?
|
||||
|
@ -107,6 +107,135 @@ i
|
||||
1
|
||||
DROP TABLE t1;
|
||||
connection node_1;
|
||||
SET GLOBAL wsrep_replicate_myisam = 0;
|
||||
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=MyISAM;
|
||||
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
PREPARE upd from 'update t1 set b = 100 where id = 5';
|
||||
PREPARE ins from 'insert into t1 values (11,11)';
|
||||
PREPARE del from 'delete from t1 where id = 4';
|
||||
PREPARE rep from 'replace into t1 values (12,12),(6,600)';
|
||||
EXECUTE upd;
|
||||
EXECUTE ins;
|
||||
EXECUTE del;
|
||||
EXECUTE rep;
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
id b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
5 100
|
||||
6 600
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
10 10
|
||||
11 11
|
||||
12 12
|
||||
connection node_2;
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
id b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
5 100
|
||||
6 600
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
10 10
|
||||
11 11
|
||||
12 12
|
||||
DROP TABLE t1;
|
||||
connection node_1;
|
||||
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=MyISAM;
|
||||
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
CREATE PROCEDURE proc()
|
||||
BEGIN
|
||||
UPDATE t1 set b = 100 WHERE id = 5;
|
||||
INSERT INTO t1 VALUES (11,11);
|
||||
DELETE FROM t1 WHERE id = 4;
|
||||
REPLACE INTO t1 VALUES (12,12),(6,600);
|
||||
COMMIT;
|
||||
END|
|
||||
CALL proc();
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
id b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
5 100
|
||||
6 600
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
10 10
|
||||
11 11
|
||||
12 12
|
||||
connection node_2;
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
id b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
5 100
|
||||
6 600
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
10 10
|
||||
11 11
|
||||
12 12
|
||||
DROP PROCEDURE proc;
|
||||
DROP TABLE t1;
|
||||
connection node_1;
|
||||
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT) ENGINE=MyISAM;
|
||||
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, NEW.b);
|
||||
CREATE TRIGGER tr2 BEFORE UPDATE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, OLD.b),(NULL, NEW.b);
|
||||
CREATE TRIGGER tr3 BEFORE DELETE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, OLD.b);
|
||||
INSERT INTO t1 VALUES (11,11);
|
||||
UPDATE t1 SET b = 200 WHERE id = 2;
|
||||
DELETE FROM t1 where id = 5;
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
id b
|
||||
1 1
|
||||
2 200
|
||||
3 3
|
||||
4 4
|
||||
6 6
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
10 10
|
||||
11 11
|
||||
SELECT * FROM t2 ORDER BY id;
|
||||
id b
|
||||
1 11
|
||||
2 2
|
||||
3 200
|
||||
4 5
|
||||
connection node_2;
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
id b
|
||||
1 1
|
||||
2 200
|
||||
3 3
|
||||
4 4
|
||||
6 6
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
10 10
|
||||
11 11
|
||||
SELECT * FROM t2 ORDER BY id;
|
||||
id b
|
||||
1 11
|
||||
2 2
|
||||
3 200
|
||||
4 5
|
||||
DROP TRIGGER tr1;
|
||||
DROP TRIGGER tr2;
|
||||
DROP TRIGGER tr3;
|
||||
DROP TABLE t1,t2;
|
||||
connection node_1;
|
||||
connection node_2;
|
||||
SET GLOBAL wsrep_replicate_myisam = 0;
|
||||
|
@ -142,8 +142,88 @@ INSERT INTO t1 VALUES(1);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test prepared staments
|
||||
#
|
||||
--connection node_1
|
||||
--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig
|
||||
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=MyISAM;
|
||||
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
|
||||
PREPARE upd from 'update t1 set b = 100 where id = 5';
|
||||
PREPARE ins from 'insert into t1 values (11,11)';
|
||||
PREPARE del from 'delete from t1 where id = 4';
|
||||
PREPARE rep from 'replace into t1 values (12,12),(6,600)';
|
||||
|
||||
EXECUTE upd;
|
||||
EXECUTE ins;
|
||||
EXECUTE del;
|
||||
EXECUTE rep;
|
||||
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
|
||||
--connection node_2
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test procedure
|
||||
#
|
||||
--connection node_1
|
||||
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=MyISAM;
|
||||
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE proc()
|
||||
BEGIN
|
||||
UPDATE t1 set b = 100 WHERE id = 5;
|
||||
INSERT INTO t1 VALUES (11,11);
|
||||
DELETE FROM t1 WHERE id = 4;
|
||||
REPLACE INTO t1 VALUES (12,12),(6,600);
|
||||
COMMIT;
|
||||
END|
|
||||
DELIMITER ;|
|
||||
|
||||
CALL proc();
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
|
||||
--connection node_2
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
|
||||
DROP PROCEDURE proc;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test trigger
|
||||
#
|
||||
--connection node_1
|
||||
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT) ENGINE=MyISAM;
|
||||
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, NEW.b);
|
||||
CREATE TRIGGER tr2 BEFORE UPDATE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, OLD.b),(NULL, NEW.b);
|
||||
CREATE TRIGGER tr3 BEFORE DELETE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, OLD.b);
|
||||
|
||||
INSERT INTO t1 VALUES (11,11);
|
||||
UPDATE t1 SET b = 200 WHERE id = 2;
|
||||
DELETE FROM t1 where id = 5;
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
SELECT * FROM t2 ORDER BY id;
|
||||
|
||||
--connection node_2
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
SELECT * FROM t2 ORDER BY id;
|
||||
DROP TRIGGER tr1;
|
||||
DROP TRIGGER tr2;
|
||||
DROP TRIGGER tr3;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--connection node_1
|
||||
--disable_query_log
|
||||
--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig
|
||||
--enable_query_log
|
||||
|
||||
--connection node_2
|
||||
--disable_query_log
|
||||
--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig
|
||||
--enable_query_log
|
||||
|
26
mysql-test/suite/galera_sr/r/MDEV-23623.result
Normal file
26
mysql-test/suite/galera_sr/r/MDEV-23623.result
Normal file
@ -0,0 +1,26 @@
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 (f2) VALUES ('a');
|
||||
INSERT INTO t1 (f2) VALUES ('b');
|
||||
INSERT INTO t1 (f2) VALUES ('c');
|
||||
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
||||
connection node_2a;
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
SET GLOBAL wsrep_provider_options = 'dbug=d,after_certify_apply_monitor_enter';
|
||||
connection node_2;
|
||||
SET SESSION wsrep_retry_autocommit = 0;
|
||||
SET SESSION wsrep_trx_fragment_size = 64;
|
||||
DELETE FROM t1 ORDER BY f1 DESC LIMIT 2;;
|
||||
connection node_2a;
|
||||
SET SESSION wsrep_on = 0;
|
||||
SET SESSION wsrep_on = 1;
|
||||
connection node_1;
|
||||
INSERT INTO t1 (f2) VALUES ('d'),('e');
|
||||
connection node_2a;
|
||||
SET GLOBAL wsrep_provider_options = 'signal=after_certify_apply_monitor_enter';
|
||||
SET GLOBAL wsrep_provider_options = 'dbug=';
|
||||
connection node_2;
|
||||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
connection node_1;
|
||||
DROP TABLE t1;
|
50
mysql-test/suite/galera_sr/t/MDEV-23623.test
Normal file
50
mysql-test/suite/galera_sr/t/MDEV-23623.test
Normal file
@ -0,0 +1,50 @@
|
||||
#
|
||||
# MDEV-23623 - trans_commit_stmt(THD*): Assertion
|
||||
# `thd->in_active_multi_stmt_transaction() ||
|
||||
# thd->m_transaction_psi == __null' failed
|
||||
#
|
||||
|
||||
--source include/galera_cluster.inc
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/galera_have_debug_sync.inc
|
||||
|
||||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 (f2) VALUES ('a');
|
||||
INSERT INTO t1 (f2) VALUES ('b');
|
||||
INSERT INTO t1 (f2) VALUES ('c');
|
||||
|
||||
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
|
||||
--connection node_2a
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
--let $galera_sync_point = after_certify_apply_monitor_enter
|
||||
--source include/galera_set_sync_point.inc
|
||||
|
||||
--connection node_2
|
||||
SET SESSION wsrep_retry_autocommit = 0;
|
||||
SET SESSION wsrep_trx_fragment_size = 64;
|
||||
--send DELETE FROM t1 ORDER BY f1 DESC LIMIT 2;
|
||||
|
||||
--connection node_2a
|
||||
--source include/galera_wait_sync_point.inc
|
||||
|
||||
#
|
||||
# This is going to cause a certification
|
||||
# failure on node_2
|
||||
#
|
||||
--connection node_1
|
||||
INSERT INTO t1 (f2) VALUES ('d'),('e');
|
||||
|
||||
--connection node_2a
|
||||
--source include/galera_signal_sync_point.inc
|
||||
--source include/galera_clear_sync_point.inc
|
||||
|
||||
--connection node_2
|
||||
--error ER_LOCK_DEADLOCK
|
||||
--reap
|
||||
|
||||
#
|
||||
# Assertion would happen when the following
|
||||
# DROP TABLE is applied on node_2
|
||||
#
|
||||
--connection node_1
|
||||
DROP TABLE t1;
|
@ -1,30 +1,17 @@
|
||||
# Wait for everything to be purged.
|
||||
# The user should have set innodb_purge_rseg_truncate_frequency=1.
|
||||
|
||||
--disable_query_log
|
||||
if (!$wait_all_purged)
|
||||
{
|
||||
let $wait_all_purged= 0;
|
||||
SET GLOBAL innodb_max_purge_lag_wait= 0;
|
||||
}
|
||||
let $remaining_expect= `select concat('InnoDB ',$wait_all_purged)`;
|
||||
|
||||
let $wait_counter= 600;
|
||||
if ($VALGRIND_TEST)
|
||||
if ($wait_all_purged)
|
||||
{
|
||||
let $wait_counter= 2000;
|
||||
eval SET GLOBAL innodb_max_purge_lag_wait= $wait_all_purged;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
while ($wait_counter)
|
||||
{
|
||||
--replace_regex /.*History list length ([0-9]+).*/\1/
|
||||
let $remaining= `SHOW ENGINE INNODB STATUS`;
|
||||
if ($remaining == $remaining_expect)
|
||||
{
|
||||
let $wait_counter= 0;
|
||||
}
|
||||
if ($wait_counter)
|
||||
{
|
||||
real_sleep 0.1;
|
||||
dec $wait_counter;
|
||||
}
|
||||
}
|
||||
--replace_regex /.*History list length ([0-9]+).*/\1/
|
||||
let $remaining= `SHOW ENGINE INNODB STATUS`;
|
||||
echo $remaining transactions not purged;
|
||||
|
@ -34,7 +34,7 @@ grad_degree CREATE TABLE `grad_degree` (
|
||||
`plan` varchar(10) NOT NULL,
|
||||
`admit_term` char(4) NOT NULL,
|
||||
`wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
|
||||
`deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term',
|
||||
PRIMARY KEY (`student_id`,`plan`,`admit_term`)
|
||||
@ -142,14 +142,14 @@ grad_degree CREATE TABLE `grad_degree` (
|
||||
`plan` varchar(10) NOT NULL,
|
||||
`admit_term` char(4) NOT NULL,
|
||||
`wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed2' else 'Not Completed2' end) VIRTUAL,
|
||||
`ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed3' else 'Not Completed3' end) VIRTUAL,
|
||||
`ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed4' else 'Not Completed4' end) VIRTUAL,
|
||||
`ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed5' else 'Not Completed5' end) VIRTUAL,
|
||||
`ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed6' else 'Not Completed6' end) VIRTUAL,
|
||||
`ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed7' else 'Not Completed7' end) VIRTUAL,
|
||||
`ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed8' else 'Not Completed8' end) VIRTUAL,
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed2' else 'Not Completed2' end) VIRTUAL,
|
||||
`ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed3' else 'Not Completed3' end) VIRTUAL,
|
||||
`ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed4' else 'Not Completed4' end) VIRTUAL,
|
||||
`ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed5' else 'Not Completed5' end) VIRTUAL,
|
||||
`ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed6' else 'Not Completed6' end) VIRTUAL,
|
||||
`ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed7' else 'Not Completed7' end) VIRTUAL,
|
||||
`ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed8' else 'Not Completed8' end) VIRTUAL,
|
||||
`deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
|
||||
`deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term',
|
||||
PRIMARY KEY (`student_id`,`plan`,`admit_term`)
|
||||
@ -199,14 +199,14 @@ grad_degree CREATE TABLE `grad_degree` (
|
||||
`plan` varchar(10) NOT NULL,
|
||||
`admit_term` char(4) NOT NULL,
|
||||
`wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed2' else 'Not Completed2' end) VIRTUAL,
|
||||
`ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed3' else 'Not Completed3' end) VIRTUAL,
|
||||
`ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed4' else 'Not Completed4' end) VIRTUAL,
|
||||
`ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed5' else 'Not Completed5' end) VIRTUAL,
|
||||
`ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed6' else 'Not Completed6' end) VIRTUAL,
|
||||
`ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed7' else 'Not Completed7' end) VIRTUAL,
|
||||
`ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed8' else 'Not Completed8' end) VIRTUAL,
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed2' else 'Not Completed2' end) VIRTUAL,
|
||||
`ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed3' else 'Not Completed3' end) VIRTUAL,
|
||||
`ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed4' else 'Not Completed4' end) VIRTUAL,
|
||||
`ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed5' else 'Not Completed5' end) VIRTUAL,
|
||||
`ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed6' else 'Not Completed6' end) VIRTUAL,
|
||||
`ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed7' else 'Not Completed7' end) VIRTUAL,
|
||||
`ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed8' else 'Not Completed8' end) VIRTUAL,
|
||||
`deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term',
|
||||
PRIMARY KEY (`student_id`,`plan`,`admit_term`),
|
||||
KEY `grad_degree_as_of_term_ndx` (`deg_as_of_term`)
|
||||
@ -278,14 +278,14 @@ grad_degree CREATE TABLE `grad_degree` (
|
||||
`plan` varchar(10) NOT NULL,
|
||||
`admit_term` char(4) NOT NULL,
|
||||
`wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed2' else 'Not Completed2' end) VIRTUAL,
|
||||
`ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed3' else 'Not Completed3' end) VIRTUAL,
|
||||
`ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed4' else 'Not Completed4' end) VIRTUAL,
|
||||
`ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed5' else 'Not Completed5' end) VIRTUAL,
|
||||
`ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed6' else 'Not Completed6' end) VIRTUAL,
|
||||
`ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed7' else 'Not Completed7' end) VIRTUAL,
|
||||
`ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed8' else 'Not Completed8' end) VIRTUAL,
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed2' else 'Not Completed2' end) VIRTUAL,
|
||||
`ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed3' else 'Not Completed3' end) VIRTUAL,
|
||||
`ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed4' else 'Not Completed4' end) VIRTUAL,
|
||||
`ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed5' else 'Not Completed5' end) VIRTUAL,
|
||||
`ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed6' else 'Not Completed6' end) VIRTUAL,
|
||||
`ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed7' else 'Not Completed7' end) VIRTUAL,
|
||||
`ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed8' else 'Not Completed8' end) VIRTUAL,
|
||||
`deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
|
||||
`deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term',
|
||||
PRIMARY KEY (`student_id`,`plan`,`admit_term`)
|
||||
|
@ -40,6 +40,7 @@ ALTER TABLE t2 DROP COLUMN c3, ADD COLUMN c5 TEXT DEFAULT 'naturam abhorrere';
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR ddl';
|
||||
SET GLOBAL innodb_flush_log_at_trx_commit=1;
|
||||
SET debug_dbug='+d,dict_sys_mutex_avoid';
|
||||
UPDATE t1 SET c2=c2+1;
|
||||
# Kill the server
|
||||
disconnect ddl;
|
||||
@ -68,6 +69,7 @@ ALTER TABLE t2 ADD COLUMN (c4 TEXT NOT NULL DEFAULT ' et malorum');
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR ddl';
|
||||
SET GLOBAL innodb_flush_log_at_trx_commit=1;
|
||||
SET debug_dbug='+d,dict_sys_mutex_avoid';
|
||||
DELETE FROM t1;
|
||||
# Kill the server
|
||||
disconnect ddl;
|
||||
|
@ -198,3 +198,39 @@ Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
DROP FUNCTION get_index_id;
|
||||
#
|
||||
# MDEV-23356 InnoDB: Failing assertion: field->col->mtype == type, crash or ASAN failures in row_sel_convert_mysql_key_to_innobase, InnoDB indexes are inconsistent after INDEX changes
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT, c CHAR(8),
|
||||
KEY ind1(c), KEY ind2(b)) ENGINE=InnoDB STATS_PERSISTENT=1;
|
||||
INSERT INTO t1 SELECT 1, 1, 'a' FROM seq_1_to_100;
|
||||
SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
|
||||
table_name index_name stat_name
|
||||
t1 GEN_CLUST_INDEX n_diff_pfx01
|
||||
t1 GEN_CLUST_INDEX n_leaf_pages
|
||||
t1 GEN_CLUST_INDEX size
|
||||
t1 ind1 n_diff_pfx01
|
||||
t1 ind1 n_diff_pfx02
|
||||
t1 ind1 n_leaf_pages
|
||||
t1 ind1 size
|
||||
t1 ind2 n_diff_pfx01
|
||||
t1 ind2 n_diff_pfx02
|
||||
t1 ind2 n_leaf_pages
|
||||
t1 ind2 size
|
||||
ALTER TABLE t1 DROP INDEX ind2, ADD INDEX ind3(b),
|
||||
DROP INDEX ind1, ADD INDEX ind2(c);
|
||||
SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
|
||||
table_name index_name stat_name
|
||||
t1 GEN_CLUST_INDEX n_diff_pfx01
|
||||
t1 GEN_CLUST_INDEX n_leaf_pages
|
||||
t1 GEN_CLUST_INDEX size
|
||||
t1 ind2 n_diff_pfx01
|
||||
t1 ind2 n_diff_pfx02
|
||||
t1 ind2 n_leaf_pages
|
||||
t1 ind2 size
|
||||
t1 ind3 n_diff_pfx01
|
||||
t1 ind3 n_diff_pfx02
|
||||
t1 ind3 n_leaf_pages
|
||||
t1 ind3 size
|
||||
UPDATE t1 SET a = 1 WHERE c = 'foo';
|
||||
DROP TABLE t1;
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- instant_alter_purge.result
|
||||
+++ instant_alter_purge,release.result
|
||||
@@ -32,15 +32,11 @@
|
||||
@@ -32,16 +32,11 @@
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
connection default;
|
||||
DELETE FROM t1;
|
||||
@ -9,7 +9,8 @@
|
||||
connection purge_control;
|
||||
-SET DEBUG_SYNC='now WAIT_FOR go';
|
||||
COMMIT;
|
||||
InnoDB 0 transactions not purged
|
||||
SET GLOBAL innodb_max_purge_lag_wait= 0;
|
||||
-InnoDB 0 transactions not purged
|
||||
-SET DEBUG_SYNC='now SIGNAL do';
|
||||
disconnect purge_control;
|
||||
connection default;
|
||||
|
19
mysql-test/suite/innodb/r/stats_persistent.result
Normal file
19
mysql-test/suite/innodb/r/stats_persistent.result
Normal file
@ -0,0 +1,19 @@
|
||||
#
|
||||
# MDEV-23991 dict_table_stats_lock() has unnecessarily long scope
|
||||
#
|
||||
CREATE TABLE t1(a INT) ENGINE=INNODB STATS_PERSISTENT=1;
|
||||
SET DEBUG_SYNC='dict_stats_update_persistent SIGNAL stop WAIT_FOR go';
|
||||
ANALYZE TABLE t1;
|
||||
connect con1, localhost, root;
|
||||
SET DEBUG_SYNC='now WAIT_FOR stop';
|
||||
SELECT ENGINE,SUM(DATA_LENGTH+INDEX_LENGTH),COUNT(ENGINE),SUM(DATA_LENGTH),SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB';
|
||||
ENGINE SUM(DATA_LENGTH+INDEX_LENGTH) COUNT(ENGINE) SUM(DATA_LENGTH) SUM(INDEX_LENGTH)
|
||||
InnoDB 114688 4 65536 49152
|
||||
SET DEBUG_SYNC='now SIGNAL go';
|
||||
disconnect con1;
|
||||
connection default;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
DROP TABLE t1;
|
@ -447,10 +447,6 @@ create table t1 (
|
||||
col_text_g text generated always as (substr(col_text,1,499)) )
|
||||
engine innodb row_format = redundant;
|
||||
insert into t1 (col_int,col_text) values (0, 'a'), (null, 'b');
|
||||
# FIXME: remove the following to trigger the bug
|
||||
--disable_query_log
|
||||
alter table t1 modify column col_text text null, force;
|
||||
--enable_query_log
|
||||
alter table t1 modify column col_text text null, algorithm = instant;
|
||||
insert into t1 (col_int,col_text) values (1, null), (null, null);
|
||||
update t1 set col_text= 'd';
|
||||
|
@ -55,6 +55,7 @@ ALTER TABLE t2 DROP COLUMN c3, ADD COLUMN c5 TEXT DEFAULT 'naturam abhorrere';
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR ddl';
|
||||
SET GLOBAL innodb_flush_log_at_trx_commit=1;
|
||||
SET debug_dbug='+d,dict_sys_mutex_avoid';
|
||||
UPDATE t1 SET c2=c2+1;
|
||||
|
||||
--source include/kill_mysqld.inc
|
||||
@ -83,6 +84,7 @@ ALTER TABLE t2 ADD COLUMN (c4 TEXT NOT NULL DEFAULT ' et malorum');
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR ddl';
|
||||
SET GLOBAL innodb_flush_log_at_trx_commit=1;
|
||||
SET debug_dbug='+d,dict_sys_mutex_avoid';
|
||||
DELETE FROM t1;
|
||||
|
||||
--source include/kill_mysqld.inc
|
||||
|
@ -1,5 +1,6 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_sequence.inc
|
||||
|
||||
delimiter |;
|
||||
create function get_index_id(tbl_id int, index_name char(100))
|
||||
@ -207,3 +208,22 @@ CHECK TABLE t1 EXTENDED ;
|
||||
DROP TABLE t1;
|
||||
|
||||
DROP FUNCTION get_index_id;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-23356 InnoDB: Failing assertion: field->col->mtype == type, crash or ASAN failures in row_sel_convert_mysql_key_to_innobase, InnoDB indexes are inconsistent after INDEX changes
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT, c CHAR(8),
|
||||
KEY ind1(c), KEY ind2(b)) ENGINE=InnoDB STATS_PERSISTENT=1;
|
||||
|
||||
INSERT INTO t1 SELECT 1, 1, 'a' FROM seq_1_to_100;
|
||||
|
||||
SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
|
||||
|
||||
ALTER TABLE t1 DROP INDEX ind2, ADD INDEX ind3(b),
|
||||
DROP INDEX ind1, ADD INDEX ind2(c);
|
||||
|
||||
SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
|
||||
|
||||
UPDATE t1 SET a = 1 WHERE c = 'foo';
|
||||
DROP TABLE t1;
|
||||
|
27
mysql-test/suite/innodb/t/stats_persistent.test
Normal file
27
mysql-test/suite/innodb/t/stats_persistent.test
Normal file
@ -0,0 +1,27 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/count_sessions.inc
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-23991 dict_table_stats_lock() has unnecessarily long scope
|
||||
--echo #
|
||||
CREATE TABLE t1(a INT) ENGINE=INNODB STATS_PERSISTENT=1;
|
||||
|
||||
SET DEBUG_SYNC='dict_stats_update_persistent SIGNAL stop WAIT_FOR go';
|
||||
--send ANALYZE TABLE t1
|
||||
|
||||
--connect(con1, localhost, root)
|
||||
SET DEBUG_SYNC='now WAIT_FOR stop';
|
||||
|
||||
SELECT ENGINE,SUM(DATA_LENGTH+INDEX_LENGTH),COUNT(ENGINE),SUM(DATA_LENGTH),SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB';
|
||||
|
||||
SET DEBUG_SYNC='now SIGNAL go';
|
||||
--disconnect con1
|
||||
|
||||
--connection default
|
||||
--reap
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
DROP TABLE t1;
|
||||
|
||||
--source include/wait_until_count_sessions.inc
|
@ -13,7 +13,6 @@ order by name;
|
||||
name
|
||||
wait/synch/sxlock/innodb/btr_search_latch
|
||||
wait/synch/sxlock/innodb/dict_operation_lock
|
||||
wait/synch/sxlock/innodb/dict_table_stats
|
||||
wait/synch/sxlock/innodb/fil_space_latch
|
||||
wait/synch/sxlock/innodb/fts_cache_init_rw_lock
|
||||
wait/synch/sxlock/innodb/fts_cache_rw_lock
|
||||
|
@ -292,3 +292,18 @@ Warning 1264 Out of range value for column 'id' at row 1
|
||||
Warning 1264 Out of range value for column 'id' at row 2
|
||||
update ignore t1 for portion of p from '1995-07-06' to '2009-01-12' set f = 1;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-22805 SIGSEGV in check_fields on UPDATE (optimized builds) | Assertion `thd->lex->sql_command == SQLCOM_UPDATE' failed.
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b DATE, c DATE, PERIOD FOR APPTIME(b, c));
|
||||
INSERT INTO t1 VALUES(1, '1999-01-01', '2018-12-12');
|
||||
UPDATE t1 FOR PORTION OF APPTIME FROM (SELECT '1999-01-01' FROM t1 WHERE a=2) TO '2018-01-01' SET a = 100;
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'updating and querying the same temporal periods table'
|
||||
set @tmp= "UPDATE t1 FOR PORTION OF APPTIME FROM (SELECT '1999-01-01' FROM t1 WHERE a=2) TO '2018-01-01' SET a = 100";
|
||||
execute immediate @tmp;
|
||||
ERROR 42000: This version of MariaDB doesn't yet support 'updating and querying the same temporal periods table'
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
UPDATE v1 FOR PORTION OF APPTIME FROM (SELECT '1999-01-01' FROM t1 WHERE a=2) TO '2018-01-01' SET a = 100;
|
||||
ERROR 42S02: 'v1' is a view
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
@ -183,3 +183,25 @@ update ignore t1 set id = 2429681664;
|
||||
update ignore t1 for portion of p from '1995-07-06' to '2009-01-12' set f = 1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-22805 SIGSEGV in check_fields on UPDATE (optimized builds) | Assertion `thd->lex->sql_command == SQLCOM_UPDATE' failed.
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT, b DATE, c DATE, PERIOD FOR APPTIME(b, c));
|
||||
|
||||
INSERT INTO t1 VALUES(1, '1999-01-01', '2018-12-12');
|
||||
|
||||
# Without a patch the following statement crashs a server built in debug mode
|
||||
let $stmt= UPDATE t1 FOR PORTION OF APPTIME FROM (SELECT '1999-01-01' FROM t1 WHERE a=2) TO '2018-01-01' SET a = 100;
|
||||
--error ER_NOT_SUPPORTED_YET
|
||||
eval $stmt;
|
||||
eval set @tmp= "$stmt";
|
||||
--error ER_NOT_SUPPORTED_YET
|
||||
execute immediate @tmp;
|
||||
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
--error ER_IT_IS_A_VIEW
|
||||
UPDATE v1 FOR PORTION OF APPTIME FROM (SELECT '1999-01-01' FROM t1 WHERE a=2) TO '2018-01-01' SET a = 100;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
@ -227,6 +227,21 @@ set global server_audit_logging= on;
|
||||
disconnect cn1;
|
||||
drop user user1@localhost;
|
||||
set global server_audit_events='';
|
||||
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
|
||||
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
|
||||
connect(localhost,plug,plug_dest,test,MYSQL_PORT,MYSQL_SOCK);
|
||||
connect plug_con,localhost,plug,plug_dest;
|
||||
ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES)
|
||||
GRANT PROXY ON plug_dest TO plug;
|
||||
connect plug_con,localhost,plug,plug_dest;
|
||||
connection plug_con;
|
||||
select USER(),CURRENT_USER();
|
||||
USER() CURRENT_USER()
|
||||
plug@localhost plug_dest@%
|
||||
connection default;
|
||||
disconnect plug_con;
|
||||
DROP USER plug;
|
||||
DROP USER plug_dest;
|
||||
set global server_audit_query_log_limit= 15;
|
||||
select (1), (2), (3), (4);
|
||||
1 2 3 4
|
||||
@ -416,6 +431,46 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER plug IDENTIFIED WITH \'test_plugin_server\' AS \'plug_dest\'',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER plug_dest IDENTIFIED BY *****',0
|
||||
TIME,HOSTNAME,plug,localhost,ID,0,FAILED_CONNECT,,,ID
|
||||
TIME,HOSTNAME,plug,localhost,ID,0,DISCONNECT,,,0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT PROXY ON plug_dest TO plug',0
|
||||
TIME,HOSTNAME,plug,localhost,ID,0,PROXY_CONNECT,test,`plug_dest`@`%`,0
|
||||
TIME,HOSTNAME,plug,localhost,ID,0,CONNECT,test,,0
|
||||
TIME,HOSTNAME,plug,localhost,ID,0,DISCONNECT,test,,0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'DROP USER plug',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'DROP USER plug_dest',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global serv',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select (1), (2)',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select \'A\', ',0
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
--source include/have_plugin_auth.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
if (!$SERVER_AUDIT_SO) {
|
||||
@ -174,6 +174,25 @@ drop user user1@localhost;
|
||||
|
||||
set global server_audit_events='';
|
||||
|
||||
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
|
||||
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
|
||||
--sleep 2
|
||||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
||||
--error ER_ACCESS_DENIED_ERROR : this should fail : no grant
|
||||
connect(plug_con,localhost,plug,plug_dest);
|
||||
--sleep 2
|
||||
GRANT PROXY ON plug_dest TO plug;
|
||||
--sleep 2
|
||||
connect(plug_con,localhost,plug,plug_dest);
|
||||
connection plug_con;
|
||||
select USER(),CURRENT_USER();
|
||||
connection default;
|
||||
disconnect plug_con;
|
||||
--sleep 2
|
||||
--sleep 2
|
||||
DROP USER plug;
|
||||
DROP USER plug_dest;
|
||||
|
||||
set global server_audit_query_log_limit= 15;
|
||||
select (1), (2), (3), (4);
|
||||
select 'A', 'B', 'C', 'D';
|
||||
|
@ -17,6 +17,7 @@ Grants for test_user@localhost
|
||||
GRANT `test_role` TO `test_user`@`localhost`
|
||||
GRANT USAGE ON *.* TO `test_user`@`localhost`
|
||||
GRANT SELECT ON *.* TO `test_role`
|
||||
SET DEFAULT ROLE test_role FOR 'test_user'@'localhost'
|
||||
select user, host, default_role from mysql.user where user='test_user';
|
||||
User Host default_role
|
||||
test_user localhost test_role
|
||||
|
@ -21,6 +21,7 @@ Grants for user_a@localhost
|
||||
GRANT `role_a` TO `user_a`@`localhost`
|
||||
GRANT USAGE ON *.* TO `user_a`@`localhost`
|
||||
GRANT SELECT ON *.* TO `role_a`
|
||||
SET DEFAULT ROLE role_a FOR 'user_a'@'localhost'
|
||||
select user, host, default_role from mysql.user where user like 'user_%';
|
||||
User Host default_role
|
||||
user_a localhost role_a
|
||||
@ -42,6 +43,7 @@ Grants for user_b@localhost
|
||||
GRANT `role_b` TO `user_b`@`localhost`
|
||||
GRANT USAGE ON *.* TO `user_b`@`localhost`
|
||||
GRANT INSERT, UPDATE ON *.* TO `role_b`
|
||||
SET DEFAULT ROLE role_b FOR 'user_b'@'localhost'
|
||||
select user, host, default_role from mysql.user where user like 'user_%';
|
||||
ERROR 42000: SELECT command denied to user 'user_b'@'localhost' for table 'user'
|
||||
set default role NONE for user_a@localhost;
|
||||
|
@ -24,6 +24,7 @@ Grants for test_user@localhost
|
||||
GRANT `test_role` TO `test_user`@`localhost`
|
||||
GRANT USAGE ON *.* TO `test_user`@`localhost`
|
||||
GRANT SELECT ON *.* TO `test_role`
|
||||
SET DEFAULT ROLE test_role FOR 'test_user'@'localhost'
|
||||
select user, host, default_role from mysql.user where user='test_user';
|
||||
User Host default_role
|
||||
test_user localhost test_role
|
||||
@ -71,6 +72,7 @@ GRANT `r1` TO `b`@`%`
|
||||
GRANT `r2` TO `b`@`%`
|
||||
GRANT USAGE ON *.* TO `b`@`%`
|
||||
GRANT SELECT ON `mysql`.* TO `b`@`%`
|
||||
SET DEFAULT ROLE r2 FOR 'b'@'%'
|
||||
SET DEFAULT ROLE r1 FOR a;
|
||||
ERROR 42000: Access denied for user 'b'@'%' to database 'mysql'
|
||||
SELECT CURRENT_ROLE;
|
||||
@ -96,6 +98,7 @@ GRANT `r1` TO `b`@`%`
|
||||
GRANT `r2` TO `b`@`%`
|
||||
GRANT USAGE ON *.* TO `b`@`%`
|
||||
GRANT SELECT, UPDATE ON `mysql`.* TO `b`@`%`
|
||||
SET DEFAULT ROLE r2 FOR 'b'@'%'
|
||||
SET DEFAULT ROLE r1 FOR a;
|
||||
ERROR OP000: User `a@%` has not been granted role `r1`
|
||||
SET DEFAULT ROLE invalid_role;
|
||||
|
@ -23,6 +23,7 @@ Grants for test_user@localhost
|
||||
GRANT `test_role` TO `test_user`@`localhost`
|
||||
GRANT USAGE ON *.* TO `test_user`@`localhost`
|
||||
GRANT SELECT ON *.* TO `test_role`
|
||||
SET DEFAULT ROLE test_role FOR 'test_user'@'localhost'
|
||||
select user, host, default_role from mysql.user where user = 'test_user';
|
||||
User Host default_role
|
||||
test_user localhost test_role
|
||||
@ -51,6 +52,7 @@ Grants for test_user@localhost
|
||||
GRANT `test_role` TO `test_user`@`localhost`
|
||||
GRANT USAGE ON *.* TO `test_user`@`localhost`
|
||||
GRANT SELECT ON *.* TO `test_role`
|
||||
SET DEFAULT ROLE test_role FOR 'test_user'@'localhost'
|
||||
select user, host, default_role from mysql.user where user = 'test_user';
|
||||
User Host default_role
|
||||
test_user localhost test_role
|
||||
|
@ -2,20 +2,8 @@ CREATE SEQUENCE a1 engine=aria;
|
||||
CREATE TABLE t1(a INT, KEY (a)) KEY_BLOCK_SIZE=1024;
|
||||
insert into t1 values (1),(2);
|
||||
CREATE SEQUENCE x1 engine=innodb;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `a1` (
|
||||
`next_not_cached_value` bigint(21) NOT NULL,
|
||||
`minimum_value` bigint(21) NOT NULL,
|
||||
`maximum_value` bigint(21) NOT NULL,
|
||||
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
|
||||
`increment` bigint(21) NOT NULL COMMENT 'increment value',
|
||||
`cache_size` bigint(21) unsigned NOT NULL,
|
||||
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
|
||||
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
|
||||
) ENGINE=Aria SEQUENCE=1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO `a1` VALUES (1,1,9223372036854775806,1,1,1000,0,0);
|
||||
CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria;
|
||||
SELECT SETVAL(`a1`, 1, 0);
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t1` (
|
||||
@ -24,20 +12,8 @@ CREATE TABLE `t1` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1024;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO `t1` VALUES (1),(2);
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `x1` (
|
||||
`next_not_cached_value` bigint(21) NOT NULL,
|
||||
`minimum_value` bigint(21) NOT NULL,
|
||||
`maximum_value` bigint(21) NOT NULL,
|
||||
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
|
||||
`increment` bigint(21) NOT NULL COMMENT 'increment value',
|
||||
`cache_size` bigint(21) unsigned NOT NULL,
|
||||
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
|
||||
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
|
||||
) ENGINE=InnoDB SEQUENCE=1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO `x1` VALUES (1,1,9223372036854775806,1,1,1000,0,0);
|
||||
CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB;
|
||||
SELECT SETVAL(`x1`, 1, 0);
|
||||
DROP TABLE a1,t1,x1;
|
||||
set default_storage_engine=InnoDB;
|
||||
create sequence t1;
|
||||
|
@ -541,5 +541,10 @@ CREATE VIEW v AS SELECT 1;
|
||||
LOCK TABLE v READ;
|
||||
SELECT NEXT VALUE FOR v;
|
||||
ERROR 42S02: 'test.v' is not a SEQUENCE
|
||||
#
|
||||
# MDEV-24018: SIGSEGV in Item_func_nextval::update_table on SELECT SETVAL
|
||||
#
|
||||
SELECT SETVAL (v,0);
|
||||
ERROR 42S02: 'test.v' is not a SEQUENCE
|
||||
UNLOCK TABLES;
|
||||
DROP VIEW v;
|
||||
|
@ -288,5 +288,12 @@ CREATE VIEW v AS SELECT 1;
|
||||
LOCK TABLE v READ;
|
||||
--error ER_NOT_SEQUENCE
|
||||
SELECT NEXT VALUE FOR v;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-24018: SIGSEGV in Item_func_nextval::update_table on SELECT SETVAL
|
||||
--echo #
|
||||
--error ER_NOT_SEQUENCE
|
||||
SELECT SETVAL (v,0);
|
||||
|
||||
UNLOCK TABLES;
|
||||
DROP VIEW v;
|
||||
|
@ -147,6 +147,8 @@ SELECT @@session.session_track_system_variables;
|
||||
@@session.session_track_system_variables
|
||||
|
||||
|
||||
# MDEV-22524 SIGABRT in safe_mutex_unlock with session_track_system_variables and max_relay_log_size.
|
||||
SET SESSION session_track_system_variables="sql_slave_skip_counter", sql_slave_skip_counter= 0;
|
||||
# Restoring the original values.
|
||||
SET @@global.session_track_system_variables = @global_saved_tmp;
|
||||
# End of tests.
|
||||
|
@ -1353,6 +1353,18 @@ NUMERIC_BLOCK_SIZE 0
|
||||
ENUM_VALUE_LIST NULL
|
||||
READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT REQUIRED
|
||||
VARIABLE_NAME INNODB_MAX_PURGE_LAG_WAIT
|
||||
SESSION_VALUE NULL
|
||||
DEFAULT_VALUE 4294967295
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
VARIABLE_TYPE INT UNSIGNED
|
||||
VARIABLE_COMMENT Wait until History list length is below the specified limit
|
||||
NUMERIC_MIN_VALUE 0
|
||||
NUMERIC_MAX_VALUE 4294967295
|
||||
NUMERIC_BLOCK_SIZE 0
|
||||
ENUM_VALUE_LIST NULL
|
||||
READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT REQUIRED
|
||||
VARIABLE_NAME INNODB_MAX_UNDO_LOG_SIZE
|
||||
SESSION_VALUE NULL
|
||||
DEFAULT_VALUE 10485760
|
||||
|
@ -119,6 +119,8 @@ SELECT @@global.session_track_system_variables;
|
||||
SELECT @@session.session_track_system_variables;
|
||||
--echo
|
||||
|
||||
--echo # MDEV-22524 SIGABRT in safe_mutex_unlock with session_track_system_variables and max_relay_log_size.
|
||||
SET SESSION session_track_system_variables="sql_slave_skip_counter", sql_slave_skip_counter= 0;
|
||||
|
||||
--echo # Restoring the original values.
|
||||
SET @@global.session_track_system_variables = @global_saved_tmp;
|
||||
|
3
mysql-test/suite/wsrep/r/mdev_22681.result
Normal file
3
mysql-test/suite/wsrep/r/mdev_22681.result
Normal file
@ -0,0 +1,3 @@
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 ENGINE=InnoDB AS SELECT 1 AS b';
|
||||
DROP TABLE t1;
|
10
mysql-test/suite/wsrep/t/mdev_22681.cnf
Normal file
10
mysql-test/suite/wsrep/t/mdev_22681.cnf
Normal file
@ -0,0 +1,10 @@
|
||||
!include ../my.cnf
|
||||
|
||||
[mysqld.1]
|
||||
wsrep-on=ON
|
||||
log-bin
|
||||
binlog-format=ROW
|
||||
innodb-flush-log-at-trx-commit=1
|
||||
wsrep-cluster-address=gcomm://
|
||||
wsrep-provider=@ENV.WSREP_PROVIDER
|
||||
innodb-autoinc-lock-mode=2
|
15
mysql-test/suite/wsrep/t/mdev_22681.test
Normal file
15
mysql-test/suite/wsrep/t/mdev_22681.test
Normal file
@ -0,0 +1,15 @@
|
||||
#
|
||||
# MDEV-22681: Server crashes in galera::ReplicatorSMM::CommitOrder::CommitOrder
|
||||
# or assertion failed in wsrep::transaction::before_prepare.
|
||||
#
|
||||
# EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 ENGINE=InnoDB AS SELECT 1 AS b'
|
||||
# crashes the server if binlog is on (see mdev_22681.cnf for configuration).
|
||||
#
|
||||
--source include/have_wsrep.inc
|
||||
--source include/have_wsrep_provider.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 ENGINE=InnoDB AS SELECT 1 AS b';
|
||||
|
||||
DROP TABLE t1;
|
@ -137,7 +137,7 @@ ENDIF()
|
||||
ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES})
|
||||
MAYBE_DISABLE_IPO(mysys)
|
||||
TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY}
|
||||
${LIBNSL} ${LIBM} ${LIBRT} ${LIBDL} ${LIBSOCKET} ${LIBEXECINFO})
|
||||
${LIBNSL} ${LIBM} ${LIBRT} ${CMAKE_DL_LIBS} ${LIBSOCKET} ${LIBEXECINFO})
|
||||
DTRACE_INSTRUMENT(mysys)
|
||||
|
||||
IF(HAVE_BFD_H)
|
||||
|
@ -251,7 +251,7 @@ int init_io_cache_ext(IO_CACHE *info, File file, size_t cachesize,
|
||||
info->write_buffer= info->buffer + cachesize;
|
||||
else
|
||||
info->write_buffer= info->buffer;
|
||||
info->alloced_buffer= 1;
|
||||
info->alloced_buffer= buffer_block;
|
||||
break; /* Enough memory found */
|
||||
}
|
||||
if (cachesize == min_cache)
|
||||
@ -321,14 +321,14 @@ int init_slave_io_cache(IO_CACHE *master, IO_CACHE *slave)
|
||||
DBUG_ASSERT(!master->share);
|
||||
DBUG_ASSERT(master->alloced_buffer);
|
||||
|
||||
if (!(slave_buf= (uchar*)my_malloc(PSI_INSTRUMENT_ME, master->buffer_length, MYF(0))))
|
||||
if (!(slave_buf= (uchar*)my_malloc(PSI_INSTRUMENT_ME, master->alloced_buffer, MYF(0))))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
memcpy(slave, master, sizeof(IO_CACHE));
|
||||
slave->buffer= slave_buf;
|
||||
|
||||
memcpy(slave->buffer, master->buffer, master->buffer_length);
|
||||
memcpy(slave->buffer, master->buffer, master->alloced_buffer);
|
||||
slave->read_pos= slave->buffer + (master->read_pos - master->buffer);
|
||||
slave->read_end= slave->buffer + (master->read_end - master->buffer);
|
||||
|
||||
|
@ -18,6 +18,11 @@ ELSE()
|
||||
SET(GSSAPI_SERVER gssapi_server.cc)
|
||||
SET(GSSAPI_ERRMSG gssapi_errmsg.cc)
|
||||
|
||||
IF(APPLE)
|
||||
SET_SOURCE_FILES_PROPERTIES(
|
||||
${GSSAPI_CLIENT} ${GSSAPI_SERVER} ${GSSAPI_ERRMSG}
|
||||
PROPERTY COMPILE_FLAGS "-Wno-deprecated-declarations")
|
||||
ENDIF()
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${GSSAPI_INCS})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${GSSAPI_LIBS})
|
||||
SET(CMAKE_REQUIRED_FLAGS "-Werror -Wall")
|
||||
|
@ -5,27 +5,35 @@ CHECK_INCLUDE_FILES (security/pam_ext.h HAVE_PAM_EXT_H)
|
||||
CHECK_INCLUDE_FILES (security/pam_appl.h HAVE_PAM_APPL_H)
|
||||
CHECK_FUNCTION_EXISTS (strndup HAVE_STRNDUP)
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# Check whether getgrouplist uses git_t for second and third arguments.
|
||||
SET(CMAKE_REQUIRED_FLAGS -Werror)
|
||||
CHECK_C_SOURCE_COMPILES(
|
||||
"
|
||||
#include <grp.h>
|
||||
#include <unistd.h>
|
||||
int main() {
|
||||
char *arg_1;
|
||||
gid_t arg_2, arg_3;
|
||||
int arg_4;
|
||||
(void)getgrouplist(arg_1,arg_2,&arg_3,&arg_4);
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
HAVE_POSIX_GETGROUPLIST
|
||||
)
|
||||
SET(CMAKE_REQUIRED_FLAGS)
|
||||
|
||||
SET(CMAKE_REQUIRED_LIBRARIES pam)
|
||||
CHECK_FUNCTION_EXISTS(pam_syslog HAVE_PAM_SYSLOG)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
IF(HAVE_PAM_SYSLOG)
|
||||
ADD_DEFINITIONS(-DHAVE_PAM_SYSLOG)
|
||||
ENDIF()
|
||||
|
||||
IF(HAVE_PAM_EXT_H)
|
||||
ADD_DEFINITIONS(-DHAVE_PAM_EXT_H)
|
||||
ENDIF()
|
||||
|
||||
IF(HAVE_PAM_APPL_H)
|
||||
ADD_DEFINITIONS(-DHAVE_PAM_APPL_H)
|
||||
IF(HAVE_STRNDUP)
|
||||
ADD_DEFINITIONS(-DHAVE_STRNDUP)
|
||||
ENDIF(HAVE_STRNDUP)
|
||||
FIND_LIBRARY(PAM_LIBRARY pam) # for srpm build-depends detection
|
||||
ADD_DEFINITIONS(-D_GNU_SOURCE)
|
||||
MYSQL_ADD_PLUGIN(auth_pam_v1 auth_pam_v1.c LINK_LIBRARIES pam MODULE_ONLY)
|
||||
MYSQL_ADD_PLUGIN(auth_pam auth_pam.c LINK_LIBRARIES pam ${LIBDL} MODULE_ONLY)
|
||||
MYSQL_ADD_PLUGIN(auth_pam auth_pam.c LINK_LIBRARIES pam ${CMAKE_DL_LIBS} MODULE_ONLY)
|
||||
IF (TARGET auth_pam)
|
||||
MYSQL_ADD_EXECUTABLE(auth_pam_tool auth_pam_tool.c DESTINATION ${INSTALL_PLUGINDIR}/auth_pam_tool_dir COMPONENT Server)
|
||||
TARGET_LINK_LIBRARIES(auth_pam_tool pam)
|
||||
@ -47,3 +55,6 @@ IF(HAVE_PAM_APPL_H)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF(HAVE_PAM_APPL_H)
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/config_auth_pam.h)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2011, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2011, 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 as published by
|
||||
@ -15,6 +15,7 @@
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
|
||||
|
||||
|
||||
#include <config_auth_pam.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -30,6 +30,7 @@
|
||||
static int read_packet(struct param *param, unsigned char **pkt)
|
||||
*/
|
||||
|
||||
#include <config_auth_pam.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <security/pam_appl.h>
|
||||
|
5
plugin/auth_pam/config.h.cmake
Normal file
5
plugin/auth_pam/config.h.cmake
Normal file
@ -0,0 +1,5 @@
|
||||
#cmakedefine HAVE_POSIX_GETGROUPLIST 1
|
||||
#cmakedefine HAVE_PAM_SYSLOG 1
|
||||
#cmakedefine HAVE_PAM_EXT_H 1
|
||||
#cmakedefine HAVE_PAM_APPL_H 1
|
||||
#cmakedefine HAVE_STRNDUP 1
|
@ -31,6 +31,7 @@ These comments are written to the syslog as 'authpriv.debug'
|
||||
and usually end up in /var/log/secure file.
|
||||
*/
|
||||
|
||||
#include <config_auth_pam.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
@ -70,10 +71,16 @@ pam_syslog (const pam_handle_t *pamh, int priority,
|
||||
#define GROUP_BUFFER_SIZE 100
|
||||
static const char debug_keyword[]= "debug";
|
||||
|
||||
static int populate_user_groups(const char *user, gid_t **groups)
|
||||
#ifdef HAVE_POSIX_GETGROUPLIST
|
||||
typedef gid_t my_gid_t;
|
||||
#else
|
||||
typedef int my_gid_t;
|
||||
#endif
|
||||
|
||||
static int populate_user_groups(const char *user, my_gid_t **groups)
|
||||
{
|
||||
gid_t user_group_id;
|
||||
gid_t *loc_groups= *groups;
|
||||
my_gid_t user_group_id;
|
||||
my_gid_t *loc_groups= *groups;
|
||||
int ng;
|
||||
|
||||
{
|
||||
@ -88,22 +95,23 @@ static int populate_user_groups(const char *user, gid_t **groups)
|
||||
{
|
||||
/* The rare case when the user is present in more than */
|
||||
/* GROUP_BUFFER_SIZE groups. */
|
||||
loc_groups= (gid_t *) malloc(ng * sizeof (gid_t));
|
||||
loc_groups= (my_gid_t *) malloc(ng * sizeof (my_gid_t));
|
||||
|
||||
if (!loc_groups)
|
||||
return 0;
|
||||
|
||||
(void) getgrouplist(user, user_group_id, loc_groups, &ng);
|
||||
*groups= loc_groups;
|
||||
*groups= (my_gid_t*)loc_groups;
|
||||
}
|
||||
|
||||
return ng;
|
||||
}
|
||||
|
||||
|
||||
static int user_in_group(const gid_t *user_groups, int ng,const char *group)
|
||||
static int user_in_group(const my_gid_t *user_groups, int ng,const char *group)
|
||||
{
|
||||
gid_t group_id;
|
||||
const gid_t *groups_end = user_groups + ng;
|
||||
my_gid_t group_id;
|
||||
const my_gid_t *groups_end = user_groups + ng;
|
||||
|
||||
{
|
||||
struct group *g= getgrnam(group);
|
||||
@ -122,7 +130,7 @@ static int user_in_group(const gid_t *user_groups, int ng,const char *group)
|
||||
}
|
||||
|
||||
|
||||
static void print_groups(pam_handle_t *pamh, const gid_t *user_groups, int ng)
|
||||
static void print_groups(pam_handle_t *pamh, const my_gid_t *user_groups, int ng)
|
||||
{
|
||||
char buf[256];
|
||||
char *c_buf= buf, *buf_end= buf+sizeof(buf)-2;
|
||||
@ -158,8 +166,8 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
|
||||
const char *username;
|
||||
char buf[256];
|
||||
FILE *f;
|
||||
gid_t group_buffer[GROUP_BUFFER_SIZE];
|
||||
gid_t *groups= group_buffer;
|
||||
my_gid_t group_buffer[GROUP_BUFFER_SIZE];
|
||||
my_gid_t *groups= group_buffer;
|
||||
int n_groups= -1;
|
||||
|
||||
for (; argc > 0; argc--)
|
||||
|
@ -162,6 +162,10 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Flush(void) override
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void ProcessFormattedStatement(Aws::String&& statement) override
|
||||
{
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
#define PLUGIN_VERSION 0x104
|
||||
#define PLUGIN_STR_VERSION "1.4.8"
|
||||
#define PLUGIN_STR_VERSION "1.4.10"
|
||||
|
||||
#define _my_thread_var loc_thread_var
|
||||
|
||||
@ -327,6 +327,10 @@ struct connection_info
|
||||
char query_buffer[1024];
|
||||
time_t query_time;
|
||||
int log_always;
|
||||
char proxy[64];
|
||||
int proxy_length;
|
||||
char proxy_host[64];
|
||||
int proxy_host_length;
|
||||
};
|
||||
|
||||
#define DEFAULT_FILENAME_LEN 16
|
||||
@ -1131,9 +1135,13 @@ static void setup_connection_simple(struct connection_info *ci)
|
||||
ci->ip_length= 0;
|
||||
ci->query_length= 0;
|
||||
ci->header= 0;
|
||||
ci->proxy_length= 0;
|
||||
}
|
||||
|
||||
|
||||
#define MAX_HOSTNAME 61
|
||||
#define USERNAME_LENGTH 384
|
||||
|
||||
static void setup_connection_connect(struct connection_info *cn,
|
||||
const struct mysql_event_connection *event)
|
||||
{
|
||||
@ -1150,6 +1158,29 @@ static void setup_connection_connect(struct connection_info *cn,
|
||||
get_str_n(cn->ip, &cn->ip_length, sizeof(cn->ip),
|
||||
event->ip, event->ip_length);
|
||||
cn->header= 0;
|
||||
if (event->proxy_user && event->proxy_user[0])
|
||||
{
|
||||
const char *priv_host= event->proxy_user +
|
||||
sizeof(char[MAX_HOSTNAME+USERNAME_LENGTH+5]);
|
||||
size_t priv_host_length;
|
||||
|
||||
if (mysql_57_started)
|
||||
{
|
||||
priv_host+= sizeof(size_t);
|
||||
priv_host_length= *(size_t *) (priv_host + MAX_HOSTNAME);
|
||||
}
|
||||
else
|
||||
priv_host_length= strlen(priv_host);
|
||||
|
||||
|
||||
get_str_n(cn->proxy, &cn->proxy_length, sizeof(cn->proxy),
|
||||
event->priv_user, event->priv_user_length);
|
||||
get_str_n(cn->proxy_host, &cn->proxy_host_length,
|
||||
sizeof(cn->proxy_host),
|
||||
priv_host, priv_host_length);
|
||||
}
|
||||
else
|
||||
cn->proxy_length= 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1349,6 +1380,31 @@ static size_t log_header(char *message, size_t message_len,
|
||||
}
|
||||
|
||||
|
||||
static int log_proxy(const struct connection_info *cn,
|
||||
const struct mysql_event_connection *event)
|
||||
|
||||
{
|
||||
time_t ctime;
|
||||
size_t csize;
|
||||
char message[1024];
|
||||
|
||||
(void) time(&ctime);
|
||||
csize= log_header(message, sizeof(message)-1, &ctime,
|
||||
servhost, servhost_len,
|
||||
cn->user, cn->user_length,
|
||||
cn->host, cn->host_length,
|
||||
cn->ip, cn->ip_length,
|
||||
event->thread_id, 0, "PROXY_CONNECT");
|
||||
csize+= my_snprintf(message+csize, sizeof(message) - 1 - csize,
|
||||
",%.*s,`%.*s`@`%.*s`,%d", cn->db_length, cn->db,
|
||||
cn->proxy_length, cn->proxy,
|
||||
cn->proxy_host_length, cn->proxy_host,
|
||||
event->status);
|
||||
message[csize]= '\n';
|
||||
return write_log(message, csize + 1, 1);
|
||||
}
|
||||
|
||||
|
||||
static int log_connection(const struct connection_info *cn,
|
||||
const struct mysql_event_connection *event,
|
||||
const char *type)
|
||||
@ -2010,9 +2066,13 @@ static void update_connection_info(struct connection_info *cn,
|
||||
{
|
||||
case MYSQL_AUDIT_CONNECTION_CONNECT:
|
||||
setup_connection_connect(cn, event);
|
||||
if (event->status == 0 && event->proxy_user && event->proxy_user[0])
|
||||
log_proxy(cn, event);
|
||||
break;
|
||||
case MYSQL_AUDIT_CONNECTION_CHANGE_USER:
|
||||
*after_action= AA_CHANGE_USER;
|
||||
if (event->proxy_user && event->proxy_user[0])
|
||||
log_proxy(cn, event);
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ $flags->{libs} =
|
||||
$flags->{libs_r} =
|
||||
[@ldflags,@lib_r_opts,'@ZLIB_DEPS@','@LIBS@','@openssl_libs@'];
|
||||
$flags->{embedded_libs} =
|
||||
[@ldflags,@lib_e_opts,'@LIBDL@','@ZLIB_DEPS@','@LIBS@','@WRAPLIBS@','@openssl_libs@'];
|
||||
[@ldflags,@lib_e_opts,'@CMAKE_DL_LIBS@','@ZLIB_DEPS@','@LIBS@','@WRAPLIBS@','@openssl_libs@'];
|
||||
|
||||
$flags->{include} = ["-I$pkgincludedir"];
|
||||
$flags->{cflags} = [@{$flags->{include}},split(" ",'@CFLAGS@')];
|
||||
|
@ -194,7 +194,7 @@ DTRACE_INSTRUMENT(sql)
|
||||
TARGET_LINK_LIBRARIES(sql
|
||||
mysys mysys_ssl dbug strings vio pcre2-8
|
||||
tpool
|
||||
${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT}
|
||||
${LIBWRAP} ${LIBCRYPT} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}
|
||||
${SSL_LIBRARIES}
|
||||
${LIBSYSTEMD})
|
||||
|
||||
|
@ -310,6 +310,64 @@ retry :
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Create a security descriptor for pipe.
|
||||
- Use low integrity level, so that it is possible to connect
|
||||
from any process.
|
||||
- Give current user read/write access to pipe.
|
||||
- Give Everyone read/write access to pipe minus FILE_CREATE_PIPE_INSTANCE
|
||||
*/
|
||||
static void init_pipe_security_descriptor()
|
||||
{
|
||||
#define SDDL_FMT "S:(ML;; NW;;; LW) D:(A;; 0x%08x;;; WD)(A;; FRFW;;; %s)"
|
||||
#define EVERYONE_PIPE_ACCESS_MASK \
|
||||
(FILE_READ_DATA | FILE_READ_EA | FILE_READ_ATTRIBUTES | READ_CONTROL | \
|
||||
SYNCHRONIZE | FILE_WRITE_DATA | FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES)
|
||||
|
||||
#ifndef SECURITY_MAX_SID_STRING_CHARACTERS
|
||||
/* Old SDK does not have this constant */
|
||||
#define SECURITY_MAX_SID_STRING_CHARACTERS 187
|
||||
#endif
|
||||
|
||||
/*
|
||||
Figure out SID of the user that runs the server, then create SDDL string
|
||||
for pipe permissions, and convert it to the security descriptor.
|
||||
*/
|
||||
char sddl_string[sizeof(SDDL_FMT) + 8 + SECURITY_MAX_SID_STRING_CHARACTERS];
|
||||
struct
|
||||
{
|
||||
TOKEN_USER token_user;
|
||||
BYTE buffer[SECURITY_MAX_SID_SIZE];
|
||||
} token_buffer;
|
||||
HANDLE token;
|
||||
DWORD tmp;
|
||||
|
||||
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
||||
goto fail;
|
||||
|
||||
if (!GetTokenInformation(token, TokenUser, &token_buffer,
|
||||
(DWORD) sizeof(token_buffer), &tmp))
|
||||
goto fail;
|
||||
|
||||
CloseHandle(token);
|
||||
|
||||
char *current_user_string_sid;
|
||||
if (!ConvertSidToStringSid(token_buffer.token_user.User.Sid,
|
||||
¤t_user_string_sid))
|
||||
goto fail;
|
||||
|
||||
snprintf(sddl_string, sizeof(sddl_string), SDDL_FMT,
|
||||
EVERYONE_PIPE_ACCESS_MASK, current_user_string_sid);
|
||||
LocalFree(current_user_string_sid);
|
||||
|
||||
if (ConvertStringSecurityDescriptorToSecurityDescriptor(sddl_string,
|
||||
SDDL_REVISION_1, &pipe_security.lpSecurityDescriptor, 0))
|
||||
return;
|
||||
|
||||
fail:
|
||||
sql_perror("Can't start server : Initialize security descriptor");
|
||||
unireg_abort(1);
|
||||
}
|
||||
|
||||
/**
|
||||
Pipe Listener.
|
||||
@ -338,13 +396,7 @@ struct Pipe_Listener : public Listener
|
||||
{
|
||||
snprintf(pipe_name, sizeof(pipe_name), "\\\\.\\pipe\\%s", mysqld_unix_port);
|
||||
open_mode |= FILE_FLAG_FIRST_PIPE_INSTANCE;
|
||||
if (!ConvertStringSecurityDescriptorToSecurityDescriptorA(
|
||||
"S:(ML;; NW;;; LW) D:(A;; FRFW;;; WD)",
|
||||
1, &pipe_security.lpSecurityDescriptor, NULL))
|
||||
{
|
||||
sql_perror("Can't start server : Initialize security descriptor");
|
||||
unireg_abort(1);
|
||||
}
|
||||
init_pipe_security_descriptor();
|
||||
pipe_security.nLength= sizeof(SECURITY_ATTRIBUTES);
|
||||
pipe_security.bInheritHandle= FALSE;
|
||||
}
|
||||
|
19
sql/item.h
19
sql/item.h
@ -120,20 +120,19 @@ enum precedence {
|
||||
XOR_PRECEDENCE, // XOR
|
||||
AND_PRECEDENCE, // AND, &&
|
||||
NOT_PRECEDENCE, // NOT (unless HIGH_NOT_PRECEDENCE)
|
||||
BETWEEN_PRECEDENCE, // BETWEEN, CASE, WHEN, THEN, ELSE
|
||||
CMP_PRECEDENCE, // =, <=>, >=, >, <=, <, <>, !=, IS, LIKE, REGEXP, IN
|
||||
CMP_PRECEDENCE, // =, <=>, >=, >, <=, <, <>, !=, IS
|
||||
BETWEEN_PRECEDENCE, // BETWEEN
|
||||
IN_PRECEDENCE, // IN, LIKE, REGEXP
|
||||
BITOR_PRECEDENCE, // |
|
||||
BITAND_PRECEDENCE, // &
|
||||
SHIFT_PRECEDENCE, // <<, >>
|
||||
ADDINTERVAL_PRECEDENCE, // first argument in +INTERVAL
|
||||
INTERVAL_PRECEDENCE, // first argument in +INTERVAL
|
||||
ADD_PRECEDENCE, // +, -
|
||||
MUL_PRECEDENCE, // *, /, DIV, %, MOD
|
||||
BITXOR_PRECEDENCE, // ^
|
||||
PIPES_PRECEDENCE, // || (if PIPES_AS_CONCAT)
|
||||
NEG_PRECEDENCE, // unary -, ~
|
||||
BANG_PRECEDENCE, // !, NOT (if HIGH_NOT_PRECEDENCE)
|
||||
NEG_PRECEDENCE, // unary -, ~, !, NOT (if HIGH_NOT_PRECEDENCE)
|
||||
COLLATE_PRECEDENCE, // BINARY, COLLATE
|
||||
INTERVAL_PRECEDENCE, // INTERVAL
|
||||
DEFAULT_PRECEDENCE,
|
||||
HIGHEST_PRECEDENCE
|
||||
};
|
||||
@ -1716,6 +1715,8 @@ public:
|
||||
mysql_register_view().
|
||||
*/
|
||||
virtual enum precedence precedence() const { return DEFAULT_PRECEDENCE; }
|
||||
enum precedence higher_precedence() const
|
||||
{ return (enum precedence)(precedence() + 1); }
|
||||
void print_parenthesised(String *str, enum_query_type query_type,
|
||||
enum precedence parent_prec);
|
||||
/**
|
||||
@ -5439,7 +5440,11 @@ public:
|
||||
{
|
||||
(*ref)->restore_to_before_no_rows_in_result();
|
||||
}
|
||||
virtual void print(String *str, enum_query_type query_type);
|
||||
void print(String *str, enum_query_type query_type);
|
||||
enum precedence precedence() const
|
||||
{
|
||||
return ref ? (*ref)->precedence() : DEFAULT_PRECEDENCE;
|
||||
}
|
||||
void cleanup();
|
||||
Item_field *field_for_view_update()
|
||||
{ return (*ref)->field_for_view_update(); }
|
||||
|
@ -2331,7 +2331,7 @@ longlong Item_func_between::val_int_cmp_real()
|
||||
|
||||
void Item_func_between::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
args[0]->print_parenthesised(str, query_type, precedence());
|
||||
args[0]->print_parenthesised(str, query_type, higher_precedence());
|
||||
if (negated)
|
||||
str->append(STRING_WITH_LEN(" not"));
|
||||
str->append(STRING_WITH_LEN(" between "));
|
||||
@ -3348,27 +3348,28 @@ Item* Item_func_case_simple::propagate_equal_fields(THD *thd,
|
||||
}
|
||||
|
||||
|
||||
void Item_func_case::print_when_then_arguments(String *str,
|
||||
enum_query_type query_type,
|
||||
Item **items, uint count)
|
||||
inline void Item_func_case::print_when_then_arguments(String *str,
|
||||
enum_query_type
|
||||
query_type,
|
||||
Item **items, uint count)
|
||||
{
|
||||
for (uint i=0 ; i < count ; i++)
|
||||
for (uint i= 0; i < count; i++)
|
||||
{
|
||||
str->append(STRING_WITH_LEN("when "));
|
||||
items[i]->print_parenthesised(str, query_type, precedence());
|
||||
items[i]->print(str, query_type);
|
||||
str->append(STRING_WITH_LEN(" then "));
|
||||
items[i + count]->print_parenthesised(str, query_type, precedence());
|
||||
items[i + count]->print(str, query_type);
|
||||
str->append(' ');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Item_func_case::print_else_argument(String *str,
|
||||
enum_query_type query_type,
|
||||
Item *item)
|
||||
inline void Item_func_case::print_else_argument(String *str,
|
||||
enum_query_type query_type,
|
||||
Item *item)
|
||||
{
|
||||
str->append(STRING_WITH_LEN("else "));
|
||||
item->print_parenthesised(str, query_type, precedence());
|
||||
item->print(str, query_type);
|
||||
str->append(' ');
|
||||
}
|
||||
|
||||
@ -5600,12 +5601,14 @@ void Item_func_like::print(String *str, enum_query_type query_type)
|
||||
str->append(STRING_WITH_LEN(" not "));
|
||||
str->append(func_name());
|
||||
str->append(' ');
|
||||
args[1]->print_parenthesised(str, query_type, precedence());
|
||||
if (escape_used_in_parsing)
|
||||
{
|
||||
args[1]->print_parenthesised(str, query_type, precedence());
|
||||
str->append(STRING_WITH_LEN(" escape "));
|
||||
escape_item->print(str, query_type);
|
||||
escape_item->print_parenthesised(str, query_type, higher_precedence());
|
||||
}
|
||||
else
|
||||
args[1]->print_parenthesised(str, query_type, higher_precedence());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef ITEM_CMPFUNC_INCLUDED
|
||||
#define ITEM_CMPFUNC_INCLUDED
|
||||
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2016, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -608,7 +608,7 @@ public:
|
||||
enum Functype functype() const override { return NOT_FUNC; }
|
||||
const char *func_name() const override { return "not"; }
|
||||
bool find_not_null_fields(table_map allowed) override { return false; }
|
||||
enum precedence precedence() const override { return BANG_PRECEDENCE; }
|
||||
enum precedence precedence() const override { return NEG_PRECEDENCE; }
|
||||
Item *neg_transformer(THD *thd) override;
|
||||
bool fix_fields(THD *, Item **) override;
|
||||
void print(String *str, enum_query_type query_type) override;
|
||||
@ -2184,9 +2184,11 @@ protected:
|
||||
bool aggregate_then_and_else_arguments(THD *thd, uint count);
|
||||
virtual Item **else_expr_addr() const= 0;
|
||||
virtual Item *find_item()= 0;
|
||||
void print_when_then_arguments(String *str, enum_query_type query_type,
|
||||
Item **items, uint count);
|
||||
void print_else_argument(String *str, enum_query_type query_type, Item *item);
|
||||
inline void print_when_then_arguments(String *str,
|
||||
enum_query_type query_type,
|
||||
Item **items, uint count);
|
||||
inline void print_else_argument(String *str, enum_query_type query_type,
|
||||
Item *item);
|
||||
void reorder_args(uint start);
|
||||
public:
|
||||
Item_func_case(THD *thd, List<Item> &list)
|
||||
@ -2202,7 +2204,6 @@ public:
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
table_map not_null_tables() const { return 0; }
|
||||
const char *func_name() const { return "case"; }
|
||||
enum precedence precedence() const { return BETWEEN_PRECEDENCE; }
|
||||
CHARSET_INFO *compare_collation() const { return cmp_collation.collation; }
|
||||
bool need_parentheses_in_default() { return true; }
|
||||
};
|
||||
@ -2467,7 +2468,7 @@ public:
|
||||
virtual void print(String *str, enum_query_type query_type);
|
||||
enum Functype functype() const { return IN_FUNC; }
|
||||
const char *func_name() const { return "in"; }
|
||||
enum precedence precedence() const { return CMP_PRECEDENCE; }
|
||||
enum precedence precedence() const { return IN_PRECEDENCE; }
|
||||
bool eval_not_null_tables(void *opt_arg);
|
||||
bool find_not_null_fields(table_map allowed);
|
||||
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
|
||||
@ -2793,7 +2794,7 @@ public:
|
||||
return this;
|
||||
}
|
||||
const char *func_name() const { return "like"; }
|
||||
enum precedence precedence() const { return CMP_PRECEDENCE; }
|
||||
enum precedence precedence() const { return IN_PRECEDENCE; }
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
@ -2902,7 +2903,7 @@ public:
|
||||
longlong val_int();
|
||||
bool fix_length_and_dec();
|
||||
const char *func_name() const { return "regexp"; }
|
||||
enum precedence precedence() const { return CMP_PRECEDENCE; }
|
||||
enum precedence precedence() const { return IN_PRECEDENCE; }
|
||||
Item *get_copy(THD *) { return 0; }
|
||||
void print(String *str, enum_query_type query_type)
|
||||
{
|
||||
|
@ -640,8 +640,7 @@ void Item_func::print_op(String *str, enum_query_type query_type)
|
||||
str->append(func_name());
|
||||
str->append(' ');
|
||||
}
|
||||
args[arg_count-1]->print_parenthesised(str, query_type,
|
||||
(enum precedence)(precedence() + 1));
|
||||
args[arg_count-1]->print_parenthesised(str, query_type, higher_precedence());
|
||||
}
|
||||
|
||||
|
||||
|
@ -2464,6 +2464,8 @@ String *Item_func_json_merge_patch::val_str(String *str)
|
||||
uint n_arg;
|
||||
bool empty_result, merge_to_null;
|
||||
|
||||
/* To report errors properly if some JSON is invalid. */
|
||||
je1.s.error= je2.s.error= 0;
|
||||
merge_to_null= args[0]->null_value;
|
||||
|
||||
for (n_arg=1; n_arg < arg_count; n_arg++)
|
||||
|
@ -3357,7 +3357,7 @@ void Item_in_subselect::print(String *str, enum_query_type query_type)
|
||||
str->append(STRING_WITH_LEN("<exists>"));
|
||||
else
|
||||
{
|
||||
left_expr->print(str, query_type);
|
||||
left_expr->print_parenthesised(str, query_type, precedence());
|
||||
str->append(STRING_WITH_LEN(" in "));
|
||||
}
|
||||
Item_subselect::print(str, query_type);
|
||||
|
@ -640,7 +640,7 @@ public:
|
||||
bool val_bool() override;
|
||||
bool test_limit(st_select_lex_unit *unit);
|
||||
void print(String *str, enum_query_type query_type) override;
|
||||
enum precedence precedence() const override { return CMP_PRECEDENCE; }
|
||||
enum precedence precedence() const override { return IN_PRECEDENCE; }
|
||||
bool fix_fields(THD *thd, Item **ref) override;
|
||||
bool fix_length_and_dec() override;
|
||||
void fix_after_pullout(st_select_lex *new_parent, Item **ref,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user