1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 11.7 into main

This commit is contained in:
Marko Mäkelä
2024-12-02 17:55:44 +02:00
455 changed files with 6810 additions and 4327 deletions

View File

@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12) CMAKE_MINIMUM_REQUIRED(VERSION 3.12.0)
IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
# Setting build type to RelWithDebInfo as none was specified. # Setting build type to RelWithDebInfo as none was specified.

View File

@@ -3454,6 +3454,9 @@ static int com_charset(String *, char *line)
MYF(MY_UTF8_IS_UTF8MB3 | MY_WME)); MYF(MY_UTF8_IS_UTF8MB3 | MY_WME));
if (new_cs) if (new_cs)
{ {
if (new_cs->mbminlen > 1)
return put_info("Character sets with mbminlen>1 are not supported",
INFO_ERROR, 0);
charset_info= new_cs; charset_info= new_cs;
mysql_set_character_set(&mysql, charset_info->cs_name.str); mysql_set_character_set(&mysql, charset_info->cs_name.str);
default_charset= (char *)charset_info->cs_name.str; default_charset= (char *)charset_info->cs_name.str;

View File

@@ -43,6 +43,11 @@
#include "sql_priv.h" #include "sql_priv.h"
#include "sql_basic_types.h" #include "sql_basic_types.h"
#include <atomic> #include <atomic>
#if 0 /* FIXME: the following is broken for now */
# include "mariadb_rpl.h"
#else
enum Item_result {STRING_RESULT,REAL_RESULT,INT_RESULT,ROW_RESULT,DECIMAL_RESULT};
#endif
#include "log_event.h" #include "log_event.h"
#include "compat56.h" #include "compat56.h"
#include "sql_common.h" #include "sql_common.h"

View File

@@ -877,11 +877,10 @@ static void write_footer(FILE *sql_file)
} /* write_footer */ } /* write_footer */
uchar* get_table_key(const char *entry, size_t *length, const uchar *get_table_key(const void *entry, size_t *length, my_bool)
my_bool not_used __attribute__((unused)))
{ {
*length= strlen(entry); *length= strlen(static_cast<const char*>(entry));
return (uchar*) entry; return static_cast<const uchar*>(entry);
} }
@@ -1121,11 +1120,11 @@ static int get_options(int *argc, char ***argv)
load_defaults_or_exit("my", load_default_groups, argc, argv); load_defaults_or_exit("my", load_default_groups, argc, argv);
defaults_argv= *argv; defaults_argv= *argv;
if (my_hash_init(PSI_NOT_INSTRUMENTED, &ignore_database, charset_info, 16, 0, 0, if (my_hash_init(PSI_NOT_INSTRUMENTED, &ignore_database, charset_info, 16, 0,
(my_hash_get_key) get_table_key, my_free, 0)) 0, get_table_key, my_free, 0))
return(EX_EOM); return(EX_EOM);
if (my_hash_init(PSI_NOT_INSTRUMENTED, &ignore_table, charset_info, 16, 0, 0, if (my_hash_init(PSI_NOT_INSTRUMENTED, &ignore_table, charset_info, 16, 0, 0,
(my_hash_get_key) get_table_key, my_free, 0)) get_table_key, my_free, 0))
return(EX_EOM); return(EX_EOM);
/* Don't copy internal log tables */ /* Don't copy internal log tables */
if (my_hash_insert(&ignore_table, (uchar*) my_strdup(PSI_NOT_INSTRUMENTED, if (my_hash_insert(&ignore_table, (uchar*) my_strdup(PSI_NOT_INSTRUMENTED,
@@ -1141,7 +1140,7 @@ static int get_options(int *argc, char ***argv)
return(EX_EOM); return(EX_EOM);
if (my_hash_init(PSI_NOT_INSTRUMENTED, &ignore_data, charset_info, 16, 0, 0, if (my_hash_init(PSI_NOT_INSTRUMENTED, &ignore_data, charset_info, 16, 0, 0,
(my_hash_get_key) get_table_key, my_free, 0)) get_table_key, my_free, 0))
return(EX_EOM); return(EX_EOM);
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option))) if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
@@ -1865,7 +1864,7 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
query_length= my_snprintf(query_buffer, query_length= my_snprintf(query_buffer,
sizeof (query_buffer), sizeof (query_buffer),
"SET SESSION character_set_results = '%s'", "SET SESSION character_set_results = '%s'",
(const char *) cs_name); cs_name);
return mysql_real_query(mysql, query_buffer, (ulong)query_length); return mysql_real_query(mysql, query_buffer, (ulong)query_length);
} }

View File

@@ -998,7 +998,6 @@ end_thread:
cn->mysql= 0; cn->mysql= 0;
cn->query_done= 1; cn->query_done= 1;
mysql_thread_end(); mysql_thread_end();
pthread_exit(0);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@@ -2411,13 +2410,12 @@ static void strip_parentheses(struct st_command *command)
C_MODE_START C_MODE_START
static uchar *get_var_key(const uchar* var, size_t *len, static const uchar *get_var_key(const void *var, size_t *len, my_bool)
my_bool __attribute__((unused)) t)
{ {
char* key; char* key;
key = ((VAR*)var)->name; key= (static_cast<const VAR *>(var))->name;
*len = ((VAR*)var)->name_len; *len= (static_cast<const VAR *>(var))->name_len;
return (uchar*)key; return reinterpret_cast<const uchar *>(key);
} }
@@ -12282,8 +12280,10 @@ void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val)
keep_header If header should not be sorted keep_header If header should not be sorted
*/ */
static int comp_lines(const char **a, const char **b) static int comp_lines(const void *a_, const void *b_)
{ {
auto a= static_cast<const char *const *>(a_);
auto b= static_cast<const char *const *>(b_);
return (strcmp(*a,*b)); return (strcmp(*a,*b));
} }

View File

@@ -39,12 +39,23 @@ SET(MY_WARNING_FLAGS
-Woverloaded-virtual -Woverloaded-virtual
-Wvla -Wvla
-Wwrite-strings -Wwrite-strings
-Wcast-function-type-strict
)
# Warning flags that are in testing before moving
# to MY_WARNING_FLAGS if stable.
SET(MY_WARNING_FLAGS_NON_FATAL
) )
FOREACH(F ${MY_WARNING_FLAGS}) FOREACH(F ${MY_WARNING_FLAGS})
MY_CHECK_AND_SET_COMPILER_FLAG(${F} DEBUG RELWITHDEBINFO) MY_CHECK_AND_SET_COMPILER_FLAG(${F} DEBUG RELWITHDEBINFO)
ENDFOREACH() ENDFOREACH()
FOREACH(F ${MY_WARNING_FLAGS_NON_FATAL})
MY_CHECK_AND_SET_COMPILER_FLAG(-W${F} DEBUG RELWITHDEBINFO)
MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-error=${F} DEBUG RELWITHDEBINFO)
ENDFOREACH()
SET(MY_ERROR_FLAGS -Werror -fno-operator-names -Wsuggest-override) SET(MY_ERROR_FLAGS -Werror -fno-operator-names -Wsuggest-override)
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0") IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")

View File

@@ -76,6 +76,8 @@ static my_bool do_leaf;
static my_bool per_page_details; static my_bool per_page_details;
static ulint n_merge; static ulint n_merge;
static ulint physical_page_size; /* Page size in bytes on disk. */ static ulint physical_page_size; /* Page size in bytes on disk. */
static ulint extent_size;
static ulint xdes_size;
ulong srv_page_size; ulong srv_page_size;
uint32_t srv_page_size_shift; uint32_t srv_page_size_shift;
/* Current page number (0 based). */ /* Current page number (0 based). */
@@ -100,7 +102,7 @@ char* log_filename = NULL;
FILE* log_file = NULL; FILE* log_file = NULL;
/* Enabled for log write option. */ /* Enabled for log write option. */
static bool is_log_enabled = false; static bool is_log_enabled = false;
static bool skip_freed_pages;
static byte field_ref_zero_buf[UNIV_PAGE_SIZE_MAX]; static byte field_ref_zero_buf[UNIV_PAGE_SIZE_MAX];
const byte *field_ref_zero = field_ref_zero_buf; const byte *field_ref_zero = field_ref_zero_buf;
@@ -268,6 +270,8 @@ static void init_page_size(const byte* buf)
srv_page_size_shift = UNIV_ZIP_SIZE_SHIFT_MIN - 1 + ssize; srv_page_size_shift = UNIV_ZIP_SIZE_SHIFT_MIN - 1 + ssize;
srv_page_size = 512U << ssize; srv_page_size = 512U << ssize;
physical_page_size = srv_page_size; physical_page_size = srv_page_size;
extent_size = FSP_EXTENT_SIZE;
xdes_size = XDES_SIZE;
return; return;
} }
@@ -279,6 +283,8 @@ static void init_page_size(const byte* buf)
srv_page_size = fil_space_t::logical_size(flags); srv_page_size = fil_space_t::logical_size(flags);
physical_page_size = fil_space_t::physical_size(flags); physical_page_size = fil_space_t::physical_size(flags);
extent_size = FSP_EXTENT_SIZE;
xdes_size = XDES_SIZE;
} }
#ifdef _WIN32 #ifdef _WIN32
@@ -551,8 +557,8 @@ bool
is_page_doublewritebuffer( is_page_doublewritebuffer(
const byte* page) const byte* page)
{ {
if ((cur_page_num >= FSP_EXTENT_SIZE) if ((cur_page_num >= extent_size)
&& (cur_page_num < FSP_EXTENT_SIZE * 3)) { && (cur_page_num < extent_size * 3)) {
/* page is doublewrite buffer. */ /* page is doublewrite buffer. */
return (true); return (true);
} }
@@ -753,8 +759,8 @@ static inline bool is_page_free(const byte *xdes, ulint physical_page_size,
{ {
const byte *des= const byte *des=
xdes + XDES_ARR_OFFSET + xdes + XDES_ARR_OFFSET +
XDES_SIZE * ((page_no & (physical_page_size - 1)) / FSP_EXTENT_SIZE); xdes_size * ((page_no & (physical_page_size - 1)) / extent_size);
return xdes_is_free(des, page_no % FSP_EXTENT_SIZE); return xdes_is_free(des, page_no % extent_size);
} }
/* /*
@@ -782,6 +788,16 @@ parse_page(
/* Check whether page is doublewrite buffer. */ /* Check whether page is doublewrite buffer. */
str = skip_page ? "Double_write_buffer" : "-"; str = skip_page ? "Double_write_buffer" : "-";
page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
if (skip_freed_pages) {
const byte *des= xdes + XDES_ARR_OFFSET +
xdes_size * ((page_no & (physical_page_size - 1))
/ extent_size);
if (mach_read_from_4(des) != XDES_FSEG &&
xdes_is_free(des, page_no % extent_size)) {
return;
}
}
switch (fil_page_get_type(page)) { switch (fil_page_get_type(page)) {
@@ -1207,6 +1223,9 @@ static struct my_option innochecksum_options[] = {
&do_leaf, &do_leaf, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &do_leaf, &do_leaf, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"merge", 'm', "leaf page count if merge given number of consecutive pages", {"merge", 'm', "leaf page count if merge given number of consecutive pages",
&n_merge, &n_merge, 0, GET_ULONG, REQUIRED_ARG, 0, 0, (longlong)10L, 0, 1, 0}, &n_merge, &n_merge, 0, GET_ULONG, REQUIRED_ARG, 0, 0, (longlong)10L, 0, 1, 0},
{"skip-freed-pages", 'r', "skip freed pages for the tablespace",
&skip_freed_pages, &skip_freed_pages, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };
@@ -1216,7 +1235,7 @@ static void usage(void)
print_version(); print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
printf("InnoDB offline file checksum utility.\n"); printf("InnoDB offline file checksum utility.\n");
printf("Usage: %s [-c] [-s <start page>] [-e <end page>] " printf("Usage: %s [-c] [-r] [-s <start page>] [-e <end page>] "
"[-p <page>] [-i] [-v] [-a <allow mismatches>] [-n] " "[-p <page>] [-i] [-v] [-a <allow mismatches>] [-n] "
"[-S] [-D <page type dump>] " "[-S] [-D <page type dump>] "
"[-l <log>] [-l] [-m <merge pages>] <filename or [-]>\n", my_progname); "[-l <log>] [-l] [-m <merge pages>] <filename or [-]>\n", my_progname);
@@ -1229,7 +1248,7 @@ static void usage(void)
extern "C" my_bool extern "C" my_bool
innochecksum_get_one_option( innochecksum_get_one_option(
const struct my_option *opt, const struct my_option *opt,
const char *argument MY_ATTRIBUTE((unused)), const char *IF_DBUG(argument,),
const char *) const char *)
{ {
switch (opt->id) { switch (opt->id) {
@@ -1255,15 +1274,6 @@ innochecksum_get_one_option(
my_end(0); my_end(0);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
break; break;
case 'n':
no_check = true;
break;
case 'a':
case 'S':
break;
case 'w':
do_write = true;
break;
case 'D': case 'D':
page_type_dump = true; page_type_dump = true;
break; break;
@@ -1310,8 +1320,8 @@ get_options(
*/ */
static bool check_encryption(const char* filename, const byte* page) static bool check_encryption(const char* filename, const byte* page)
{ {
ulint offset = FSP_HEADER_OFFSET + XDES_ARR_OFFSET + XDES_SIZE * ulint offset = FSP_HEADER_OFFSET + XDES_ARR_OFFSET + xdes_size *
physical_page_size / FSP_EXTENT_SIZE; physical_page_size / extent_size;
if (memcmp(page + offset, CRYPT_MAGIC, MAGIC_SZ) != 0) { if (memcmp(page + offset, CRYPT_MAGIC, MAGIC_SZ) != 0) {
return false; return false;
@@ -1843,7 +1853,7 @@ first_non_zero:
printf("page " UINT32PF " ", cur_page_num); printf("page " UINT32PF " ", cur_page_num);
} }
if (page_get_page_no(buf) % physical_page_size == 0) { if (cur_page_num % physical_page_size == 0) {
memcpy(xdes, buf, physical_page_size); memcpy(xdes, buf, physical_page_size);
} }

View File

@@ -203,7 +203,7 @@ const char *encryption_plugin_get_config()
return encryption_plugin_config.c_str(); return encryption_plugin_config.c_str();
} }
extern int finalize_encryption_plugin(st_plugin_int *plugin); extern int finalize_encryption_plugin(void *plugin);
void encryption_plugin_prepare_init(int argc, char **argv) void encryption_plugin_prepare_init(int argc, char **argv)

View File

@@ -353,18 +353,19 @@ err:
} }
static static
uchar * const uchar *
get_file_entry_key(file_entry_t *entry, size_t *length, get_file_entry_key(const void *entry_, size_t *length, my_bool)
my_bool not_used __attribute__((unused)))
{ {
const file_entry_t *entry= static_cast<const file_entry_t *>(entry_);
*length= entry->pathlen; *length= entry->pathlen;
return (uchar *) entry->path; return reinterpret_cast<const uchar *>(entry->path);
} }
static static
void void
file_entry_free(file_entry_t *entry) file_entry_free(void *entry_)
{ {
file_entry_t *entry= static_cast<file_entry_t *>(entry_);
pthread_mutex_destroy(&entry->mutex); pthread_mutex_destroy(&entry->mutex);
ds_close(entry->file); ds_close(entry->file);
my_free(entry->path); my_free(entry->path);
@@ -541,8 +542,9 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
int ret = 0; int ret = 0;
if (my_hash_init(PSI_NOT_INSTRUMENTED, &filehash, &my_charset_bin, if (my_hash_init(PSI_NOT_INSTRUMENTED, &filehash, &my_charset_bin,
START_FILE_HASH_SIZE, 0, 0, (my_hash_get_key) get_file_entry_key, START_FILE_HASH_SIZE, 0, 0, get_file_entry_key,
(my_hash_free_key) file_entry_free, MYF(0))) { file_entry_free, MYF(0)))
{
msg("%s: failed to initialize file hash.", my_progname); msg("%s: failed to initialize file hash.", my_progname);
return 1; return 1;
} }

View File

@@ -1185,7 +1185,7 @@ static void backup_file_op_fail(uint32_t space_id, int type,
const byte* new_name, ulint new_len) const byte* new_name, ulint new_len)
{ {
bool fail = false; bool fail = false;
const static std::string spacename{filename_to_spacename(name, len)}; const std::string spacename{filename_to_spacename(name, len)};
switch (type) { switch (type) {
case FILE_CREATE: case FILE_CREATE:
msg("DDL tracking : create %u \"%.*s\"", space_id, int(len), name); msg("DDL tracking : create %u \"%.*s\"", space_id, int(len), name);
@@ -2978,25 +2978,19 @@ my_bool regex_list_check_match(
return(FALSE); return(FALSE);
} }
static static bool find_filter_in_hashtable(const char *name, hash_table_t *table,
my_bool xb_filter_entry_t **result) noexcept
find_filter_in_hashtable(
const char* name,
hash_table_t* table,
xb_filter_entry_t** result
)
{ {
xb_filter_entry_t* found = NULL;
const ulint fold= my_crc32c(0, name, strlen(name)); const ulint fold= my_crc32c(0, name, strlen(name));
HASH_SEARCH(name_hash, table, fold, if (auto found= table->cell_get(fold)->
xb_filter_entry_t*, find(&xb_filter_entry_t::name_hash,[name](xb_filter_entry_t *f)
found, (void) 0, { return !strcmp(f->name, name); }))
!strcmp(found->name, name)); {
if (result)
if (found && result) {
*result= found; *result= found;
return true;
} }
return (found != NULL); return false;
} }
/************************************************************************ /************************************************************************
@@ -4480,11 +4474,10 @@ xb_add_filter(
{ {
xb_filter_entry_t *entry= xb_new_filter_entry(name); xb_filter_entry_t *entry= xb_new_filter_entry(name);
if (UNIV_UNLIKELY(!hash->array)) { if (UNIV_UNLIKELY(!hash->array))
hash->create(1000); hash->create(1000);
} hash->cell_get(my_crc32c(0, entry->name, strlen(entry->name)))->
const ulint fold = my_crc32c(0, entry->name, strlen(entry->name)); append(*entry, &xb_filter_entry_t::name_hash);
HASH_INSERT(xb_filter_entry_t, name_hash, hash, fold, entry);
return entry; return entry;
} }
@@ -4523,12 +4516,8 @@ xb_register_filter_entry(
hash_table_t* tables_hash hash_table_t* tables_hash
) )
{ {
const char* p; size_t namelen = strlen(name);
size_t namelen; if (const char* p = strchr(name, '.')) {
xb_filter_entry_t* db_entry = NULL;
namelen = strlen(name);
if ((p = strchr(name, '.')) != NULL) {
char dbname[NAME_LEN + 1]; char dbname[NAME_LEN + 1];
xb_validate_name(name, p - name); xb_validate_name(name, p - name);
@@ -4537,18 +4526,20 @@ xb_register_filter_entry(
strncpy(dbname, name, p - name); strncpy(dbname, name, p - name);
dbname[p - name] = 0; dbname[p - name] = 0;
if (databases_hash && databases_hash->array) { if (UNIV_UNLIKELY(!databases_hash->array)) {
const ulint fold = my_crc32c(0, dbname, p - name); databases_hash->create(1000);
HASH_SEARCH(name_hash, databases_hash,
fold,
xb_filter_entry_t*,
db_entry, (void) 0,
!strcmp(db_entry->name, dbname));
} }
if (!db_entry) {
db_entry = xb_add_filter(dbname, databases_hash); xb_filter_entry_t **prev =
databases_hash->cell_get(my_crc32c(0, name, p - name))
->search(&xb_filter_entry_t::name_hash,
[dbname](xb_filter_entry_t* f)
{ return f && !strcmp(f->name, dbname); });
if (!*prev) {
(*prev = xb_new_filter_entry(dbname))
->has_tables = TRUE;
} }
db_entry->has_tables = TRUE; ut_ad((*prev)->has_tables);
xb_add_filter(name, tables_hash); xb_add_filter(name, tables_hash);
} else { } else {
xb_validate_name(name, namelen); xb_validate_name(name, namelen);
@@ -4731,32 +4722,16 @@ xb_filters_init()
} }
} }
static static void xb_filter_hash_free(hash_table_t* hash)
void
xb_filter_hash_free(hash_table_t* hash)
{ {
ulint i; for (ulint i= 0; i < hash->n_cells; i++)
for (auto prev= static_cast<xb_filter_entry_t*>(hash->array[i].node);
/* free the hash elements */ prev; )
for (i = 0; i < hash->n_cells; i++) { {
xb_filter_entry_t* table; auto next= prev->name_hash;
free(prev);
table = static_cast<xb_filter_entry_t *> prev= next;
(HASH_GET_FIRST(hash, i));
while (table) {
xb_filter_entry_t* prev_table = table;
table = static_cast<xb_filter_entry_t *>
(HASH_GET_NEXT(name_hash, prev_table));
const ulint fold = my_crc32c(0, prev_table->name,
strlen(prev_table->name));
HASH_DELETE(xb_filter_entry_t, name_hash, hash,
fold, prev_table);
free(prev_table);
} }
}
hash->free(); hash->free();
} }
@@ -6025,8 +6000,8 @@ exit:
table->name = ((char*)table) + sizeof(xb_filter_entry_t); table->name = ((char*)table) + sizeof(xb_filter_entry_t);
memcpy(table->name, dest_space_name, len + 1); memcpy(table->name, dest_space_name, len + 1);
const ulint fold = my_crc32c(0, dest_space_name, len); const ulint fold = my_crc32c(0, dest_space_name, len);
HASH_INSERT(xb_filter_entry_t, name_hash, &inc_dir_tables_hash, inc_dir_tables_hash.cell_get(fold)->append(
fold, table); *table, &xb_filter_entry_t::name_hash);
mysql_mutex_lock(&fil_system.mutex); mysql_mutex_lock(&fil_system.mutex);
fil_space = fil_space_get_by_name(dest_space_name); fil_space = fil_space_get_by_name(dest_space_name);
@@ -6446,8 +6421,8 @@ static ibool prepare_handle_new_files(const char *data_home_dir,
strcpy(table->name, table_name.c_str()); strcpy(table->name, table_name.c_str());
const ulint fold = my_crc32c(0, table->name, const ulint fold = my_crc32c(0, table->name,
table_name.size()); table_name.size());
HASH_INSERT(xb_filter_entry_t, name_hash, &inc_dir_tables_hash, inc_dir_tables_hash.cell_get(fold)->append(
fold, table); *table, &xb_filter_entry_t::name_hash);
} }
return TRUE; return TRUE;
@@ -6463,31 +6438,17 @@ rm_if_not_found(
const char* data_home_dir, /*!<in: path to datadir */ const char* data_home_dir, /*!<in: path to datadir */
const char* db_name, /*!<in: database name */ const char* db_name, /*!<in: database name */
const char* file_name, /*!<in: file name with suffix */ const char* file_name, /*!<in: file name with suffix */
void* arg __attribute__((unused))) void*)
{ {
char name[FN_REFLEN]; char name[FN_REFLEN];
xb_filter_entry_t* table;
snprintf(name, FN_REFLEN, "%s/%s", db_name, file_name);
/* Truncate ".ibd" */ /* Truncate ".ibd" */
const size_t len = strlen(name) - 4; name[snprintf(name, FN_REFLEN, "%s/%s", db_name, file_name) - 4]= '\0';
name[len] = '\0'; if (find_filter_in_hashtable(name, &inc_dir_tables_hash, nullptr))
const ulint fold = my_crc32c(0, name, len); return true;
snprintf(name, FN_REFLEN, "%s/%s/%s", data_home_dir, db_name, file_name);
HASH_SEARCH(name_hash, &inc_dir_tables_hash, fold,
xb_filter_entry_t*,
table, (void) 0,
!strcmp(table->name, name));
if (!table) {
snprintf(name, FN_REFLEN, "%s/%s/%s", data_home_dir,
db_name, file_name);
return os_file_delete(0, name); return os_file_delete(0, name);
} }
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. by provided suffix. For each entry callback is called.

View File

@@ -49,7 +49,7 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log", (char**) &default_dbug_option, {"debug", '#', "Output debug log", (char**) &default_dbug_option,
(char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
{"mysqld", 0, "Read the same set of groups that the mysqld binary does.", {"mysqld", 0, "Read the same set of groups that the mariadbd (previously known as mysqld) binary does.",
&opt_mysqld, &opt_mysqld, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_mysqld, &opt_mysqld, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"mariadbd", 0, "Read the same set of groups that the mariadbd binary does.", {"mariadbd", 0, "Read the same set of groups that the mariadbd binary does.",
&opt_mysqld, &opt_mysqld, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_mysqld, &opt_mysqld, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -116,7 +116,7 @@ static int get_options(int *argc,char ***argv)
int ho_error; int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error); cleanup_and_exit(ho_error);
return 0; return 0;
} }
@@ -160,7 +160,8 @@ int main(int argc, char **argv)
load_default_groups=(char**) my_malloc(PSI_NOT_INSTRUMENTED, load_default_groups=(char**) my_malloc(PSI_NOT_INSTRUMENTED,
nargs*sizeof(char*), MYF(MY_WME)); nargs*sizeof(char*), MYF(MY_WME));
if (!load_default_groups) if (!load_default_groups)
exit(1); cleanup_and_exit(1);
if (opt_mysqld) if (opt_mysqld)
{ {
for (; mysqld_groups[i]; i++) for (; mysqld_groups[i]; i++)

View File

@@ -42,6 +42,7 @@ SET(HEADERS
my_dbug.h my_dbug.h
m_string.h m_string.h
my_sys.h my_sys.h
my_cmp.h
my_xml.h my_xml.h
mysql_embed.h mysql_embed.h
my_decimal_limits.h my_decimal_limits.h

View File

@@ -42,7 +42,7 @@ extern "C" {
#define HASH_THREAD_SPECIFIC 2 /* Mark allocated memory THREAD_SPECIFIC */ #define HASH_THREAD_SPECIFIC 2 /* Mark allocated memory THREAD_SPECIFIC */
typedef uint32 my_hash_value_type; typedef uint32 my_hash_value_type;
typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool); typedef const uchar *(*my_hash_get_key)(const void *, size_t *, my_bool);
typedef my_hash_value_type (*my_hash_function)(CHARSET_INFO *, typedef my_hash_value_type (*my_hash_function)(CHARSET_INFO *,
const uchar *, size_t); const uchar *, size_t);
typedef void (*my_hash_free_key)(void *); typedef void (*my_hash_free_key)(void *);

25
include/my_cmp.h Normal file
View File

@@ -0,0 +1,25 @@
/* Copyright (c) 2024, 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
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
typedef int (*qsort_cmp)(const void *, const void *);
typedef int (*qsort_cmp2)(void *param, const void *a, const void *b);
#ifdef __cplusplus
}
#endif

View File

@@ -540,10 +540,9 @@ typedef int pbool; /* Mixed prototypes can't take char */
typedef int pshort; /* Mixed prototypes can't take short int */ typedef int pshort; /* Mixed prototypes can't take short int */
typedef double pfloat; /* Mixed prototypes can't take float */ typedef double pfloat; /* Mixed prototypes can't take float */
#endif #endif
C_MODE_START
typedef int (*qsort_cmp)(const void *,const void *); #include <my_cmp.h>
typedef int (*qsort_cmp2)(void*, const void *,const void *);
C_MODE_END
#define qsort_t RETQSORTTYPE /* Broken GCC can't handle typedef !!!! */ #define qsort_t RETQSORTTYPE /* Broken GCC can't handle typedef !!!! */
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>

View File

@@ -230,8 +230,8 @@ static inline ulonglong my_timer_cycles(void)
ulonglong result; ulonglong result;
__asm __volatile__("rdtime %0" : "=r"(result)); __asm __volatile__("rdtime %0" : "=r"(result));
return result; return result;
}
# endif # endif
}
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME) #elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
#define MY_TIMER_ROUTINE_CYCLES MY_TIMER_ROUTINE_GETHRTIME #define MY_TIMER_ROUTINE_CYCLES MY_TIMER_ROUTINE_GETHRTIME
/* gethrtime may appear as either cycle or nanosecond counter */ /* gethrtime may appear as either cycle or nanosecond counter */

View File

@@ -29,6 +29,7 @@ C_MODE_START
#include <stdarg.h> #include <stdarg.h>
#include <typelib.h> #include <typelib.h>
#include <my_alloca.h> #include <my_alloca.h>
#include <my_cmp.h>
#include <mysql/plugin.h> #include <mysql/plugin.h>
#include <mysql/service_my_print_error.h> #include <mysql/service_my_print_error.h>
@@ -501,8 +502,6 @@ typedef struct st_io_cache /* Used when caching files */
size_t alloced_buffer; size_t alloced_buffer;
} IO_CACHE; } IO_CACHE;
typedef int (*qsort2_cmp)(const void *, const void *, const void *);
typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...) typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...)
ATTRIBUTE_FORMAT_FPTR(printf, 2, 3); ATTRIBUTE_FORMAT_FPTR(printf, 2, 3);
@@ -806,8 +805,8 @@ extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
extern qsort_t my_qsort(void *base_ptr, size_t total_elems, size_t size, extern qsort_t my_qsort(void *base_ptr, size_t total_elems, size_t size,
qsort_cmp cmp); qsort_cmp cmp);
extern qsort_t my_qsort2(void *base_ptr, size_t total_elems, size_t size, extern qsort_t my_qsort2(void *base_ptr, size_t total_elems, size_t size,
qsort2_cmp cmp, void *cmp_argument); qsort_cmp2 cmp, void *cmp_argument);
extern qsort2_cmp get_ptr_compare(size_t); extern qsort_cmp2 get_ptr_compare(size_t);
void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos); void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos);
my_off_t my_get_ptr(uchar *ptr, size_t pack_length); my_off_t my_get_ptr(uchar *ptr, size_t pack_length);
extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize, extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize,

View File

@@ -374,7 +374,7 @@ typedef struct st_mi_sort_param
my_bool fix_datafile, master; my_bool fix_datafile, master;
my_bool calc_checksum; /* calculate table checksum */ my_bool calc_checksum; /* calculate table checksum */
int (*key_cmp)(struct st_mi_sort_param *, const void *, const void *); int (*key_cmp)(void *, const void *, const void *);
int (*key_read)(struct st_mi_sort_param *,void *); int (*key_read)(struct st_mi_sort_param *,void *);
int (*key_write)(struct st_mi_sort_param *, const void *); int (*key_write)(struct st_mi_sort_param *, const void *);
void (*lock_in_memory)(HA_CHECK *); void (*lock_in_memory)(HA_CHECK *);

View File

@@ -31,6 +31,8 @@
#ifndef _queues_h #ifndef _queues_h
#define _queues_h #define _queues_h
#include <my_cmp.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@@ -44,7 +46,7 @@ typedef struct st_queue {
uint offset_to_queue_pos; /* If we want to store position in element */ uint offset_to_queue_pos; /* If we want to store position in element */
uint auto_extent; uint auto_extent;
int max_at_top; /* Normally 1, set to -1 if queue_top gives max */ int max_at_top; /* Normally 1, set to -1 if queue_top gives max */
int (*compare)(void *, uchar *,uchar *); qsort_cmp2 compare;
} QUEUE; } QUEUE;
#define queue_first_element(queue) 1 #define queue_first_element(queue) 1
@@ -58,14 +60,13 @@ typedef struct st_queue {
#define queue_set_max_at_top(queue, set_arg) \ #define queue_set_max_at_top(queue, set_arg) \
(queue)->max_at_top= set_arg ? -1 : 1 (queue)->max_at_top= set_arg ? -1 : 1
#define queue_remove_top(queue_arg) queue_remove((queue_arg), queue_first_element(queue_arg)) #define queue_remove_top(queue_arg) queue_remove((queue_arg), queue_first_element(queue_arg))
typedef int (*queue_compare)(void *,uchar *, uchar *);
int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key, int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
my_bool max_at_top, queue_compare compare, my_bool max_at_top, qsort_cmp2 compare,
void *first_cmp_arg, uint offset_to_queue_pos, void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent); uint auto_extent);
int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key, int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
my_bool max_at_top, queue_compare compare, my_bool max_at_top, qsort_cmp2 compare,
void *first_cmp_arg, uint offset_to_queue_pos, void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent); uint auto_extent);
int resize_queue(QUEUE *queue, uint max_elements); int resize_queue(QUEUE *queue, uint max_elements);

View File

@@ -15,8 +15,17 @@
# file. By default the search happens from the last CURRENT_TEST: # file. By default the search happens from the last CURRENT_TEST:
# marker till the end of file (appropriate for searching error logs). # marker till the end of file (appropriate for searching error logs).
# #
# Optionally, SEARCH_ABORT can be set to "FOUND" or "NOT FOUND" and this # Optionally, SEARCH_ABORT can be specified to abort the search (in error)
# will abort if the search result doesn't match the requested one. # if a specific search result is found. Its value is a regular expression
# (with an implicit start-of-string anchor '^' prepended), and the search
# result that it will match against is either 1) "FOUND <N>", where <N> is
# the specific number of matches found, or 2) "NOT FOUND".
#
# Optionally, SEARCH_WAIT can be specified to wait for a specific search
# result. Its usage mimics that of SEARCH_ABORT, in that its value is also
# a '^'-prepended regular expression, which will be matched against the same
# search result. The timeout can be set in SEARCH_TIMEOUT, default is 60
# seconds.
# #
# Optionally, SEARCH_WAIT can be set to "FOUND" or "NOT FOUND", and this # Optionally, SEARCH_WAIT can be set to "FOUND" or "NOT FOUND", and this
# will wait for the condition to occur. The timeout can be set in # will wait for the condition to occur. The timeout can be set in
@@ -91,8 +100,7 @@ perl;
@matches= ($content =~ /$search_pattern/gs); @matches= ($content =~ /$search_pattern/gs);
$res=@matches ? "FOUND " . scalar(@matches) : "NOT FOUND"; $res=@matches ? "FOUND " . scalar(@matches) : "NOT FOUND";
if (($ENV{SEARCH_WAIT} eq 'FOUND' && $res eq 'NOT FOUND') || if ($ENV{SEARCH_WAIT} and not $res =~ /^$ENV{SEARCH_WAIT}/) {
($ENV{SEARCH_WAIT} eq 'NOT FOUND' && $res =~ m{^FOUND })) {
if (time() - $start_time < $timeout) { if (time() - $start_time < $timeout) {
# Millisceond sleep emulated with select # Millisceond sleep emulated with select
select(undef, undef, undef, 0.1); select(undef, undef, undef, 0.1);

View File

@@ -1,55 +0,0 @@
# ==== Purpose ====
#
# Waits until pattern comes into log file or until a timeout is reached.
# This is a timeout wrapper for search_pattern_in_file.inc
#
#
# ==== Usage ====
#
# [--let $timeout= NUMBER in seconds]
# For other parameters, check search_pattern_in_file.inc
--let $wait_save_keep_include_silent=$keep_include_silent
--let $include_filename= wait_for_pattern_in_file.inc
--source include/begin_include_file.inc
--let $keep_include_silent= 1
let $_timeout= $timeout;
if (!$_timeout)
{
let $_timeout= 10;
if ($VALGRIND_TEST)
{
let $_timeout= 30;
}
}
let $_timeout_counter=`SELECT $_timeout * 10`;
let SEARCH_ABORT=NOT FOUND;
let $_continue= 1;
disable_abort_on_error;
while ($_continue)
{
source include/search_pattern_in_file.inc;
if (!$errno)
{
# Found match
let $_continue= 0;
}
if ($errno)
{
dec $_timeout_counter;
if ($_timeout_counter == 1)
{
enable_abort_on_error;
}
if (!$_timeout_counter)
{
let $_continue= 0;
}
}
}
enable_abort_on_error;
--source include/end_include_file.inc
--let $keep_include_silent=$wait_save_keep_include_silent

View File

@@ -2983,4 +2983,39 @@ t2 CREATE TABLE `t2` (
`c` text /*M!100301 COMPRESSED*/ DEFAULT NULL `c` text /*M!100301 COMPRESSED*/ DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
drop table t1, t2; drop table t1, t2;
#
# MDEV-16698 ASAN: heap-use-after-free in field_longstr::uncompress
#
CREATE TABLE t5 (
i1 smallint(11) unsigned zerofill ,
e1 enum('','a') ,
b1 mediumblob /*!100301 COMPRESSED*/ ,
d2 date NOT NULL DEFAULT '1900-01-01',
pk bigint(20) unsigned NOT NULL DEFAULT 0,
d1 timestamp NULL ,
v1 varbinary(3362) ,
t1 time NOT NULL DEFAULT '00:00:00'
);
INSERT INTO t5 VALUES
(00000000004,'','ufhjdtv','1992-07-25',1,'2035-06-05 09:02:48','f','13:25:21'),
(00000000001,'','jdt','1998-07-03',2,'1994-05-05 19:59:20','','09:09:19'),
(00000000000,'','d','2007-12-05',3,'0000-00-00 00:00:00','tvs','02:51:15');
SELECT GROUP_CONCAT(t5.i1, IF(t5.e1, t5.b1, t5.e1),
IF(t5.d1, t5.t1, t5.d1), t5.v1,
IF(t5.i1, t5.i1, t5.d2), t5.v1, t5.b1
ORDER BY 2,6 SEPARATOR ';')
FROM (t5 JOIN t5 AS tt ON (tt.pk != t5.pk));
DROP TABLE t5;
create table t1 (pk int not null, b1 blob compressed, v1 varbinary(100))engine=innodb;
insert into t1 values (1,'ufhjdtv','f'),(2,'jdt',''),(3,'d','tvs');
select group_concat(t1.v1, t1.b1 order by 1) from (t1 join t1 as tt on (tt.pk != t1.pk));
group_concat(t1.v1, t1.b1 order by 1)
jdt,jdt,fufhjdtv,fufhjdtv,tvsd,tvsd
drop table t1;
CREATE TABLE t1 (a CHAR(1), b TEXT /*!100302 COMPRESSED */);
INSERT INTO t1 VALUES ('c','n'),('d','mmmmmmmmmm');
SELECT GROUP_CONCAT( b, a ORDER BY 2 ) AS f FROM t1;
f
nc,mmmmmmmmmmd
DROP TABLE t1;
# End of 10.5 tests # End of 10.5 tests

View File

@@ -487,4 +487,41 @@ create table t2 as select group_concat(c order by 1), concat(c), c from t1;
show create table t2; show create table t2;
drop table t1, t2; drop table t1, t2;
--echo #
--echo # MDEV-16698 ASAN: heap-use-after-free in field_longstr::uncompress
--echo #
CREATE TABLE t5 (
i1 smallint(11) unsigned zerofill ,
e1 enum('','a') ,
b1 mediumblob /*!100301 COMPRESSED*/ ,
d2 date NOT NULL DEFAULT '1900-01-01',
pk bigint(20) unsigned NOT NULL DEFAULT 0,
d1 timestamp NULL ,
v1 varbinary(3362) ,
t1 time NOT NULL DEFAULT '00:00:00'
);
INSERT INTO t5 VALUES
(00000000004,'','ufhjdtv','1992-07-25',1,'2035-06-05 09:02:48','f','13:25:21'),
(00000000001,'','jdt','1998-07-03',2,'1994-05-05 19:59:20','','09:09:19'),
(00000000000,'','d','2007-12-05',3,'0000-00-00 00:00:00','tvs','02:51:15');
--disable_result_log
SELECT GROUP_CONCAT(t5.i1, IF(t5.e1, t5.b1, t5.e1),
IF(t5.d1, t5.t1, t5.d1), t5.v1,
IF(t5.i1, t5.i1, t5.d2), t5.v1, t5.b1
ORDER BY 2,6 SEPARATOR ';')
FROM (t5 JOIN t5 AS tt ON (tt.pk != t5.pk));
DROP TABLE t5;
--enable_result_log
create table t1 (pk int not null, b1 blob compressed, v1 varbinary(100))engine=innodb;
insert into t1 values (1,'ufhjdtv','f'),(2,'jdt',''),(3,'d','tvs');
select group_concat(t1.v1, t1.b1 order by 1) from (t1 join t1 as tt on (tt.pk != t1.pk));
drop table t1;
CREATE TABLE t1 (a CHAR(1), b TEXT /*!100302 COMPRESSED */);
INSERT INTO t1 VALUES ('c','n'),('d','mmmmmmmmmm');
SELECT GROUP_CONCAT( b, a ORDER BY 2 ) AS f FROM t1;
DROP TABLE t1;
--echo # End of 10.5 tests --echo # End of 10.5 tests

View File

@@ -3455,3 +3455,51 @@ DROP TABLE t1;
# #
# End of 10.5 tests # End of 10.5 tests
# #
#
# Start of 10.11 tests
#
#
# MDEV-28767 Collation "binary" is not accepted for databases, tables, columns
#
CREATE TABLE t1 (a CHAR(1) COLLATE binary);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` binary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
CREATE TABLE t1 (a enum('a') CHARACTER SET binary COLLATE binary DEFAULT NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('a') CHARACTER SET binary DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
CREATE TABLE t1 (a enum('a') COLLATE binary DEFAULT NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('a') CHARACTER SET binary DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(1) CHARACTER SET latin1 COLLATE binary);
ERROR 42000: COLLATION 'binary' is not valid for CHARACTER SET 'latin1'
CREATE TABLE t1 (a CHAR(10)) COLLATE binary;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` binary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=binary
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10)) CHARACTER SET latin1 COLLATE binary;
ERROR 42000: COLLATION 'binary' is not valid for CHARACTER SET 'latin1'
CREATE DATABASE db1 COLLATE binary;
SHOW CREATE DATABASE db1;
Database Create Database
db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET binary */
DROP DATABASE db1;
CREATE DATABASE db1 CHARACTER SET latin1 COLLATE binary;
ERROR 42000: COLLATION 'binary' is not valid for CHARACTER SET 'latin1'
#
# End of 10.11 tests
#

View File

@@ -294,3 +294,50 @@ DROP TABLE t1;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #
--echo #
--echo # Start of 10.11 tests
--echo #
--echo #
--echo # MDEV-28767 Collation "binary" is not accepted for databases, tables, columns
--echo #
# Column level
CREATE TABLE t1 (a CHAR(1) COLLATE binary);
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a enum('a') CHARACTER SET binary COLLATE binary DEFAULT NULL);
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a enum('a') COLLATE binary DEFAULT NULL);
SHOW CREATE TABLE t1;
DROP TABLE t1;
--error ER_COLLATION_CHARSET_MISMATCH
CREATE TABLE t1 (a CHAR(1) CHARACTER SET latin1 COLLATE binary);
# Table level
CREATE TABLE t1 (a CHAR(10)) COLLATE binary;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--error ER_COLLATION_CHARSET_MISMATCH
CREATE TABLE t1 (a CHAR(10)) CHARACTER SET latin1 COLLATE binary;
# Database level
CREATE DATABASE db1 COLLATE binary;
SHOW CREATE DATABASE db1;
DROP DATABASE db1;
--error ER_COLLATION_CHARSET_MISMATCH
CREATE DATABASE db1 CHARACTER SET latin1 COLLATE binary;
--echo #
--echo # End of 10.11 tests
--echo #

View File

@@ -161,6 +161,21 @@ ERROR 42000: Column length too big for column 'a' (max = 204); use BLOB or TEXT
DROP TABLE t1; DROP TABLE t1;
# End of 10.5 tests # End of 10.5 tests
# #
# Start of 10.6 tests
#
#
# MDEV-35393 ASAN unknown-crash in Field_varstring::reset when inserting NULL value to a table with filename charset
#
SET sql_mode='';
CREATE TABLE t (a CHAR(205)) ENGINE=MYISAM CHARACTER SET filename;
Warnings:
Note 1246 Converting column 'a' from CHAR to VARCHAR
INSERT INTO t VALUES (NULL);
DROP TABLE t;
#
# End of 10.6 tests
#
#
# Start of 10.9 tests # Start of 10.9 tests
# #
# #

View File

@@ -168,6 +168,24 @@ DROP TABLE t1;
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo #
--echo # Start of 10.6 tests
--echo #
--echo #
--echo # MDEV-35393 ASAN unknown-crash in Field_varstring::reset when inserting NULL value to a table with filename charset
--echo #
SET sql_mode='';
CREATE TABLE t (a CHAR(205)) ENGINE=MYISAM CHARACTER SET filename;
INSERT INTO t VALUES (NULL);
DROP TABLE t;
--echo #
--echo # End of 10.6 tests
--echo #
--echo # --echo #
--echo # Start of 10.9 tests --echo # Start of 10.9 tests
--echo # --echo #

View File

@@ -0,0 +1,18 @@
#
# Start of 10.6 tests
#
#
# MDEV-35392 Assertion `!__asan_region_is_poisoned((vo id*) dest,templ->mysql_col_len)' failed in void row_sel_field_store_in_mysql_format_func(byte *, const mysql_row_templ_t *, const byte *, ulint)
#
SET sql_mode='';
CREATE TABLE t (a CHAR(205)) ENGINE=INNODB CHARACTER SET filename;
Warnings:
Note 1246 Converting column 'a' from CHAR to VARCHAR
INSERT INTO t VALUES (1);
SELECT * FROM t;
a
1
DROP TABLE t;
#
# End of 10.6 tests
#

View File

@@ -0,0 +1,19 @@
--source include/have_innodb.inc
--echo #
--echo # Start of 10.6 tests
--echo #
--echo #
--echo # MDEV-35392 Assertion `!__asan_region_is_poisoned((vo id*) dest,templ->mysql_col_len)' failed in void row_sel_field_store_in_mysql_format_func(byte *, const mysql_row_templ_t *, const byte *, ulint)
--echo #
SET sql_mode='';
CREATE TABLE t (a CHAR(205)) ENGINE=INNODB CHARACTER SET filename;
INSERT INTO t VALUES (1);
SELECT * FROM t;
DROP TABLE t;
--echo #
--echo # End of 10.6 tests
--echo #

View File

@@ -681,10 +681,10 @@ INSERT INTO t1 VALUES
(REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', ''); (REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', '');
SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
Warnings: Warnings:
Warning 4202 1 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 1 values were longer than max_sort_length. Sorting used only the first 1024 bytes
SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
Warnings: Warnings:
Warning 4202 1 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 1 values were longer than max_sort_length. Sorting used only the first 1024 bytes
DROP TABLES t1; DROP TABLES t1;
End of 5.0 tests End of 5.0 tests
# #

View File

@@ -6796,3 +6796,23 @@ c1
# #
# End of 10.5 tests # End of 10.5 tests
# #
#
# Start of 10.6 tests
#
#
# MDEV-23895 Server crash, ASAN heap-buffer-overflow or Valgrind Invalid write in Item_func_rpad::val_str
#
CREATE TABLE t1 (a CHAR(8));
INSERT INTO t1 VALUES ('foo'),('bar');
SET collation_connection= ucs2_danish_ci;
SET last_insert_id=0;
SELECT * FROM t1 WHERE RPAD(a, 50, LAST_INSERT_ID());
a
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'foo00000000000000000000000000000000000000000000000'
Warning 1292 Truncated incorrect DOUBLE value: 'bar00000000000000000000000000000000000000000000000'
DROP TABLE t1;
SET names latin1;
#
# End of 10.6 tests
#

View File

@@ -1242,3 +1242,24 @@ SELECT CAST(CONVERT('-9223372036854775808' USING ucs2) AS SIGNED) AS c1;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #
--echo #
--echo # Start of 10.6 tests
--echo #
--echo #
--echo # MDEV-23895 Server crash, ASAN heap-buffer-overflow or Valgrind Invalid write in Item_func_rpad::val_str
--echo #
CREATE TABLE t1 (a CHAR(8));
INSERT INTO t1 VALUES ('foo'),('bar');
SET collation_connection= ucs2_danish_ci;
SET last_insert_id=0;
SELECT * FROM t1 WHERE RPAD(a, 50, LAST_INSERT_ID());
DROP TABLE t1;
SET names latin1;
--echo #
--echo # End of 10.6 tests
--echo #

View File

@@ -1,5 +1,4 @@
SET TIME_ZONE='+03:00'; SET TIME_ZONE='+03:00';
DROP TABLE IF EXISTS t1;
# #
# Start of 5.5 tests # Start of 5.5 tests
# #
@@ -3153,5 +3152,15 @@ CAST(_utf16 0x0061D83DDE0E0062 AS INT)
Warnings: Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'a?b' Warning 1292 Truncated incorrect INTEGER value: 'a?b'
# #
# MDEV-23138 Odd behavior of character_set variables set to utf16 (when allowed)
#
SET character_set_connection=utf16;
SET transaction_isolation= 'READ-COMMITTED';
SELECT @@transaction_isolation;
@@transaction_isolation
READ-COMMITTED
SET transaction_isolation=DEFAULT;
SET NAMES utf8mb3;
#
# End of 10.5 tests # End of 10.5 tests
# #

View File

@@ -3,10 +3,6 @@
SET TIME_ZONE='+03:00'; SET TIME_ZONE='+03:00';
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
--echo # --echo #
--echo # Start of 5.5 tests --echo # Start of 5.5 tests
--echo # --echo #
@@ -1033,6 +1029,15 @@ SET NAMES utf8;
# surrogate pairs is replaced to a single question mark. # surrogate pairs is replaced to a single question mark.
SELECT CAST(_utf16 0x0061D83DDE0E0062 AS INT); SELECT CAST(_utf16 0x0061D83DDE0E0062 AS INT);
--echo #
--echo # MDEV-23138 Odd behavior of character_set variables set to utf16 (when allowed)
--echo #
SET character_set_connection=utf16;
SET transaction_isolation= 'READ-COMMITTED';
SELECT @@transaction_isolation;
SET transaction_isolation=DEFAULT;
SET NAMES utf8mb3;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests

View File

@@ -10769,8 +10769,8 @@ Warning 1292 Truncated incorrect INTEGER value: 'яяя'
# MDEV-28118 Wrong collation of `CAST(.. AS CHAR COLLATE DEFAULT)` # MDEV-28118 Wrong collation of `CAST(.. AS CHAR COLLATE DEFAULT)`
# #
SET NAMES utf8mb3 COLLATE utf8mb3_bin; SET NAMES utf8mb3 COLLATE utf8mb3_bin;
SELECT COLLATION(CAST('a' AS CHAR COLLATE DEFAULT)); SELECT COLLATION(CAST('a' AS CHAR COLLATE DEFAULT)) AS c1;
COLLATION(CAST('a' AS CHAR COLLATE DEFAULT)) c1
utf8mb3_general_ci utf8mb3_general_ci
CREATE TABLE t1 AS SELECT CAST('a' AS CHAR COLLATE DEFAULT) AS c1; CREATE TABLE t1 AS SELECT CAST('a' AS CHAR COLLATE DEFAULT) AS c1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;

View File

@@ -2508,7 +2508,7 @@ SELECT CAST(_utf8 'яяя' AS INT);
--echo # --echo #
SET NAMES utf8mb3 COLLATE utf8mb3_bin; SET NAMES utf8mb3 COLLATE utf8mb3_bin;
SELECT COLLATION(CAST('a' AS CHAR COLLATE DEFAULT)); SELECT COLLATION(CAST('a' AS CHAR COLLATE DEFAULT)) AS c1;
CREATE TABLE t1 AS SELECT CAST('a' AS CHAR COLLATE DEFAULT) AS c1; CREATE TABLE t1 AS SELECT CAST('a' AS CHAR COLLATE DEFAULT) AS c1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;

View File

@@ -245,5 +245,15 @@ Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_
test.t1.c 1.1 1.3 3 3 0 0 3.0000 NULL ENUM('1.1','1.3') NOT NULL test.t1.c 1.1 1.3 3 3 0 0 3.0000 NULL ENUM('1.1','1.3') NOT NULL
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-31881 ASAN: unknown-crash in check_ulonglong (sql/sql_analyse.cc) on SELECT ... FROM ... PROCEDURE ANALYSE()
#
CREATE TABLE t (a INT, b CHAR(10));
INSERT INTO t VALUES (0,'0000000000');
SELECT * FROM t PROCEDURE ANALYSE();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t.a 0 0 1 1 1 0 0.0000 0.0000 ENUM('0') NOT NULL
test.t.b 0000000000 0000000000 10 10 0 0 10.0000 NULL ENUM('0000000000') NOT NULL
DROP TABLE t;
#
# End of 10.5 tests # End of 10.5 tests
# #

View File

@@ -255,6 +255,15 @@ INSERT INTO t1 VALUES (1.3),(1.1);
SELECT * FROM t1 PROCEDURE ANALYSE(); SELECT * FROM t1 PROCEDURE ANALYSE();
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-31881 ASAN: unknown-crash in check_ulonglong (sql/sql_analyse.cc) on SELECT ... FROM ... PROCEDURE ANALYSE()
--echo #
CREATE TABLE t (a INT, b CHAR(10));
INSERT INTO t VALUES (0,'0000000000');
SELECT * FROM t PROCEDURE ANALYSE();
DROP TABLE t;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@@ -43,3 +43,14 @@ a
4828532208463511553 4828532208463511553
drop table t1; drop table t1;
#End of 4.1 tests #End of 4.1 tests
# Start of 10.5 tests
#
# MDEV-21029 Incorrect result for expression with the <=> operator and IS NULL
#
CREATE TABLE t0(c0 INT);
INSERT INTO t0 VALUES (1);
SELECT (c0 > (NULL <=> 0)) IS NULL AS c1 FROM t0;
c1
0
DROP TABLE t0;
# End of 10.5 tests

View File

@@ -44,3 +44,18 @@ select * from t1 where a in ('4828532208463511553');
drop table t1; drop table t1;
--echo #End of 4.1 tests --echo #End of 4.1 tests
--echo # Start of 10.5 tests
--echo #
--echo # MDEV-21029 Incorrect result for expression with the <=> operator and IS NULL
--echo #
CREATE TABLE t0(c0 INT);
INSERT INTO t0 VALUES (1);
SELECT (c0 > (NULL <=> 0)) IS NULL AS c1 FROM t0;
DROP TABLE t0;
--echo # End of 10.5 tests

View File

@@ -1478,5 +1478,55 @@ NULL
Warnings: Warnings:
Warning 1292 Incorrect interval value: '42949672955000x1' Warning 1292 Incorrect interval value: '42949672955000x1'
# #
# MDEV-23687 Assertion `is_valid_value_slow()' failed in Datetime::Datetime upon EXTRACT under mode ZERO_DATE_TIME_CAST
#
SET SESSION old_mode='ZERO_DATE_TIME_CAST';
Warnings:
Warning 1287 'ZERO_DATE_TIME_CAST' is deprecated and will be removed in a future release
SELECT CAST('100000:00:00' AS DATETIME);
CAST('100000:00:00' AS DATETIME)
NULL
Warnings:
Warning 1292 Incorrect datetime value: '100000:00:00'
SELECT EXTRACT(DAY FROM CAST('100000:00:00' AS DATETIME));
EXTRACT(DAY FROM CAST('100000:00:00' AS DATETIME))
NULL
Warnings:
Warning 1292 Incorrect datetime value: '100000:00:00'
SELECT CAST('100000:00:00' AS DATE);
CAST('100000:00:00' AS DATE)
NULL
Warnings:
Warning 1292 Incorrect datetime value: '100000:00:00'
SELECT EXTRACT(DAY FROM CAST('100000:00:00' AS DATE));
EXTRACT(DAY FROM CAST('100000:00:00' AS DATE))
NULL
Warnings:
Warning 1292 Incorrect datetime value: '100000:00:00'
SET SESSION old_mode=DEFAULT;
#
# MDEV-35489 Assertion `!ldate->neg' or unexpected result upon extracting unit from invalid value
#
SELECT EXTRACT(DAY FROM TIMESTAMP(-177498480000));
EXTRACT(DAY FROM TIMESTAMP(-177498480000))
NULL
Warnings:
Warning 1292 Incorrect datetime value: '-177498480000'
SELECT EXTRACT(DAY FROM TIMESTAMP(-177498480001));
EXTRACT(DAY FROM TIMESTAMP(-177498480001))
NULL
Warnings:
Warning 1292 Incorrect datetime value: '-177498480001'
SELECT EXTRACT(DAY FROM TIMESTAMP(-200000000000));
EXTRACT(DAY FROM TIMESTAMP(-200000000000))
NULL
Warnings:
Warning 1292 Incorrect datetime value: '-200000000000'
SELECT EXTRACT(DAY FROM TIMESTAMP(-221938034527));
EXTRACT(DAY FROM TIMESTAMP(-221938034527))
NULL
Warnings:
Warning 1292 Incorrect datetime value: '-221938034527'
#
# End of 10.5 tests # End of 10.5 tests
# #

View File

@@ -517,6 +517,26 @@ DROP FUNCTION select02;
SELECT EXTRACT(HOUR_MICROSECOND FROM '42949672955000x1'); SELECT EXTRACT(HOUR_MICROSECOND FROM '42949672955000x1');
--echo #
--echo # MDEV-23687 Assertion `is_valid_value_slow()' failed in Datetime::Datetime upon EXTRACT under mode ZERO_DATE_TIME_CAST
--echo #
SET SESSION old_mode='ZERO_DATE_TIME_CAST';
SELECT CAST('100000:00:00' AS DATETIME);
SELECT EXTRACT(DAY FROM CAST('100000:00:00' AS DATETIME));
SELECT CAST('100000:00:00' AS DATE);
SELECT EXTRACT(DAY FROM CAST('100000:00:00' AS DATE));
SET SESSION old_mode=DEFAULT;
--echo #
--echo # MDEV-35489 Assertion `!ldate->neg' or unexpected result upon extracting unit from invalid value
--echo #
SELECT EXTRACT(DAY FROM TIMESTAMP(-177498480000));
SELECT EXTRACT(DAY FROM TIMESTAMP(-177498480001));
SELECT EXTRACT(DAY FROM TIMESTAMP(-200000000000));
SELECT EXTRACT(DAY FROM TIMESTAMP(-221938034527));
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests

View File

@@ -4342,5 +4342,27 @@ SELECT * FROM t0 WHERE LEAST(c0, NULL);
c0 c0
DROP TABLE t0; DROP TABLE t0;
# #
# MDEV-28001 greatest/least with bigint unsigned maxium has unexpected results compared to 0
#
CREATE TABLE t1 (a BIGINT UNSIGNED, b BIGINT UNSIGNED);
INSERT INTO t1 VALUES (18446744073709551615,0);
SELECT a,b, LEAST(a,b), GREATEST(a,b) FROM t1;
a b LEAST(a,b) GREATEST(a,b)
18446744073709551615 0 0 18446744073709551615
DROP TABLE t1;
#
# End of 10.5 tests # End of 10.5 tests
# #
#
# Start of 10.6 tests
#
#
# MDEV-20944 Wrong result of LEAST() and ASAN heap-use-after-free in my_strnncollsp_simple / Item::temporal_precision on TIME()
#
SET NAMES latin1;
SELECT LEAST( CAST( 0 AS CHAR ), OLD_PASSWORD( 1 ) );
LEAST( CAST( 0 AS CHAR ), OLD_PASSWORD( 1 ) )
0
#
# End of 10.6 tests
#

View File

@@ -1137,7 +1137,30 @@ SELECT * FROM t0 WHERE GREATEST(c0, NULL);
SELECT * FROM t0 WHERE LEAST(c0, NULL); SELECT * FROM t0 WHERE LEAST(c0, NULL);
DROP TABLE t0; DROP TABLE t0;
--echo #
--echo # MDEV-28001 greatest/least with bigint unsigned maxium has unexpected results compared to 0
--echo #
CREATE TABLE t1 (a BIGINT UNSIGNED, b BIGINT UNSIGNED);
INSERT INTO t1 VALUES (18446744073709551615,0);
SELECT a,b, LEAST(a,b), GREATEST(a,b) FROM t1;
DROP TABLE t1;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #
--echo #
--echo # Start of 10.6 tests
--echo #
--echo #
--echo # MDEV-20944 Wrong result of LEAST() and ASAN heap-use-after-free in my_strnncollsp_simple / Item::temporal_precision on TIME()
--echo #
SET NAMES latin1;
SELECT LEAST( CAST( 0 AS CHAR ), OLD_PASSWORD( 1 ) );
--echo #
--echo # End of 10.6 tests
--echo #

View File

@@ -1757,5 +1757,18 @@ count(*)
0 0
drop table t1; drop table t1;
# #
# MDEV-29462 ASAN: heap-use-after-free in Binary_string::copy on DO CONVERT
#
DO CONVERT (INET_ATON (CAST(LEFT (-1,1) as BINARY (30))) USING utf8);
DO FROM_BASE64(CAST((MID(UUID(),20,64)) AS BINARY (55)));
Warnings:
Warning 1958 Bad base64 data as position 4
DO FROM_BASE64(CAST((MID(17653,ROW('-688:20:162697', (NULL))>=ROW(('*.)$'),(0xc254b6)),1)) AS BINARY (34)));
Warnings:
Warning 1958 Bad base64 data as position 1
DO FROM_BASE64(CAST(LEFT (-1,1) as BINARY (30)));
Warnings:
Warning 1958 Bad base64 data as position 0
#
# End of 10.5 tests # End of 10.5 tests
# #

View File

@@ -1381,6 +1381,16 @@ SELECT r as r1, r FROM cte;
select count(*) from t1 where r1!=r; select count(*) from t1 where r1!=r;
drop table t1; drop table t1;
--echo #
--echo # MDEV-29462 ASAN: heap-use-after-free in Binary_string::copy on DO CONVERT
--echo #
DO CONVERT (INET_ATON (CAST(LEFT (-1,1) as BINARY (30))) USING utf8);
DO FROM_BASE64(CAST((MID(UUID(),20,64)) AS BINARY (55)));
DO FROM_BASE64(CAST((MID(17653,ROW('-688:20:162697', (NULL))>=ROW(('*.)$'),(0xc254b6)),1)) AS BINARY (34)));
DO FROM_BASE64(CAST(LEFT (-1,1) as BINARY (30)));
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@@ -224,3 +224,8 @@ SELECT INTERVAL(1,ROW(1,2));
ERROR 21000: Operand should contain 1 column(s) ERROR 21000: Operand should contain 1 column(s)
SELECT INTERVAL(ROW(1,2),1); SELECT INTERVAL(ROW(1,2),1);
ERROR 21000: Operand should contain 1 column(s) ERROR 21000: Operand should contain 1 column(s)
#
# MDEV-29184 Assertion `0' in Item_row::illegal_method_call, Type_handler_row::Item_update_null_value, Item::update_null_value
#
SELECT INTERVAL(0, ROW(1,1), 1, 1, 1, 1, 1, 1, 1) AS f;
ERROR 21000: Operand should contain 1 column(s)

View File

@@ -147,3 +147,11 @@ SELECT INTERVAL(ROW(1,1),ROW(1,2));
SELECT INTERVAL(1,ROW(1,2)); SELECT INTERVAL(1,ROW(1,2));
--error ER_OPERAND_COLUMNS --error ER_OPERAND_COLUMNS
SELECT INTERVAL(ROW(1,2),1); SELECT INTERVAL(ROW(1,2),1);
--echo #
--echo # MDEV-29184 Assertion `0' in Item_row::illegal_method_call, Type_handler_row::Item_update_null_value, Item::update_null_value
--echo #
--error ER_OPERAND_COLUMNS
SELECT INTERVAL(0, ROW(1,1), 1, 1, 1, 1, 1, 1, 1) AS f;

View File

@@ -745,9 +745,9 @@ encode('abcd','ab')
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`bin(130)` varchar(64) DEFAULT NULL, `bin(130)` varchar(65) DEFAULT NULL,
`oct(130)` varchar(64) DEFAULT NULL, `oct(130)` varchar(65) DEFAULT NULL,
`conv(130,16,10)` varchar(64) DEFAULT NULL, `conv(130,16,10)` varchar(65) DEFAULT NULL,
`hex(130)` varchar(16) DEFAULT NULL, `hex(130)` varchar(16) DEFAULT NULL,
`char(130)` varbinary(4) DEFAULT NULL, `char(130)` varbinary(4) DEFAULT NULL,
`format(130,10)` varchar(25) DEFAULT NULL, `format(130,10)` varchar(25) DEFAULT NULL,
@@ -5260,7 +5260,7 @@ conv(i,16,2)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`conv(i,16,2)` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci DEFAULT NULL `conv(i,16,2)` varchar(65) CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
@@ -5330,9 +5330,94 @@ BIN(c)
DROP TABLE t1; DROP TABLE t1;
DO OCT(-9223372036854775808); DO OCT(-9223372036854775808);
# #
# MDEV-28652 SUBSTRING(str,pos,len) returns incorrect result in view (returns an empty string)
#
create view v1 as select substring('hello', 1, 4294967295);
select * from v1;
substring('hello', 1, 4294967295)
hello
drop view v1;
#
# End of 10.5 tests # End of 10.5 tests
# #
# #
# Start of 10.6 tests
#
#
# MDEV-29552 LEFT and RIGHT with big value for parameter 'len' >0 return empty value in view
#
create view v1 as select left('hello', 4294967295);
select * from v1;
left('hello', 4294967295)
hello
drop view v1;
#
# MDEV-33942 View cuts off the end of string with the utf8 character set in INSERT function
#
SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20))
D120D18E
CREATE VIEW v1 AS SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
SELECT * FROM v1;
HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20))
D120D18E
DROP VIEW v1;
#
# MDEV-28686 Assertion `0' in Type_handler_string_result::make_sort_key or unexpected result
#
CREATE TABLE t (s DATE, e DATE, PERIOD FOR p(s,e));
INSERT INTO t (s,e) VALUES ('1970-01-01','1970-01-02'),('1980-01-01','1980-01-02');
SET sql_mode='';
SELECT e, GROUP_CONCAT(s) FROM t GROUP BY CONVERT((LPAD(e, -1) AND e) USING utf8);
e GROUP_CONCAT(s)
1970-01-02 1970-01-01,1980-01-01
DROP TABLE t;
CREATE TABLE t (s DATE, e DATE, PERIOD FOR p(s,e));
INSERT INTO t (s,e) VALUES ('1970-01-01','1970-01-02'),('1980-01-01','1980-01-02');
SET sql_mode='';
SELECT DISTINCT CONVERT((LPAD(e, -1) AND e) USING utf8) FROM t;
CONVERT((LPAD(e, -1) AND e) USING utf8)
NULL
SET sql_mode=STRICT_TRANS_TABLES;
SELECT DISTINCT CONVERT((LPAD(e, -1) AND e) USING utf8) FROM t;
CONVERT((LPAD(e, -1) AND e) USING utf8)
NULL
DROP TABLE t;
SET sql_mode=DEFAULT;
#
# MDEV-32755 Stack-Buffer-Overflow at /mariadb-11.3.0/strings/int2str.c:122
#
CREATE TABLE t0 ( c55 INT , c38 INT ) ;
INSERT INTO t0 VALUES ( -54 , -27 ) , ( -107 , -62 ) ;
CREATE INDEX i0 ON t0 ( c38 ) ;
INSERT INTO t0 ( c55 ) VALUES ( 43 ) , ( 77 ) ;
SELECT t0 . c55 AS c47 FROM
( SELECT c15 AS c40 FROM
( SELECT c55 AS c15 FROM t0 ) AS t1
JOIN t0 ON t1.c15 = t1.c15 SOUNDS LIKE + CONV ( -2919286674558440404 , -17 , -2 ) ) AS t2
JOIN t0 ON t0.c38 = t0.c38;
c47
DROP TABLE t0;
SELECT CONV(-29223372036854775809, -10, 18446744073709551614);
CONV(-29223372036854775809, -10, 18446744073709551614)
-1000000000000000000000000000000000000000000000000000000000000000
SELECT CONV(1<<63, 10, -2);
CONV(1<<63, 10, -2)
-1000000000000000000000000000000000000000000000000000000000000000
#
# MDEV-35416 CONV(1<<63, 10, -2) fails with --view-protocol
#
CREATE TABLE t1 AS SELECT CONV(1<<63, 10, -2) AS c1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(65) CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
#
# End of 10.6 tests
#
#
# MDEV-25704 Function random_bytes # MDEV-25704 Function random_bytes
# #
create table t1 as select random_bytes(100); create table t1 as select random_bytes(100);

View File

@@ -2376,11 +2376,88 @@ DROP TABLE t1;
DO OCT(-9223372036854775808); DO OCT(-9223372036854775808);
--echo #
--echo # MDEV-28652 SUBSTRING(str,pos,len) returns incorrect result in view (returns an empty string)
--echo #
create view v1 as select substring('hello', 1, 4294967295);
select * from v1;
drop view v1;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #
--echo #
--echo # Start of 10.6 tests
--echo #
--echo #
--echo # MDEV-29552 LEFT and RIGHT with big value for parameter 'len' >0 return empty value in view
--echo #
create view v1 as select left('hello', 4294967295);
select * from v1;
drop view v1;
--echo #
--echo # MDEV-33942 View cuts off the end of string with the utf8 character set in INSERT function
--echo #
SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
CREATE VIEW v1 AS SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
SELECT * FROM v1;
DROP VIEW v1;
--echo #
--echo # MDEV-28686 Assertion `0' in Type_handler_string_result::make_sort_key or unexpected result
--echo #
CREATE TABLE t (s DATE, e DATE, PERIOD FOR p(s,e));
INSERT INTO t (s,e) VALUES ('1970-01-01','1970-01-02'),('1980-01-01','1980-01-02');
SET sql_mode='';
SELECT e, GROUP_CONCAT(s) FROM t GROUP BY CONVERT((LPAD(e, -1) AND e) USING utf8);
DROP TABLE t;
CREATE TABLE t (s DATE, e DATE, PERIOD FOR p(s,e));
INSERT INTO t (s,e) VALUES ('1970-01-01','1970-01-02'),('1980-01-01','1980-01-02');
SET sql_mode='';
SELECT DISTINCT CONVERT((LPAD(e, -1) AND e) USING utf8) FROM t;
SET sql_mode=STRICT_TRANS_TABLES;
SELECT DISTINCT CONVERT((LPAD(e, -1) AND e) USING utf8) FROM t;
DROP TABLE t;
SET sql_mode=DEFAULT;
--echo #
--echo # MDEV-32755 Stack-Buffer-Overflow at /mariadb-11.3.0/strings/int2str.c:122
--echo #
CREATE TABLE t0 ( c55 INT , c38 INT ) ;
INSERT INTO t0 VALUES ( -54 , -27 ) , ( -107 , -62 ) ;
CREATE INDEX i0 ON t0 ( c38 ) ;
INSERT INTO t0 ( c55 ) VALUES ( 43 ) , ( 77 ) ;
SELECT t0 . c55 AS c47 FROM
( SELECT c15 AS c40 FROM
( SELECT c55 AS c15 FROM t0 ) AS t1
JOIN t0 ON t1.c15 = t1.c15 SOUNDS LIKE + CONV ( -2919286674558440404 , -17 , -2 ) ) AS t2
JOIN t0 ON t0.c38 = t0.c38;
DROP TABLE t0;
SELECT CONV(-29223372036854775809, -10, 18446744073709551614);
SELECT CONV(1<<63, 10, -2);
--echo #
--echo # MDEV-35416 CONV(1<<63, 10, -2) fails with --view-protocol
--echo #
CREATE TABLE t1 AS SELECT CONV(1<<63, 10, -2) AS c1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # End of 10.6 tests
--echo #
--echo # --echo #
--echo # MDEV-25704 Function random_bytes --echo # MDEV-25704 Function random_bytes
--echo # --echo #

View File

@@ -5444,6 +5444,19 @@ t2 CREATE TABLE `t2` (
`c` polygon DEFAULT NULL `c` polygon DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
drop table t1, t2; drop table t1, t2;
#
# MDEV-33987 Server crashes at Item_func_as_wkt::val_str_ascii
#
SELECT ST_ASTEXT(BOUNDARY(INET6_ATON('255.255.255.255'))) AS c1;
c1
NULL
#
# Server crash in DTCollation::set_repertoire_from_charset
#
CREATE TABLE t (f POINT, KEY(f));
DELETE FROM t WHERE f NOT IN (NULL,'x');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
DROP TABLE t;
# End of 10.5 tests # End of 10.5 tests
# #
# Start of 11.5 tests # Start of 11.5 tests

View File

@@ -3445,6 +3445,22 @@ create table t2 as select group_concat(c, c order by 1,2), concat(c), c from t1;
show create table t2; show create table t2;
drop table t1, t2; drop table t1, t2;
--echo #
--echo # MDEV-33987 Server crashes at Item_func_as_wkt::val_str_ascii
--echo #
SELECT ST_ASTEXT(BOUNDARY(INET6_ATON('255.255.255.255'))) AS c1;
--echo #
--echo # Server crash in DTCollation::set_repertoire_from_charset
--echo #
CREATE TABLE t (f POINT, KEY(f));
--error ER_CANT_CREATE_GEOMETRY_OBJECT
DELETE FROM t WHERE f NOT IN (NULL,'x');
DROP TABLE t;
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@@ -4,12 +4,12 @@
install soname 'auth_0x0100'; install soname 'auth_0x0100';
CREATE USER foo@localhost IDENTIFIED VIA auth_0x0100; CREATE USER foo@localhost IDENTIFIED VIA auth_0x0100;
uninstall plugin auth_0x0100; uninstall plugin auth_0x0100;
select Priv from mysql.global_priv where User = "foo" and host="localhost" create table t as select Priv from mysql.global_priv where User = "foo" and host="localhost";
into @priv;
SET PASSWORD FOR foo@localhost = "1111"; SET PASSWORD FOR foo@localhost = "1111";
ERROR HY000: Plugin 'auth_0x0100' is not loaded ERROR HY000: Plugin 'auth_0x0100' is not loaded
select Priv = @priv as "Nothing changed" from mysql.global_priv where User = "foo" and host="localhost"; select global_priv.Priv = t.Priv as "Nothing changed" from mysql.global_priv join t where User = "foo" and host="localhost";
Nothing changed Nothing changed
1 1
drop table t;
DROP USER foo@localhost; DROP USER foo@localhost;
# End of 10.5 tests # End of 10.5 tests

View File

@@ -13,13 +13,12 @@ install soname 'auth_0x0100';
CREATE USER foo@localhost IDENTIFIED VIA auth_0x0100; CREATE USER foo@localhost IDENTIFIED VIA auth_0x0100;
uninstall plugin auth_0x0100; uninstall plugin auth_0x0100;
--disable_ps_protocol create table t as select Priv from mysql.global_priv where User = "foo" and host="localhost";
select Priv from mysql.global_priv where User = "foo" and host="localhost"
into @priv;
--enable_ps_protocol
--error ER_PLUGIN_IS_NOT_LOADED --error ER_PLUGIN_IS_NOT_LOADED
SET PASSWORD FOR foo@localhost = "1111"; SET PASSWORD FOR foo@localhost = "1111";
select Priv = @priv as "Nothing changed" from mysql.global_priv where User = "foo" and host="localhost"; select global_priv.Priv = t.Priv as "Nothing changed" from mysql.global_priv join t where User = "foo" and host="localhost";
drop table t;
DROP USER foo@localhost; DROP USER foo@localhost;

View File

@@ -1919,7 +1919,7 @@ SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
SUBSTRING(a,1,10) LENGTH(a) GROUP_CONCAT(b) SUBSTRING(a,1,10) LENGTH(a) GROUP_CONCAT(b)
1111111111 1300 one,two 1111111111 1300 one,two
Warnings: Warnings:
Warning 4202 2 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 2 values were longer than max_sort_length. Sorting used only the first 1024 bytes
EXPLAIN EXPLAIN
SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a; SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
id 1 id 1
@@ -1936,7 +1936,7 @@ SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
SUBSTRING(a,1,10) LENGTH(a) SUBSTRING(a,1,10) LENGTH(a)
1111111111 1300 1111111111 1300
Warnings: Warnings:
Warning 4202 1 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 1 values were longer than max_sort_length. Sorting used only the first 1024 bytes
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
@@ -2733,7 +2733,7 @@ f1 f2
NULL NULL
NULL NULL NULL NULL
Warnings: Warnings:
Warning 4202 116 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 116 values were longer than max_sort_length. Sorting used only the first 1024 bytes
SET @@sort_buffer_size = @old_sort_buff_size; SET @@sort_buffer_size = @old_sort_buff_size;
DROP TABLE t1; DROP TABLE t1;
# #

View File

@@ -848,10 +848,12 @@ CREATE OR REPLACE TABLE t1 (
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO t1 VALUES (GeomFromText('POINT(37.646944 -75.761111)')); INSERT INTO t1 VALUES (GeomFromText('POINT(37.646944 -75.761111)'));
--disable_cursor_protocol
--disable_ps2_protocol --disable_ps2_protocol
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1.tsv' FROM t1; eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1.tsv' FROM t1;
--enable_ps2_protocol --enable_ps2_protocol
--enable_cursor_protocol
CREATE OR REPLACE TABLE t2 LIKE t1; CREATE OR REPLACE TABLE t2 LIKE t1;
@@ -868,10 +870,12 @@ CREATE OR REPLACE TABLE t1 (
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO t1 VALUES (GeomFromText('POINT(37.646944 -75.761111)'),"їєі"); INSERT INTO t1 VALUES (GeomFromText('POINT(37.646944 -75.761111)'),"їєі");
--disable_cursor_protocol
--disable_ps2_protocol --disable_ps2_protocol
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1.tsv' FROM t1; eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1.tsv' FROM t1;
--enable_ps2_protocol --enable_ps2_protocol
--enable_cursor_protocol
CREATE OR REPLACE TABLE t2 LIKE t1; CREATE OR REPLACE TABLE t2 LIKE t1;

View File

@@ -0,0 +1,17 @@
SET pseudo_slave_mode=1;
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
CREATE TABLE t2 (c INT) ENGINE=MEMORY;
XA START 'a';
INSERT INTO t1 VALUES (0);
CREATE TEMPORARY TABLE t1t (c INT) ENGINE=InnoDB;
INSERT INTO t1t VALUES (0);
XA END 'a';
XA PREPARE 'a';
OPTIMIZE TABLE t1t;
Table Op Msg_type Msg_text
test.t1t optimize Error Table 'test.t1t' doesn't exist
test.t1t optimize status Operation failed
LOCK TABLE t2 READ;
XA COMMIT 'a';
# restart
DROP TABLE t1, t2;

View File

@@ -0,0 +1,19 @@
#
# MDEV-35046 SIGSEGV in list_delete in optimized builds when using pseudo_slave_mode
# https://jira.mariadb.org/browse/MDEV-35046
#
--source include/have_innodb.inc
SET pseudo_slave_mode=1;
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
CREATE TABLE t2 (c INT) ENGINE=MEMORY;
XA START 'a';
INSERT INTO t1 VALUES (0);
CREATE TEMPORARY TABLE t1t (c INT) ENGINE=InnoDB;
INSERT INTO t1t VALUES (0);
XA END 'a';
XA PREPARE 'a';
OPTIMIZE TABLE t1t;
LOCK TABLE t2 READ;
XA COMMIT 'a';
--source include/restart_mysqld.inc
DROP TABLE t1, t2;

View File

@@ -11,3 +11,11 @@ X
3 3
ERROR 1300 (HY000): Invalid utf8mb3 character string: 'test\xF0\x9F\x98\x81 ' ERROR 1300 (HY000): Invalid utf8mb3 character string: 'test\xF0\x9F\x98\x81 '
ERROR 1300 (HY000): Invalid binary character string: 'test\xF0\x9F\x98\x81 ' ERROR 1300 (HY000): Invalid binary character string: 'test\xF0\x9F\x98\x81 '
# Start of 10.5 tests
#
# MDEV-34090 Client allows to set character set to utf32 and crashes on the next command
#
SELECT "Success" AS c1;
c1
Success
# End of 10.5 tests

View File

@@ -29,3 +29,16 @@ exec $MYSQL test -e "$query";
--exec $MYSQL --default-character-set=utf8 -e "select 1" "test😁 " 2>&1 --exec $MYSQL --default-character-set=utf8 -e "select 1" "test😁 " 2>&1
--error 1 --error 1
--exec $MYSQL --default-character-set=binary -e "select 1" "test😁 " 2>&1 --exec $MYSQL --default-character-set=binary -e "select 1" "test😁 " 2>&1
--echo # Start of 10.5 tests
--echo #
--echo # MDEV-34090 Client allows to set character set to utf32 and crashes on the next command
--echo #
--error 1
--exec $MYSQL test -e '\C utf32 ; SELECT 1'
SELECT "Success" AS c1;
--echo # End of 10.5 tests

View File

@@ -105,9 +105,9 @@ execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_t
execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition_type ENGINE=', @time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition_type ENGINE=', @time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0');
SET session alter_algorithm=@old_alter_alg; SET session alter_algorithm=@old_alter_alg;
Warnings: Warnings:
Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warnings: Warnings:
Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
SELECT COUNT(*) FROM time_zone; SELECT COUNT(*) FROM time_zone;
COUNT(*) COUNT(*)
2 2
@@ -166,9 +166,9 @@ SET SESSION SQL_LOG_BIN=@save_sql_log_bin;
execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0'); execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0');
SET session alter_algorithm=@old_alter_alg; SET session alter_algorithm=@old_alter_alg;
Warnings: Warnings:
Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warnings: Warnings:
Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
SELECT COUNT(*) FROM time_zone; SELECT COUNT(*) FROM time_zone;
COUNT(*) COUNT(*)
2 2
@@ -490,9 +490,9 @@ execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0'
# #
set sql_mode=only_full_group_by; set sql_mode=only_full_group_by;
Warnings: Warnings:
Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warnings: Warnings:
Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
SELECT COUNT(*) FROM time_zone; SELECT COUNT(*) FROM time_zone;
COUNT(*) COUNT(*)
2 2

View File

@@ -2360,7 +2360,7 @@ set global sql_safe_updates=@orig_sql_safe_updates;
# MDEV-32043 Remove plugins previously external that are now built in (unix_socket) # MDEV-32043 Remove plugins previously external that are now built in (unix_socket)
# #
INSERT INTO mysql.plugin SELECT 'unix_socket', 'auth_socket.so' INSERT INTO mysql.plugin SELECT 'unix_socket', 'auth_socket.so'
FROM dual WHERE convert(@@version_compile_os using latin1) not in ('Win32', 'Win64', 'Windows'); FROM information_schema.plugins WHERE plugin_name='unix_socket' AND plugin_library IS NULL;
# mariadb-upgrade --force --silent 2>&1 # mariadb-upgrade --force --silent 2>&1
SELECT * FROM mysql.plugin WHERE name='unix_socket'; SELECT * FROM mysql.plugin WHERE name='unix_socket';
name dl name dl

View File

@@ -509,7 +509,7 @@ set global sql_safe_updates=@orig_sql_safe_updates;
--echo # --echo #
INSERT INTO mysql.plugin SELECT 'unix_socket', 'auth_socket.so' INSERT INTO mysql.plugin SELECT 'unix_socket', 'auth_socket.so'
FROM dual WHERE convert(@@version_compile_os using latin1) not in ('Win32', 'Win64', 'Windows'); FROM information_schema.plugins WHERE plugin_name='unix_socket' AND plugin_library IS NULL;
--echo # mariadb-upgrade --force --silent 2>&1 --echo # mariadb-upgrade --force --silent 2>&1
--exec $MYSQL_UPGRADE --force --silent 2>&1 --exec $MYSQL_UPGRADE --force --silent 2>&1
SELECT * FROM mysql.plugin WHERE name='unix_socket'; SELECT * FROM mysql.plugin WHERE name='unix_socket';

View File

@@ -860,7 +860,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxab
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaa
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz
Warnings: Warnings:
Warning 4202 2 values were longer than max_sort_length. Sorting used only the first 64 bytes Warning 4203 2 values were longer than max_sort_length. Sorting used only the first 64 bytes
drop table t1; drop table t1;
create table t1 ( create table t1 (
`sid` decimal(8,0) default null, `sid` decimal(8,0) default null,
@@ -4125,7 +4125,7 @@ a substr(b, @save_max_sort_length+1)
2 AB 2 AB
1 A 1 A
Warnings: Warnings:
Warning 4202 5 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 5 values were longer than max_sort_length. Sorting used only the first 1024 bytes
analyze format=json analyze format=json
select a, substr(b, @save_max_sort_length+1) from t1 order by b desc; select a, substr(b, @save_max_sort_length+1) from t1 order by b desc;
ANALYZE ANALYZE
@@ -4172,7 +4172,7 @@ ANALYZE
} }
} }
Warnings: Warnings:
Warning 4202 5 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 5 values were longer than max_sort_length. Sorting used only the first 1024 bytes
drop table t1; drop table t1;
# #
# Packing sort keys with complex collations # Packing sort keys with complex collations

View File

@@ -835,7 +835,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxw xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxw
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy
Warnings: Warnings:
Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 64 bytes Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 64 bytes
set max_sort_length=200; set max_sort_length=200;
select c from t1 order by c, id; select c from t1 order by c, id;
c c

View File

@@ -287,7 +287,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL
GLOBAL_VALUE_PATH NULL GLOBAL_VALUE_PATH NULL
set alter_algorithm=COPY; set alter_algorithm=COPY;
Warnings: Warnings:
Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
select @@alter_algorithm; select @@alter_algorithm;
@@alter_algorithm @@alter_algorithm
DEFAULT DEFAULT
@@ -295,8 +295,8 @@ set statement alter_algorithm=COPY FOR SELECT @@alter_algorithm;
@@alter_algorithm @@alter_algorithm
DEFAULT DEFAULT
Warnings: Warnings:
Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
# restart: --alter-algorithm=COPY # restart: --alter-algorithm=COPY
select @@alter_algorithm; select @@alter_algorithm;
@@alter_algorithm @@alter_algorithm

View File

@@ -29,8 +29,8 @@ explain select * from t1 where nm like '500%' AND fl2 = 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where 1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where
Warnings: Warnings:
Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
set @trace=(select trace from information_schema.optimizer_trace); set @trace=(select trace from information_schema.optimizer_trace);
select json_detailed(json_extract(@trace, '$**.considered_access_paths')); select json_detailed(json_extract(@trace, '$**.considered_access_paths'));
json_detailed(json_extract(@trace, '$**.considered_access_paths')) json_detailed(json_extract(@trace, '$**.considered_access_paths'))
@@ -97,8 +97,8 @@ explain select * from t1 where nm like '500%' AND fl2 = 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where 1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where
Warnings: Warnings:
Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
set @trace=(select trace from information_schema.optimizer_trace); set @trace=(select trace from information_schema.optimizer_trace);
select json_detailed(json_extract(@trace, '$**.considered_access_paths')); select json_detailed(json_extract(@trace, '$**.considered_access_paths'));
json_detailed(json_extract(@trace, '$**.considered_access_paths')) json_detailed(json_extract(@trace, '$**.considered_access_paths'))
@@ -163,14 +163,14 @@ select @@optimizer_adjust_secondary_key_costs;
0 0
set @@optimizer_adjust_secondary_key_costs=7; set @@optimizer_adjust_secondary_key_costs=7;
Warnings: Warnings:
Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warning 1292 Truncated incorrect optimizer_adjust_secondary_ke... value: '7' Warning 1292 Truncated incorrect optimizer_adjust_secondary_ke... value: '7'
select @@optimizer_adjust_secondary_key_costs; select @@optimizer_adjust_secondary_key_costs;
@@optimizer_adjust_secondary_key_costs @@optimizer_adjust_secondary_key_costs
2 2
set @@optimizer_adjust_secondary_key_costs=default; set @@optimizer_adjust_secondary_key_costs=default;
Warnings: Warnings:
Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
# #
# MDEV-34664: fix_innodb_cardinality # MDEV-34664: fix_innodb_cardinality
# #
@@ -201,7 +201,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref b b 5 test.t2.a 90 Using index 1 SIMPLE t1 ref b b 5 test.t2.a 90 Using index
set @@optimizer_adjust_secondary_key_costs=8; set @@optimizer_adjust_secondary_key_costs=8;
Warnings: Warnings:
Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warning 1292 Truncated incorrect optimizer_adjust_secondary_ke... value: '8' Warning 1292 Truncated incorrect optimizer_adjust_secondary_ke... value: '8'
explain select * from t1,t2 where t1.b=t2.a; explain select * from t1,t2 where t1.b=t2.a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
@@ -238,4 +238,4 @@ set global userstat=@save_userstat;
set global innodb_stats_persistent_sample_pages=@save_ispsp; set global innodb_stats_persistent_sample_pages=@save_ispsp;
set @@optimizer_adjust_secondary_key_costs=default; set @@optimizer_adjust_secondary_key_costs=default;
Warnings: Warnings:
Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release

View File

@@ -0,0 +1,46 @@
# Checking stack usage
#
# basic tests
#
select variable_value > 0 from information_schema.session_status where variable_name="stack_usage";
variable_value > 0
1
#
# Ensure stack usage is same for each iteration when using WITH recursive
#
create table t1
WITH recursive Fibonacci(PrevN, N, Stack) AS
(
SELECT 0, 1, 0
UNION ALL
SELECT N, PrevN + N, (select variable_value from information_schema.session_status where variable_name="stack_usage")
FROM Fibonacci
WHERE N < 100000
)
SELECT PrevN as N, Stack FROM Fibonacci;
select (select stack from t1 where n=2) = (select stack from t1 where N=75025) as c;
c
1
DROP table t1;
#
# Check stack with recursion
#
set @@max_sp_recursion_depth=20;
create or replace procedure recursion(x int, max int, OUT res int)
begin
select variable_value into res from information_schema.session_status where variable_name="stack_usage";
if (x < max) then
call recursion(x+1, max, res);
end if;
end;
$$
call recursion(0,2,@s1);
call recursion(0,3,@s2);
call recursion(0,4,@s3);
select @s1 > 0 && @s2 > 0 && @s3 > 0;
@s1 > 0 && @s2 > 0 && @s3 > 0
1
drop procedure recursion;
#
# End of 10.5 tests
#

View File

@@ -0,0 +1,60 @@
--echo # Checking stack usage
--echo #
--echo # basic tests
--echo #
select variable_value > 0 from information_schema.session_status where variable_name="stack_usage";
--echo #
--echo # Ensure stack usage is same for each iteration when using WITH recursive
--echo #
create table t1
WITH recursive Fibonacci(PrevN, N, Stack) AS
(
SELECT 0, 1, 0
UNION ALL
SELECT N, PrevN + N, (select variable_value from information_schema.session_status where variable_name="stack_usage")
FROM Fibonacci
WHERE N < 100000
)
SELECT PrevN as N, Stack FROM Fibonacci;
select (select stack from t1 where n=2) = (select stack from t1 where N=75025) as c;
DROP table t1;
--echo #
--echo # Check stack with recursion
--echo #
set @@max_sp_recursion_depth=20;
delimiter $$;
create or replace procedure recursion(x int, max int, OUT res int)
begin
select variable_value into res from information_schema.session_status where variable_name="stack_usage";
if (x < max) then
call recursion(x+1, max, res);
end if;
end;
$$
delimiter ;$$
call recursion(0,2,@s1);
call recursion(0,3,@s2);
call recursion(0,4,@s3);
select @s1 > 0 && @s2 > 0 && @s3 > 0;
if (`select @s2-@s1 <> @s3 - @s2`)
{
echo "Wrong result";
select @s1 ,@s2, @s3, @s2-@s1, @s3-@s2;
}
drop procedure recursion;
--echo #
--echo # End of 10.5 tests
--echo #

View File

@@ -899,7 +899,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
set @@group_concat_max_len = 256; set @@group_concat_max_len = 256;
explain extended select left(a1,7), left(a2,7) explain extended select left(a1,7), left(a2,7)
from t1_1024 from t1_1024
@@ -917,7 +917,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
drop table t1_1024, t2_1024, t3_1024; drop table t1_1024, t2_1024, t3_1024;
set @blob_len = 1025; set @blob_len = 1025;
set @suffix_len = @blob_len - @prefix_len; set @suffix_len = @blob_len - @prefix_len;
@@ -1002,7 +1002,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
set @@group_concat_max_len = 256; set @@group_concat_max_len = 256;
explain extended select left(a1,7), left(a2,7) explain extended select left(a1,7), left(a2,7)
from t1_1025 from t1_1025
@@ -1020,7 +1020,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
drop table t1_1025, t2_1025, t3_1025; drop table t1_1025, t2_1025, t3_1025;
create table t1bit (a1 bit(3), a2 bit(3)); create table t1bit (a1 bit(3), a2 bit(3));
create table t2bit (b1 bit(3), b2 bit(3)); create table t2bit (b1 bit(3), b2 bit(3));
@@ -3071,3 +3071,401 @@ UNION ALL
1 1
1 1
drop table t1, t2; drop table t1, t2;
#
# MDEV-34665: Simplify IN predicate processing for NULL-aware
# materialization involving only one column
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch = "materialization=on,in_to_exists=off,semijoin=off";
create table t1 (a int);
create table t2 (b int);
insert into t1 values (null), (1), (2), (3);
# Query against empty t2
select a, a in (select b from t2) from t1;
a a in (select b from t2)
1 0
2 0
3 0
NULL 0
# Insert some not-NULL values
insert into t2 values (3), (4);
select a, a in (select b from t2) from t1;
a a in (select b from t2)
1 0
2 0
3 1
NULL NULL
# Ensure the correct strategy is tested
analyze format=json select a, a in (select b from t2) from t1;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_total_filtered": 100,
"r_filtered": 100
}
}
],
"subqueries": [
{
"materialization": {
"r_strategy": "null-aware index_lookup",
"r_loops": 4,
"r_index_lookups": 3,
"r_partial_matches": 1,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"loops": 1,
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_total_filtered": 100,
"r_filtered": 100
}
}
]
}
}
}
]
}
}
# Insert NULL value (so there are both NULLs and and not-NULL values)
insert into t2 values (null);
select a, a in (select b from t2) from t1;
a a in (select b from t2)
1 NULL
2 NULL
3 1
NULL NULL
analyze format=json select a, a in (select b from t2) from t1;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_total_filtered": 100,
"r_filtered": 100
}
}
],
"subqueries": [
{
"materialization": {
"r_strategy": "null-aware index_lookup",
"r_loops": 4,
"r_index_lookups": 3,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"loops": 1,
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_total_filtered": 100,
"r_filtered": 100
}
}
]
}
}
}
]
}
}
delete from t2;
# Insert NULL values only
insert into t2 values (null), (null);
select a, a in (select b from t2) from t1;
a a in (select b from t2)
1 NULL
2 NULL
3 NULL
NULL NULL
analyze format=json select a, a in (select b from t2) from t1;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_total_filtered": 100,
"r_filtered": 100
}
}
],
"subqueries": [
{
"materialization": {
"r_strategy": "return NULL",
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"loops": 1,
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_total_filtered": 100,
"r_filtered": 100
}
}
]
}
}
}
]
}
}
# Test UPDATE
insert into t2 values (3), (4);
update t1 set a=a+1 where a not in (select b from t2);
# Nothing updated due to NULLs on both sides of IN
select * from t1;
a
NULL
1
2
3
# Remove NULLs from the right side
delete from t2 where b is null;
update t1 set a=a+1 where a not in (select b from t2);
# Now some rows are updated:
select * from t1;
a
NULL
2
3
3
analyze format=json update t1 set a=a+1 where a not in (select b from t2);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_total_time_ms": "REPLACED",
"table": {
"update": 1,
"table_name": "t1",
"access_type": "ALL",
"rows": 4,
"r_rows": 4,
"r_total_filtered": 25,
"r_total_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"attached_condition": "!(<in_optimizer>(t1.a,t1.a in (subquery#2)))",
"r_filtered": 25
},
"subqueries": [
{
"materialization": {
"r_strategy": "null-aware index_lookup",
"r_loops": 4,
"r_index_lookups": 3,
"r_partial_matches": 1,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"loops": 1,
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_total_filtered": 100,
"r_filtered": 100
}
}
]
}
}
}
]
}
}
# Test DELETE
# Restore initial data-set:
delete from t1;
insert into t1 values (null), (1), (2), (3);
# Add some NULL values to the right side of IN
insert into t2 values (null), (null);
delete from t1 where a not in (select b from t2);
# Nothing deleted due to NULLs on both sides of IN
select * from t1;
a
NULL
1
2
3
# Remove NULLs from the right side
delete from t2 where b is null;
delete from t1 where a not in (select b from t2);
# Now some rows are deleted:
select * from t1;
a
NULL
3
analyze format=json delete from t1 where a not in (select b from t2);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_total_time_ms": "REPLACED",
"table": {
"delete": 1,
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"r_rows": 2,
"r_total_filtered": 0,
"r_total_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"attached_condition": "!(<in_optimizer>(t1.a,t1.a in (subquery#2)))",
"r_filtered": 0
},
"subqueries": [
{
"materialization": {
"r_strategy": "null-aware index_lookup",
"r_loops": 2,
"r_index_lookups": 1,
"r_partial_matches": 1,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"loops": 1,
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_total_filtered": 100,
"r_filtered": 100
}
}
]
}
}
}
]
}
}
drop table t1, t2;
set @@optimizer_switch=@save_optimizer_switch;

View File

@@ -297,3 +297,76 @@ UNION ALL
; ;
drop table t1, t2; drop table t1, t2;
--echo #
--echo # MDEV-34665: Simplify IN predicate processing for NULL-aware
--echo # materialization involving only one column
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch = "materialization=on,in_to_exists=off,semijoin=off";
create table t1 (a int);
create table t2 (b int);
insert into t1 values (null), (1), (2), (3);
--echo # Query against empty t2
--sorted_result
select a, a in (select b from t2) from t1;
--echo # Insert some not-NULL values
insert into t2 values (3), (4);
--sorted_result
select a, a in (select b from t2) from t1;
--echo # Ensure the correct strategy is tested
--source include/analyze-format.inc
analyze format=json select a, a in (select b from t2) from t1;
--echo # Insert NULL value (so there are both NULLs and and not-NULL values)
insert into t2 values (null);
--sorted_result
select a, a in (select b from t2) from t1;
--source include/analyze-format.inc
analyze format=json select a, a in (select b from t2) from t1;
delete from t2;
--echo # Insert NULL values only
insert into t2 values (null), (null);
--sorted_result
select a, a in (select b from t2) from t1;
--source include/analyze-format.inc
analyze format=json select a, a in (select b from t2) from t1;
--echo # Test UPDATE
insert into t2 values (3), (4);
update t1 set a=a+1 where a not in (select b from t2);
--echo # Nothing updated due to NULLs on both sides of IN
select * from t1;
--echo # Remove NULLs from the right side
delete from t2 where b is null;
update t1 set a=a+1 where a not in (select b from t2);
--echo # Now some rows are updated:
select * from t1;
--source include/analyze-format.inc
analyze format=json update t1 set a=a+1 where a not in (select b from t2);
--echo # Test DELETE
--echo # Restore initial data-set:
delete from t1;
insert into t1 values (null), (1), (2), (3);
--echo # Add some NULL values to the right side of IN
insert into t2 values (null), (null);
delete from t1 where a not in (select b from t2);
--echo # Nothing deleted due to NULLs on both sides of IN
select * from t1;
--echo # Remove NULLs from the right side
delete from t2 where b is null;
delete from t1 where a not in (select b from t2);
--echo # Now some rows are deleted:
select * from t1;
--source include/analyze-format.inc
analyze format=json delete from t1 where a not in (select b from t2);
drop table t1, t2;
set @@optimizer_switch=@save_optimizer_switch;

View File

@@ -115,8 +115,6 @@ ANALYZE
} }
} }
# "Partial match" is used due to NOT IN # "Partial match" is used due to NOT IN
# Force rowid-merge partial partial matching
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
analyze format=json select * from t1 where a not in (select b from t2); analyze format=json select * from t1 where a not in (select b from t2);
ANALYZE ANALYZE
{ {
@@ -151,79 +149,7 @@ ANALYZE
"subqueries": [ "subqueries": [
{ {
"materialization": { "materialization": {
"r_strategy": "index_lookup;array merge for partial match", "r_strategy": "null-aware index_lookup",
"r_loops": 4,
"r_index_lookups": 3,
"r_partial_matches": 1,
"r_partial_match_buffer_size": "REPLACED",
"r_partial_match_array_sizes": ["2"],
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"loops": 1,
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_total_filtered": 100,
"r_filtered": 100
}
}
]
}
}
}
]
}
}
# Force table scan partial matching
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=on";
analyze format=json select * from t1 where a not in (select b from t2);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_total_filtered": 50,
"attached_condition": "!<in_optimizer>(t1.a,t1.a in (subquery#2))",
"r_filtered": 50
}
}
],
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;full scan for partial match",
"r_loops": 4, "r_loops": 4,
"r_index_lookups": 3, "r_index_lookups": 3,
"r_partial_matches": 1, "r_partial_matches": 1,
@@ -300,7 +226,7 @@ ANALYZE
"subqueries": [ "subqueries": [
{ {
"materialization": { "materialization": {
"r_strategy": "index_lookup;full scan for partial match", "r_strategy": "null-aware index_lookup",
"r_loops": 4, "r_loops": 4,
"r_index_lookups": 3, "r_index_lookups": 3,
"r_partial_matches": 1, "r_partial_matches": 1,
@@ -336,7 +262,6 @@ ANALYZE
} }
} }
} }
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
analyze format=json select a from t1 group by a not in (select b from t2); analyze format=json select a from t1 group by a not in (select b from t2);
ANALYZE ANALYZE
{ {
@@ -379,12 +304,10 @@ ANALYZE
"subqueries": [ "subqueries": [
{ {
"materialization": { "materialization": {
"r_strategy": "index_lookup;array merge for partial match", "r_strategy": "null-aware index_lookup",
"r_loops": 4, "r_loops": 4,
"r_index_lookups": 3, "r_index_lookups": 3,
"r_partial_matches": 1, "r_partial_matches": 1,
"r_partial_match_buffer_size": "REPLACED",
"r_partial_match_array_sizes": ["2"],
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"cost": "REPLACED", "cost": "REPLACED",
@@ -417,7 +340,6 @@ ANALYZE
} }
} }
} }
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=on";
# Subselect in ORDER BY # Subselect in ORDER BY
analyze format=json select a from t1 order by a in (select b from t2); analyze format=json select a from t1 order by a in (select b from t2);
ANALYZE ANALYZE
@@ -464,7 +386,7 @@ ANALYZE
"subqueries": [ "subqueries": [
{ {
"materialization": { "materialization": {
"r_strategy": "index_lookup;full scan for partial match", "r_strategy": "null-aware index_lookup",
"r_loops": 4, "r_loops": 4,
"r_index_lookups": 3, "r_index_lookups": 3,
"r_partial_matches": 1, "r_partial_matches": 1,
@@ -533,7 +455,7 @@ ANALYZE
"subqueries": [ "subqueries": [
{ {
"materialization": { "materialization": {
"r_strategy": "index_lookup;full scan for partial match", "r_strategy": "null-aware index_lookup",
"r_loops": 4, "r_loops": 4,
"r_index_lookups": 3, "r_index_lookups": 3,
"r_partial_matches": 1, "r_partial_matches": 1,
@@ -733,7 +655,7 @@ ANALYZE
"subqueries": [ "subqueries": [
{ {
"materialization": { "materialization": {
"r_strategy": "index_lookup;full scan for partial match", "r_strategy": "null-aware index_lookup",
"r_loops": 4, "r_loops": 4,
"r_index_lookups": 3, "r_index_lookups": 3,
"query_block": { "query_block": {
@@ -856,6 +778,7 @@ create table t1 (a1 char(1), a2 char(1));
insert into t1 values (null, 'b'); insert into t1 values (null, 'b');
create table t2 (b1 char(1), b2 char(2)); create table t2 (b1 char(1), b2 char(2));
insert into t2 values ('a','b'), ('c', 'd'), (null, 'e'), ('f', 'g'); insert into t2 values ('a','b'), ('c', 'd'), (null, 'e'), ('f', 'g');
# Force rowid-merge partial matching
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off"; set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
explain format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2); explain format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2);
EXPLAIN EXPLAIN
@@ -961,6 +884,7 @@ ANALYZE
] ]
} }
} }
# Force table scan partial matching
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=on"; set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=on";
analyze format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2); analyze format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2);
ANALYZE ANALYZE

View File

@@ -14,13 +14,6 @@ explain format=json select * from t1 where a in (select b from t2);
analyze format=json select * from t1 where a in (select b from t2); analyze format=json select * from t1 where a in (select b from t2);
--echo # "Partial match" is used due to NOT IN --echo # "Partial match" is used due to NOT IN
--echo # Force rowid-merge partial partial matching
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
--source include/analyze-format.inc
analyze format=json select * from t1 where a not in (select b from t2);
--echo # Force table scan partial matching
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=on";
--source include/analyze-format.inc --source include/analyze-format.inc
analyze format=json select * from t1 where a not in (select b from t2); analyze format=json select * from t1 where a not in (select b from t2);
@@ -28,11 +21,9 @@ analyze format=json select * from t1 where a not in (select b from t2);
--source include/analyze-format.inc --source include/analyze-format.inc
analyze format=json select a from t1 group by a in (select b from t2); analyze format=json select a from t1 group by a in (select b from t2);
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
--source include/analyze-format.inc --source include/analyze-format.inc
analyze format=json select a from t1 group by a not in (select b from t2); analyze format=json select a from t1 group by a not in (select b from t2);
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=on";
--echo # Subselect in ORDER BY --echo # Subselect in ORDER BY
--source include/analyze-format.inc --source include/analyze-format.inc
analyze format=json select a from t1 order by a in (select b from t2); analyze format=json select a from t1 order by a in (select b from t2);
@@ -69,12 +60,14 @@ insert into t1 values (null, 'b');
create table t2 (b1 char(1), b2 char(2)); create table t2 (b1 char(1), b2 char(2));
insert into t2 values ('a','b'), ('c', 'd'), (null, 'e'), ('f', 'g'); insert into t2 values ('a','b'), ('c', 'd'), (null, 'e'), ('f', 'g');
--echo # Force rowid-merge partial matching
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off"; set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
--source include/explain-no-costs.inc --source include/explain-no-costs.inc
explain format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2); explain format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2);
--source include/analyze-format.inc --source include/analyze-format.inc
analyze format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2); analyze format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2);
--echo # Force table scan partial matching
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=on"; set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=on";
--source include/analyze-format.inc --source include/analyze-format.inc
analyze format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2); analyze format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2);

View File

@@ -919,7 +919,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
set @@group_concat_max_len = 256; set @@group_concat_max_len = 256;
explain extended select left(a1,7), left(a2,7) explain extended select left(a1,7), left(a2,7)
from t1_1024 from t1_1024
@@ -938,7 +938,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
drop table t1_1024, t2_1024, t3_1024; drop table t1_1024, t2_1024, t3_1024;
set @blob_len = 1025; set @blob_len = 1025;
set @suffix_len = @blob_len - @prefix_len; set @suffix_len = @blob_len - @prefix_len;
@@ -1024,7 +1024,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
set @@group_concat_max_len = 256; set @@group_concat_max_len = 256;
explain extended select left(a1,7), left(a2,7) explain extended select left(a1,7), left(a2,7)
from t1_1025 from t1_1025
@@ -1043,7 +1043,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
drop table t1_1025, t2_1025, t3_1025; drop table t1_1025, t2_1025, t3_1025;
create table t1bit (a1 bit(3), a2 bit(3)); create table t1bit (a1 bit(3), a2 bit(3));
create table t2bit (b1 bit(3), b2 bit(3)); create table t2bit (b1 bit(3), b2 bit(3));

View File

@@ -0,0 +1 @@
--timezone=Europe/Budapest

View File

@@ -1,6 +1,6 @@
show variables like "system_time_zone"; show variables like "system_time_zone";
Variable_name Value Variable_name Value
system_time_zone MET system_time_zone CET
# #
# Test unix timestamp # Test unix timestamp
# #
@@ -80,7 +80,7 @@ alter table mysql.time_zone_transition_type add primary key (time_zone_id,transi
SET @@time_zone= default; SET @@time_zone= default;
SELECT DATE_FORMAT('2009-11-01 22:23:00', '%z %Z') AS current_timezone; SELECT DATE_FORMAT('2009-11-01 22:23:00', '%z %Z') AS current_timezone;
current_timezone current_timezone
+0100 MET +0100 CET
SELECT DATE_FORMAT('2008-06-04 02:23:00', '%z %Z') AS current_timezone; SELECT DATE_FORMAT('2008-06-04 02:23:00', '%z %Z') AS current_timezone;
current_timezone current_timezone
+0200 MEST +0200 CEST

View File

@@ -1,14 +1,14 @@
# #
# Test of SYSTEM time zone handling ( for my_system_gmt_sec()). # Test of SYSTEM time zone handling ( for my_system_gmt_sec()).
# This script must be run with TZ=MET # This script must have zonedata for CET
-- require include/have_cet_timezone.require
-- require include/have_met_timezone.require
disable_query_log; disable_query_log;
select FROM_UNIXTIME(24*3600); select FROM_UNIXTIME(24*3600);
enable_query_log; enable_query_log;
# The following is because of daylight saving time # The following is because of daylight saving time
--replace_result MEST MET --replace_result MEST CET MET CET
show variables like "system_time_zone"; show variables like "system_time_zone";
--echo # --echo #

View File

@@ -1287,6 +1287,19 @@ h varchar(16) YES NULL
DROP TABLE t1, t2; DROP TABLE t1, t2;
SET sql_mode=DEFAULT; SET sql_mode=DEFAULT;
# #
# MDEV-25174 DOUBLE columns do not accept large hex hybrids
#
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
INSERT INTO t1 VALUES (0x8000000000000000);
INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
SELECT * FROM t1 ORDER BY a;
a
9.223372036854776e18
9.223372036854776e18
1.8446744073709552e19
DROP TABLE t1;
#
# End of 10.5 tests # End of 10.5 tests
# #
# #

View File

@@ -798,6 +798,17 @@ DROP TABLE t1, t2;
SET sql_mode=DEFAULT; SET sql_mode=DEFAULT;
--echo #
--echo # MDEV-25174 DOUBLE columns do not accept large hex hybrids
--echo #
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
INSERT INTO t1 VALUES (0x8000000000000000);
INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@@ -2878,6 +2878,19 @@ h varchar(16) YES NULL
DROP TABLE t1, t2; DROP TABLE t1, t2;
SET sql_mode=DEFAULT; SET sql_mode=DEFAULT;
# #
# MDEV-25174 DOUBLE columns do not accept large hex hybrids
#
CREATE TABLE t1 (a DECIMAL(30,0));
INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
INSERT INTO t1 VALUES (0x8000000000000000);
INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
SELECT * FROM t1 ORDER BY a;
a
9223372036854775807
9223372036854775808
18446744073709551615
DROP TABLE t1;
#
# End of 10.5 tests # End of 10.5 tests
# #
# #

View File

@@ -2052,6 +2052,17 @@ DROP TABLE t1, t2;
SET sql_mode=DEFAULT; SET sql_mode=DEFAULT;
--echo #
--echo # MDEV-25174 DOUBLE columns do not accept large hex hybrids
--echo #
CREATE TABLE t1 (a DECIMAL(30,0));
INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
INSERT INTO t1 VALUES (0x8000000000000000);
INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@@ -2341,29 +2341,29 @@ DROP TABLE t1;
# MDEV-35250 Assertion `dec <= 6' failed in my_timestamp_binary_length # MDEV-35250 Assertion `dec <= 6' failed in my_timestamp_binary_length
# #
SET time_zone='+00:00'; SET time_zone='+00:00';
SELECT FROM_UNIXTIME('1922-02-10'), BIT_AND(1); SELECT FROM_UNIXTIME('1922-02-10') AS c1, BIT_AND(1) AS c2;
FROM_UNIXTIME('1922-02-10') BIT_AND(1) c1 c2
1970-01-01 00:32:02 1 1970-01-01 00:32:02 1
Warnings: Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '1922-02-10' Warning 1292 Truncated incorrect DECIMAL value: '1922-02-10'
SELECT FROM_UNIXTIME('1922'), BIT_AND(1); SELECT FROM_UNIXTIME('1922') AS c1, BIT_AND(1) AS c2;
FROM_UNIXTIME('1922') BIT_AND(1) c1 c2
1970-01-01 00:32:02 1 1970-01-01 00:32:02 1
SELECT FROM_UNIXTIME('1922.1'), BIT_AND(1); SELECT FROM_UNIXTIME('1922.1') AS c1, BIT_AND(1) AS c2;
FROM_UNIXTIME('1922.1') BIT_AND(1) c1 c2
1970-01-01 00:32:02.100000 1 1970-01-01 00:32:02.100000 1
SELECT FROM_UNIXTIME('1922.1'); SELECT FROM_UNIXTIME('1922.1') AS c1;
FROM_UNIXTIME('1922.1') c1
1970-01-01 00:32:02.100000 1970-01-01 00:32:02.100000
SELECT * FROM (SELECT FROM_UNIXTIME('1'), BIT_AND(1)) t; SELECT * FROM (SELECT FROM_UNIXTIME('1') AS c1, BIT_AND(1) AS c2) t;
FROM_UNIXTIME('1') BIT_AND(1) c1 c2
1970-01-01 00:00:01.000000 1 1970-01-01 00:00:01.000000 1
SELECT * FROM (SELECT FROM_UNIXTIME('1.1'), BIT_AND(1)) t; SELECT * FROM (SELECT FROM_UNIXTIME('1.1') AS c1, BIT_AND(1) AS c2) t;
FROM_UNIXTIME('1.1') BIT_AND(1) c1 c2
1970-01-01 00:00:01.100000 1 1970-01-01 00:00:01.100000 1
CREATE TABLE t1 (a TEXT, b TEXT); CREATE TABLE t1 (a TEXT, b TEXT);
INSERT INTO t1 SELECT FROM_UNIXTIME('1'), BIT_AND(1); INSERT INTO t1 SELECT FROM_UNIXTIME('1') AS c1, BIT_AND(1) AS c2;
INSERT INTO t1 SELECT FROM_UNIXTIME('1.1'), BIT_AND(1); INSERT INTO t1 SELECT FROM_UNIXTIME('1.1') AS c1, BIT_AND(1) AS c2;
SELECT * FROM t1; SELECT * FROM t1;
a b a b
1970-01-01 00:00:01 1 1970-01-01 00:00:01 1

View File

@@ -1380,19 +1380,19 @@ DROP TABLE t1;
SET time_zone='+00:00'; SET time_zone='+00:00';
# Disable view protocol to workaround MDEV-29534 # Disable view protocol to workaround MDEV-29534
--disable_view_protocol --disable_view_protocol
SELECT FROM_UNIXTIME('1922-02-10'), BIT_AND(1); SELECT FROM_UNIXTIME('1922-02-10') AS c1, BIT_AND(1) AS c2;
SELECT FROM_UNIXTIME('1922'), BIT_AND(1); SELECT FROM_UNIXTIME('1922') AS c1, BIT_AND(1) AS c2;
--enable_view_protocol --enable_view_protocol
# Disable PS protocol to workaround CONC-739 # Disable PS protocol to workaround CONC-739
--disable_ps_protocol --disable_ps_protocol
SELECT FROM_UNIXTIME('1922.1'), BIT_AND(1); SELECT FROM_UNIXTIME('1922.1') AS c1, BIT_AND(1) AS c2;
SELECT FROM_UNIXTIME('1922.1'); SELECT FROM_UNIXTIME('1922.1') AS c1;
--enable_ps_protocol --enable_ps_protocol
SELECT * FROM (SELECT FROM_UNIXTIME('1'), BIT_AND(1)) t; SELECT * FROM (SELECT FROM_UNIXTIME('1') AS c1, BIT_AND(1) AS c2) t;
SELECT * FROM (SELECT FROM_UNIXTIME('1.1'), BIT_AND(1)) t; SELECT * FROM (SELECT FROM_UNIXTIME('1.1') AS c1, BIT_AND(1) AS c2) t;
CREATE TABLE t1 (a TEXT, b TEXT); CREATE TABLE t1 (a TEXT, b TEXT);
INSERT INTO t1 SELECT FROM_UNIXTIME('1'), BIT_AND(1); INSERT INTO t1 SELECT FROM_UNIXTIME('1') AS c1, BIT_AND(1) AS c2;
INSERT INTO t1 SELECT FROM_UNIXTIME('1.1'), BIT_AND(1); INSERT INTO t1 SELECT FROM_UNIXTIME('1.1') AS c1, BIT_AND(1) AS c2;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;

Binary file not shown.

View File

@@ -391,3 +391,16 @@ Warnings:
Note 1003 select "test"."t1"."c1" AS "c1","test"."t1"."c2" AS "c2","test"."t1"."c1" like concat("test"."t1"."c2",'_') AS "c1 LIKE c2||'_'" from "test"."t1" order by "test"."t1"."ord" Note 1003 select "test"."t1"."c1" AS "c1","test"."t1"."c2" AS "c2","test"."t1"."c1" like concat("test"."t1"."c2",'_') AS "c1 LIKE c2||'_'" from "test"."t1" order by "test"."t1"."ord"
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
#
# Start of 10.6 tests
#
#
# MDEV-31910 ASAN memcpy-param-overlap upon CONCAT in ORACLE mode
#
SET SQL_MODE= ORACLE;
SELECT CONCAT(SUBSTR(123 FROM 2));
CONCAT(SUBSTR(123 FROM 2))
23
#
# End of 10.6 tests
#

View File

@@ -182,3 +182,19 @@ EXPLAIN EXTENDED SELECT * FROM v1;
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Start of 10.6 tests
--echo #
--echo #
--echo # MDEV-31910 ASAN memcpy-param-overlap upon CONCAT in ORACLE mode
--echo #
SET SQL_MODE= ORACLE;
SELECT CONCAT(SUBSTR(123 FROM 2));
--echo #
--echo # End of 10.6 tests
--echo #

View File

@@ -870,3 +870,14 @@ USE test;
DROP DATABASE events_test; DROP DATABASE events_test;
SET GLOBAL event_scheduler= 'ON'; SET GLOBAL event_scheduler= 'ON';
SET @@global.concurrent_insert= @concurrent_insert; SET @@global.concurrent_insert= @concurrent_insert;
#
# MDEV-33472 Assertion `0' failed in Item_row::illegal_method_call on CREATE EVENT
#
CREATE EVENT e ON SCHEDULE EVERY 1 HOUR STARTS ROW(1,2) DO SELECT 1;
ERROR 21000: Operand should contain 1 column(s)
CREATE EVENT e ON SCHEDULE EVERY 1 HOUR ENDS ROW(1,2) DO SELECT 1;
ERROR 21000: Operand should contain 1 column(s)
CREATE EVENT e ON SCHEDULE AT ROW(1,2) DO SELECT *;
ERROR 21000: Operand should contain 1 column(s)
CREATE EVENT e ON SCHEDULE EVERY ROW(1,2) HOUR DO SELECT 1;
ERROR 21000: Operand should contain 1 column(s)

View File

@@ -1308,3 +1308,20 @@ SET GLOBAL event_scheduler= 'ON';
--source include/running_event_scheduler.inc --source include/running_event_scheduler.inc
SET @@global.concurrent_insert= @concurrent_insert; SET @@global.concurrent_insert= @concurrent_insert;
# THIS MUST BE THE LAST LINE in this file. # THIS MUST BE THE LAST LINE in this file.
--echo #
--echo # MDEV-33472 Assertion `0' failed in Item_row::illegal_method_call on CREATE EVENT
--echo #
--error ER_OPERAND_COLUMNS
CREATE EVENT e ON SCHEDULE EVERY 1 HOUR STARTS ROW(1,2) DO SELECT 1;
--error ER_OPERAND_COLUMNS
CREATE EVENT e ON SCHEDULE EVERY 1 HOUR ENDS ROW(1,2) DO SELECT 1;
--error ER_OPERAND_COLUMNS
CREATE EVENT e ON SCHEDULE AT ROW(1,2) DO SELECT *;
--error ER_OPERAND_COLUMNS
CREATE EVENT e ON SCHEDULE EVERY ROW(1,2) HOUR DO SELECT 1;

View File

@@ -27,4 +27,4 @@ wsrep_last_written_gtid()
connection node_1; connection node_1;
drop table t1; drop table t1;
connection node_2; connection node_2;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");

View File

@@ -49,4 +49,4 @@ mysqld-bin.000003 # Query # # COMMIT
BINLOG_POSITIONS_MATCH BINLOG_POSITIONS_MATCH
1 1
DROP TABLE t1,ts1; DROP TABLE t1,ts1;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");

View File

@@ -5,7 +5,7 @@ select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode;
@@gtid_domain_id @@server_id @@wsrep_gtid_domain_id @@wsrep_gtid_mode @@gtid_domain_id @@server_id @@wsrep_gtid_domain_id @@wsrep_gtid_mode
0 11 1 1 0 11 1 1
connection node_2; connection node_2;
call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node\\."); call mtr.add_suppression("WSREP: Ignoring server id .* for non bootstrap node");
select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode; select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode;
@@gtid_domain_id @@server_id @@wsrep_gtid_domain_id @@wsrep_gtid_mode @@gtid_domain_id @@server_id @@wsrep_gtid_domain_id @@wsrep_gtid_mode
0 12 1 1 0 12 1 1

View File

@@ -42,4 +42,4 @@ SET GLOBAL wsrep_on=ON;
connection node_3; connection node_3;
reset master; reset master;
connection node_2; connection node_2;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");

View File

@@ -167,4 +167,4 @@ set global wsrep_on=ON;
connection node_3; connection node_3;
reset master; reset master;
connection node_2; connection node_2;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");

View File

@@ -42,4 +42,4 @@ SELECT @@gtid_binlog_state;
@@gtid_binlog_state @@gtid_binlog_state
1-1-101 1-1-101
DROP TABLE t1; DROP TABLE t1;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");

View File

@@ -34,4 +34,4 @@ wsrep_last_written_id_advanced
SET AUTOCOMMIT=ON; SET AUTOCOMMIT=ON;
DROP TABLE t1; DROP TABLE t1;
connection node_2; connection node_2;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");

View File

@@ -3,9 +3,9 @@ connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
connection node_2; connection node_2;
call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node\\."); call mtr.add_suppression("WSREP: Ignoring server id .* for non bootstrap node");
connection node_4; connection node_4;
call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node\\."); call mtr.add_suppression("WSREP: Ignoring server id .* for non bootstrap node");
connection node_3; connection node_3;
CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_ssl_verify_server_cert=0, master_use_gtid=current_pos; CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_ssl_verify_server_cert=0, master_use_gtid=current_pos;
START SLAVE; START SLAVE;

View File

@@ -24,4 +24,4 @@ WSREP_SYNC_WAIT_UPTO
connection node_1; connection node_1;
DROP TABLE t1; DROP TABLE t1;
connection node_2; connection node_2;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");

View File

@@ -90,7 +90,7 @@ set global wsrep_on=OFF;
reset master; reset master;
set global wsrep_on=ON; set global wsrep_on=ON;
connection node_2; connection node_2;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");
disconnect node_2; disconnect node_2;
disconnect node_1; disconnect node_1;
# End of test # End of test

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