Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä 2020-10-29 13:38:38 +02:00
commit 7b2bb67113
177 changed files with 20549 additions and 2952 deletions

1
.gitignore vendored
View file

@ -103,6 +103,7 @@ pcre/pcregrep
pcre/pcretest
pcre/test*grep
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

View file

@ -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,6 +83,7 @@
#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_SEQUENCE_TABLE 0x04 /* catch the SEQUENCE*/
/* Chars needed to store LONGLONG, excluding trailing '\0'. */
#define LONGLONG_LEN 20
@ -2728,7 +2729,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
@ -3710,6 +3772,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.
@ -5678,7 +5748,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))
@ -5718,7 +5788,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 these two types, we do want to skip dumping the table
*/

View file

@ -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)

View file

@ -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}")

View file

@ -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)

View file

@ -2529,17 +2529,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;
@ -2583,7 +2590,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) {
@ -2594,18 +2601,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;
}
@ -2626,7 +2626,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;
}
}
@ -2635,8 +2635,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;
}
@ -2650,8 +2650,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);
@ -2660,8 +2660,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*/
@ -2671,8 +2671,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);
@ -2968,9 +2968,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);
@ -4578,7 +4578,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);
@ -5140,22 +5140,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;
}
@ -5192,17 +5236,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];
@ -5237,7 +5282,7 @@ xb_process_datadir(
suffix)) {
if (!func(
path, NULL,
fileinfo.name, NULL))
fileinfo.name, func_arg))
{
os_file_closedir(dbdir);
return(FALSE);
@ -5301,7 +5346,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);
@ -5461,6 +5506,12 @@ 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 = hash_create(1000);
ut_ad(inc_dir_tables_hash);
}
/* Fix DDL for prepare. Process .del,.ren, and .new files.
The order in which files are processed, is important
(see MDEV-18185, MDEV-18201)
@ -5472,6 +5523,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);
@ -5555,8 +5608,6 @@ static bool xtrabackup_prepare_func(char** argv)
goto error_cleanup;
}
inc_dir_tables_hash = hash_create(1000);
ok = xtrabackup_apply_deltas();
xb_data_files_close();

View file

@ -479,18 +479,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;
#ifdef HAVE_AIOWAIT
/*
As inidicated by ifdef, this is for async I/O, which is not currently

View file

@ -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

View file

@ -153,7 +153,7 @@ ENDIF()
SET(LIBS
dbug strings mysys mysys_ssl pcre vio
${ZLIB_LIBRARY} ${SSL_LIBRARIES}
${LIBWRAP} ${LIBCRYPT} ${LIBDL}
${LIBWRAP} ${LIBCRYPT} ${CMAKE_DL_LIBS}
${MYSQLD_STATIC_PLUGIN_LIBS}
sql_embedded
)

View file

@ -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)

View file

@ -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

View file

@ -10048,11 +10048,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": {
@ -10097,11 +10097,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": {
@ -10146,11 +10146,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": {
@ -10195,7 +10195,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,
@ -10207,7 +10207,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"
}
}
}

View file

@ -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"}

View file

@ -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

View file

@ -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
#

View file

@ -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 #

View file

@ -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

View file

@ -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
#

View file

@ -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';

View file

@ -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
#

View file

@ -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
@ -492,7 +492,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 USE INDEX ()
WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%';
ID Name Country Population
@ -719,7 +719,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 35,4 NULL # Using sort_intersect(Name,Population); 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%';
@ -730,7 +730,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

View file

@ -3,7 +3,7 @@
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 const,const 1 Using index
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 const 5 Using where
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
flush status;
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
count(*)
@ -12,7 +12,7 @@
Handler_read_key 1
Handler_read_last 0
-Handler_read_next 1
+Handler_read_next 5
+Handler_read_next 6
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
@ -93,7 +93,7 @@
where l_shipdate='1992-07-01' and l_orderkey=130;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 const 5 Using where
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
flush status;
select max(l_linenumber) from lineitem
where l_shipdate='1992-07-01' and l_orderkey=130;
@ -102,7 +102,7 @@
Handler_read_key 1
Handler_read_last 0
-Handler_read_next 0
+Handler_read_next 5
+Handler_read_next 6
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
@ -132,8 +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
@@ -718,13 +718,13 @@
@@ -710,13 +710,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'
@@ -759,13 +759,14 @@
@@ -751,13 +751,14 @@
"select_id": 1,
"table": {
"table_name": "t1",
@ -285,7 +282,7 @@
"index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
"attached_condition": "t1.f1 <= '3'"
}
@@ -792,8 +793,8 @@
@@ -784,8 +785,8 @@
"access_type": "range",
"possible_keys": ["k1"],
"key": "k1",

View file

@ -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;

View file

@ -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

View file

@ -5906,4 +5906,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

View file

@ -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

View file

@ -121,7 +121,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"using_mrr": false,
"index_only": false,
"rows": 1000,
"cost": 203.39,
"cost": 204.01,
"chosen": true
},
{
@ -141,8 +141,8 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"index": "key1",
"index_scan_cost": 1.0001,
"cumulated_index_scan_cost": 1.0001,
"disk_sweep_cost": 1.0014,
"cumulative_total_cost": 2.0015,
"disk_sweep_cost": 1.0042,
"cumulative_total_cost": 2.0043,
"usable": true,
"matching_rows_now": 1,
"intersect_covering_with_this_index": false,

View file

@ -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
#
@ -1771,7 +1788,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

View file

@ -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 #
@ -1550,7 +1564,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

View file

@ -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

View file

@ -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);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View 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;

View 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;

View file

@ -55,7 +55,7 @@ SELECT * FROM City
WHERE (Population >= 100000 OR Name LIKE 'P%') AND Country='CAN' OR
(Population < 100000 OR Name Like 'T%') AND Country='ARG';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range Population,Country,Name Country 3 NULL 106 Using index condition; Using where
1 SIMPLE City index_merge Population,Country,Name Population,Name,Country 4,35,3 NULL 821 Using sort_union(Population,Name,Country); Using where
EXPLAIN
SELECT * FROM City
WHERE Population < 200000 AND Name LIKE 'P%' AND
@ -622,7 +622,7 @@ WHERE ((Population > 101000 AND Population < 102000) AND
((ID BETWEEN 3400 AND 3800) AND
(Country < 'AGO' OR Name LIKE 'Pa%'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Population,PRIMARY 4,4 NULL 440 Using sort_union(Population,PRIMARY); Using where
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Country,Name 3,35 NULL 831 Using sort_union(Country,Name); Using where
EXPLAIN
SELECT * FROM City
WHERE ((Population > 101000 AND Population < 110000) AND
@ -630,7 +630,7 @@ WHERE ((Population > 101000 AND Population < 110000) AND
((ID BETWEEN 3790 AND 3800) AND
(Country < 'C' OR Name LIKE 'P%'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Country,Name,PRIMARY 3,35,4 NULL 87 Using sort_union(Country,Name,PRIMARY); Using where
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Country,Name 7,39 NULL 678 Using sort_union(Country,Name); Using where
SELECT * FROM City USE INDEX ()
WHERE ((Population > 101000 AND Population < 102000) AND
(Country < 'C' OR Name BETWEEN 'P' AND 'S')) OR

View file

@ -1716,7 +1716,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 39,
"filtered": 1.9499,
"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'"
},
@ -1734,7 +1734,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"filtered": 3.0475,
"filtered": "REPLACED",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
}
@ -1746,8 +1746,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 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 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 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
@ -1776,7 +1776,7 @@ ANALYZE
"rows": 39,
"r_rows": 41,
"r_total_time_ms": "REPLACED",
"filtered": 1.9499,
"filtered": "REPLACED",
"r_filtered": 2.439,
"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'"
@ -1798,7 +1798,7 @@ ANALYZE
"rows": 4,
"r_rows": 6,
"r_total_time_ms": "REPLACED",
"filtered": 3.0475,
"filtered": "REPLACED",
"r_filtered": 66.667,
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -1847,7 +1847,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 39,
"filtered": 1.9499,
"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'"
},
@ -1865,7 +1865,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"filtered": 3.0475,
"filtered": "REPLACED",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
}
@ -1877,8 +1877,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 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 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 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
@ -1907,7 +1907,7 @@ ANALYZE
"rows": 39,
"r_rows": 41,
"r_total_time_ms": "REPLACED",
"filtered": 1.9499,
"filtered": "REPLACED",
"r_filtered": 2.439,
"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'"
@ -1929,7 +1929,7 @@ ANALYZE
"rows": 4,
"r_rows": 6,
"r_total_time_ms": "REPLACED",
"filtered": 3.0475,
"filtered": "REPLACED",
"r_filtered": 66.667,
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}

View file

@ -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_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_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;

View file

@ -1645,7 +1645,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 41,
"filtered": 2.0711,
"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'"
},
@ -1663,7 +1663,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"filtered": 3.0475,
"filtered": "REPLACED",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
}
@ -1675,8 +1675,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
@ -1705,7 +1705,7 @@ ANALYZE
"rows": 41,
"r_rows": 41,
"r_total_time_ms": "REPLACED",
"filtered": 2.0711,
"filtered": "REPLACED",
"r_filtered": 2.439,
"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'"
@ -1727,7 +1727,7 @@ ANALYZE
"rows": 4,
"r_rows": 6,
"r_total_time_ms": "REPLACED",
"filtered": 3.0475,
"filtered": "REPLACED",
"r_filtered": 66.667,
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -1776,7 +1776,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 41,
"filtered": 2.0711,
"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'"
},
@ -1794,7 +1794,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"filtered": 3.0475,
"filtered": "REPLACED",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
}
@ -1806,8 +1806,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
@ -1836,7 +1836,7 @@ ANALYZE
"rows": 41,
"r_rows": 41,
"r_total_time_ms": "REPLACED",
"filtered": 2.0711,
"filtered": "REPLACED",
"r_filtered": 2.439,
"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'"
@ -1858,7 +1858,7 @@ ANALYZE
"rows": 4,
"r_rows": 6,
"r_total_time_ms": "REPLACED",
"filtered": 3.0475,
"filtered": "REPLACED",
"r_filtered": 66.667,
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}

View file

@ -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

View file

@ -6605,17 +6605,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>&,

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,26 @@
CREATE TABLE t1(f2 INT) ENGINE=InnoDB;
connect node_1_applier_thd, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
connection node_2;
SET SESSION wsrep_sync_wait = 0;
INSERT INTO t1 (f2) VALUES (2);
connection node_1_applier_thd;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
connection node_1;
SET SESSION wsrep_sync_wait = 0;
SET DEBUG_SYNC = 'wsrep_before_replication SIGNAL wsrep_before_replication_reached WAIT_FOR continue';
INSERT INTO t1 (f2) VALUES (1);
connect node_1_flush_thd, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET DEBUG_SYNC="now WAIT_FOR wsrep_before_replication_reached";
SET GLOBAL debug_dbug = "+d,sync.wsrep_before_mdl_wait";
FLUSH TABLES;
connect node_1_sync_release_thd, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET GLOBAL debug_dbug = "";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_before_mdl_wait";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
SET DEBUG_SYNC = "now SIGNAL continue";
SET DEBUG_SYNC = "RESET";
connection node_1;
connection node_1_flush_thd;
connection node_2;
DROP TABLE t1;

View file

@ -0,0 +1,51 @@
#
# MDEV-22707 galera got stuck after flush tables
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
CREATE TABLE t1(f2 INT) ENGINE=InnoDB;
--connect node_1_applier_thd, 127.0.0.1, root, , test, $NODE_MYPORT_1
SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
--connection node_2
SET SESSION wsrep_sync_wait = 0;
--send INSERT INTO t1 (f2) VALUES (2)
--connection node_1_applier_thd
# Wait for `sync.wsrep_apply_cb_reached` signal
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
--connection node_1
SET SESSION wsrep_sync_wait = 0;
SET DEBUG_SYNC = 'wsrep_before_replication SIGNAL wsrep_before_replication_reached WAIT_FOR continue';
--send INSERT INTO t1 (f2) VALUES (1)
--connect node_1_flush_thd, 127.0.0.1, root, , test, $NODE_MYPORT_1
SET DEBUG_SYNC="now WAIT_FOR wsrep_before_replication_reached";
SET GLOBAL debug_dbug = "+d,sync.wsrep_before_mdl_wait";
--send FLUSH TABLES
--connect node_1_sync_release_thd, 127.0.0.1, root, , test, $NODE_MYPORT_1
# First clear all DBUG points
SET GLOBAL debug_dbug = "";
# Now signal threads to continue execution
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_before_mdl_wait";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
SET DEBUG_SYNC = "now SIGNAL continue";
SET DEBUG_SYNC = "RESET";
--connection node_1
--reap
--connection node_1_flush_thd
--reap
--connection node_2
--reap
DROP TABLE t1;

View file

@ -1,25 +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;
while ($wait_counter)
if ($wait_all_purged)
{
--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;
}
eval SET GLOBAL innodb_max_purge_lag_wait= $wait_all_purged;
}
--enable_query_log
--replace_regex /.*History list length ([0-9]+).*/\1/
let $remaining= `SHOW ENGINE INNODB STATUS`;
echo $remaining transactions not purged;

View file

@ -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`)

View file

@ -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;

View file

@ -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;

View file

@ -37,6 +37,7 @@ ALTER TABLE t1 ADD COLUMN f3 INT;
connection purge_control;
SET DEBUG_SYNC='now WAIT_FOR go';
COMMIT;
SET GLOBAL innodb_max_purge_lag_wait= 0;
InnoDB 0 transactions not purged
SET DEBUG_SYNC='now SIGNAL do';
disconnect purge_control;

View 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;

View file

@ -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

View file

@ -59,8 +59,9 @@ if ($have_debug) {
SET DEBUG_SYNC='now WAIT_FOR go';
}
COMMIT;
--source include/wait_all_purged.inc
SET GLOBAL innodb_max_purge_lag_wait= 0;
if ($have_debug) {
--source include/wait_all_purged.inc
SET DEBUG_SYNC='now SIGNAL do';
}
disconnect purge_control;

View 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

View file

@ -0,0 +1,7 @@
--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
--innodb-file-per-table
--innodb-encryption-threads=4
--innodb-encrypt-tables
--innodb-encrypt-log
--loose-file-key-management
--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt

View file

@ -0,0 +1,26 @@
SET @old_innodb_log_optimize_ddl=@@global.innodb_log_optimize_ddl;
SET GLOBAL innodb_log_optimize_ddl=ON;
SET @old_debug_dbug=@@global.debug_dbug;
SET GLOBAL debug_dbug="+d,ib_log_checkpoint_avoid";
SET @old_innodb_page_cleaner_disabled_debug=@@global.innodb_page_cleaner_disabled_debug;
SET GLOBAL innodb_page_cleaner_disabled_debug=ON;
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
# backup
SET GLOBAL debug_dbug="+d,ib_do_not_log_crypt_data";
INSERT INTO t1 VALUES (2);
# incremental backup
# prepare
# incremental prepare
SET GLOBAL innodb_log_optimize_ddl=@old_innodb_log_optimize_ddl;
SET GLOBAL innodb_page_cleaner_disabled_debug=@old_innodb_page_cleaner_disabled_debug;
SET GLOBAL debug_dbug=@old_debug_dbug;
# Restore and check results
# shutdown server
# remove datadir
# xtrabackup move back
# restart
SELECT count(*) FROM t1;
count(*)
2
DROP TABLE t1;

View file

@ -0,0 +1,66 @@
#
# If MDEV-20755 bug is no fixed, incremental prepare will fail.
#
--source include/have_debug.inc
--source include/have_file_key_management.inc
--let $base_dir=$MYSQLTEST_VARDIR/tmp/backup
--let $inc_dir=$MYSQLTEST_VARDIR/tmp/backup_inc
SET @old_innodb_log_optimize_ddl=@@global.innodb_log_optimize_ddl;
SET GLOBAL innodb_log_optimize_ddl=ON;
# Disable pages flushing to allow redo log records to be executed on --prepare.
SET @old_debug_dbug=@@global.debug_dbug;
SET GLOBAL debug_dbug="+d,ib_log_checkpoint_avoid";
SET @old_innodb_page_cleaner_disabled_debug=@@global.innodb_page_cleaner_disabled_debug;
SET GLOBAL innodb_page_cleaner_disabled_debug=ON;
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--echo # backup
--disable_result_log
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$base_dir
--enable_result_log
# Do not log crypt data to avoid it's execution on --prepare.
SET GLOBAL debug_dbug="+d,ib_do_not_log_crypt_data";
INSERT INTO t1 VALUES (2);
--disable_result_log
# Execute OPTIMIZE TABLE after the table is copied to execute optimized ddl
# callback during backup, which, in turns, will create t1.new file in backup
# directory.
--let after_copy_test_t1=OPTIMIZE TABLE test.t1;
--echo # incremental backup
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$inc_dir --incremental-basedir=$base_dir --dbug=+d,mariabackup_events
--echo # prepare
--exec $XTRABACKUP --prepare --target-dir=$base_dir
# If the tablespace is created during delta tablespace open procedure, then
# crypt data will be not written, and page corruption test will not pass
# when some redo log event is executed, and --prepare will fail.
--echo # incremental prepare
--exec $XTRABACKUP --prepare --target-dir=$base_dir --incremental-dir=$inc_dir
--enable_result_log
SET GLOBAL innodb_log_optimize_ddl=@old_innodb_log_optimize_ddl;
SET GLOBAL innodb_page_cleaner_disabled_debug=@old_innodb_page_cleaner_disabled_debug;
SET GLOBAL debug_dbug=@old_debug_dbug;
--echo # Restore and check results
--let $targetdir=$base_dir
--source include/restart_and_restore.inc
--enable_result_log
SELECT count(*) FROM t1;
# Cleanup
DROP TABLE t1;
--rmdir $base_dir
--rmdir $inc_dir

View file

@ -1,5 +1,6 @@
CREATE TABLE t1(i INT PRIMARY KEY auto_increment, a int) ENGINE INNODB;
INSERT INTO t1(a) SELECT * from seq_1_to_10000;
SET GLOBAL innodb_log_optimize_ddl=ON;
# xtrabackup backup
t1.frm
t1.ibd

View file

@ -2,6 +2,7 @@
CREATE TABLE t1(i INT PRIMARY KEY auto_increment, a int) ENGINE INNODB;
INSERT INTO t1(a) SELECT * from seq_1_to_10000;
SET GLOBAL innodb_log_optimize_ddl=ON;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;

View file

@ -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

View file

@ -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';

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -153,6 +153,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.

View file

@ -1,272 +1,550 @@
52c52
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
64c64
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
76c76
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
88c88
< VARIABLE_TYPE BIGINT
---
> VARIABLE_TYPE INT
160c160
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
163c163
< NUMERIC_MAX_VALUE 9223372036854775807
---
> NUMERIC_MAX_VALUE 2147483647
196c196
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
232c232
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
292c292
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
388c388
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
424c424
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
448c448
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
460c460
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
463c463
< NUMERIC_MAX_VALUE 18446744073709551615
---
> NUMERIC_MAX_VALUE 4294967295
688c688
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
784c784
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
832c832
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
844c844
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
868c868
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
892c892
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
940c940
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
964c964
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1000c1000
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1012c1012
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1024c1024
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1036c1036
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1039c1039
< NUMERIC_MAX_VALUE 18446744073709551615
---
> NUMERIC_MAX_VALUE 4294967295
1060c1060
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1072c1072
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1096c1096
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1120c1120
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1123c1123
< NUMERIC_MAX_VALUE 18446744073709551615
---
> NUMERIC_MAX_VALUE 4294967295
1130c1130
< DEFAULT_VALUE 18446744073709551615
---
> DEFAULT_VALUE 4294967295
1132c1132
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1135c1135
< NUMERIC_MAX_VALUE 18446744073709551615
---
> NUMERIC_MAX_VALUE 4294967295
1192c1192
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1204c1204
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1207c1207
< NUMERIC_MAX_VALUE 9223372036854775807
---
> NUMERIC_MAX_VALUE 2147483647
1252c1252
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1300c1300
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1312c1312
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1315c1315
< NUMERIC_MAX_VALUE 18446744073709551615
---
> NUMERIC_MAX_VALUE 4294967295
1360c1360
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1363c1363
< NUMERIC_MAX_VALUE 18446744073709551615
---
> NUMERIC_MAX_VALUE 4294967295
1372c1372
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1492c1492
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1495c1495
< NUMERIC_MAX_VALUE 9223372036854775807
---
> NUMERIC_MAX_VALUE 2147483647
1516c1516
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1540c1540
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1552c1552
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1588c1588
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1600c1600
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1612c1612
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1636c1636
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1648c1648
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1672c1672
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1675c1675
< NUMERIC_MAX_VALUE 18446744073709551615
---
> NUMERIC_MAX_VALUE 4294967295
1696c1696
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1708c1708
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1756c1756
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1936c1936
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1960c1960
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
1963c1963
< NUMERIC_MAX_VALUE 18446744073709551615
---
> NUMERIC_MAX_VALUE 4294967295
1996c1996
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
2008c2008
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
2068c2068
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
2092c2092
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
2116c2116
< VARIABLE_TYPE BIGINT UNSIGNED
---
> VARIABLE_TYPE INT UNSIGNED
@@ -49,7 +49,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 8
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of InnoDB Adaptive Hash Index Partitions (default 8)
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 512
@@ -61,7 +61,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 150000
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The upper limit of the sleep delay in usec. Value of 0 disables it.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000000
@@ -73,7 +73,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 64
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Data file autoextend increment in megabytes
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1000
@@ -85,7 +85,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT
+VARIABLE_TYPE INT
VARIABLE_COMMENT The AUTOINC lock modes supported by InnoDB: 0 => Old style AUTOINC locking (for backward compatibility); 1 => New style AUTOINC locking; 2 => No AUTOINC locking (unsafe for SBR)
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2
@@ -157,10 +157,10 @@
SESSION_VALUE NULL
DEFAULT_VALUE 134217728
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Size of a single memory chunk within each buffer pool instance for resizing buffer pool. Online buffer pool resizing happens at this granularity. 0 means disable resizing buffer pool.
NUMERIC_MIN_VALUE 1048576
-NUMERIC_MAX_VALUE 9223372036854775807
+NUMERIC_MAX_VALUE 2147483647
NUMERIC_BLOCK_SIZE 1048576
ENUM_VALUE_LIST NULL
READ_ONLY YES
@@ -193,7 +193,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 25
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Dump only the hottest N% of each buffer pool, defaults to 25
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 100
@@ -229,7 +229,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of buffer pool instances, set to higher value on high-end machines to increase scalability
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64
@@ -289,7 +289,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT A number between [0, 100] that tells how oftern buffer pool dump status in percentages should be printed. E.g. 10 means that buffer pool dump status is printed when every 10% of number of buffer pool pages are dumped. Default is 0 (only start and end status is printed).
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
@@ -397,7 +397,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Helps in performance tuning in heavily concurrent environments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000
@@ -433,7 +433,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 5
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT If the compression failure rate of a table is greater than this number more padding is added to the pages to reduce the failures. A value of zero implies no padding
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
@@ -457,7 +457,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 50
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Percentage of empty space on a data page that can be reserved to make the page compressible.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 75
@@ -469,10 +469,10 @@
SESSION_VALUE NULL
DEFAULT_VALUE 5000
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket
NUMERIC_MIN_VALUE 1
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -697,7 +697,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 120
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of pages reserved in doublewrite buffer for batch flushing
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 127
@@ -793,7 +793,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 600
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
@@ -841,7 +841,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Make the first page of the given tablespace dirty.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
@@ -853,7 +853,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 30
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of iterations over which the background flushing is averaged.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1000
@@ -877,7 +877,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 3
@@ -901,7 +901,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Set to 0 (don't flush neighbors from buffer pool), 1 (flush contiguous neighbors from buffer pool) or 2 (flush neighbors from buffer pool), when flushing a block
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2
@@ -949,7 +949,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 6
@@ -973,7 +973,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 8000000
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT InnoDB Fulltext search cache size in bytes
NUMERIC_MIN_VALUE 1600000
NUMERIC_MAX_VALUE 80000000
@@ -1009,7 +1009,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 84
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT InnoDB Fulltext search maximum token size in characters
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 84
@@ -1021,7 +1021,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 3
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT InnoDB Fulltext search minimum token size in characters
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16
@@ -1033,7 +1033,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 2000
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT InnoDB Fulltext search number of words to optimize for each optimize table call
NUMERIC_MIN_VALUE 1000
NUMERIC_MAX_VALUE 10000
@@ -1045,10 +1045,10 @@
SESSION_VALUE NULL
DEFAULT_VALUE 2000000000
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT InnoDB Fulltext search query result cache limit in bytes
NUMERIC_MIN_VALUE 1000000
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -1069,7 +1069,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 2
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT InnoDB Fulltext search parallel sort degree, will round up to nearest power of 2 number
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 16
@@ -1081,7 +1081,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 640000000
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Total memory allocated for InnoDB Fulltext Search cache
NUMERIC_MIN_VALUE 32000000
NUMERIC_MAX_VALUE 1600000000
@@ -1105,7 +1105,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Up to what percentage of dirty pages should be flushed when innodb finds it has spare resources to do so.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
@@ -1141,22 +1141,22 @@
SESSION_VALUE NULL
DEFAULT_VALUE 200
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of IOPs the server can do. Tunes the background IO rate
NUMERIC_MIN_VALUE 100
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_IO_CAPACITY_MAX
SESSION_VALUE NULL
-DEFAULT_VALUE 18446744073709551615
+DEFAULT_VALUE 4294967295
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Limit to which innodb_io_capacity can be inflated.
NUMERIC_MIN_VALUE 100
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -1213,7 +1213,7 @@
SESSION_VALUE 50
DEFAULT_VALUE 50
VARIABLE_SCOPE SESSION
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1073741824
@@ -1225,10 +1225,10 @@
SESSION_VALUE NULL
DEFAULT_VALUE 16777216
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The size of the buffer which InnoDB uses to write log to the log files on disk.
NUMERIC_MIN_VALUE 262144
-NUMERIC_MAX_VALUE 9223372036854775807
+NUMERIC_MAX_VALUE 2147483647
NUMERIC_BLOCK_SIZE 1024
ENUM_VALUE_LIST NULL
READ_ONLY YES
@@ -1273,7 +1273,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 2
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of log files in the log group. InnoDB writes to the files in a circular fashion.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 100
@@ -1321,7 +1321,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 8192
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Redo log write ahead unit size to avoid read-on-write, it should match the OS cache block IO size
NUMERIC_MIN_VALUE 512
NUMERIC_MAX_VALUE 16384
@@ -1333,10 +1333,10 @@
SESSION_VALUE NULL
DEFAULT_VALUE 1024
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT How deep to scan LRU to keep it clean
NUMERIC_MIN_VALUE 100
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -1381,10 +1381,10 @@
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Desired maximum length of the purge queue (0 = no limit)
NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -1393,7 +1393,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Maximum delay of user threads in micro-seconds
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10000000
@@ -1525,10 +1525,10 @@
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT How many files at the maximum InnoDB keeps open at the same time.
NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 9223372036854775807
+NUMERIC_MAX_VALUE 2147483647
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
@@ -1549,7 +1549,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Page cleaner threads can be from 1 to 64. Default is 4.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64
@@ -1573,7 +1573,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 16
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of rw_locks protecting buffer pool page_hash. Rounded up to the next power of 2
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
@@ -1585,7 +1585,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 16384
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Page size to use for all InnoDB tablespaces.
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 65536
@@ -1621,7 +1621,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 300
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 5000
@@ -1633,7 +1633,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Dictates rate at which UNDO records are purged. Value N means purge rollback segment(s) on every Nth iteration of purge invocation
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
@@ -1645,7 +1645,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Purge threads can be from 1 to 32. Default is 4.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 32
@@ -1669,7 +1669,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 56
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64
@@ -1681,7 +1681,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of background read I/O threads in InnoDB.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64
@@ -1705,10 +1705,10 @@
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Replication thread delay (ms) on the slave server if innodb_thread_concurrency is reached (0 by default)
NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -1729,7 +1729,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of undo logs to use (deprecated).
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
@@ -1741,7 +1741,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT An InnoDB page number.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
@@ -1789,7 +1789,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Memory buffer size for index creation
NUMERIC_MIN_VALUE 65536
NUMERIC_MAX_VALUE 67108864
@@ -1969,7 +1969,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Size of the mutex/lock wait array.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
@@ -1993,10 +1993,10 @@
SESSION_VALUE NULL
DEFAULT_VALUE 30
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Count of spin-loop rounds in InnoDB mutexes (30 by default)
NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -2029,7 +2029,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000
@@ -2041,7 +2041,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 10000
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000000
@@ -2101,7 +2101,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of undo logs to use.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
@@ -2125,7 +2125,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of undo tablespaces to use.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 127
@@ -2149,7 +2149,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of background write I/O threads in InnoDB.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64

View file

@ -1307,10 +1307,10 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_LOG_OPTIMIZE_DDL
SESSION_VALUE NULL
DEFAULT_VALUE ON
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Reduce redo logging when natively creating indexes or rebuilding tables. Setting this OFF avoids delay due to page flushing and allows concurrent backup.
VARIABLE_COMMENT DEPRECATED. Ignored in MariaDB 10.5. Reduce redo logging when natively creating indexes or rebuilding tables. Enabling this may slow down backup and cause delay due to page flushing.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
@ -1401,6 +1401,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

View file

@ -2337,7 +2337,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT
VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 200
NUMERIC_MAX_VALUE 1048576
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES

View file

@ -2497,7 +2497,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT
VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 200
NUMERIC_MAX_VALUE 1048576
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES

View file

@ -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;

View file

@ -75,7 +75,7 @@ ENDIF()
ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES})
TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY}
${LIBNSL} ${LIBM} ${LIBRT} ${LIBDL} ${LIBSOCKET} ${LIBEXECINFO} ${CRC32_LIBRARY})
${LIBNSL} ${LIBM} ${LIBRT} ${CMAKE_DL_LIBS} ${LIBSOCKET} ${LIBEXECINFO} ${CRC32_LIBRARY})
DTRACE_INSTRUMENT(mysys)
IF(HAVE_BFD_H)

View file

@ -250,7 +250,7 @@ int init_io_cache(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)
@ -324,14 +324,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(master->buffer_length, MYF(0))))
if (!(slave_buf= (uchar*)my_malloc(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);

View file

@ -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})
INCLUDE(CheckCXXSymbolExists)

View file

@ -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)

View file

@ -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>

View file

@ -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>

View 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

View file

@ -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--)

View file

@ -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:;
}

View file

@ -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@')];

View file

@ -179,7 +179,7 @@ ADD_LIBRARY(sql STATIC ${SQL_SOURCE})
DTRACE_INSTRUMENT(sql)
TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS}
mysys mysys_ssl dbug strings vio pcre
${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT}
${LIBWRAP} ${LIBCRYPT} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}
${WSREP_LIB}
${SSL_LIBRARIES}
${LIBSYSTEMD})

View file

@ -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
};
@ -1696,6 +1695,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);
/**
@ -5430,7 +5431,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(); }

View file

@ -2316,7 +2316,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 "));
@ -3333,27 +3333,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(' ');
}
@ -5457,12 +5458,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());
}

View file

@ -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
@ -603,7 +603,7 @@ public:
longlong val_int();
enum Functype functype() const { return NOT_FUNC; }
const char *func_name() const { return "not"; }
enum precedence precedence() const { return BANG_PRECEDENCE; }
enum precedence precedence() const { return NEG_PRECEDENCE; }
Item *neg_transformer(THD *thd);
bool fix_fields(THD *, Item **);
virtual void print(String *str, enum_query_type query_type);
@ -2164,9 +2164,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)
@ -2182,7 +2184,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; }
};
@ -2447,7 +2448,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);
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
bool count_sargable_conds(void *arg);
@ -2771,7 +2772,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()
{
@ -2899,7 +2900,7 @@ public:
bool fix_fields(THD *thd, Item **ref);
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)
{

View file

@ -621,8 +621,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());
}

View file

@ -2425,6 +2425,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++)

View file

@ -3321,7 +3321,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);

View file

@ -637,7 +637,7 @@ public:
bool val_bool();
bool test_limit(st_select_lex_unit *unit);
void print(String *str, enum_query_type query_type);
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();
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);

View file

@ -2095,9 +2095,9 @@ static const char *interval_names[]=
void Item_date_add_interval::print(String *str, enum_query_type query_type)
{
args[0]->print_parenthesised(str, query_type, ADDINTERVAL_PRECEDENCE);
args[0]->print_parenthesised(str, query_type, INTERVAL_PRECEDENCE);
str->append(date_sub_interval?" - interval ":" + interval ");
args[1]->print_parenthesised(str, query_type, INTERVAL_PRECEDENCE);
args[1]->print(str, query_type);
str->append(' ');
str->append(interval_names[int_type]);
}

View file

@ -948,7 +948,7 @@ public:
bool fix_length_and_dec();
bool eq(const Item *item, bool binary_cmp) const;
void print(String *str, enum_query_type query_type);
enum precedence precedence() const { return ADDINTERVAL_PRECEDENCE; }
enum precedence precedence() const { return INTERVAL_PRECEDENCE; }
bool need_parentheses_in_default() { return true; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_date_add_interval>(thd, this); }

View file

@ -71,6 +71,16 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count)
DBUG_RETURN(1);
}
info->seek_not_done= 0;
if (info->next_file_user)
{
IO_CACHE *c;
for (c= info->next_file_user;
c!= info;
c= c->next_file_user)
{
c->seek_not_done= 1;
}
}
}
do

View file

@ -442,8 +442,11 @@ bool Session_sysvars_tracker::vars_list::store(THD *thd, String *buf)
show.name= svar->name.str;
show.value= (char *) svar;
mysql_mutex_lock(&LOCK_global_system_variables);
const char *value= get_one_variable(thd, &show, OPT_SESSION, SHOW_SYS, NULL,
&charset, val_buf, &val_length);
mysql_mutex_unlock(&LOCK_global_system_variables);
if (is_plugin)
mysql_mutex_unlock(&LOCK_plugin);

View file

@ -1068,7 +1068,6 @@ static void store_var(Field *field, sys_var *var, enum_var_type scope,
int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
{
char name_buffer[NAME_CHAR_LEN];
enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
bool res= 1;
CHARSET_INFO *scs= system_charset_info;
StringBuffer<STRING_BUFFER_USUAL_SIZE> strbuf(scs);
@ -1078,7 +1077,6 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
DBUG_ASSERT(tables->table->in_use == thd);
cond= make_cond_for_info_schema(thd, cond, tables);
thd->count_cuted_fields= CHECK_FIELD_WARN;
mysql_prlock_rdlock(&LOCK_system_variables_hash);
for (uint i= 0; i < system_variable_hash.records; i++)
@ -1243,7 +1241,6 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
res= 0;
end:
mysql_prlock_unlock(&LOCK_system_variables_hash);
thd->count_cuted_fields= save_count_cuted_fields;
return res;
}

View file

@ -294,8 +294,9 @@ ulong role_global_merges= 0, role_db_merges= 0, role_table_merges= 0,
static void update_hostname(acl_host_and_ip *host, const char *hostname);
static bool show_proxy_grants (THD *, const char *, const char *,
char *, size_t);
static bool show_role_grants(THD *, const char *, const char *,
static bool show_role_grants(THD *, const char *,
ACL_USER_BASE *, char *, size_t);
static bool show_default_role(THD *, ACL_USER *, char *, size_t);
static bool show_global_privileges(THD *, ACL_USER_BASE *,
bool, char *, size_t);
static bool show_database_privileges(THD *, const char *, const char *,
@ -8863,7 +8864,7 @@ static bool print_grants_for_role(THD *thd, ACL_ROLE * role)
{
char buff[1024];
if (show_role_grants(thd, role->user.str, "", role, buff, sizeof(buff)))
if (show_role_grants(thd, "", role, buff, sizeof(buff)))
return TRUE;
if (show_global_privileges(thd, role, TRUE, buff, sizeof(buff)))
@ -9108,7 +9109,7 @@ bool mysql_show_grants(THD *thd, LEX_USER *lex_user)
}
/* Show granted roles to acl_user */
if (show_role_grants(thd, username, hostname, acl_user, buff, sizeof(buff)))
if (show_role_grants(thd, hostname, acl_user, buff, sizeof(buff)))
goto end;
/* Add first global access grants */
@ -9165,6 +9166,14 @@ bool mysql_show_grants(THD *thd, LEX_USER *lex_user)
}
}
if (username)
{
/* Show default role to acl_user */
if (show_default_role(thd, acl_user, buff, sizeof(buff)))
goto end;
}
error= 0;
end:
mysql_mutex_unlock(&acl_cache->lock);
@ -9191,15 +9200,44 @@ static ROLE_GRANT_PAIR *find_role_grant_pair(const LEX_CSTRING *u,
my_hash_search(&acl_roles_mappings, (uchar*)pair_key.ptr(), key_length);
}
static bool show_role_grants(THD *thd, const char *username,
const char *hostname, ACL_USER_BASE *acl_entry,
static bool show_default_role(THD *thd, ACL_USER *acl_entry,
char *buff, size_t buffsize)
{
Protocol *protocol= thd->protocol;
LEX_CSTRING def_rolename= acl_entry->default_rolename;
if (def_rolename.length)
{
String def_str(buff, buffsize, system_charset_info);
def_str.length(0);
def_str.append(STRING_WITH_LEN("SET DEFAULT ROLE "));
def_str.append(&def_rolename);
def_str.append(" FOR '");
def_str.append(&acl_entry->user);
DBUG_ASSERT(!(acl_entry->flags & IS_ROLE));
def_str.append(STRING_WITH_LEN("'@'"));
def_str.append(acl_entry->host.hostname, acl_entry->hostname_length,
system_charset_info);
def_str.append('\'');
protocol->prepare_for_resend();
protocol->store(def_str.ptr(),def_str.length(),def_str.charset());
if (protocol->write())
{
return TRUE;
}
}
return FALSE;
}
static bool show_role_grants(THD *thd, const char *hostname,
ACL_USER_BASE *acl_entry,
char *buff, size_t buffsize)
{
uint counter;
Protocol *protocol= thd->protocol;
LEX_CSTRING host= {const_cast<char*>(hostname), strlen(hostname)};
String grant(buff,sizeof(buff),system_charset_info);
String grant(buff, buffsize, system_charset_info);
for (counter= 0; counter < acl_entry->role_grants.elements; counter++)
{
grant.length(0);
@ -9240,7 +9278,7 @@ static bool show_global_privileges(THD *thd, ACL_USER_BASE *acl_entry,
ulong want_access;
Protocol *protocol= thd->protocol;
String global(buff,sizeof(buff),system_charset_info);
String global(buff, buffsize, system_charset_info);
global.length(0);
global.append(STRING_WITH_LEN("GRANT "));
@ -9333,7 +9371,7 @@ static bool show_database_privileges(THD *thd, const char *username,
want_access=acl_db->initial_access;
if (want_access)
{
String db(buff,sizeof(buff),system_charset_info);
String db(buff, buffsize, system_charset_info);
db.length(0);
db.append(STRING_WITH_LEN("GRANT "));

Some files were not shown because too many files have changed in this diff Show more