Merge branch '10.4' into 10.5

This commit is contained in:
Sergei Golubchik 2023-12-01 13:43:58 +01:00
commit 98a39b0c91
511 changed files with 26233 additions and 3853 deletions

View file

@ -145,7 +145,7 @@ elif [ "x$warning_mode" = "xmaintainer" ]; then
debug_extra_cflags="-g3"
else
# Both C and C++ warnings
warnings="-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized -Wno-strict-aliasing -Wimplicit-fallthrough=2 -Wformat-security -Wvla"
warnings="-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized -Wno-strict-aliasing -Wformat-security -Wvla"
# For more warnings, uncomment the following line
# warnings="$warnings -Wshadow"

View file

@ -81,6 +81,9 @@ static my_bool non_blocking_api_enabled= 0;
#define DIE_BUFF_SIZE 256*1024
#define RESULT_STRING_INIT_MEM 2048
#define RESULT_STRING_INCREMENT_MEM 2048
/* Flags controlling send and reap */
#define QUERY_SEND_FLAG 1
#define QUERY_REAP_FLAG 2
@ -1717,7 +1720,7 @@ void log_msg(const char *fmt, ...)
va_end(args);
dynstr_append_mem(&ds_res, buff, len);
dynstr_append(&ds_res, "\n");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("\n"));
DBUG_VOID_RETURN;
}
@ -1852,7 +1855,7 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
die("Out of memory");
dynstr_append_os_quoted(&ds_cmdline, tool_path, NullS);
dynstr_append(&ds_cmdline, " ");
dynstr_append_mem(&ds_cmdline, STRING_WITH_LEN(" "));
va_start(args, ds_res);
@ -1863,13 +1866,13 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
dynstr_append_os_quoted(&ds_cmdline, arg, NullS);
else
dynstr_append(&ds_cmdline, arg);
dynstr_append(&ds_cmdline, " ");
dynstr_append_mem(&ds_cmdline, STRING_WITH_LEN(" "));
}
va_end(args);
#ifdef _WIN32
dynstr_append(&ds_cmdline, "\"");
dynstr_append_mem(&ds_cmdline, STRING_WITH_LEN("\""));
#endif
DBUG_PRINT("info", ("Running: %s", ds_cmdline.str));
@ -2004,8 +2007,8 @@ void show_diff(DYNAMIC_STRING* ds,
Fallback to dump both files to result file and inform
about installing "diff"
*/
dynstr_append(&ds_tmp, "\n");
dynstr_append(&ds_tmp,
char message[]=
"\n"
"\n"
"The two files differ but it was not possible to execute 'diff' in\n"
"order to show only the difference. Instead the whole content of the\n"
@ -2015,17 +2018,18 @@ void show_diff(DYNAMIC_STRING* ds,
#ifdef _WIN32
"or http://gnuwin32.sourceforge.net/packages/diffutils.htm\n"
#endif
"\n");
"\n";
dynstr_append_mem(&ds_tmp, message, sizeof(message));
dynstr_append(&ds_tmp, " --- ");
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN(" --- "));
dynstr_append(&ds_tmp, filename1);
dynstr_append(&ds_tmp, " >>>\n");
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN(" >>>\n"));
cat_file(&ds_tmp, filename1);
dynstr_append(&ds_tmp, "<<<\n --- ");
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN("<<<\n --- "));
dynstr_append(&ds_tmp, filename1);
dynstr_append(&ds_tmp, " >>>\n");
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN(" >>>\n"));
cat_file(&ds_tmp, filename2);
dynstr_append(&ds_tmp, "<<<<\n");
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN("<<<<\n"));
}
if (ds)
@ -2804,9 +2808,9 @@ do_result_format_version(struct st_command *command)
set_result_format_version(version);
dynstr_append(&ds_res, "result_format: ");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("result_format: "));
dynstr_append_mem(&ds_res, ds_version.str, ds_version.length);
dynstr_append(&ds_res, "\n");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("\n"));
dynstr_free(&ds_version);
}
@ -3353,7 +3357,7 @@ void do_exec(struct st_command *command)
if (disable_result_log)
{
/* Collect stderr output as well, for the case app. crashes or returns error.*/
dynstr_append(&ds_cmd, " 2>&1");
dynstr_append_mem(&ds_cmd, STRING_WITH_LEN(" 2>&1"));
}
DBUG_PRINT("info", ("Executing '%s' as '%s'",
@ -3555,9 +3559,9 @@ void do_system(struct st_command *command)
else
{
/* If ! abort_on_error, log message and continue */
dynstr_append(&ds_res, "system command '");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("system command '"));
replace_dynstr_append(&ds_res, command->first_argument);
dynstr_append(&ds_res, "' failed\n");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("' failed\n"));
}
}
@ -4024,7 +4028,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
wild_compare(file->name, ds_wild->str, 0))
continue;
replace_dynstr_append(ds, file->name);
dynstr_append(ds, "\n");
dynstr_append_mem(ds, STRING_WITH_LEN("\n"));
}
set_wild_chars(0);
my_dirend(dir_info);
@ -7710,9 +7714,10 @@ void append_metadata(DYNAMIC_STRING *ds,
uint num_fields)
{
MYSQL_FIELD *field_end;
dynstr_append(ds,"Catalog\tDatabase\tTable\tTable_alias\tColumn\t"
dynstr_append_mem(ds, STRING_WITH_LEN(
"Catalog\tDatabase\tTable\tTable_alias\tColumn\t"
"Column_alias\tType\tLength\tMax length\tIs_null\t"
"Flags\tDecimals\tCharsetnr\n");
"Flags\tDecimals\tCharsetnr\n"));
for (field_end= field+num_fields ;
field < field_end ;
@ -7775,9 +7780,9 @@ void append_info(DYNAMIC_STRING *ds, ulonglong affected_rows,
dynstr_append(ds, buf);
if (info)
{
dynstr_append(ds, "info: ");
dynstr_append_mem(ds, STRING_WITH_LEN("info: "));
dynstr_append(ds, info);
dynstr_append_mem(ds, "\n", 1);
dynstr_append_mem(ds, STRING_WITH_LEN("\n"));
}
}
@ -7823,7 +7828,7 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
(enum_session_state_type) type,
&data, &data_length))
{
dynstr_append(ds, "-- ");
dynstr_append_mem(ds, STRING_WITH_LEN("-- "));
if (type <= SESSION_TRACK_END)
{
dynstr_append(ds, trking_info_desc[type]);
@ -7831,10 +7836,10 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
else
{
DBUG_ASSERT(0);
dynstr_append(ds, "Tracker???\n");
dynstr_append_mem(ds, STRING_WITH_LEN("Tracker???\n"));
}
dynstr_append(ds, "-- ");
dynstr_append_mem(ds, STRING_WITH_LEN("-- "));
dynstr_append_mem(ds, data, data_length);
}
else
@ -7843,16 +7848,16 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
(enum_session_state_type) type,
&data, &data_length))
{
dynstr_append(ds, "\n-- ");
dynstr_append_mem(ds, STRING_WITH_LEN("\n-- "));
if (data == NULL)
{
DBUG_ASSERT(data_length == 0);
dynstr_append_mem(ds, "<NULL>", sizeof("<NULL>") - 1);
dynstr_append_mem(ds, STRING_WITH_LEN("<NULL>"));
}
else
dynstr_append_mem(ds, data, data_length);
}
dynstr_append(ds, "\n\n");
dynstr_append_mem(ds, STRING_WITH_LEN("\n\n"));
}
#endif /* EMBEDDED_LIBRARY */
}
@ -8247,7 +8252,8 @@ void handle_error(struct st_command *command,
else if (command->expected_errors.err[0].type == ERR_SQLSTATE ||
(command->expected_errors.err[0].type == ERR_ERRNO &&
command->expected_errors.err[0].code.errnum != 0))
dynstr_append(ds,"Got one of the listed errors\n");
dynstr_append_mem(ds, STRING_WITH_LEN("Got one of the listed "
"errors\n"));
}
/* OK */
revert_properties();
@ -8320,6 +8326,87 @@ void handle_no_error(struct st_command *command)
}
/*
Read result set after prepare statement execution
SYNOPSIS
read_stmt_results
stmt - prepare statemet
mysql - mysql handle
command - current command pointer
ds - output buffer where to store result form query
RETURN VALUE
1 - if there is an error in result set
*/
int read_stmt_results(MYSQL_STMT* stmt,
DYNAMIC_STRING* ds,
struct st_command *command)
{
MYSQL_RES *res= NULL;
/*
We instruct that we want to update the "max_length" field in
mysql_stmt_store_result(), this is our only way to know how much
buffer to allocate for result data
*/
{
my_bool one= 1;
if (mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void*) &one))
die("mysql_stmt_attr_set(STMT_ATTR_UPDATE_MAX_LENGTH) failed': %d %s",
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
}
/*
If we got here the statement succeeded and was expected to do so,
get data. Note that this can still give errors found during execution!
Store the result of the query if if will return any fields
*/
if (mysql_stmt_field_count(stmt) && mysql_stmt_store_result(stmt))
{
handle_error(command, mysql_stmt_errno(stmt),
mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds);
return 1;
}
/* If we got here the statement was both executed and read successfully */
handle_no_error(command);
if (!disable_result_log)
{
/*
Not all statements creates a result set. If there is one we can
now create another normal result set that contains the meta
data. This set can be handled almost like any other non prepared
statement result set.
*/
if ((res= mysql_stmt_result_metadata(stmt)) != NULL)
{
/* Take the column count from meta info */
MYSQL_FIELD *fields= mysql_fetch_fields(res);
uint num_fields= mysql_num_fields(res);
if (display_metadata)
append_metadata(ds, fields, num_fields);
if (!display_result_vertically)
append_table_headings(ds, fields, num_fields);
append_stmt_result(ds, stmt, fields, num_fields);
mysql_free_result(res); /* Free normal result set with meta data */
}
else
{
/*
This is a query without resultset
*/
}
}
return 0;
}
/*
Run query using prepared statement C API
@ -8339,11 +8426,17 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
char *query, size_t query_len, DYNAMIC_STRING *ds,
DYNAMIC_STRING *ds_warnings)
{
MYSQL_RES *res= NULL; /* Note that here 'res' is meta data result set */
MYSQL *mysql= cn->mysql;
MYSQL_STMT *stmt;
DYNAMIC_STRING ds_prepare_warnings;
DYNAMIC_STRING ds_execute_warnings;
DYNAMIC_STRING ds_res_1st_execution;
DYNAMIC_STRING ds_res_2_execution_unsorted;
DYNAMIC_STRING *ds_res_2_output;
my_bool ds_res_1st_execution_init = FALSE;
my_bool compare_2nd_execution = TRUE;
int query_match_ps2_re;
DBUG_ENTER("run_query_stmt");
DBUG_PRINT("query", ("'%-.60s'", query));
@ -8370,6 +8463,12 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
init_dynamic_string(&ds_execute_warnings, NULL, 0, 256);
}
/* Check and remove potential trash */
if(strlen(ds->str) != 0)
{
dynstr_trunc(ds, 0);
}
/*
Prepare the query
*/
@ -8405,10 +8504,12 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
}
#endif
query_match_ps2_re = match_re(&ps2_re, query);
/*
Execute the query first time if second execution enable
*/
if(ps2_protocol_enabled && match_re(&ps2_re, query))
if(ps2_protocol_enabled && query_match_ps2_re)
{
if (do_stmt_execute(cn))
{
@ -8416,6 +8517,17 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds);
goto end;
}
init_dynamic_string(&ds_res_1st_execution, "",
RESULT_STRING_INIT_MEM, RESULT_STRING_INCREMENT_MEM);
ds_res_1st_execution_init = TRUE;
if(read_stmt_results(stmt, &ds_res_1st_execution, command))
{
/*
There was an error during execution
and there is no result set to compare
*/
compare_2nd_execution = 0;
}
}
/*
@ -8435,74 +8547,85 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
if (cursor_protocol_enabled && !disable_warnings)
append_warnings(&ds_execute_warnings, mysql);
/*
We instruct that we want to update the "max_length" field in
mysql_stmt_store_result(), this is our only way to know how much
buffer to allocate for result data
*/
{
my_bool one= 1;
if (mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void*) &one))
die("mysql_stmt_attr_set(STMT_ATTR_UPDATE_MAX_LENGTH) failed': %d %s",
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
}
/*
If we got here the statement succeeded and was expected to do so,
get data. Note that this can still give errors found during execution!
Store the result of the query if if will return any fields
*/
if (mysql_stmt_field_count(stmt) && mysql_stmt_store_result(stmt))
DBUG_ASSERT(ds->length == 0);
if (!disable_result_log &&
compare_2nd_execution &&
ps2_protocol_enabled &&
query_match_ps2_re &&
display_result_sorted)
{
handle_error(command, mysql_stmt_errno(stmt),
mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds);
init_dynamic_string(&ds_res_2_execution_unsorted, "",
RESULT_STRING_INIT_MEM,
RESULT_STRING_INCREMENT_MEM);
ds_res_2_output= &ds_res_2_execution_unsorted;
}
else
ds_res_2_output= ds;
if(read_stmt_results(stmt, ds_res_2_output, command))
{
if (ds_res_2_output != ds)
{
dynstr_append_mem(ds, ds_res_2_output->str, ds_res_2_output->length);
dynstr_free(ds_res_2_output);
}
goto end;
}
/* If we got here the statement was both executed and read successfully */
handle_no_error(command);
if (!disable_result_log)
{
/*
Not all statements creates a result set. If there is one we can
now create another normal result set that contains the meta
data. This set can be handled almost like any other non prepared
statement result set.
The results of the first and second execution are compared
only if result logging is enabled
*/
if ((res= mysql_stmt_result_metadata(stmt)) != NULL)
if(compare_2nd_execution && ps2_protocol_enabled && query_match_ps2_re)
{
/* Take the column count from meta info */
MYSQL_FIELD *fields= mysql_fetch_fields(res);
uint num_fields= mysql_num_fields(res);
if (display_metadata)
append_metadata(ds, fields, num_fields);
if (!display_result_vertically)
append_table_headings(ds, fields, num_fields);
append_stmt_result(ds, stmt, fields, num_fields);
mysql_free_result(res); /* Free normal result set with meta data */
DYNAMIC_STRING *ds_res_1_execution_compare;
DYNAMIC_STRING ds_res_1_execution_sorted;
if (display_result_sorted)
{
init_dynamic_string(&ds_res_1_execution_sorted, "",
RESULT_STRING_INIT_MEM,
RESULT_STRING_INCREMENT_MEM);
dynstr_append_sorted(&ds_res_1_execution_sorted,
&ds_res_1st_execution, 1);
dynstr_append_sorted(ds, &ds_res_2_execution_unsorted, 1);
ds_res_1_execution_compare= &ds_res_1_execution_sorted;
}
else
{
ds_res_1_execution_compare= &ds_res_1st_execution;
}
if(ds->length != ds_res_1_execution_compare->length ||
!(memcmp(ds_res_1_execution_compare->str, ds->str, ds->length) == 0))
{
die("The result of the 1st execution does not match with \n"
"the result of the 2nd execution of ps-protocol:\n 1st:\n"
"%s\n 2nd:\n %s",
ds_res_1_execution_compare->str,
ds->str);
}
if (display_result_sorted)
{
dynstr_free(&ds_res_1_execution_sorted);
dynstr_free(&ds_res_2_execution_unsorted);
}
}
/*
Normally, if there is a result set, we do not show warnings from the
prepare phase. This is because some warnings are generated both during
prepare and execute; this would generate different warning output
between normal and ps-protocol test runs.
The --enable_prepare_warnings command can be used to change this so
that warnings from both the prepare and execute phase are shown.
*/
if (!disable_warnings && !prepare_warnings_enabled)
if ((mysql_stmt_result_metadata(stmt) != NULL) &&
!disable_warnings &&
!prepare_warnings_enabled)
dynstr_set(&ds_prepare_warnings, NULL);
}
else
{
/*
This is a query without resultset
*/
}
/*
Fetch info before fetching warnings, since it will be reset
@ -8514,7 +8637,6 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
if (display_session_track_info)
append_session_track_info(ds, mysql);
if (!disable_warnings)
{
/* Get the warnings from execute */
@ -8540,6 +8662,13 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
}
end:
if (ds_res_1st_execution_init)
{
dynstr_free(&ds_res_1st_execution);
ds_res_1st_execution_init= FALSE;
}
if (!disable_warnings)
{
dynstr_free(&ds_prepare_warnings);
@ -9046,11 +9175,14 @@ int util_query(MYSQL* org_mysql, const char* query){
void run_query(struct st_connection *cn, struct st_command *command, int flags)
{
MYSQL *mysql= cn->mysql;
DYNAMIC_STRING *ds;
DYNAMIC_STRING *save_ds= NULL;
DYNAMIC_STRING ds_result;
DYNAMIC_STRING ds_sorted;
DYNAMIC_STRING ds_warnings;
DYNAMIC_STRING *rs_output; /* where to put results */
DYNAMIC_STRING rs_cmp_result; /* here we put results to compare with
pre-recrded file */
DYNAMIC_STRING rs_unsorted; /* if we need sorted results, here we store
results before sorting them */
DYNAMIC_STRING *rs_sorted_save= NULL; /* here we store where to put sorted
result if needed */
DYNAMIC_STRING rs_warnings;
char *query;
size_t query_len;
my_bool view_created= 0, sp_created= 0;
@ -9064,8 +9196,8 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
if (!(flags & QUERY_SEND_FLAG) && !cn->pending)
die("Cannot reap on a connection without pending send");
init_dynamic_string(&ds_warnings, NULL, 0, 256);
ds_warn= &ds_warnings;
init_dynamic_string(&rs_warnings, NULL, 0, 256);
ds_warn= &rs_warnings;
/*
Evaluate query if this is an eval command
@ -9096,11 +9228,11 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
*/
if (command->require_file)
{
init_dynamic_string(&ds_result, "", 1024, 1024);
ds= &ds_result;
init_dynamic_string(&rs_cmp_result, "", 1024, 1024);
rs_output= &rs_cmp_result;
}
else
ds= &ds_res;
rs_output= &ds_res; // will be shown to colsole
/*
Log the query into the output buffer
@ -9114,9 +9246,9 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
print_query= command->query;
print_len= (int)(command->end - command->query);
}
replace_dynstr_append_mem(ds, print_query, print_len);
dynstr_append_mem(ds, delimiter, delimiter_length);
dynstr_append_mem(ds, "\n", 1);
replace_dynstr_append_mem(rs_output, print_query, print_len);
dynstr_append_mem(rs_output, delimiter, delimiter_length);
dynstr_append_mem(rs_output, "\n", 1);
}
/* We're done with this flag */
@ -9171,7 +9303,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
Collect warnings from create of the view that should otherwise
have been produced when the SELECT was executed
*/
append_warnings(&ds_warnings,
append_warnings(&rs_warnings,
service_connection_enabled ?
cur_con->util_mysql :
mysql);
@ -9227,9 +9359,9 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
that can be sorted before it's added to the
global result string
*/
init_dynamic_string(&ds_sorted, "", 1024, 1024);
save_ds= ds; /* Remember original ds */
ds= &ds_sorted;
init_dynamic_string(&rs_unsorted, "", 1024, 1024);
rs_sorted_save= rs_output; /* Remember original ds */
rs_output= &rs_unsorted;
}
/*
@ -9244,20 +9376,20 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
if (ps_protocol_enabled &&
complete_query &&
match_re(&ps_re, query))
run_query_stmt(cn, command, query, query_len, ds, &ds_warnings);
run_query_stmt(cn, command, query, query_len, rs_output, &rs_warnings);
else
run_query_normal(cn, command, flags, query, query_len,
ds, &ds_warnings);
rs_output, &rs_warnings);
dynstr_free(&ds_warnings);
dynstr_free(&rs_warnings);
ds_warn= 0;
if (display_result_sorted)
{
/* Sort the result set and append it to result */
dynstr_append_sorted(save_ds, &ds_sorted, 1);
ds= save_ds;
dynstr_free(&ds_sorted);
dynstr_append_sorted(rs_sorted_save, &rs_unsorted, 1);
rs_output= rs_sorted_save;
dynstr_free(&rs_unsorted);
}
if (sp_created)
@ -9280,11 +9412,11 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
and the output should be checked against an already
existing file which has been specified using --require or --result
*/
check_require(ds, command->require_file);
check_require(rs_output, command->require_file);
}
if (ds == &ds_result)
dynstr_free(&ds_result);
if (rs_output == &rs_cmp_result)
dynstr_free(&rs_cmp_result);
DBUG_VOID_RETURN;
}
@ -9727,7 +9859,7 @@ int main(int argc, char **argv)
read_command_buf= (char*)my_malloc(PSI_NOT_INSTRUMENTED, read_command_buflen= 65536, MYF(MY_FAE));
init_dynamic_string(&ds_res, "", 2048, 2048);
init_dynamic_string(&ds_res, "", RESULT_STRING_INIT_MEM, RESULT_STRING_INCREMENT_MEM);
init_alloc_root(PSI_NOT_INSTRUMENTED, &require_file_root, 1024, 1024, MYF(0));
parse_args(argc, argv);
@ -10158,7 +10290,7 @@ int main(int argc, char **argv)
if (p && *p == '#' && *(p+1) == '#')
{
dynstr_append_mem(&ds_res, command->query, command->query_len);
dynstr_append(&ds_res, "\n");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("\n"));
}
break;
}
@ -10171,7 +10303,7 @@ int main(int argc, char **argv)
if (disable_query_log)
break;
dynstr_append(&ds_res, "\n");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("\n"));
break;
case Q_PING:
handle_command_error(command, mysql_ping(cur_con->mysql), -1);
@ -11813,7 +11945,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input,
{
const char **line= dynamic_element(&lines, i, const char**);
dynstr_append(ds, *line);
dynstr_append(ds, "\n");
dynstr_append_mem(ds, STRING_WITH_LEN("\n"));
}
delete_dynamic(&lines);

View file

@ -86,7 +86,7 @@ IF(NOT CPACK_PACKAGE_FILE_NAME)
ENDIF()
SET_IF_UNSET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-${VERSION}")
SET_IF_UNSET(CPACK_PACKAGE_CONTACT "MariaDB Developers <maria-developers@lists.launchpad.net>")
SET_IF_UNSET(CPACK_PACKAGE_CONTACT "MariaDB Developers <developers@lists.mariadb.org>")
SET_IF_UNSET(CPACK_PACKAGE_VENDOR "MariaDB Foundation")
SET_IF_UNSET(CPACK_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}

2
debian/control vendored
View file

@ -1,7 +1,7 @@
Source: mariadb-10.5
Section: database
Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
Maintainer: MariaDB Developers <developers@lists.mariadb.org>
Build-Depends: bison,
cmake,
cracklib-runtime <!nocheck>,

5
debian/copyright vendored
View file

@ -2,12 +2,11 @@
== MariaDB ==
The Debian package of MySQL was first debianzed on 1997-04-12 by Christian
Schwarz <schwarz@debian.org> and ist maintained since 1999-04-20 by
Schwarz <schwarz@debian.org> and is maintained since 1999-04-20 by
Christian Hammers <ch@debian.org>.
The MariaDB packages were initially made by http://ourdelta.org/, and
are now managed by the MariaDB development team,
maria-developers@lists.launchpad.net
are now managed by the MariaDB development team, developers@lists.mariadb.org
MariaDB can be downloaded from https://downloads.mariadb.org/

View file

@ -127,7 +127,8 @@ int sd_notifyf() { return 0; }
int sys_var_init();
/* === xtrabackup specific options === */
char xtrabackup_real_target_dir[FN_REFLEN] = "./xtrabackup_backupfiles/";
#define DEFAULT_TARGET_DIR "./xtrabackup_backupfiles/"
char xtrabackup_real_target_dir[FN_REFLEN] = DEFAULT_TARGET_DIR;
char *xtrabackup_target_dir= xtrabackup_real_target_dir;
static my_bool xtrabackup_version;
static my_bool verbose;
@ -413,6 +414,9 @@ uint opt_safe_slave_backup_timeout = 0;
const char *opt_history = NULL;
/* Whether xtrabackup_binlog_info should be created on recovery */
static bool recover_binlog_info;
char mariabackup_exe[FN_REFLEN];
char orig_argv1[FN_REFLEN];
@ -1195,22 +1199,25 @@ struct my_option xb_client_options[]= {
{"compress", OPT_XTRA_COMPRESS,
"Compress individual backup files using the "
"specified compression algorithm. Currently the only supported algorithm "
"is 'quicklz'. It is also the default algorithm, i.e. the one used when "
"--compress is used without an argument.",
"specified compression algorithm. It uses no longer maintained QuickLZ "
"library hence this option was deprecated with MariaDB 10.1.31 and 10.2.13.",
(G_PTR *) &xtrabackup_compress_alg, (G_PTR *) &xtrabackup_compress_alg, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"compress-threads", OPT_XTRA_COMPRESS_THREADS,
"Number of threads for parallel data compression. The default value is "
"1.",
"1. "
"This option was deprecated as it relies on the no longer "
"maintained QuickLZ library.",
(G_PTR *) &xtrabackup_compress_threads,
(G_PTR *) &xtrabackup_compress_threads, 0, GET_UINT, REQUIRED_ARG, 1, 1,
UINT_MAX, 0, 0, 0},
{"compress-chunk-size", OPT_XTRA_COMPRESS_CHUNK_SIZE,
"Size of working buffer(s) for compression threads in bytes. The default "
"value is 64K.",
"value is 64K. "
"This option was deprecated as it relies on the no longer "
"maintained QuickLZ library.",
(G_PTR *) &xtrabackup_compress_chunk_size,
(G_PTR *) &xtrabackup_compress_chunk_size, 0, GET_ULL, REQUIRED_ARG,
(1 << 16), 1024, ULONGLONG_MAX, 0, 0, 0},
@ -1331,7 +1338,9 @@ struct my_option xb_client_options[]= {
{"decompress", OPT_DECOMPRESS,
"Decompresses all files with the .qp "
"extension in a backup previously made with the --compress option.",
"extension in a backup previously made with the --compress option. "
"This option was deprecated as it relies on the no longer "
"maintained QuickLZ library.",
(uchar *) &opt_decompress, (uchar *) &opt_decompress, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
@ -2298,6 +2307,7 @@ xtrabackup_read_metadata(char *filename)
{
FILE *fp;
my_bool r = TRUE;
int t;
fp = fopen(filename,"r");
if(!fp) {
@ -2328,6 +2338,9 @@ xtrabackup_read_metadata(char *filename)
}
/* Optional fields */
if (fscanf(fp, "recover_binlog_info = %d\n", &t) == 1) {
recover_binlog_info = (t == 1);
}
end:
fclose(fp);
@ -2346,11 +2359,13 @@ xtrabackup_print_metadata(char *buf, size_t buf_len)
"backup_type = %s\n"
"from_lsn = " UINT64PF "\n"
"to_lsn = " UINT64PF "\n"
"last_lsn = " UINT64PF "\n",
"last_lsn = " UINT64PF "\n"
"recover_binlog_info = %d\n",
metadata_type,
metadata_from_lsn,
metadata_to_lsn,
metadata_last_lsn);
metadata_last_lsn,
MY_TEST(opt_binlog_info == BINLOG_INFO_LOCKLESS));
}
/***********************************************************************
@ -5961,6 +5976,26 @@ static ibool prepare_handle_del_files(const char *datadir, const char *db, const
return TRUE;
}
/**************************************************************************
Store the current binary log coordinates in a specified file.
@return 'false' on error. */
static bool
store_binlog_info(const char *filename, const char* name, ulonglong pos)
{
FILE *fp = fopen(filename, "w");
if (!fp) {
msg("mariabackup: failed to open '%s'\n", filename);
return(false);
}
fprintf(fp, "%s\t%llu\n", name, pos);
fclose(fp);
return(true);
}
/** Implement --prepare
@return whether the operation succeeded */
static bool xtrabackup_prepare_func(char** argv)
@ -6152,6 +6187,20 @@ static bool xtrabackup_prepare_func(char** argv)
msg("Last binlog file %s, position %lld",
trx_sys.recovered_binlog_filename,
longlong(trx_sys.recovered_binlog_offset));
/* output to xtrabackup_binlog_pos_innodb and (if
backup_safe_binlog_info was available on the server) to
xtrabackup_binlog_info. In the latter case
xtrabackup_binlog_pos_innodb becomes redundant and is created
only for compatibility. */
ok = store_binlog_info(
"xtrabackup_binlog_pos_innodb",
trx_sys.recovered_binlog_filename,
trx_sys.recovered_binlog_offset)
&& (!recover_binlog_info || store_binlog_info(
XTRABACKUP_BINLOG_INFO,
trx_sys.recovered_binlog_filename,
trx_sys.recovered_binlog_offset));
}
/* Check whether the log is applied enough or not. */
@ -6583,9 +6632,10 @@ void handle_options(int argc, char **argv, char ***argv_server,
server_default_groups.push_back(NULL);
snprintf(conf_file, sizeof(conf_file), "my");
if (prepare && target_dir) {
if (prepare) {
snprintf(conf_file, sizeof(conf_file),
"%s/backup-my.cnf", target_dir);
"%s/backup-my.cnf", target_dir ? target_dir:
DEFAULT_TARGET_DIR);
if (!strncmp(argv[1], "--defaults-file=", 16)) {
/* Remove defaults-file*/
for (int i = 2; ; i++) {

View file

@ -173,7 +173,7 @@ extern uint opt_safe_slave_backup_timeout;
extern const char *opt_history;
enum binlog_info_enum { BINLOG_INFO_OFF, BINLOG_INFO_ON,
enum binlog_info_enum { BINLOG_INFO_OFF, BINLOG_INFO_LOCKLESS, BINLOG_INFO_ON,
BINLOG_INFO_AUTO};
extern ulong opt_binlog_info;

View file

@ -83,7 +83,7 @@ static inline ulonglong uint6korr(const void *p)
#define HAVE_mi_uint5korr
#define HAVE_mi_uint6korr
#define HAVE_mi_uint7korr
#define HAVE_mi_uint78orr
#define HAVE_mi_uint8korr
/* Read numbers stored in high-bytes-first order */

View file

@ -343,7 +343,8 @@ enum my_lex_states
MY_LEX_IDENT_OR_KEYWORD,
MY_LEX_IDENT_OR_HEX, MY_LEX_IDENT_OR_BIN, MY_LEX_IDENT_OR_NCHAR,
MY_LEX_STRING_OR_DELIMITER, MY_LEX_MINUS_OR_COMMENT, MY_LEX_PLACEHOLDER,
MY_LEX_COMMA
MY_LEX_COMMA,
MY_LEX_IDENT_OR_QUALIFIED_SPECIAL_FUNC
};
struct charset_info_st;

View file

@ -22,7 +22,7 @@
#ifndef MARIADB_CAPI_RENAME_INCLUDED
#define MARIADB_CAPI_RENAME_INCLUDED
#if !defined(EMBEDDED_LIBRARY)
#if !defined(EMBEDDED_LIBRARY) && !defined(MYSQL_DYNAMIC_PLUGIN)
#define MARIADB_ADD_PREFIX(_SYMBOL) server_##_SYMBOL
#define mysql_real_connect MARIADB_ADD_PREFIX(mysql_real_connect)

View file

@ -25,6 +25,8 @@
#define ALLOC_MAX_BLOCK_TO_DROP 4096
#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10
#define ROOT_FLAG_READ_ONLY 4
#ifdef __cplusplus
extern "C" {
#endif
@ -50,11 +52,8 @@ typedef struct st_mem_root
first free block in queue test counter (if it exceed
MAX_BLOCK_USAGE_BEFORE_DROP block will be dropped in 'used' list)
*/
unsigned int first_block_usage;
#ifdef PROTECT_STATEMENT_MEMROOT
int read_only;
#endif
unsigned short first_block_usage;
unsigned short flags;
void (*error_handler)(void);

View file

@ -668,15 +668,19 @@ extern void my_mutex_end(void);
We need to have at least 256K stack to handle calls to myisamchk_init()
with the current number of keys and key parts.
*/
#if defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN)
#ifndef DBUG_OFF
#define DEFAULT_THREAD_STACK (1024*1024L)
#else
#define DEFAULT_THREAD_STACK (383*1024L) /* 392192 */
#endif
#else
#define DEFAULT_THREAD_STACK (292*1024L) /* 299008 */
#endif
# if defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN)
/*
Optimized WITH_ASAN=ON executables produced
by GCC 12.3.0, GCC 13.2.0, or clang 16.0.6
would fail ./mtr main.1st when the stack size is 5 MiB.
The minimum is more than 6 MiB for CMAKE_BUILD_TYPE=RelWithDebInfo and
more than 8 MiB for CMAKE_BUILD_TYPE=Debug.
Let us add some safety margin.
*/
# define DEFAULT_THREAD_STACK (10L<<20)
# else
# define DEFAULT_THREAD_STACK (292*1024L) /* 299008 */
# endif
#endif
#define MY_PTHREAD_LOCK_READ 0

View file

@ -870,6 +870,7 @@ extern void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root,
extern void *alloc_root(MEM_ROOT *mem_root, size_t Size);
extern void *multi_alloc_root(MEM_ROOT *mem_root, ...);
extern void free_root(MEM_ROOT *root, myf MyFLAGS);
extern void move_root(MEM_ROOT *to, MEM_ROOT *from);
extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
size_t prealloc_size);

View file

@ -112,6 +112,7 @@ typedef struct st_handler_check_param
uint progress_counter; /* How often to call _report_progress() */
ulonglong progress, max_progress;
void (*init_fix_record)(void *);
int (*fix_record)(struct st_myisam_info *info, uchar *record, int keynum);
mysql_mutex_t print_msg_mutex;

View file

@ -277,7 +277,6 @@ typedef struct st_mysql
char *host,*user,*passwd,*unix_socket,*server_version,*host_info;
char *info, *db;
const struct charset_info_st *charset;
MYSQL_FIELD *fields;
MEM_ROOT field_alloc;
my_ulonglong affected_rows;
my_ulonglong insert_id; /* id if insert on table with NEXTNR */
@ -299,7 +298,8 @@ typedef struct st_mysql
/* session-wide random string */
char scramble[SCRAMBLE_LENGTH+1];
my_bool auto_local_infile;
void *unused2, *unused3, *unused4, *unused5;
void *unused2, *unused3, *unused4;
MYSQL_FIELD *fields;
LIST *stmts; /* list of all statements */
const struct st_mysql_methods *methods;
@ -334,7 +334,7 @@ typedef struct st_mysql_res {
} MYSQL_RES;
#if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT)
#if !defined(MYSQL_SERVICE_SQL) && !defined(MYSQL_CLIENT)
#define MYSQL_CLIENT
#endif
@ -366,7 +366,7 @@ typedef struct st_mysql_parameters
*/
#define MYSQL_WAIT_TIMEOUT 8
#if !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
#if !defined(MYSQL_SERVICE_SQL)
#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length)
#endif

View file

@ -464,6 +464,35 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
extern "C" {
extern struct sql_service_st {
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
const char *user, const char *passwd, const char *db, unsigned int port,
const char *unix_socket, unsigned long clientflag);
unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
unsigned long length);
my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
void (STDCALL *mysql_close_func)(MYSQL *mysql);
int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
const void *arg);
unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}
}
struct st_mysql_xid {
long formatID;

View file

@ -464,6 +464,35 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
extern "C" {
extern struct sql_service_st {
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
const char *user, const char *passwd, const char *db, unsigned int port,
const char *unix_socket, unsigned long clientflag);
unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
unsigned long length);
my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
void (STDCALL *mysql_close_func)(MYSQL *mysql);
int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
const void *arg);
unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}
}
struct st_mysql_xid {
long formatID;

View file

@ -464,6 +464,35 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
extern "C" {
extern struct sql_service_st {
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
const char *user, const char *passwd, const char *db, unsigned int port,
const char *unix_socket, unsigned long clientflag);
unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
unsigned long length);
my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
void (STDCALL *mysql_close_func)(MYSQL *mysql);
int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
const void *arg);
unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}
}
struct st_mysql_xid {
long formatID;

View file

@ -464,6 +464,35 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
extern "C" {
extern struct sql_service_st {
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
const char *user, const char *passwd, const char *db, unsigned int port,
const char *unix_socket, unsigned long clientflag);
unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
unsigned long length);
my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
void (STDCALL *mysql_close_func)(MYSQL *mysql);
int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
const void *arg);
unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}
}
struct st_mysql_xid {
long formatID;

View file

@ -464,6 +464,35 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
extern "C" {
extern struct sql_service_st {
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
const char *user, const char *passwd, const char *db, unsigned int port,
const char *unix_socket, unsigned long clientflag);
unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
unsigned long length);
my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
void (STDCALL *mysql_close_func)(MYSQL *mysql);
int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
const void *arg);
unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}
}
struct st_mysql_xid {
long formatID;

View file

@ -464,6 +464,35 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
extern "C" {
extern struct sql_service_st {
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
const char *user, const char *passwd, const char *db, unsigned int port,
const char *unix_socket, unsigned long clientflag);
unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
unsigned long length);
my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
void (STDCALL *mysql_close_func)(MYSQL *mysql);
int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
const void *arg);
unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}
}
struct st_mysql_xid {
long formatID;

View file

@ -464,6 +464,35 @@ int json_escape_string(const char *str,const char *str_end,
int json_unescape_json(const char *json_str, const char *json_end,
char *res, char *res_end);
}
extern "C" {
extern struct sql_service_st {
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
const char *user, const char *passwd, const char *db, unsigned int port,
const char *unix_socket, unsigned long clientflag);
unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
unsigned long length);
my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
void (STDCALL *mysql_close_func)(MYSQL *mysql);
int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
const void *arg);
unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}
}
struct st_mysql_xid {
long formatID;

119
include/mysql/service_sql.h Normal file
View file

@ -0,0 +1,119 @@
/* Copyright (C) 2021 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 Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef MYSQL_SERVICE_SQL
#define MYSQL_SERVICE_SQL
#ifndef MYSQL_ABI_CHECK
#include <mysql.h>
#endif
/**
@file
SQL service
Interface for plugins to execute SQL queries on the local server.
Functions of the service are the 'server-limited' client library:
mysql_init
mysql_real_connect_local
mysql_real_connect
mysql_errno
mysql_error
mysql_real_query
mysql_affected_rows
mysql_num_rows
mysql_store_result
mysql_free_result
mysql_fetch_row
mysql_close
*/
#ifdef __cplusplus
extern "C" {
#endif
extern struct sql_service_st {
MYSQL *(STDCALL *mysql_init_func)(MYSQL *mysql);
MYSQL *(*mysql_real_connect_local_func)(MYSQL *mysql);
MYSQL *(STDCALL *mysql_real_connect_func)(MYSQL *mysql, const char *host,
const char *user, const char *passwd, const char *db, unsigned int port,
const char *unix_socket, unsigned long clientflag);
unsigned int(STDCALL *mysql_errno_func)(MYSQL *mysql);
const char *(STDCALL *mysql_error_func)(MYSQL *mysql);
int (STDCALL *mysql_real_query_func)(MYSQL *mysql, const char *q,
unsigned long length);
my_ulonglong (STDCALL *mysql_affected_rows_func)(MYSQL *mysql);
my_ulonglong (STDCALL *mysql_num_rows_func)(MYSQL_RES *res);
MYSQL_RES *(STDCALL *mysql_store_result_func)(MYSQL *mysql);
void (STDCALL *mysql_free_result_func)(MYSQL_RES *result);
MYSQL_ROW (STDCALL *mysql_fetch_row_func)(MYSQL_RES *result);
void (STDCALL *mysql_close_func)(MYSQL *mysql);
int (STDCALL *mysql_options_func)(MYSQL *mysql, enum mysql_option option,
const void *arg);
unsigned long *(STDCALL *mysql_fetch_lengths_func)(MYSQL_RES *res);
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca,
const char *capath, const char *cipher);
} *sql_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
#define mysql_init(M) sql_service->mysql_init_func(M)
#define mysql_real_connect_local(M) sql_service->mysql_real_connect_local_func(M)
#define mysql_real_connect(M,H,U,PW,D,P,S,F) sql_service->mysql_real_connect_func(M,H,U,PW,D,P,S,F)
#define mysql_errno(M) sql_service->mysql_errno_func(M)
#define mysql_error(M) sql_service->mysql_error_func(M)
#define mysql_real_query sql_service->mysql_real_query_func
#define mysql_affected_rows(M) sql_service->mysql_affected_rows_func(M)
#define mysql_num_rows(R) sql_service->mysql_num_rows_func(R)
#define mysql_store_result(M) sql_service->mysql_store_result_func(M)
#define mysql_free_result(R) sql_service->mysql_free_result_func(R)
#define mysql_fetch_row(R) sql_service->mysql_fetch_row_func(R)
#define mysql_close(M) sql_service->mysql_close_func(M)
#define mysql_options(M,O,V) sql_service->mysql_options_func(M,O,V)
#define mysql_fetch_lengths(R) sql_service->mysql_fetch_lengths_func(R)
#define mysql_set_character_set(M,C) sql_service->mysql_set_character_set_func(M,C)
#define mysql_num_fields(R) sql_service->mysql_num_fields_func(R)
#define mysql_select_db(M,D) sql_service->mysql_select_db_func(M,D)
#define mysql_ssl_set(M,K,C,A,P,H) sql_service->mysql_ssl_set_func(M,K,C,A,P,H)
#else
/*
Establishes the connection to the 'local' server that started the plugin.
Like the mysql_real_connect() does for the remote server.
The established connection has no user/host associated to it,
neither it has the current db, so the queries should have
database/table name specified.
*/
MYSQL *mysql_real_connect_local(MYSQL *mysql);
/* The rest of the function declarations must be taken from the mysql.h */
#endif /*MYSQL_DYNAMIC_PLUGIN*/
#ifdef __cplusplus
}
#endif
#endif /*MYSQL_SERVICE_SQL */

View file

@ -41,6 +41,7 @@ extern "C" {
#include <mysql/service_thd_wait.h>
#include <mysql/service_json.h>
/*#include <mysql/service_wsrep.h>*/
#include <mysql/service_sql.h>
#ifdef __cplusplus
}

View file

@ -43,4 +43,5 @@
#define VERSION_thd_wait 0x0100
#define VERSION_wsrep 0x0500
#define VERSION_json 0x0100
#define VERSION_sql_service 0x0100
#define VERSION_thd_mdl 0x0100

View file

@ -65,13 +65,13 @@ typedef struct st_mysql_methods
MYSQL_ROW column, unsigned int field_count);
void (*flush_use_result)(MYSQL *mysql, my_bool flush_all_results);
int (*read_change_user_result)(MYSQL *mysql);
void (*on_close_free)(MYSQL *mysql);
#if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
MYSQL_FIELD * (*list_fields)(MYSQL *mysql);
my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
int (*stmt_execute)(MYSQL_STMT *stmt);
int (*read_binary_rows)(MYSQL_STMT *stmt);
int (*unbuffered_fetch)(MYSQL *mysql, char **row);
void (*free_embedded_thd)(MYSQL *mysql);
const char *(*read_statistics)(MYSQL *mysql);
my_bool (*next_result)(MYSQL *mysql);
int (*read_rows_from_cursor)(MYSQL_STMT *stmt);

View file

@ -43,7 +43,7 @@ C_MODE_START
extern unsigned int mysql_server_last_errno;
extern char mysql_server_last_error[MYSQL_ERRMSG_SIZE];
static my_bool emb_read_query_result(MYSQL *mysql);
static void emb_free_embedded_thd(MYSQL *mysql);
static void free_embedded_thd(MYSQL *mysql);
static bool embedded_print_errors= 0;
extern "C" void unireg_clear(int exit_code)
@ -121,7 +121,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
thd->killed= NOT_KILLED;
else
{
emb_free_embedded_thd(mysql);
free_embedded_thd(mysql);
thd= 0;
}
}
@ -431,7 +431,7 @@ int emb_unbuffered_fetch(MYSQL *mysql, char **row)
return 0;
}
static void emb_free_embedded_thd(MYSQL *mysql)
static void free_embedded_thd(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
server_threads.erase(thd);
@ -454,12 +454,25 @@ static MYSQL_RES * emb_store_result(MYSQL *mysql)
return mysql_store_result(mysql);
}
int emb_read_change_user_result(MYSQL *mysql)
static int emb_read_change_user_result(MYSQL *mysql)
{
mysql->net.read_pos= (uchar*)""; // fake an OK packet
return mysql_errno(mysql) ? (int)packet_error : 1 /* length of the OK packet */;
}
static void emb_on_close_free(MYSQL *mysql)
{
my_free(mysql->info_buffer);
mysql->info_buffer= 0;
if (mysql->thd)
{
free_embedded_thd(mysql);
mysql->thd= 0;
}
}
MYSQL_METHODS embedded_methods=
{
emb_read_query_result,
@ -469,12 +482,12 @@ MYSQL_METHODS embedded_methods=
emb_fetch_lengths,
emb_flush_use_result,
emb_read_change_user_result,
emb_on_close_free,
emb_list_fields,
emb_read_prepare_result,
emb_stmt_execute,
emb_read_binary_rows,
emb_unbuffered_fetch,
emb_free_embedded_thd,
emb_read_statistics,
emb_read_query_result,
emb_read_rows_from_cursor
@ -691,8 +704,7 @@ void *create_embedded_thd(ulong client_flag)
if (thd->variables.max_join_size == HA_POS_ERROR)
thd->variables.option_bits |= OPTION_BIG_SELECTS;
thd->proc_info=0; // Remove 'login'
thd->set_command(COM_SLEEP);
thd->mark_connection_idle();
thd->set_time();
thd->init_for_queries();
thd->client_capabilities= client_flag | MARIADB_CLIENT_EXTENDED_METADATA;

View file

@ -38,6 +38,7 @@ SET(MYSQLSERVICES_SOURCES
thd_wait_service.c
wsrep_service.c
json_service.c
sql_service.c
)
ADD_CONVENIENCE_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})

19
libservices/sql_service.c Normal file
View file

@ -0,0 +1,19 @@
/* Copyright (c) 2018, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
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-1301 USA
*/
#include <service_versions.h>
SERVICE_VERSION sql_service= (void*)VERSION_sql_service;

View file

@ -87,8 +87,8 @@ edit the test result to the correct results so that we can verify that
the bug is corrected in future releases.
If you want to submit your test case you can send it
to maria-developers@lists.launchpad.net or attach it to a bug report on
https://mariadb.org/jira/.
to developers@lists.mariadb.org or attach it to a bug report on
http://mariadb.org/jira/.
If the test case is really big or if it contains 'not public' data,
then put your .test file and .result file(s) into a tar.gz archive,

View file

@ -59,7 +59,7 @@ let $_wfsie_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
if ($slave_io_errno == '') {
--echo !!!ERROR IN TEST: you must set \$slave_io_errno before you source
--echo !!!wait_for_slave_sql_error.inc. The error we got this time was '$_wfsie_errno',
--echo !!!wait_for_slave_io_error.inc. The error we got this time was '$_wfsie_errno',
--echo !!!so you probably want to add the following line to your test case:
--echo !!! --let \$slave_io_errno= $_wfsie_errno
--die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc

View file

@ -21,6 +21,17 @@
# $slave_timeout
# See include/wait_for_slave_param.inc.
#
# $rpl_allow_error
# By default, this file fails if there is an error in the IO
# thread. However, if an error in the IO thread is possible and allowed,
# setting $rpl_allow_error=1 will prevent this file from failing if
# there is an error in the IO thread.
# (If an error is _always_ expected, a better alternative might be to
# use wait_for_slave_io_error.inc instead of this file).
# Note: This is currently always enabled, since a simple STOP SLAVE
# IO_THREAD can cause an error if it interrupts the slave's initial
# communication with the master (MDEV-32892).
#
# $rpl_debug
# See include/rpl_init.inc
@ -31,9 +42,15 @@
--let $slave_param= Slave_IO_Running
--let $slave_param_value= No
--let $slave_error_param= Last_IO_Errno
--let $_io_stop_save_allow_error= $slave_error_param
# Disabled, as IO errors are left behind when a normal STOP SLAVE interrupts
# the initial communication between the IO thread and the master (MDEV-32892).
#if (!$rpl_allow_error)
#{
# --let $slave_error_param= Last_IO_Errno
#}
--source include/wait_for_slave_param.inc
--let $slave_error_param=
--let $slave_error_param= $_io_stop_save_allow_error
--let $include_filename= wait_for_slave_io_to_stop.inc

View file

@ -35,7 +35,7 @@
# $slave_error_param
# If set, this script will check if the column of the output from
# SHOW SLAVE STATUS named $slave_error_param is nonzero. If it is,
# this script will faile immediately. Typically, this should be set
# this script will fail immediately. Typically, this should be set
# to Last_IO_Errno or Last_SQL_Errno.
#
# $rpl_debug
@ -56,11 +56,6 @@ if (!$_slave_timeout)
}
}
if ($slave_error_param == '')
{
--let $slave_error_param= 1
}
let $_slave_param_comparison= $slave_param_comparison;
if (!$_slave_param_comparison)
{
@ -90,7 +85,7 @@ while ($_slave_continue)
--let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1)
# Check if an error condition is reached.
if (!$slave_error_param)
if ($slave_error_param)
{
--let $_show_slave_status_error_value= query_get_value("SHOW SLAVE STATUS", $slave_error_param, 1)
if ($_show_slave_status_error_value)

View file

@ -21,6 +21,14 @@
# $slave_timeout
# See include/wait_for_slave_param.inc
#
# $rpl_allow_error
# By default, this file fails if there is an error in the SQL
# thread. However, if an error in the SQL thread is possible and allowed,
# setting $rpl_allow_error=1 will prevent this file from failing if
# there is an error in the SQL thread.
# (If an error is _always_ expected, a better alternative might be to
# use wait_for_slave_sql_error.inc instead of this file).
#
# $rpl_debug
# See include/rpl_init.inc
@ -31,7 +39,10 @@
--let $slave_param= Slave_SQL_Running
--let $slave_param_value= No
--let $slave_error_param= Last_SQL_Errno
if (!$rpl_allow_error)
{
--let $slave_error_param= Last_SQL_Errno
}
--source include/wait_for_slave_param.inc
--let $slave_error_param=

View file

@ -1999,8 +1999,7 @@ ALTER TABLE ti1 DROP FOREIGN KEY fi1;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE tm1 DROP FOREIGN KEY fm1;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
ERROR 42000: Can't DROP FOREIGN KEY `fm1`; check that it exists
ALTER TABLE ti1 RENAME TO ti3;
affected rows: 0
ALTER TABLE tm1 RENAME TO tm3;

View file

@ -1696,6 +1696,7 @@ ALTER TABLE ti1 DROP PRIMARY KEY;
ALTER TABLE tm1 DROP PRIMARY KEY;
ALTER TABLE ti1 DROP FOREIGN KEY fi1;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE tm1 DROP FOREIGN KEY fm1;
ALTER TABLE ti1 RENAME TO ti3;

View file

@ -1,3 +1,5 @@
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
#
# Check backup and FTWRL
#
@ -95,7 +97,7 @@ drop table t1;
#
# BACKUP STAGE performs implicit commits
#
create table t1(a int) engine=InnoDB;
create table t1(a int) stats_persistent=0, engine=InnoDB;
begin;
insert into t1 values(1);
select lock_mode from information_schema.metadata_lock_info where thread_id>0;
@ -197,8 +199,9 @@ drop table t1;
# CHECK: RO transaction under BACKUP STAGE is a potential deadlock
# OTOH we most probably allow them under FTWRL as well
#
CREATE TABLE t1 (col1 INT) ENGINE = InnoDB;
CREATE TABLE t1 (col1 INT)stats_persistent=0, ENGINE = InnoDB;
insert into t1 values (1);
InnoDB 0 transactions not purged
backup stage start;
backup stage block_commit;
begin;
@ -526,3 +529,4 @@ FLUSH TABLE t1 WITH READ LOCK;
ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
BACKUP STAGE END;
DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;

View file

@ -5,6 +5,9 @@
--source include/have_innodb.inc
--source include/have_metadata_lock_info.inc
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
--echo #
--echo # Check backup and FTWRL
--echo #
@ -120,7 +123,7 @@ drop table t1;
--echo # BACKUP STAGE performs implicit commits
--echo #
--disable_view_protocol
create table t1(a int) engine=InnoDB;
create table t1(a int) stats_persistent=0, engine=InnoDB;
begin;
insert into t1 values(1);
select lock_mode from information_schema.metadata_lock_info where thread_id>0;
@ -221,8 +224,9 @@ drop table t1;
--echo # OTOH we most probably allow them under FTWRL as well
--echo #
--disable_view_protocol
CREATE TABLE t1 (col1 INT) ENGINE = InnoDB;
CREATE TABLE t1 (col1 INT)stats_persistent=0, ENGINE = InnoDB;
insert into t1 values (1);
--source ../suite/innodb/include/wait_all_purged.inc
backup stage start;
backup stage block_commit;
begin;
@ -521,3 +525,4 @@ FLUSH TABLE t1 FOR EXPORT;
FLUSH TABLE t1 WITH READ LOCK;
BACKUP STAGE END;
DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;

View file

@ -1,6 +1,9 @@
#
# Testing which locks we get from all stages
#
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
InnoDB 0 transactions not purged
BACKUP STAGE START;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
@ -29,7 +32,8 @@ connection default;
#
# testing if BACKUP STAGE FLUSH causes deadlocks with ALTER TABLE
#
create table t1 (a int) engine=innodb;
create table t1 (a int) stats_persistent= 0, engine=innodb;
InnoDB 0 transactions not purged
start transaction;
insert into t1 values (1);
connection con1;
@ -95,7 +99,8 @@ drop table t1;
#
# testing if BACKUP STAGE FLUSH causes deadlocks with DROP TABLE
#
create table t1 (a int) engine=innodb;
create table t1 (a int)stats_persistent=0, engine=innodb;
InnoDB 0 transactions not purged
start transaction;
insert into t1 values (1);
connection con1;
@ -122,6 +127,7 @@ connection default;
# Check if backup stage block_dll + concurrent drop table blocks select
#
create table t1 (a int) engine=innodb;
InnoDB 0 transactions not purged
backup stage start;
backup stage block_ddl;
connection con1;
@ -260,3 +266,4 @@ DROP TABLE t_permanent_myisam, t_permanent_innodb, t_permanent_aria, t_permanent
DROP TABLE t_con1_innodb, t_con1_myisam;
disconnect con1;
set global lock_wait_timeout=default;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;

View file

@ -12,6 +12,9 @@
--echo # Testing which locks we get from all stages
--echo #
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
--source ../suite/innodb/include/wait_all_purged.inc
BACKUP STAGE START;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
BACKUP STAGE FLUSH;
@ -36,8 +39,8 @@ connection default;
--echo # testing if BACKUP STAGE FLUSH causes deadlocks with ALTER TABLE
--echo #
create table t1 (a int) engine=innodb;
create table t1 (a int) stats_persistent= 0, engine=innodb;
--source ../suite/innodb/include/wait_all_purged.inc
start transaction;
# Acquires MDL lock
insert into t1 values (1);
@ -123,7 +126,8 @@ drop table t1;
--echo # testing if BACKUP STAGE FLUSH causes deadlocks with DROP TABLE
--echo #
create table t1 (a int) engine=innodb;
create table t1 (a int)stats_persistent=0, engine=innodb;
--source ../suite/innodb/include/wait_all_purged.inc
start transaction;
# Acquires MDL lock
insert into t1 values (1);
@ -159,6 +163,7 @@ connection default;
--echo #
create table t1 (a int) engine=innodb;
--source ../suite/innodb/include/wait_all_purged.inc
backup stage start;
backup stage block_ddl;
connection con1;
@ -319,3 +324,4 @@ DROP TABLE t_permanent_myisam, t_permanent_innodb, t_permanent_aria, t_permanent
DROP TABLE t_con1_innodb, t_con1_myisam;
--disconnect con1
set global lock_wait_timeout=default;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;

View file

@ -23,7 +23,7 @@ BACKUP UNLOCK;
#
connect con1,localhost,root,,;
connection default;
create table t1 (a int) engine=innodb;
create table t1 (a int) stats_persistent=0,engine=innodb;
insert into t1 values (1);
backup lock t1;
select * from t1;
@ -32,7 +32,7 @@ a
connection con1;
drop table t1;
connection default;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_SHARED_HIGH_PRIO Table metadata lock test t1
MDL_INTENTION_EXCLUSIVE Schema metadata lock test
@ -184,5 +184,82 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock
BACKUP UNLOCK;
DROP TABLE t3;
#
# MDEV-28367: BACKUP LOCKS on table to be accessible to those
# with database LOCK TABLES privileges
#
create database db1;
create table db1.t1(t int);
create user user1@localhost;
select user,host from mysql.user where user='user1';
User Host
user1 localhost
connect(localhost,user1,,db1,MASTER_PORT,MASTER_SOCKET);
connect con1, localhost, user1, ,db1;
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1'
grant reload on *.* to user1@localhost;
grant select on db1.* to user1@localhost;
show grants for user1@localhost;
Grants for user1@localhost
GRANT RELOAD ON *.* TO `user1`@`localhost`
GRANT SELECT ON `db1`.* TO `user1`@`localhost`
connect con1, localhost, user1, ,db1;
BACKUP UNLOCK;
BACKUP LOCK db1.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_SHARED_HIGH_PRIO Table metadata lock db1 t1
BACKUP UNLOCK;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
connection default;
disconnect con1;
grant lock tables on db1.* to user1@localhost;
show grants for user1@localhost;
Grants for user1@localhost
GRANT RELOAD ON *.* TO `user1`@`localhost`
GRANT SELECT, LOCK TABLES ON `db1`.* TO `user1`@`localhost`
connect con1, localhost, user1, ,db1;
BACKUP UNLOCK;
BACKUP LOCK db1.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_SHARED_HIGH_PRIO Table metadata lock db1 t1
BACKUP UNLOCK;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
connection default;
disconnect con1;
revoke reload on *.* from user1@localhost;
show grants for user1@localhost;
Grants for user1@localhost
GRANT USAGE ON *.* TO `user1`@`localhost`
GRANT SELECT, LOCK TABLES ON `db1`.* TO `user1`@`localhost`
connect con1, localhost, user1, ,db1;
BACKUP UNLOCK;
ERROR 42000: Access denied; you need (at least one of) the RELOAD, LOCK TABLES privilege(s) for this operation
BACKUP LOCK db1.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_SHARED_HIGH_PRIO Table metadata lock db1 t1
BACKUP UNLOCK;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
connection default;
disconnect con1;
revoke lock tables on db1.* from user1@localhost;
show grants for user1@localhost;
Grants for user1@localhost
GRANT USAGE ON *.* TO `user1`@`localhost`
GRANT SELECT ON `db1`.* TO `user1`@`localhost`
connect con1, localhost, user1, ,db1;
BACKUP LOCK db1.t1;
ERROR 42000: Access denied; you need (at least one of) the RELOAD, LOCK TABLES privilege(s) for this operation
BACKUP UNLOCK;
ERROR 42000: Access denied; you need (at least one of) the RELOAD, LOCK TABLES privilege(s) for this operation
connection default;
disconnect con1;
drop database db1;
drop user user1@localhost;
#
# End of MariaDB 10.4 tests
#

View file

@ -29,7 +29,7 @@ BACKUP UNLOCK;
connect (con1,localhost,root,,);
connection default;
create table t1 (a int) engine=innodb;
create table t1 (a int) stats_persistent=0,engine=innodb;
insert into t1 values (1);
backup lock t1;
select * from t1;
@ -40,7 +40,7 @@ let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table metadata lock";
--source include/wait_condition.inc
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
--error ER_LOCK_DEADLOCK
select * from t1;
backup unlock;
@ -214,7 +214,78 @@ LOCK TABLES t3 AS a2 WRITE, t3 AS a1 READ LOCAL;
DROP TABLE t3;
BACKUP UNLOCK;
DROP TABLE t3;
--echo #
--echo # MDEV-28367: BACKUP LOCKS on table to be accessible to those
--echo # with database LOCK TABLES privileges
--echo #
--source include/have_metadata_lock_info.inc
create database db1;
create table db1.t1(t int);
create user user1@localhost;
select user,host from mysql.user where user='user1';
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_DBACCESS_DENIED_ERROR
--connect (con1, localhost, user1, ,db1)
grant reload on *.* to user1@localhost;
# To access DB one need select privileges
grant select on db1.* to user1@localhost;
show grants for user1@localhost;
--connect (con1, localhost, user1, ,db1)
# This should work we have RELOAD privilege
BACKUP UNLOCK;
BACKUP LOCK db1.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
BACKUP UNLOCK;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
# Add LOCK TABLES DB privileges (all privileges for BACKUP LOCK are there)
connection default;
disconnect con1;
grant lock tables on db1.* to user1@localhost;
show grants for user1@localhost;
--connect (con1, localhost, user1, ,db1)
# This should work we have RELOAD & LOCK privilege
BACKUP UNLOCK;
BACKUP LOCK db1.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
BACKUP UNLOCK;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
# Remove reload privilege, leave only LOCK TABLES privilege
connection default;
disconnect con1;
revoke reload on *.* from user1@localhost;
show grants for user1@localhost;
--connect (con1, localhost, user1, ,db1)
# There is no reload priv needed for unlock and there is no mdl_backup_lock taken
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP UNLOCK;
# BACKUP LOCK should work, since we have LOCK privilege
BACKUP LOCK db1.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
# This works since there was taken mdl_backup_lock before
BACKUP UNLOCK;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
# Remove LOCK TABLES privilege
connection default;
disconnect con1;
revoke lock tables on db1.* from user1@localhost;
show grants for user1@localhost;
--connect (con1, localhost, user1, ,db1)
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP LOCK db1.t1;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP UNLOCK;
connection default;
disconnect con1;
drop database db1;
drop user user1@localhost;
--echo #
--echo # End of MariaDB 10.4 tests
--echo #

View file

@ -1,3 +1,5 @@
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
#-----------------------------------------------------------------------
# Multi-threaded tests
#-----------------------------------------------------------------------
@ -17,6 +19,7 @@ FROM information_schema.processlist WHERE id = @con1_id;
ID USER COMMAND STATE INFO STAGE MAX_STAGE INFO_BINARY
<con1_id> root Query Waiting for backup lock BACKUP STAGE START 0 0 BACKUP STAGE START
BACKUP STAGE END;
InnoDB 0 transactions not purged
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_BACKUP_START Backup lock
@ -333,3 +336,4 @@ disconnect con11;
disconnect con12;
disconnect backup;
connection default;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;

View file

@ -11,6 +11,8 @@
# Save the initial number of concurrent sessions.
--source include/count_sessions.inc
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
let $old_lock_wait_timeout = `SELECT @@global.lock_wait_timeout`;
--echo #-----------------------------------------------------------------------
@ -50,6 +52,7 @@ FROM information_schema.processlist WHERE id = @con1_id;
# con1 uses @@global.lock_wait_timeout
BACKUP STAGE END;
--source ../suite/innodb/include/wait_all_purged.inc
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
--connection con1
@ -383,3 +386,4 @@ SET GLOBAL lock_wait_timeout = $old_lock_wait_timeout;
--connection default
--source include/wait_until_count_sessions.inc
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;

View file

@ -814,7 +814,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(5) GENERATED ALWAYS AS (cast('a' as char(10) charset latin1) + `a`) VIRTUAL
`b` char(5) GENERATED ALWAYS AS (cast('a' as char(10) charset latin1 binary) + `a`) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
select collation(cast("a" as char(10) binary));

View file

@ -158,10 +158,9 @@ select cast(1 as double(64,63));
#
set names binary;
select cast(_latin1'test' as char character set latin2);
#enable after MDEV-32461 fix
--disable_view_protocol
--disable_service_connection
select cast(_koi8r'ÔÅÓÔ' as char character set cp1251);
--enable_view_protocol
--enable_service_connection
create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
show create table t1;
drop table t1;
@ -169,8 +168,7 @@ drop table t1;
#
# CAST to CHAR with/without length
#
#enable after MDEV-32461 fix
--disable_view_protocol
--disable_service_connection
select
cast(_latin1'ab' AS char) as c1,
cast(_latin1'a ' AS char) as c2,
@ -178,7 +176,7 @@ select
cast(_latin1'a ' AS char(2)) as c4,
hex(cast(_latin1'a' AS char(2))) as c5;
select cast(1000 as CHAR(3));
--enable_view_protocol
--enable_service_connection
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 select
@ -239,15 +237,14 @@ select cast("1:2:3" as TIME) = "1:02:03";
#
CREATE TABLE t1 (a enum ('aac','aab','aaa') not null);
INSERT INTO t1 VALUES ('aaa'),('aab'),('aac');
#enable after MDEV-32461 fix
--disable_view_protocol
--disable_service_connection
# these two should be in enum order
SELECT a, CAST(a AS CHAR) FROM t1 ORDER BY CAST(a AS UNSIGNED) ;
SELECT a, CAST(a AS CHAR(3)) FROM t1 ORDER BY CAST(a AS CHAR(2)), a;
# these two should be in alphabetic order
SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a;
--enable_view_protocol
--enable_service_connection
DROP TABLE t1;
#
@ -349,12 +346,11 @@ select cast(NULL as decimal(6)) as t1;
# Bug #17903: cast to char results in binary
#
set names latin1;
#enable after MDEV-32461 fix
--disable_view_protocol
--disable_service_connection
select hex(cast('a' as char(2) binary));
select hex(cast('a' as binary(2)));
select hex(cast('a' as char(2) binary));
--enable_view_protocol
--enable_service_connection
#
# Bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag.
@ -484,14 +480,13 @@ drop table t1;
#
# CAST (... BINARY)
#
#enable after MDEV-32461 fix
--disable_view_protocol
--disable_service_connection
select collation(cast("a" as char(10) binary));
select collation(cast("a" as char(10) charset utf8 binary));
select collation(cast("a" as char(10) ascii binary));
select collation(cast("a" as char(10) binary charset utf8));
select collation(cast("a" as char(10) binary ascii));
--enable_view_protocol
--enable_service_connection
--echo #
--echo # MDEV-11030 Assertion `precision > 0' failed in decimal_bin_size
@ -773,14 +768,14 @@ INSERT INTO t1 VALUES (-1.0);
SELECT * FROM t1;
DROP TABLE t1;
#enable after MDEV-32461 fix
#enable after MDEV-32645 is fixed
--disable_view_protocol
SELECT CAST(-1e0 AS UNSIGNED);
--enable_view_protocol
CREATE TABLE t1 (a BIGINT UNSIGNED);
INSERT INTO t1 VALUES (-1e0);
SELECT * FROM t1;
DROP TABLE t1;
--enable_view_protocol
SELECT CAST(-1e308 AS UNSIGNED);
CREATE TABLE t1 (a BIGINT UNSIGNED);

View file

@ -1,4 +1,6 @@
drop table if exists t1,t2,t3;
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
CREATE TABLE t2 (a int);
INSERT INTO t2 VALUES(1),(2),(3);
#
@ -259,6 +261,7 @@ Note 1051 Unknown table 'test.t1,mysqltest2.t2'
create table test.t1 (i int) engine=myisam;
create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write;
InnoDB 0 transactions not purged
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock
@ -575,6 +578,7 @@ CREATE TABLE tm (a INT) ENGINE=MERGE UNION(t);
CREATE OR REPLACE TABLE t LIKE tm;
ERROR HY000: Table 'tm' is specified twice, both as a target for 'CREATE' and as a separate source for data
DROP TABLE IF EXISTS tm, t;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
#
# End of 10.3 tests
#

View file

@ -8,6 +8,8 @@
drop table if exists t1,t2,t3;
--enable_warnings
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
#
# Create help table
#
@ -216,6 +218,7 @@ drop table if exists test.t1,mysqltest2.t2;
create table test.t1 (i int) engine=myisam;
create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write;
--source ../suite/innodb/include/wait_all_purged.inc
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info;
@ -523,6 +526,7 @@ CREATE OR REPLACE TABLE t LIKE tm;
# Cleanup
DROP TABLE IF EXISTS tm, t;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
--echo #
--echo # End of 10.3 tests
--echo #

View file

@ -2599,4 +2599,29 @@ src path dest distance population
E FD D 251 80000
drop procedure sp;
drop table distances, city_population;
#
# MDEV-28615: Multi-table UPDATE over derived table containing
# row that uses subquery with hanging CTE
#
CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (3), (7), (1);
UPDATE
(SELECT (5, (WITH cte AS (SELECT 1) SELECT a FROM t1))) dt
JOIN t1 t
ON t.a=dt.a
SET t.a = 1;
ERROR 21000: Operand should contain 1 column(s)
UPDATE
(SELECT a FROM t1
WHERE (5, (WITH cte AS (SELECT 1) SELECT a FROM t1 WHERE a > 4)) <=
(5,a)) dt
JOIN t1 t
ON t.a=dt.a
SET t.a = 1;
SELECT * FROM t1;
a
3
1
1
DROP TABLE t1;
# End of 10.4 tests

View file

@ -1796,8 +1796,6 @@ with data as (select 1 as id)
select id into @myid from data;
set sql_mode= @save_sql_mode;
--echo #
--echo # MDEV-31995 Bogus error executing PS for query using CTE with renaming of columns
--echo #
@ -1954,4 +1952,31 @@ drop procedure sp;
drop table distances, city_population;
--echo #
--echo # MDEV-28615: Multi-table UPDATE over derived table containing
--echo # row that uses subquery with hanging CTE
--echo #
CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (3), (7), (1);
--error ER_OPERAND_COLUMNS
UPDATE
(SELECT (5, (WITH cte AS (SELECT 1) SELECT a FROM t1))) dt
JOIN t1 t
ON t.a=dt.a
SET t.a = 1;
UPDATE
(SELECT a FROM t1
WHERE (5, (WITH cte AS (SELECT 1) SELECT a FROM t1 WHERE a > 4)) <=
(5,a)) dt
JOIN t1 t
ON t.a=dt.a
SET t.a = 1;
SELECT * FROM t1;
DROP TABLE t1;
--echo # End of 10.4 tests

View file

@ -613,7 +613,7 @@ ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('SET STATEMENT ',@seq, '.a=1 SELECT 1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('SET STATEMENT a.',@seq, '=1 SELECT 1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
ERROR HY000: Invalid cp932 character string: '\x81'
#
# SET SESSION (bad|good.bad|bad.good)=1
#
@ -622,7 +622,7 @@ ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('SET SESSION ',@seq, '.a=1 SELECT 1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('SET SESSION a.',@seq, '=1 SELECT 1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
ERROR HY000: Invalid cp932 character string: '\x81'
#
# SET (bad|good.bad|bad.good)=1
#
@ -631,7 +631,7 @@ ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('SET ', @seq, '.a=1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('SET a.', @seq, '=1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
ERROR HY000: Invalid cp932 character string: '\x81'
#
# Oracle SP call: BEGIN (bad|good.bad|bad.good)(params); END
#
@ -641,7 +641,7 @@ ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('BEGIN ',@seq, '.a(1); END;');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('BEGIN a.',@seq, '(1); END;');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
ERROR HY000: Invalid cp932 character string: '\x81'
#
# Oracle assignment: (bad|good.bad|bad.good):= value
#
@ -650,7 +650,7 @@ ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT(@seq, '.a:=1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('a.', @seq, ':=1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
ERROR HY000: Invalid cp932 character string: '\x81'
SET sql_mode=DEFAULT;
#
# End of 10.5 tests

View file

@ -19349,7 +19349,7 @@ ERROR HY000: Invalid sjis character string: '
EXECUTE IMMEDIATE CONCAT('SET STATEMENT ',@seq, '.a=1 SELECT 1');
ERROR HY000: Invalid sjis character string: '<27>_x81<38>_xAD'
EXECUTE IMMEDIATE CONCAT('SET STATEMENT a.',@seq, '=1 SELECT 1');
ERROR HY000: Invalid sjis character string: '<27>_x81<EFBFBD>_xAD'
ERROR HY000: Invalid sjis character string: '<27>_x81'
#
# SET SESSION (bad|good.bad|bad.good)=1
#
@ -19358,7 +19358,7 @@ ERROR HY000: Invalid sjis character string: '
EXECUTE IMMEDIATE CONCAT('SET SESSION ',@seq, '.a=1 SELECT 1');
ERROR HY000: Invalid sjis character string: '<27>_x81<38>_xAD'
EXECUTE IMMEDIATE CONCAT('SET SESSION a.',@seq, '=1 SELECT 1');
ERROR HY000: Invalid sjis character string: '<27>_x81<EFBFBD>_xAD'
ERROR HY000: Invalid sjis character string: '<27>_x81'
#
# SET (bad|good.bad|bad.good)=1
#
@ -19367,7 +19367,7 @@ ERROR HY000: Invalid sjis character string: '
EXECUTE IMMEDIATE CONCAT('SET ', @seq, '.a=1');
ERROR HY000: Invalid sjis character string: '<27>_x81<38>_xAD'
EXECUTE IMMEDIATE CONCAT('SET a.', @seq, '=1');
ERROR HY000: Invalid sjis character string: '<27>_x81<EFBFBD>_xAD'
ERROR HY000: Invalid sjis character string: '<27>_x81'
#
# Oracle SP call: BEGIN (bad|good.bad|bad.good)(params); END
#
@ -19377,7 +19377,7 @@ ERROR HY000: Invalid sjis character string: '
EXECUTE IMMEDIATE CONCAT('BEGIN ',@seq, '.a(1); END;');
ERROR HY000: Invalid sjis character string: '<27>_x81<38>_xAD'
EXECUTE IMMEDIATE CONCAT('BEGIN a.',@seq, '(1); END;');
ERROR HY000: Invalid sjis character string: '<27>_x81<EFBFBD>_xAD'
ERROR HY000: Invalid sjis character string: '<27>_x81'
#
# Oracle assignment: (bad|good.bad|bad.good):= value
#
@ -19386,7 +19386,7 @@ ERROR HY000: Invalid sjis character string: '
EXECUTE IMMEDIATE CONCAT(@seq, '.a:=1');
ERROR HY000: Invalid sjis character string: '<27>_x81<38>_xAD'
EXECUTE IMMEDIATE CONCAT('a.', @seq, ':=1');
ERROR HY000: Invalid sjis character string: '<27>_x81<EFBFBD>_xAD'
ERROR HY000: Invalid sjis character string: '<27>_x81'
SET sql_mode=DEFAULT;
#
# End of 10.5 tests

View file

@ -4170,4 +4170,49 @@ a
deallocate prepare stmt;
drop view v;
drop table t1,t2,t3;
#
# MDEV-32829 Crash when executing PS for query with eliminated subquery
# using view
#
create view v1 as select 1 as a;
prepare stmt from
'SELECT EXISTS (SELECT 1 FROM v1 GROUP BY a IN (SELECT a FROM v1))';
execute stmt;
EXISTS (SELECT 1 FROM v1 GROUP BY a IN (SELECT a FROM v1))
1
drop view v1;
create table t1 (a int, b int);
insert into t1 values (1,2),(3,4),(5,6);
create view v1 as select * from t1;
create table t2 select * from t1;
prepare stmt from "select t2.a from t2 where exists
(
select * from t1 where t2.b = t1.b and t1.b != 6
group by a in (select a from v1 where v1.a = t2.a)
)";
execute stmt;
a
1
3
execute stmt;
a
1
3
deallocate prepare stmt;
create procedure aproc() select t2.a from t2 where exists
(
select * from t1 where t2.b = t1.b and t1.b != 6
group by a in (select a from v1 where v1.a = t2.a)
);
call aproc();
a
1
3
call aproc();
a
1
3
drop table t1, t2;
drop view v1;
drop procedure aproc;
# End of 10.4 tests

View file

@ -2759,4 +2759,40 @@ deallocate prepare stmt;
drop view v;
drop table t1,t2,t3;
--echo #
--echo # MDEV-32829 Crash when executing PS for query with eliminated subquery
--echo # using view
--echo #
create view v1 as select 1 as a;
prepare stmt from
'SELECT EXISTS (SELECT 1 FROM v1 GROUP BY a IN (SELECT a FROM v1))';
execute stmt;
drop view v1;
create table t1 (a int, b int);
insert into t1 values (1,2),(3,4),(5,6);
create view v1 as select * from t1;
create table t2 select * from t1;
let $q=
select t2.a from t2 where exists
(
select * from t1 where t2.b = t1.b and t1.b != 6
group by a in (select a from v1 where v1.a = t2.a)
);
eval prepare stmt from "$q";
execute stmt;
execute stmt;
deallocate prepare stmt;
eval create procedure aproc() $q;
call aproc();
call aproc();
drop table t1, t2;
drop view v1;
drop procedure aproc;
--echo # End of 10.4 tests

View file

@ -670,18 +670,16 @@ SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,50));
--echo #
--echo # creation test (names)
set names utf8;
#enable after MDEV-32465 fix
--disable_view_protocol
--disable_service_connection
select hex(column_create("адын", 1212));
--enable_view_protocol
--enable_service_connection
select hex(column_create("1212", 1212));
select hex(column_create(1212, 2, "www", 3));
select hex(column_create("1212", 2, "www", 3));
select hex(column_create("1212", 2, 3, 3));
#enable after MDEV-32465 fix
--disable_view_protocol
--disable_service_connection
select hex(column_create("1212", 2, "адын", 1, 3, 3));
--enable_view_protocol
--enable_service_connection
set names latin1;
--echo # fetching column test (names)
@ -708,15 +706,14 @@ select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4") as ex;
set names latin1;
--echo # column changing test (names)
#enable after MDEV-32465 fix
--disable_view_protocol
--disable_service_connection
select hex(column_add(column_create(1, "AAA"), "b", "BBB")) as ex;
select hex(column_add(column_create("1", "AAA"), "b", "BBB")) as ex;
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char) as ex;
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char) as ex;
select hex(column_add(column_create("a", "AAA"), 1, "BBB")) as ex;
select hex(column_add(column_create("a", "AAA"), "1", "BBB")) as ex;
--enable_view_protocol
--enable_service_connection
select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer)) as ex;

View file

@ -158,5 +158,12 @@ t3 CREATE TABLE `t3` (
PRIMARY KEY (`c1`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t3;
#
# MDEV-21618 CREATE UNIQUE INDEX fails with "ERROR 1286 (42000): Unknown storage engine 'partition'"
#
SET SESSION enforce_storage_engine=MyISAM;
CREATE TABLE t4 (a INT) ENGINE=MyISAM PARTITION BY HASH(a);
CREATE INDEX x on t4 (a);
DROP TABLE t4;
SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;

View file

@ -1,4 +1,5 @@
-- source include/not_embedded.inc
--source include/not_embedded.inc
--source include/have_partition.inc
set local sql_mode="";
set global sql_mode="";
@ -107,5 +108,15 @@ ALTER TABLE t3 ADD COLUMN c3 INT;
SHOW CREATE TABLE t3;
DROP TABLE t3;
--echo #
--echo # MDEV-21618 CREATE UNIQUE INDEX fails with "ERROR 1286 (42000): Unknown storage engine 'partition'"
--echo #
SET SESSION enforce_storage_engine=MyISAM;
CREATE TABLE t4 (a INT) ENGINE=MyISAM PARTITION BY HASH(a);
CREATE INDEX x on t4 (a);
DROP TABLE t4;
SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;

View file

@ -1960,6 +1960,11 @@ GRANT EXECUTE ON mysqltest_db1.* TO mysqltest_u1@localhost;
GRANT FILE ON *.* TO mysqltest_u1@localhost;
GRANT CREATE USER ON *.* TO mysqltest_u1@localhost;
GRANT PROCESS ON *.* TO mysqltest_u1@localhost;
GRANT RELOAD ON mysqltest_db1.* TO mysqltest_u1@localhost;
ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
connect(localhost,mysqltest_u1,,db1,MASTER_PORT,MASTER_SOCKET);
connect con1, localhost, mysqltest_u1, ,db1;
ERROR 42000: Access denied for user 'mysqltest_u1'@'localhost' to database 'db1'
GRANT RELOAD ON *.* TO mysqltest_u1@localhost;
GRANT REPLICATION CLIENT ON *.* TO mysqltest_u1@localhost;
GRANT REPLICATION SLAVE ON *.* TO mysqltest_u1@localhost;

View file

@ -1821,6 +1821,13 @@ GRANT EXECUTE ON mysqltest_db1.* TO mysqltest_u1@localhost;
GRANT FILE ON *.* TO mysqltest_u1@localhost;
GRANT CREATE USER ON *.* TO mysqltest_u1@localhost;
GRANT PROCESS ON *.* TO mysqltest_u1@localhost;
# Global privileges should be granted to all schemas, not individual DB
--error ER_WRONG_USAGE
GRANT RELOAD ON mysqltest_db1.* TO mysqltest_u1@localhost;
# Select privilege is needed beside RELOAD privilege
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_DBACCESS_DENIED_ERROR
--connect (con1, localhost, mysqltest_u1, ,db1)
GRANT RELOAD ON *.* TO mysqltest_u1@localhost;
GRANT REPLICATION CLIENT ON *.* TO mysqltest_u1@localhost;
GRANT REPLICATION SLAVE ON *.* TO mysqltest_u1@localhost;

View file

@ -500,21 +500,21 @@ SELECT @@global.rpad(); -- Unknown system variable 'rpad'
--------
SELECT @@global.adddate(); -- Unknown system variable 'adddate'
--------
SELECT @@global.substr(); -- Unknown system variable 'substr'
SELECT @@global.substr(); -- ..syntax.. near 'substr()' at line 1
--------
SELECT @@global.substring(); -- Unknown system variable 'substring'
SELECT @@global.substring(); -- ..syntax.. near 'substring()' at line 1
--------
SELECT @@global.trim_oracle(); -- Unknown system variable 'trim_oracle'
--------
SELECT @@global.ascii(); -- Unknown system variable 'ascii'
--------
SELECT @@global.replace(); -- Unknown system variable 'replace'
SELECT @@global.replace(); -- ..syntax.. near 'replace()' at line 1
--------
SELECT @@global.weight_string(); -- Unknown system variable 'weight_string'
--------
SELECT @@global.char(); -- Unknown system variable 'char'
--------
SELECT @@global.trim(); -- Unknown system variable 'trim'
SELECT @@global.trim(); -- ..syntax.. near 'trim()' at line 1
--------
SELECT @@global.year(); -- Unknown system variable 'year'
--------
@ -732,21 +732,21 @@ CREATE FUNCTION test.rpad() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------
CREATE FUNCTION test.adddate() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------
CREATE FUNCTION test.substr() RETURNS OOPS; -- Unknown data type: 'OOPS'
CREATE FUNCTION test.substr() RETURNS OOPS; -- ..syntax.. near 'substr() RETURNS OOPS'
--------
CREATE FUNCTION test.substring() RETURNS OOPS; -- Unknown data type: 'OOPS'
CREATE FUNCTION test.substring() RETURNS OOPS; -- ..syntax.. near 'substring() RETURNS OOP
--------
CREATE FUNCTION test.trim_oracle() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------
CREATE FUNCTION test.ascii() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------
CREATE FUNCTION test.replace() RETURNS OOPS; -- Unknown data type: 'OOPS'
CREATE FUNCTION test.replace() RETURNS OOPS; -- ..syntax.. near 'replace() RETURNS OOPS'
--------
CREATE FUNCTION test.weight_string() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------
CREATE FUNCTION test.char() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------
CREATE FUNCTION test.trim() RETURNS OOPS; -- Unknown data type: 'OOPS'
CREATE FUNCTION test.trim() RETURNS OOPS; -- ..syntax.. near 'trim() RETURNS OOPS' at
--------
CREATE FUNCTION test.year() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------

View file

@ -231,15 +231,18 @@ SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL log_output= "TABLE";
SET GLOBAL slow_query_log= ON;
SET SESSION long_query_time= 0;
SET GLOBAL debug_dbug="+d,debug_huge_number_of_examined_rows";
SET debug_dbug="+d,debug_huge_number_of_examined_rows";
SELECT * FROM tab_MDEV_30820 ORDER BY 1;
ID A
1 0
2 0
SET GLOBAL debug_dbug=@old_dbug;
SET debug_dbug=@old_dbug;
SET @@long_query_time= @old_long_query_time;
SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log;
SELECT rows_examined, sql_text from mysql.slow_log where sql_text like "SELECT%FROM tab_MDEV_30820%";
rows_examined sql_text
18446744073708551615 SELECT * FROM tab_MDEV_30820 ORDER BY 1
drop table tab_MDEV_30820;
#
# End of 10.4 test

View file

@ -104,16 +104,21 @@ SET GLOBAL log_output= "TABLE";
SET GLOBAL slow_query_log= ON;
SET SESSION long_query_time= 0;
SET GLOBAL debug_dbug="+d,debug_huge_number_of_examined_rows";
SET debug_dbug="+d,debug_huge_number_of_examined_rows";
--disable_ps_protocol
--disable_view_protocol
SELECT * FROM tab_MDEV_30820 ORDER BY 1;
SET GLOBAL debug_dbug=@old_dbug;
--enable_view_protocol
--enable_ps_protocol
SET debug_dbug=@old_dbug;
## Reset to initial values
SET @@long_query_time= @old_long_query_time;
SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log;
SELECT rows_examined, sql_text from mysql.slow_log where sql_text like "SELECT%FROM tab_MDEV_30820%";
drop table tab_MDEV_30820;
--echo #

View file

@ -61,7 +61,7 @@ DROP TABLE t1,t3;
#
# Check MDL locks taken for different kind of tables by open
#
CREATE TABLE t1(a INT) ENGINE=InnoDB;
CREATE TABLE t1(a INT) stats_persistent=0, ENGINE=InnoDB;
CREATE TABLE t3(a INT) ENGINE=myisam;
connect purge_control,localhost,root,,;
START TRANSACTION WITH CONSISTENT SNAPSHOT;

View file

@ -43,7 +43,7 @@ DROP TABLE t1,t3;
--echo # Check MDL locks taken for different kind of tables by open
--echo #
CREATE TABLE t1(a INT) ENGINE=InnoDB;
CREATE TABLE t1(a INT) stats_persistent=0, ENGINE=InnoDB;
CREATE TABLE t3(a INT) ENGINE=myisam;
connect(purge_control,localhost,root,,);
START TRANSACTION WITH CONSISTENT SNAPSHOT;

View file

@ -1,4 +1,6 @@
SET DEBUG_SYNC= 'RESET';
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
connect con1,localhost,root,,test,,;
connect con2,localhost,root,,test,,;
connect con3,localhost,root,,test,,;
@ -2403,6 +2405,7 @@ connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
# Check that FLUSH must wait to get the GRL
# and let DROP PROCEDURE continue
InnoDB 0 transactions not purged
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_BACKUP_DDL Backup lock
@ -2427,7 +2430,7 @@ SET DEBUG_SYNC= 'RESET';
# UPDATE should wait for FTWRL with non transactional table second
#
create table t1 (a int) engine=myisam;
create table t2 (a int) engine=innodb;
create table t2 (a int) stats_persistent=0, engine=innodb;
insert into t1 values (1);
insert into t2 values (1);
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2';
@ -3013,3 +3016,4 @@ connection default;
SET debug_sync='RESET';
DROP TABLE t1;
disconnect con1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;

View file

@ -16,6 +16,8 @@
SET DEBUG_SYNC= 'RESET';
--enable_warnings
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
#
# Test the case of when a exclusive lock request waits for a
# shared lock being upgraded to a exclusive lock.
@ -3085,6 +3087,7 @@ connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
--echo # Check that FLUSH must wait to get the GRL
--echo # and let DROP PROCEDURE continue
--source ../suite/innodb/include/wait_all_purged.inc
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
--send FLUSH TABLES WITH READ LOCK
@ -3110,7 +3113,7 @@ SET DEBUG_SYNC= 'RESET';
--echo #
create table t1 (a int) engine=myisam;
create table t2 (a int) engine=innodb;
create table t2 (a int) stats_persistent=0, engine=innodb;
insert into t1 values (1);
insert into t2 values (1);
@ -4011,3 +4014,4 @@ disconnect con1;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;

View file

@ -520,9 +520,8 @@ The following specify which files/extra groups are read (specified before remain
when binary log is disabled).
--log-tc-size=# Size of transaction coordinator log.
-W, --log-warnings[=#]
Log some not critical warnings to the general log
file.Value can be between 0 and 11. Higher values mean
more verbosity
Log some non critical warnings to the error log.Value can
be between 0 and 11. Higher values mean more verbosity
--long-query-time=# Log all queries that have taken more than long_query_time
seconds to execute to the slow query log file. The
argument will be treated as a decimal value with

View file

@ -3726,6 +3726,126 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 Using where
DROP TABLE t1,t2;
#
# MDEV-29681 Server crashes when optimizing SQL with ORDER BY
#
CREATE TABLE t1 (b INT);
CREATE TABLE t2 (a INT, c INT);
# First test empty tables
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b LIMIT 3) ORDER BY a+1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 0.00 Const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
Note 1003 /* select#1 */ select NULL AS `b`,NULL AS `a`,NULL AS `c` from ((/* select#2 */ select NULL AS `b`,NULL AS `a`,NULL AS `c` from `test`.`t1` join `test`.`t2` where 0 limit 3)) `__2` order by NULL + 1
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b LIMIT 3) ORDER BY a=2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 0.00 Const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
Note 1003 /* select#1 */ select NULL AS `b`,NULL AS `a`,NULL AS `c` from ((/* select#2 */ select NULL AS `b`,NULL AS `a`,NULL AS `c` from `test`.`t1` join `test`.`t2` where 0 limit 3)) `__2` order by NULL = 2
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b LIMIT 3)
ORDER BY a+1, a-b DESC, c<>a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 0.00 Const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
Note 1003 /* select#1 */ select NULL AS `b`,NULL AS `a`,NULL AS `c` from ((/* select#2 */ select NULL AS `b`,NULL AS `a`,NULL AS `c` from `test`.`t1` join `test`.`t2` where 0 limit 3)) `__2` order by NULL + 1,NULL - NULL desc,NULL <> NULL
# Insert some data
INSERT INTO t1 VALUES (1),(2),(3),(4);
INSERT INTO t2 VALUES (1,1),(2,2),(3,3),(4,4);
(SELECT * FROM t1 JOIN t2 ON a=b LIMIT 3) ORDER BY a=b, a-10 DESC, b+a, c+a+a+b;
b a c
1 1 1
2 2 2
3 3 3
(SELECT * FROM t1 JOIN t2 ON a=b LIMIT 3) ORDER BY a=2;
b a c
1 1 1
2 2 2
3 3 3
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b LIMIT 3)
ORDER BY a=b, a-10, b+a, c+a+a+b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00 Using filesort
2 DERIVED t1 ALL NULL NULL NULL NULL 4 100.00
2 DERIVED t2 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1003 /* select#1 */ select `__2`.`b` AS `b`,`__2`.`a` AS `a`,`__2`.`c` AS `c` from ((/* select#2 */ select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` limit 3)) `__2` order by `__2`.`a` = `__2`.`b`,`__2`.`a` - 10,`__2`.`b` + `__2`.`a`,`__2`.`c` + `__2`.`a` + `__2`.`a` + `__2`.`b`
# When there is no LIMIT clause the derived table must be merged
(SELECT * FROM t1 JOIN t2 ON a=b) ORDER BY a+16, b+a, c<>b;
b a c
1 1 1
2 2 2
3 3 3
4 4 4
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b) ORDER BY a+16 DESC, b+a, c<>b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1003 (select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` order by `test`.`t2`.`a` + 16 desc,`test`.`t1`.`b` + `test`.`t2`.`a`,`test`.`t2`.`c` <> `test`.`t1`.`b`)
# Test UNIONs:
(SELECT * FROM t1 JOIN t2 ON a=b UNION
SELECT * FROM t1 JOIN t2 ON a!=b
LIMIT 3)
ORDER BY a+16, b+a, c<>b;
b a c
1 1 1
2 2 2
3 3 3
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b UNION
SELECT * FROM t1 JOIN t2 ON a!=b
LIMIT 3)
ORDER BY a+16, b+a, c<>b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 32 100.00 Using filesort
2 DERIVED t1 ALL NULL NULL NULL NULL 4 100.00
2 DERIVED t2 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
3 UNION t1 ALL NULL NULL NULL NULL 4 100.00
3 UNION t2 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 /* select#1 */ select `__3`.`b` AS `b`,`__3`.`a` AS `a`,`__3`.`c` AS `c` from (/* select#2 */ select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` union /* select#3 */ select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` <> `test`.`t1`.`b` limit 3) `__3` order by `__3`.`a` + 16,`__3`.`b` + `__3`.`a`,`__3`.`c` <> `__3`.`b`
(SELECT * FROM t1 JOIN t2 ON a=b UNION
SELECT NULL, NULL, NULL
LIMIT 3)
ORDER BY b-a-c;
b a c
1 1 1
2 2 2
3 3 3
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b UNION
SELECT NULL, NULL, NULL
LIMIT 3)
ORDER BY b-a-c;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 16 100.00 Using filesort
2 DERIVED t1 ALL NULL NULL NULL NULL 4 100.00
2 DERIVED t2 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 /* select#1 */ select `__3`.`b` AS `b`,`__3`.`a` AS `a`,`__3`.`c` AS `c` from (/* select#2 */ select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` union /* select#3 */ select NULL AS `NULL`,NULL AS `NULL`,NULL AS `NULL` limit 3) `__3` order by `__3`.`b` - `__3`.`a` - `__3`.`c`
(SELECT * FROM t1 JOIN t2 ON a=b UNION
SELECT NULL, NULL, NULL
ORDER BY a LIMIT 3)
ORDER BY b-a-c LIMIT 1;
b a c
NULL NULL NULL
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b UNION
SELECT NULL, NULL, NULL
ORDER BY a LIMIT 3)
ORDER BY b-a-c LIMIT 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 16 100.00 Using filesort
2 DERIVED t1 ALL NULL NULL NULL NULL 4 100.00
2 DERIVED t2 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL Using filesort
Warnings:
Note 1003 /* select#1 */ select `__3`.`b` AS `b`,`__3`.`a` AS `a`,`__3`.`c` AS `c` from (/* select#2 */ select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` union /* select#3 */ select NULL AS `NULL`,NULL AS `NULL`,NULL AS `NULL` order by `a` limit 3) `__3` order by `__3`.`b` - `__3`.`a` - `__3`.`c` limit 1
DROP TABLE t1, t2;
# End of 10.4 tests
#
# MDEV-21655: Server crashes in my_qsort2 / Filesort_buffer::sort_buffer

View file

@ -2469,6 +2469,65 @@ EXPLAIN SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FRO
DROP TABLE t1,t2;
--echo #
--echo # MDEV-29681 Server crashes when optimizing SQL with ORDER BY
--echo #
CREATE TABLE t1 (b INT);
CREATE TABLE t2 (a INT, c INT);
--echo # First test empty tables
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b LIMIT 3) ORDER BY a+1;
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b LIMIT 3) ORDER BY a=2;
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b LIMIT 3)
ORDER BY a+1, a-b DESC, c<>a;
--echo # Insert some data
INSERT INTO t1 VALUES (1),(2),(3),(4);
INSERT INTO t2 VALUES (1,1),(2,2),(3,3),(4,4);
--sorted_result
(SELECT * FROM t1 JOIN t2 ON a=b LIMIT 3) ORDER BY a=b, a-10 DESC, b+a, c+a+a+b;
--sorted_result
(SELECT * FROM t1 JOIN t2 ON a=b LIMIT 3) ORDER BY a=2;
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b LIMIT 3)
ORDER BY a=b, a-10, b+a, c+a+a+b;
--echo # When there is no LIMIT clause the derived table must be merged
--sorted_result
(SELECT * FROM t1 JOIN t2 ON a=b) ORDER BY a+16, b+a, c<>b;
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b) ORDER BY a+16 DESC, b+a, c<>b;
--echo # Test UNIONs:
--sorted_result
(SELECT * FROM t1 JOIN t2 ON a=b UNION
SELECT * FROM t1 JOIN t2 ON a!=b
LIMIT 3)
ORDER BY a+16, b+a, c<>b;
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b UNION
SELECT * FROM t1 JOIN t2 ON a!=b
LIMIT 3)
ORDER BY a+16, b+a, c<>b;
--sorted_result
(SELECT * FROM t1 JOIN t2 ON a=b UNION
SELECT NULL, NULL, NULL
LIMIT 3)
ORDER BY b-a-c;
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b UNION
SELECT NULL, NULL, NULL
LIMIT 3)
ORDER BY b-a-c;
--sorted_result
(SELECT * FROM t1 JOIN t2 ON a=b UNION
SELECT NULL, NULL, NULL
ORDER BY a LIMIT 3)
ORDER BY b-a-c LIMIT 1;
EXPLAIN EXTENDED (SELECT * FROM t1 JOIN t2 ON a=b UNION
SELECT NULL, NULL, NULL
ORDER BY a LIMIT 3)
ORDER BY b-a-c LIMIT 1;
DROP TABLE t1, t2;
--echo # End of 10.4 tests
--echo #

View file

@ -203,6 +203,10 @@ INSERT INTO t1 VALUES (100);
ERROR HY000: Table has no partition for value 100
insert INTO t1 VALUES (110);
ERROR HY000: Table has no partition for value 110
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
@ -406,7 +410,7 @@ t1 InnoDB 10 Dynamic 2 8192 16384 0 0 0 NULL Create_time NULL NULL latin1_swedis
insert into t1 values (0), (1), (2), (3);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
t1 InnoDB 10 Dynamic 4 4096 16384 0 0 0 NULL Create_time Update_time NULL latin1_swedish_ci NULL partitioned 0 N
t1 InnoDB 10 Dynamic Rows Avg_row_length 16384 0 0 0 NULL Create_time Update_time NULL latin1_swedish_ci NULL partitioned 0 N
drop table t1;
create table t1 (a int auto_increment primary key)
engine = innodb
@ -417,11 +421,11 @@ t1 InnoDB 10 Dynamic 2 8192 16384 0 0 0 1 Create_time NULL NULL latin1_swedish_c
insert into t1 values (NULL), (NULL), (NULL), (NULL);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
t1 InnoDB 10 Dynamic 4 4096 16384 0 0 0 5 Create_time Update_time NULL latin1_swedish_ci NULL partitioned 0 N
t1 InnoDB 10 Dynamic Rows Avg_row_length 16384 0 0 0 5 Create_time Update_time NULL latin1_swedish_ci NULL partitioned 0 N
insert into t1 values (NULL), (NULL), (NULL), (NULL);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
t1 InnoDB 10 Dynamic 8 2048 16384 0 0 0 9 Create_time Update_time NULL latin1_swedish_ci NULL partitioned 0 N
t1 InnoDB 10 Dynamic Rows Avg_row_length 16384 0 0 0 9 Create_time Update_time NULL latin1_swedish_ci NULL partitioned 0 N
drop table t1;
create table t1 (a int)
partition by key (a)

View file

@ -214,6 +214,7 @@ INSERT INTO t1 VALUES (90);
INSERT INTO t1 VALUES (100);
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
insert INTO t1 VALUES (110);
ANALYZE TABLE t1;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90;
@ -426,7 +427,9 @@ partition by key (a);
--replace_column 12 Create_time
show table status;
insert into t1 values (0), (1), (2), (3);
--replace_column 12 Create_time 13 Update_time
# Mask `Rows`, as it can fluctuate slightly if background statistics are
# running simultaneously with insert (MDEV-20169).
--replace_column 5 Rows 6 Avg_row_length 12 Create_time 13 Update_time
show table status;
drop table t1;
@ -436,10 +439,10 @@ partition by key (a);
--replace_column 12 Create_time
show table status;
insert into t1 values (NULL), (NULL), (NULL), (NULL);
--replace_column 12 Create_time 13 Update_time
--replace_column 5 Rows 6 Avg_row_length 12 Create_time 13 Update_time
show table status;
insert into t1 values (NULL), (NULL), (NULL), (NULL);
--replace_column 12 Create_time 13 Update_time
--replace_column 5 Rows 6 Avg_row_length 12 Create_time 13 Update_time
show table status;
drop table t1;

View file

@ -3,6 +3,20 @@
#
CREATE TABLE t1 (a VARCHAR(10)) ENGINE=MYISAM;
CREATE TABLE t2 (b VARCHAR(10) CHARACTER SET utf8) ENGINE=MYISAM;
INSERT INTO t1 VALUES ('b'), ('a'), ('c');
INSERT INTO t2 VALUES ('c'), ('d'), ('b');
PREPARE stmt FROM "SELECT t1.a FROM t1 WHERE t1.a IN (SELECT t2.b FROM t2)";
EXECUTE stmt;
a
c
b
EXECUTE stmt;
a
c
b
DEALLOCATE PREPARE stmt;
DELETE FROM t1;
DELETE FROM t2;
INSERT INTO t1 VALUES ('b');
INSERT INTO t2 VALUES ('b');
PREPARE stmt FROM "SELECT t1.a FROM t1 WHERE t1.a IN (SELECT t2.b FROM t2)";
@ -14,3 +28,64 @@ a
b
DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2;
#
# MDEV-32569: Failure when executing PS for query using IN subquery
#
CREATE TABLE t1 (a varchar(10)) ENGINE=MYISAM;
CREATE TABLE t2 (b varchar(10) CHARACTER SET utf8) ENGINE=MYISAM;
INSERT INTO t1 VALUES ('b');
INSERT INTO t2 VALUES ('b');
PREPARE stmt FROM
"SELECT STRAIGHT_JOIN t1.a FROM t1 WHERE t1.a IN (SELECT t2.b FROM t2)";
EXECUTE stmt;
a
b
EXECUTE stmt;
a
b
DEALLOCATE PREPARE stmt;
DROP TABLE t1,t2;
#
# MDEV-32733: Two JSON related tests running in PS mode fail on server
# built with -DWITH_PROTECT_STATEMENT_MEMROOT=YES
#
PREPARE stmt FROM "select json_contains_path('{\"key1\":1}', 'oNE', '$.key2[1]') as exp";
EXECUTE stmt;
exp
0
EXECUTE stmt;
exp
0
DEALLOCATE PREPARE stmt;
#
# MDEV-32466: Potential memory leak on execuing of create view statement
#
CREATE FUNCTION f1 () RETURNS VARCHAR(1)
BEGIN
DECLARE rec1 ROW TYPE OF v1;
SELECT z INTO rec1 FROM v1;
RETURN 1;
END|
CREATE FUNCTION f2 () RETURNS VARCHAR(1) RETURN '!';
CREATE VIEW v1 AS SELECT f2() z;
PREPARE stmt FROM "SELECT f1()";
EXECUTE stmt;
f1()
1
EXECUTE stmt;
f1()
1
DEALLOCATE PREPARE stmt;
DROP FUNCTION f1;
DROP VIEW v1;
DROP FUNCTION f2;
#
# MDEV-32867: ASAN errors in Item_func_json_contains_path::val_int upon PS execution
#
CREATE TABLE t1 (f BLOB) ENGINE=MyISAM;
PREPARE stmt FROM "SELECT * FROM t1 WHERE JSON_EXISTS(JSON_ARRAY('[true,1234567890]'), '$**.*') != JSON_CONTAINS_PATH(JSON_INSERT('{}', '$[1]', NULL), 'all', '$[1]')";
EXECUTE stmt;
f
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
# End of 10.4 tests

View file

@ -13,6 +13,19 @@
CREATE TABLE t1 (a VARCHAR(10)) ENGINE=MYISAM;
CREATE TABLE t2 (b VARCHAR(10) CHARACTER SET utf8) ENGINE=MYISAM;
INSERT INTO t1 VALUES ('b'), ('a'), ('c');
INSERT INTO t2 VALUES ('c'), ('d'), ('b');
PREPARE stmt FROM "SELECT t1.a FROM t1 WHERE t1.a IN (SELECT t2.b FROM t2)";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DELETE FROM t1;
DELETE FROM t2;
INSERT INTO t1 VALUES ('b');
INSERT INTO t2 VALUES ('b');
@ -25,3 +38,75 @@ DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2;
--echo #
--echo # MDEV-32569: Failure when executing PS for query using IN subquery
--echo #
CREATE TABLE t1 (a varchar(10)) ENGINE=MYISAM;
CREATE TABLE t2 (b varchar(10) CHARACTER SET utf8) ENGINE=MYISAM;
INSERT INTO t1 VALUES ('b');
INSERT INTO t2 VALUES ('b');
PREPARE stmt FROM
"SELECT STRAIGHT_JOIN t1.a FROM t1 WHERE t1.a IN (SELECT t2.b FROM t2)";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-32733: Two JSON related tests running in PS mode fail on server
--echo # built with -DWITH_PROTECT_STATEMENT_MEMROOT=YES
--echo #
PREPARE stmt FROM "select json_contains_path('{\"key1\":1}', 'oNE', '$.key2[1]') as exp";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
--echo #
--echo # MDEV-32466: Potential memory leak on execuing of create view statement
--echo #
--delimiter |
CREATE FUNCTION f1 () RETURNS VARCHAR(1)
BEGIN
DECLARE rec1 ROW TYPE OF v1;
SELECT z INTO rec1 FROM v1;
RETURN 1;
END|
--delimiter ;
CREATE FUNCTION f2 () RETURNS VARCHAR(1) RETURN '!';
CREATE VIEW v1 AS SELECT f2() z;
PREPARE stmt FROM "SELECT f1()";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
# Clean up
DROP FUNCTION f1;
DROP VIEW v1;
DROP FUNCTION f2;
--echo #
--echo # MDEV-32867: ASAN errors in Item_func_json_contains_path::val_int upon PS execution
--echo #
CREATE TABLE t1 (f BLOB) ENGINE=MyISAM;
PREPARE stmt FROM "SELECT * FROM t1 WHERE JSON_EXISTS(JSON_ARRAY('[true,1234567890]'), '$**.*') != JSON_CONTAINS_PATH(JSON_INSERT('{}', '$[1]', NULL), 'all', '$[1]')";
EXECUTE stmt;
# Clean up
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo # End of 10.4 tests

View file

@ -103,19 +103,19 @@ drop table t1;
show variables like "wait_timeout%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 4097 0 8
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 4097 0 8
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 4096 5 N 4097 0 8
Variable_name Value
wait_timeout 28800
show variables like "WAIT_timeout%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 4097 0 8
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 4097 0 8
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 4096 5 N 4097 0 8
Variable_name Value
wait_timeout 28800
show variables like "this_doesn't_exists%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 4097 0 8
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 0 N 4097 0 8
def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 4096 0 N 4097 0 8
Variable_name Value
show table status from test like "this_doesn't_exists%";
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr

View file

@ -1318,7 +1318,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(3) DEFAULT NULL
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
create table t1 (a int);
@ -7161,23 +7161,26 @@ drop table t1;
#
# MDEV-7565: Server crash with Signal 6 (part 2)
#
create table t1 (id int not null primary key);
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
Group By TestCase.Revenue, TestCase.TemplateID;
ControlRev
NULL
drop table t1;
#
# MDEV-7445:Server crash with Signal 6
#
create table t1 (id int not null primary key);
CREATE PROCEDURE procedure2()
BEGIN
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
@ -7190,6 +7193,7 @@ call procedure2();
ControlRev
NULL
drop procedure procedure2;
drop table t1;
#
# MDEV-7846:Server crashes in Item_subselect::fix
#_fields or fails with Thread stack overrun
@ -7495,5 +7499,44 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
ERROR HY000: Illegal parameter data types row and boolean for operation '='
#
# MDEV-29070 SIGSEGV in my_decimal::operator= and Assertion `0' failed
# in Item_type_holder::val_decimal on SELECT
#
CREATE TABLE t1(a INT UNIQUE);
INSERT INTO t1(a) VALUES (1);
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT 1, 1);
a
1
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT a, a);
a
1
UPDATE t1 SET a = 0
WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT +1 / +1, a FROM t1 WHERE a > -0+1) IN (SELECT a, a);
SELECT a FROM t1 WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT + 1 / + 1, a FROM t1
WHERE a > -0 + 1) IN (SELECT a, a);
a
CREATE TABLE x (x INT);
INSERT INTO x (x) VALUES (1);
UPDATE x SET x = 1 WHERE x = 1;
INSERT INTO x (x) VALUES (1), (1);
WITH RECURSIVE x (x) AS (
SELECT 1 INTERSECT
SELECT -(SELECT 1.000000 AS x
UNION
SELECT 1.000000 ORDER BY NOT x < 'x',
-(SELECT 1 + x/1.000000 IN (1, 1) FROM x
WHERE x ORDER BY 1 - x) DESC LIMIT 1 OFFSET 1
) + 1 FROM x
)
SELECT DISTINCT x, 1, NULL, 1.000000
FROM x
WHERE (SELECT (SELECT x WHERE x IN (SELECT x FROM x))) >
(SELECT (SELECT x ORDER BY x = x OR (x = 1 AND x = 1) DESC))
ORDER BY x ASC, x DESC, x;
ERROR 22007: Truncated incorrect DECIMAL value: 'x'
DROP TABLE t1, x;
#
# End of 10.4 tests
#

View file

@ -1170,8 +1170,10 @@ create table t1 (a int, b decimal(13, 3));
insert into t1 values (1, 0.123);
let $outfile_abs= $MYSQLTEST_VARDIR/tmp/subselect.out.file.1;
let $outfile_rel= ../../tmp/subselect.out.file.1;
--disable_warnings
--error 0,1
--remove_file $outfile_abs
--enable_warnings
eval select a, (select max(b) from t1) into outfile "$outfile_rel" from t1;
delete from t1;
eval load data infile "$outfile_rel" into table t1;
@ -5990,24 +5992,28 @@ drop table t1;
--echo #
--echo # MDEV-7565: Server crash with Signal 6 (part 2)
--echo #
create table t1 (id int not null primary key);
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
Group By TestCase.Revenue, TestCase.TemplateID;
drop table t1;
--echo #
--echo # MDEV-7445:Server crash with Signal 6
--echo #
create table t1 (id int not null primary key);
--delimiter |
CREATE PROCEDURE procedure2()
BEGIN
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
@ -6019,6 +6025,7 @@ call procedure2();
call procedure2();
drop procedure procedure2;
drop table t1;
--echo #
@ -6340,6 +6347,50 @@ SELECT ROW(1,2) = 1 IN (SELECT 1 UNION SELECT 2);
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
--echo #
--echo # MDEV-29070 SIGSEGV in my_decimal::operator= and Assertion `0' failed
--echo # in Item_type_holder::val_decimal on SELECT
--echo #
CREATE TABLE t1(a INT UNIQUE);
INSERT INTO t1(a) VALUES (1);
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT 1, 1);
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT a, a);
UPDATE t1 SET a = 0
WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT +1 / +1, a FROM t1 WHERE a > -0+1) IN (SELECT a, a);
SELECT a FROM t1 WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT + 1 / + 1, a FROM t1
WHERE a > -0 + 1) IN (SELECT a, a);
CREATE TABLE x (x INT);
INSERT INTO x (x) VALUES (1);
UPDATE x SET x = 1 WHERE x = 1;
INSERT INTO x (x) VALUES (1), (1);
let $q= WITH RECURSIVE x (x) AS (
SELECT 1 INTERSECT
SELECT -(SELECT 1.000000 AS x
UNION
SELECT 1.000000 ORDER BY NOT x < 'x',
-(SELECT 1 + x/1.000000 IN (1, 1) FROM x
WHERE x ORDER BY 1 - x) DESC LIMIT 1 OFFSET 1
) + 1 FROM x
)
SELECT DISTINCT x, 1, NULL, 1.000000
FROM x
WHERE (SELECT (SELECT x WHERE x IN (SELECT x FROM x))) >
(SELECT (SELECT x ORDER BY x = x OR (x = 1 AND x = 1) DESC))
ORDER BY x ASC, x DESC, x;
--error ER_TRUNCATED_WRONG_VALUE
eval $q;
DROP TABLE t1, x;
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -1322,7 +1322,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(3) DEFAULT NULL
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
create table t1 (a int);
@ -7161,23 +7161,26 @@ drop table t1;
#
# MDEV-7565: Server crash with Signal 6 (part 2)
#
create table t1 (id int not null primary key);
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
Group By TestCase.Revenue, TestCase.TemplateID;
ControlRev
NULL
drop table t1;
#
# MDEV-7445:Server crash with Signal 6
#
create table t1 (id int not null primary key);
CREATE PROCEDURE procedure2()
BEGIN
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
@ -7190,6 +7193,7 @@ call procedure2();
ControlRev
NULL
drop procedure procedure2;
drop table t1;
#
# MDEV-7846:Server crashes in Item_subselect::fix
#_fields or fails with Thread stack overrun
@ -7495,6 +7499,45 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
ERROR HY000: Illegal parameter data types row and boolean for operation '='
#
# MDEV-29070 SIGSEGV in my_decimal::operator= and Assertion `0' failed
# in Item_type_holder::val_decimal on SELECT
#
CREATE TABLE t1(a INT UNIQUE);
INSERT INTO t1(a) VALUES (1);
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT 1, 1);
a
1
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT a, a);
a
1
UPDATE t1 SET a = 0
WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT +1 / +1, a FROM t1 WHERE a > -0+1) IN (SELECT a, a);
SELECT a FROM t1 WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT + 1 / + 1, a FROM t1
WHERE a > -0 + 1) IN (SELECT a, a);
a
CREATE TABLE x (x INT);
INSERT INTO x (x) VALUES (1);
UPDATE x SET x = 1 WHERE x = 1;
INSERT INTO x (x) VALUES (1), (1);
WITH RECURSIVE x (x) AS (
SELECT 1 INTERSECT
SELECT -(SELECT 1.000000 AS x
UNION
SELECT 1.000000 ORDER BY NOT x < 'x',
-(SELECT 1 + x/1.000000 IN (1, 1) FROM x
WHERE x ORDER BY 1 - x) DESC LIMIT 1 OFFSET 1
) + 1 FROM x
)
SELECT DISTINCT x, 1, NULL, 1.000000
FROM x
WHERE (SELECT (SELECT x WHERE x IN (SELECT x FROM x))) >
(SELECT (SELECT x ORDER BY x = x OR (x = 1 AND x = 1) DESC))
ORDER BY x ASC, x DESC, x;
ERROR 22007: Truncated incorrect DECIMAL value: 'x'
DROP TABLE t1, x;
#
# End of 10.4 tests
#
set optimizer_switch=default;

View file

@ -1325,7 +1325,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(3) DEFAULT NULL
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
create table t1 (a int);
@ -7154,23 +7154,26 @@ drop table t1;
#
# MDEV-7565: Server crash with Signal 6 (part 2)
#
create table t1 (id int not null primary key);
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
Group By TestCase.Revenue, TestCase.TemplateID;
ControlRev
NULL
drop table t1;
#
# MDEV-7445:Server crash with Signal 6
#
create table t1 (id int not null primary key);
CREATE PROCEDURE procedure2()
BEGIN
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
@ -7183,6 +7186,7 @@ call procedure2();
ControlRev
NULL
drop procedure procedure2;
drop table t1;
#
# MDEV-7846:Server crashes in Item_subselect::fix
#_fields or fails with Thread stack overrun
@ -7488,6 +7492,45 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
ERROR HY000: Illegal parameter data types row and boolean for operation '='
#
# MDEV-29070 SIGSEGV in my_decimal::operator= and Assertion `0' failed
# in Item_type_holder::val_decimal on SELECT
#
CREATE TABLE t1(a INT UNIQUE);
INSERT INTO t1(a) VALUES (1);
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT 1, 1);
a
1
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT a, a);
a
1
UPDATE t1 SET a = 0
WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT +1 / +1, a FROM t1 WHERE a > -0+1) IN (SELECT a, a);
SELECT a FROM t1 WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT + 1 / + 1, a FROM t1
WHERE a > -0 + 1) IN (SELECT a, a);
a
CREATE TABLE x (x INT);
INSERT INTO x (x) VALUES (1);
UPDATE x SET x = 1 WHERE x = 1;
INSERT INTO x (x) VALUES (1), (1);
WITH RECURSIVE x (x) AS (
SELECT 1 INTERSECT
SELECT -(SELECT 1.000000 AS x
UNION
SELECT 1.000000 ORDER BY NOT x < 'x',
-(SELECT 1 + x/1.000000 IN (1, 1) FROM x
WHERE x ORDER BY 1 - x) DESC LIMIT 1 OFFSET 1
) + 1 FROM x
)
SELECT DISTINCT x, 1, NULL, 1.000000
FROM x
WHERE (SELECT (SELECT x WHERE x IN (SELECT x FROM x))) >
(SELECT (SELECT x ORDER BY x = x OR (x = 1 AND x = 1) DESC))
ORDER BY x ASC, x DESC, x;
ERROR 22007: Truncated incorrect DECIMAL value: 'x'
DROP TABLE t1, x;
#
# End of 10.4 tests
#
set optimizer_switch=default;

View file

@ -1321,7 +1321,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(3) DEFAULT NULL
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
create table t1 (a int);
@ -7152,23 +7152,26 @@ drop table t1;
#
# MDEV-7565: Server crash with Signal 6 (part 2)
#
create table t1 (id int not null primary key);
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
Group By TestCase.Revenue, TestCase.TemplateID;
ControlRev
NULL
drop table t1;
#
# MDEV-7445:Server crash with Signal 6
#
create table t1 (id int not null primary key);
CREATE PROCEDURE procedure2()
BEGIN
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
@ -7181,6 +7184,7 @@ call procedure2();
ControlRev
NULL
drop procedure procedure2;
drop table t1;
#
# MDEV-7846:Server crashes in Item_subselect::fix
#_fields or fails with Thread stack overrun
@ -7486,6 +7490,45 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
ERROR HY000: Illegal parameter data types row and boolean for operation '='
#
# MDEV-29070 SIGSEGV in my_decimal::operator= and Assertion `0' failed
# in Item_type_holder::val_decimal on SELECT
#
CREATE TABLE t1(a INT UNIQUE);
INSERT INTO t1(a) VALUES (1);
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT 1, 1);
a
1
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT a, a);
a
1
UPDATE t1 SET a = 0
WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT +1 / +1, a FROM t1 WHERE a > -0+1) IN (SELECT a, a);
SELECT a FROM t1 WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT + 1 / + 1, a FROM t1
WHERE a > -0 + 1) IN (SELECT a, a);
a
CREATE TABLE x (x INT);
INSERT INTO x (x) VALUES (1);
UPDATE x SET x = 1 WHERE x = 1;
INSERT INTO x (x) VALUES (1), (1);
WITH RECURSIVE x (x) AS (
SELECT 1 INTERSECT
SELECT -(SELECT 1.000000 AS x
UNION
SELECT 1.000000 ORDER BY NOT x < 'x',
-(SELECT 1 + x/1.000000 IN (1, 1) FROM x
WHERE x ORDER BY 1 - x) DESC LIMIT 1 OFFSET 1
) + 1 FROM x
)
SELECT DISTINCT x, 1, NULL, 1.000000
FROM x
WHERE (SELECT (SELECT x WHERE x IN (SELECT x FROM x))) >
(SELECT (SELECT x ORDER BY x = x OR (x = 1 AND x = 1) DESC))
ORDER BY x ASC, x DESC, x;
ERROR 22007: Truncated incorrect DECIMAL value: 'x'
DROP TABLE t1, x;
#
# End of 10.4 tests
#
set @optimizer_switch_for_subselect_test=null;

View file

@ -1324,7 +1324,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(3) DEFAULT NULL
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
create table t1 (a int);
@ -7167,23 +7167,26 @@ drop table t1;
#
# MDEV-7565: Server crash with Signal 6 (part 2)
#
create table t1 (id int not null primary key);
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
Group By TestCase.Revenue, TestCase.TemplateID;
ControlRev
NULL
drop table t1;
#
# MDEV-7445:Server crash with Signal 6
#
create table t1 (id int not null primary key);
CREATE PROCEDURE procedure2()
BEGIN
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
@ -7196,6 +7199,7 @@ call procedure2();
ControlRev
NULL
drop procedure procedure2;
drop table t1;
#
# MDEV-7846:Server crashes in Item_subselect::fix
#_fields or fails with Thread stack overrun
@ -7501,6 +7505,45 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
ERROR HY000: Illegal parameter data types row and boolean for operation '='
#
# MDEV-29070 SIGSEGV in my_decimal::operator= and Assertion `0' failed
# in Item_type_holder::val_decimal on SELECT
#
CREATE TABLE t1(a INT UNIQUE);
INSERT INTO t1(a) VALUES (1);
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT 1, 1);
a
1
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT a, a);
a
1
UPDATE t1 SET a = 0
WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT +1 / +1, a FROM t1 WHERE a > -0+1) IN (SELECT a, a);
SELECT a FROM t1 WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT + 1 / + 1, a FROM t1
WHERE a > -0 + 1) IN (SELECT a, a);
a
CREATE TABLE x (x INT);
INSERT INTO x (x) VALUES (1);
UPDATE x SET x = 1 WHERE x = 1;
INSERT INTO x (x) VALUES (1), (1);
WITH RECURSIVE x (x) AS (
SELECT 1 INTERSECT
SELECT -(SELECT 1.000000 AS x
UNION
SELECT 1.000000 ORDER BY NOT x < 'x',
-(SELECT 1 + x/1.000000 IN (1, 1) FROM x
WHERE x ORDER BY 1 - x) DESC LIMIT 1 OFFSET 1
) + 1 FROM x
)
SELECT DISTINCT x, 1, NULL, 1.000000
FROM x
WHERE (SELECT (SELECT x WHERE x IN (SELECT x FROM x))) >
(SELECT (SELECT x ORDER BY x = x OR (x = 1 AND x = 1) DESC))
ORDER BY x ASC, x DESC, x;
ERROR 22007: Truncated incorrect DECIMAL value: 'x'
DROP TABLE t1, x;
#
# End of 10.4 tests
#
set optimizer_switch=default;

View file

@ -1321,7 +1321,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(3) DEFAULT NULL
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
create table t1 (a int);
@ -7152,23 +7152,26 @@ drop table t1;
#
# MDEV-7565: Server crash with Signal 6 (part 2)
#
create table t1 (id int not null primary key);
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
Group By TestCase.Revenue, TestCase.TemplateID;
ControlRev
NULL
drop table t1;
#
# MDEV-7445:Server crash with Signal 6
#
create table t1 (id int not null primary key);
CREATE PROCEDURE procedure2()
BEGIN
Select
(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
(Select Sum(`TestCase`.Revenue) From t1 E
Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
) As `ControlRev`
From
(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
@ -7181,6 +7184,7 @@ call procedure2();
ControlRev
NULL
drop procedure procedure2;
drop table t1;
#
# MDEV-7846:Server crashes in Item_subselect::fix
#_fields or fails with Thread stack overrun
@ -7486,6 +7490,45 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
ERROR HY000: Illegal parameter data types row and boolean for operation '='
#
# MDEV-29070 SIGSEGV in my_decimal::operator= and Assertion `0' failed
# in Item_type_holder::val_decimal on SELECT
#
CREATE TABLE t1(a INT UNIQUE);
INSERT INTO t1(a) VALUES (1);
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT 1, 1);
a
1
SELECT a FROM t1 WHERE (SELECT a, a UNION SELECT 1, a FROM t1) IN (SELECT a, a);
a
1
UPDATE t1 SET a = 0
WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT +1 / +1, a FROM t1 WHERE a > -0+1) IN (SELECT a, a);
SELECT a FROM t1 WHERE (SELECT a, a WHERE a < 0 INTERSECT
SELECT + 1 / + 1, a FROM t1
WHERE a > -0 + 1) IN (SELECT a, a);
a
CREATE TABLE x (x INT);
INSERT INTO x (x) VALUES (1);
UPDATE x SET x = 1 WHERE x = 1;
INSERT INTO x (x) VALUES (1), (1);
WITH RECURSIVE x (x) AS (
SELECT 1 INTERSECT
SELECT -(SELECT 1.000000 AS x
UNION
SELECT 1.000000 ORDER BY NOT x < 'x',
-(SELECT 1 + x/1.000000 IN (1, 1) FROM x
WHERE x ORDER BY 1 - x) DESC LIMIT 1 OFFSET 1
) + 1 FROM x
)
SELECT DISTINCT x, 1, NULL, 1.000000
FROM x
WHERE (SELECT (SELECT x WHERE x IN (SELECT x FROM x))) >
(SELECT (SELECT x ORDER BY x = x OR (x = 1 AND x = 1) DESC))
ORDER BY x ASC, x DESC, x;
ERROR 22007: Truncated incorrect DECIMAL value: 'x'
DROP TABLE t1, x;
#
# End of 10.4 tests
#
#

View file

@ -144,8 +144,10 @@ alter short drop default,
DROP INDEX utiny,
DROP INDEX ushort,
DROP PRIMARY KEY,
DROP FOREIGN KEY any_name,
DROP FOREIGN KEY IF EXISTS any_name,
ADD INDEX (auto);
Warnings:
Note 1091 Can't DROP FOREIGN KEY `any_name`; check that it exists
LOCK TABLES t1 WRITE;
ALTER TABLE t1
RENAME as t2,

View file

@ -76,7 +76,7 @@ alter short drop default,
DROP INDEX utiny,
DROP INDEX ushort,
DROP PRIMARY KEY,
DROP FOREIGN KEY any_name,
DROP FOREIGN KEY IF EXISTS any_name,
ADD INDEX (auto);
LOCK TABLES t1 WRITE;

View file

@ -1,3 +1,4 @@
RESET MASTER;
#
# MDEV-30698 Cover missing test cases for mariadb-binlog options
# --raw [and] --flashback

View file

@ -0,0 +1,21 @@
#
# Initialize test data
set @save_master_verify_checksum = @@global.master_verify_checksum;
set @@global.master_verify_checksum = 1;
create table t1 (a int);
insert into t1 values (1);
insert into t1 values (2);
SHOW BINLOG EVENTS FROM invalid_pos;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
include/assert_grep.inc [Ensure the client error is not in the server log]
SHOW BINLOG EVENTS FROM 500;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
include/assert_grep.inc [Ensure the client error is not in the server log]
SHOW BINLOG EVENTS FROM 498;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
include/assert_grep.inc [Ensure the client error is not in the server log]
include/assert_grep.inc [Ensure there is not a specific checksum failure error]
#
# Cleanup
set @@global.master_verify_checksum = @save_master_verify_checksum;
drop table t1;

View file

@ -20,6 +20,8 @@
--source include/linux.inc
--source include/have_log_bin.inc
# Test needs to reset the binlog as it is checking specific GTID.
RESET MASTER;
--echo #
--echo # MDEV-30698 Cover missing test cases for mariadb-binlog options
@ -35,7 +37,7 @@ FLUSH LOGS;
INSERT INTO t1 VALUES (1);
# Read binlog data from master to intermediary result file
--let TIMEOUT=1
--let TIMEOUT=5
--echo # timeout TIMEOUT MYSQL_BINLOG --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=MASTER_MYPORT --stop-never --result-file=MYSQLTEST_VARDIR/tmp/ master-bin.000001
--error 124 # Error 124 means timeout was reached
--exec timeout $TIMEOUT $MYSQL_BINLOG --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --stop-never --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001

View file

@ -0,0 +1,53 @@
#
# Ensure that calling SHOW BINLOG EVENTS FROM <offset> with an invalid offset
# will not result in error messages in the server log. That is, this call is a
# read operation for a user, and if it fails due to invalid usage, that is not
# a server error, but only one to report to the user.
#
# References:
# MDEV-32628: Cryptic ERROR message & inconsistent behavior on incorrect
# SHOW BINLOG EVENTS FROM ...
#
--source include/have_binlog_format_row.inc
--echo #
--echo # Initialize test data
set @save_master_verify_checksum = @@global.master_verify_checksum;
set @@global.master_verify_checksum = 1;
create table t1 (a int);
insert into t1 values (1);
--let $middle_binlog_pos= query_get_value(SHOW BINARY LOGS, File_size, 1)
insert into t1 values (2);
--let $assert_text= Ensure the client error is not in the server log
--let $assert_select= Error in Log_event
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_count= 0
--let $assert_only_after = CURRENT_TEST:
# Pre MDEV-32628, this would write an event truncated error in the logs
--let $invalid_pos= `SELECT $middle_binlog_pos - 1`
--replace_result $invalid_pos invalid_pos
--error 1220
--eval SHOW BINLOG EVENTS FROM $invalid_pos
--source include/assert_grep.inc
# Pre MDEV-32628, this would write an event too big error in the logs
--error 1220
SHOW BINLOG EVENTS FROM 500;
--source include/assert_grep.inc
# Pre MDEV-32628, this would write a checksum verification failed error in the logs
--error 1220
SHOW BINLOG EVENTS FROM 498;
--source include/assert_grep.inc
--let $assert_text= Ensure there is not a specific checksum failure error
--let $assert_select= Replication event checksum verification failed while reading from a log file
--source include/assert_grep.inc
--echo #
--echo # Cleanup
set @@global.master_verify_checksum = @save_master_verify_checksum;
drop table t1;

View file

@ -63,7 +63,7 @@ include/wait_for_slave_io_error.inc [errno=1236]
SHOW TABLES;
Tables_in_test
table1_no_encryption
include/stop_slave.inc
include/stop_slave_sql.inc
reset slave;
##########
# Cleanup

View file

@ -136,7 +136,8 @@ start slave;
SHOW TABLES;
--disable_connect_log
--source include/stop_slave.inc
# IO thread is stopped, stop SQL thread only
--source include/stop_slave_sql.inc
--enable_connect_log
reset slave;

View file

@ -62,7 +62,7 @@ include/wait_for_slave_io_error.inc [errno=1236]
# ..success
SHOW TABLES;
Tables_in_test
include/stop_slave.inc
include/stop_slave_sql.inc
reset slave;
##########
# Cleanup

View file

@ -132,7 +132,8 @@ if (`SELECT strcmp("$gsp","")`)
SHOW TABLES;
--disable_connect_log
--source include/stop_slave.inc
# IO thread is stopped, wait for SQL thread to be stopped
--source include/stop_slave_sql.inc
--enable_connect_log
reset slave;

View file

@ -192,7 +192,7 @@ SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
include/stop_slave.inc
include/stop_slave_io.inc
include/start_slave.inc
connection master;
connection slave;

View file

@ -35,7 +35,8 @@ connection server_2;
connection con_temp2;
COMMIT;
connection server_2;
include/stop_slave.inc
include/wait_for_slave_sql_error.inc [errno=1062]
include/stop_slave_io.inc
include/assert.inc [table t1 should have zero rows where a>32]
SELECT * FROM t1 WHERE a>32;
a

View file

@ -38,7 +38,6 @@ connection con2;
SET debug_sync='RESET';
connection server_2;
include/wait_for_slave_sql_error.inc [errno=1062]
include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t3 WHERE a >= 110 ORDER BY a;
a b
110 1

View file

@ -3,12 +3,12 @@ EXPLAIN EXTENDED SELECT 'a'||'b'||'c';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat_operator_oracle(concat_operator_oracle('a','b'),'c') AS "'a'||'b'||'c'"
Note 1003 select concat(concat('a','b'),'c') AS "'a'||'b'||'c'"
EXPLAIN EXTENDED SELECT CONCAT('a'||'b'||'c');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat_operator_oracle(concat_operator_oracle(concat_operator_oracle('a','b'),'c')) AS "CONCAT('a'||'b'||'c')"
Note 1003 select concat(concat(concat('a','b'),'c')) AS "CONCAT('a'||'b'||'c')"
SELECT '' || '';
'' || ''
@ -211,14 +211,14 @@ SET sql_mode=ORACLE;
CREATE VIEW v1 AS SELECT 'foo'||NULL||'bar' AS test;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE VIEW "v1" AS select concat_operator_oracle(concat_operator_oracle('foo',NULL),'bar') AS "test" latin1 latin1_swedish_ci
v1 CREATE VIEW "v1" AS select concat(concat('foo',NULL),'bar') AS "test" latin1 latin1_swedish_ci
SELECT * FROM v1;
test
foobar
SET sql_mode=DEFAULT;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select concat_operator_oracle(concat_operator_oracle('foo',NULL),'bar') AS `test` latin1 latin1_swedish_ci
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select oracle_schema.concat(oracle_schema.concat('foo',NULL),'bar') AS `test` latin1 latin1_swedish_ci
SELECT * FROM v1;
test
foobar
@ -234,7 +234,7 @@ NULL
SET sql_mode=ORACLE;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE VIEW "v1" AS select concat('foo',NULL,'bar') AS "test" latin1 latin1_swedish_ci
v1 CREATE VIEW "v1" AS select mariadb_schema.concat('foo',NULL,'bar') AS "test" latin1 latin1_swedish_ci
SELECT * FROM v1;
test
NULL
@ -268,12 +268,12 @@ EXPLAIN EXTENDED SELECT -1<<1||1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select -1 << concat_operator_oracle(1,1) AS "a"
Note 1003 select -1 << concat(1,1) AS "a"
EXPLAIN EXTENDED SELECT -1||0<<1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat_operator_oracle(-1,0) << 1 AS "a"
Note 1003 select concat(-1,0) << 1 AS "a"
SELECT -1+1||1 AS a FROM DUAL;
a
01
@ -284,12 +284,12 @@ EXPLAIN EXTENDED SELECT -1+1||1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat_operator_oracle(-1 + 1,1) AS "a"
Note 1003 select concat(-1 + 1,1) AS "a"
EXPLAIN EXTENDED SELECT -1||0+1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat_operator_oracle(-1,0) + 1 AS "a"
Note 1003 select concat(-1,0) + 1 AS "a"
SELECT 1*1||-1 AS a FROM DUAL;
a
1-1
@ -300,12 +300,12 @@ EXPLAIN EXTENDED SELECT 1*1||-1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat_operator_oracle(1 * 1,-1) AS "a"
Note 1003 select concat(1 * 1,-1) AS "a"
EXPLAIN EXTENDED SELECT 1||1*-1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat_operator_oracle(1,1 * -1) AS "a"
Note 1003 select concat(1,1 * -1) AS "a"
SELECT -1^1||1 AS a FROM DUAL;
a
184467440737095516141
@ -316,12 +316,12 @@ EXPLAIN EXTENDED SELECT -1^1||1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat_operator_oracle(-1 ^ 1,1) AS "a"
Note 1003 select concat(-1 ^ 1,1) AS "a"
EXPLAIN EXTENDED SELECT -1||0^1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat_operator_oracle(-1,0 ^ 1) AS "a"
Note 1003 select concat(-1,0 ^ 1) AS "a"
#
# MDEV-17359 Concatenation operator || in like expression failed in sql_mode=ORACLE
#
@ -332,7 +332,7 @@ EXPLAIN EXTENDED SELECT 'abc' LIKE 'a'||'%';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select 'abc' like concat_operator_oracle('a','%') AS "'abc' LIKE 'a'||'%'"
Note 1003 select 'abc' like concat('a','%') AS "'abc' LIKE 'a'||'%'"
SELECT 'x' FROM DUAL WHERE 11 LIKE 1||1;
x
x
@ -353,7 +353,7 @@ EXPLAIN EXTENDED SELECT c1 FROM t1 WHERE c1 LIKE '%'||'b' ORDER BY ord;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
Warnings:
Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like <cache>(concat_operator_oracle('%','b')) order by "test"."t1"."ord"
Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like <cache>(concat('%','b')) order by "test"."t1"."ord"
SELECT c1 FROM t1 WHERE c1 LIKE c2||'%'||'c' ORDER BY ord;
c1
abc
@ -361,7 +361,7 @@ EXPLAIN EXTENDED SELECT c1 FROM t1 WHERE c1 LIKE c2||'%'||'c' ORDER BY ord;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
Warnings:
Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like concat_operator_oracle(concat_operator_oracle("test"."t1"."c2",'%'),'c') order by "test"."t1"."ord"
Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like concat(concat("test"."t1"."c2",'%'),'c') order by "test"."t1"."ord"
SELECT 'x' FROM t1 WHERE c1||c2 LIKE 'aa%';
x
x
@ -369,7 +369,7 @@ EXPLAIN EXTENDED SELECT 'x' FROM t1 WHERE c1||c2 LIKE 'aa%';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select 'x' AS "x" from "test"."t1" where concat_operator_oracle("test"."t1"."c1","test"."t1"."c2") like 'aa%'
Note 1003 select 'x' AS "x" from "test"."t1" where concat("test"."t1"."c1","test"."t1"."c2") like 'aa%'
SELECT 'x' FROM t1 WHERE c1||c2 LIKE c2||c1;
x
x
@ -377,7 +377,7 @@ EXPLAIN EXTENDED SELECT 'x' FROM t1 WHERE c1||c2 LIKE c2||c1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select 'x' AS "x" from "test"."t1" where concat_operator_oracle("test"."t1"."c1","test"."t1"."c2") like concat_operator_oracle("test"."t1"."c2","test"."t1"."c1")
Note 1003 select 'x' AS "x" from "test"."t1" where concat("test"."t1"."c1","test"."t1"."c2") like concat("test"."t1"."c2","test"."t1"."c1")
CREATE VIEW v1 AS SELECT c1, c2, c1 LIKE c2||'_' FROM t1 ORDER BY ord;
SELECT * FROM v1;
c1 c2 c1 LIKE c2||'_'
@ -388,6 +388,6 @@ EXPLAIN EXTENDED SELECT * FROM v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
Note 1003 select "test"."t1"."c1" AS "c1","test"."t1"."c2" AS "c2","test"."t1"."c1" like concat_operator_oracle("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 TABLE t1;

View file

@ -28,7 +28,7 @@ EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11','def');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select decode_oracle(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
Note 1003 select decode(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
CREATE TABLE decode (decode int);
DROP TABLE decode;
#
@ -46,22 +46,22 @@ EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select decode_oracle(12,10,'x10',11,'x11') AS "DECODE(12,10,'x10',11,'x11')"
Note 1003 select decode(12,10,'x10',11,'x11') AS "DECODE(12,10,'x10',11,'x11')"
EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11','def');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select decode_oracle(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
Note 1003 select decode(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
EXPLAIN EXTENDED SELECT DECODE_ORACLE(12,10,'x10',11,'x11');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select decode_oracle(12,10,'x10',11,'x11') AS "DECODE_ORACLE(12,10,'x10',11,'x11')"
Note 1003 select decode(12,10,'x10',11,'x11') AS "DECODE_ORACLE(12,10,'x10',11,'x11')"
EXPLAIN EXTENDED SELECT DECODE_ORACLE(12,10,'x10',11,'x11','def');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select decode_oracle(12,10,'x10',11,'x11','def') AS "DECODE_ORACLE(12,10,'x10',11,'x11','def')"
Note 1003 select decode(12,10,'x10',11,'x11','def') AS "DECODE_ORACLE(12,10,'x10',11,'x11','def')"
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS
SELECT
@ -72,7 +72,7 @@ DECODE_ORACLE(a,1,'x1',NULL,'xNULL','xELSE') AS d4
FROM t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE VIEW "v1" AS select decode_oracle("t1"."a",1,'x1',NULL,'xNULL') AS "d1",decode_oracle("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d2",decode_oracle("t1"."a",1,'x1',NULL,'xNULL') AS "d3",decode_oracle("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d4" from "t1" latin1 latin1_swedish_ci
v1 CREATE VIEW "v1" AS select decode("t1"."a",1,'x1',NULL,'xNULL') AS "d1",decode("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d2",decode("t1"."a",1,'x1',NULL,'xNULL') AS "d3",decode("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d4" from "t1" latin1 latin1_swedish_ci
DROP VIEW v1;
DROP TABLE t1;
SELECT DECODE(TIME'10:20:31','10:20:31','then1','10:20:32','then2','def');

View file

@ -44,11 +44,11 @@ EXPLAIN EXTENDED SELECT RPAD('a',0,'.'), LPAD('a',0,'.'), LPAD(c1,c2,c3), LPAD(c
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using filesort
Warnings:
Note 1003 select rpad_oracle('a',0,'.') AS "RPAD('a',0,'.')",lpad_oracle('a',0,'.') AS "LPAD('a',0,'.')",lpad_oracle("test"."t1"."c1","test"."t1"."c2","test"."t1"."c3") AS "LPAD(c1,c2,c3)",lpad_oracle("test"."t1"."c1","test"."t1"."c2") AS "LPAD(c1,c2)",rpad_oracle("test"."t1"."c1","test"."t1"."c2","test"."t1"."c3") AS "RPAD(c1,c2,c3)",rpad_oracle("test"."t1"."c1","test"."t1"."c2") AS "RPAD(c1,c2)" from "test"."t1" order by "test"."t1"."ord"
Note 1003 select rpad('a',0,'.') AS "RPAD('a',0,'.')",lpad('a',0,'.') AS "LPAD('a',0,'.')",lpad("test"."t1"."c1","test"."t1"."c2","test"."t1"."c3") AS "LPAD(c1,c2,c3)",lpad("test"."t1"."c1","test"."t1"."c2") AS "LPAD(c1,c2)",rpad("test"."t1"."c1","test"."t1"."c2","test"."t1"."c3") AS "RPAD(c1,c2,c3)",rpad("test"."t1"."c1","test"."t1"."c2") AS "RPAD(c1,c2)" from "test"."t1" order by "test"."t1"."ord"
CREATE VIEW v1 AS SELECT RPAD('a',0,'.') AS "C1", LPAD('a',0,'.') AS "C2", LPAD(c1,c2,c3) AS "C3", LPAD(c1,c2) AS "C4", RPAD(c1,c2,c3) AS "C5", RPAD(c1,c2) AS "C6" FROM t1 ORDER BY ord;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE VIEW "v1" AS select rpad_oracle('a',0,'.') AS "C1",lpad_oracle('a',0,'.') AS "C2",lpad_oracle("t1"."c1","t1"."c2","t1"."c3") AS "C3",lpad_oracle("t1"."c1","t1"."c2") AS "C4",rpad_oracle("t1"."c1","t1"."c2","t1"."c3") AS "C5",rpad_oracle("t1"."c1","t1"."c2") AS "C6" from "t1" order by "t1"."ord" latin1 latin1_swedish_ci
v1 CREATE VIEW "v1" AS select rpad('a',0,'.') AS "C1",lpad('a',0,'.') AS "C2",lpad("t1"."c1","t1"."c2","t1"."c3") AS "C3",lpad("t1"."c1","t1"."c2") AS "C4",rpad("t1"."c1","t1"."c2","t1"."c3") AS "C5",rpad("t1"."c1","t1"."c2") AS "C6" from "t1" order by "t1"."ord" latin1 latin1_swedish_ci
SELECT * FROM v1;
C1 C2 C3 C4 C5 C6
NULL NULL NULL a NULL a

File diff suppressed because it is too large Load diff

View file

@ -21,11 +21,11 @@ EXPLAIN EXTENDED SELECT REPLACE('ab','a',null) ;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select replace_oracle('ab','a',NULL) AS "REPLACE('ab','a',null)"
Note 1003 select replace('ab','a',NULL) AS "REPLACE('ab','a',null)"
CREATE VIEW v1 AS SELECT REPLACE('ab','a',null) ;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE VIEW "v1" AS select replace_oracle('ab','a',NULL) AS "REPLACE('ab','a',null)" latin1 latin1_swedish_ci
v1 CREATE VIEW "v1" AS select replace('ab','a',NULL) AS "REPLACE('ab','a',null)" latin1 latin1_swedish_ci
SELECT * FROM v1;
REPLACE('ab','a',null)
b

View file

@ -76,11 +76,11 @@ EXPLAIN EXTENDED SELECT SUBSTR('abc',2,1) ;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select substr_oracle('abc',2,1) AS "SUBSTR('abc',2,1)"
Note 1003 select substr('abc',2,1) AS "SUBSTR('abc',2,1)"
CREATE VIEW v1 AS SELECT SUBSTR('abc',2,1) ;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE VIEW "v1" AS select substr_oracle('abc',2,1) AS "SUBSTR('abc',2,1)" latin1 latin1_swedish_ci
v1 CREATE VIEW "v1" AS select substr('abc',2,1) AS "SUBSTR('abc',2,1)" latin1 latin1_swedish_ci
SELECT * FROM v1;
SUBSTR('abc',2,1)
b

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