1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge branch '11.0' into 11.1

This commit is contained in:
Sergei Golubchik
2023-12-19 20:11:54 +01:00
672 changed files with 27790 additions and 5130 deletions

View File

@ -32,7 +32,8 @@ Without automated tests, future regressions in the expected behavior can't be au
If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.
<!--
Tick one of the following boxes [x] to help us understand if the base branch for the PR is correct. (Currently the earliest maintained branch is 10.4)
Tick one of the following boxes [x] to help us understand if the base branch for the PR is correct.
see [CODING_STANDARDS.md](https://github.com/MariaDB/server/blob/-/CODING_STANDARDS.md) for the latest versions.
-->
## Basing the PR against the correct MariaDB version
- [ ] *This is a new feature and the PR is based against the latest MariaDB development branch.*
@ -43,5 +44,5 @@ Tick one of the following boxes [x] to help us understand if the base branch for
Maintainers are happy to point out inconsistencies but in order to speed up the review and merge process we ask you to check the CODING standards.
-->
## PR quality check
- [ ] I checked the [CODING_STANDARDS.md](https://github.com/MariaDB/server/blob/11.0/CODING_STANDARDS.md) file and my PR conforms to this where appropriate.
- [ ] I checked the [CODING_STANDARDS.md](https://github.com/MariaDB/server/blob/-/CODING_STANDARDS.md) file and my PR conforms to this where appropriate.
- [ ] For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

View File

@ -37,14 +37,21 @@ The commit messages are typically rendered in [Markdown format](https://docs.git
When updating your code, please make sure you perform a rebase, not a merge with the latest branch.
Pull requests should be a simple fast-forward of the branch they are intended to land on.
The correct way to rebase (if working on top of 10.3 branch):
The correct way to rebase (if working on top of 10.11 branch):
```sh
git fetch upstream/10.3 # This assumes upstream is github.com/MariaDB/server
git rebase upstream/10.3
git fetch upstream/10.11 # This assumes upstream is github.com/MariaDB/server
git rebase upstream/10.11
git push --force my_branch
```
### Target branch
Pull requests should be based against the correct MariaDB version.
New features should be based against the latest MariaDB development branch, which is the current GitHub default branch: https://github.com/MariaDB/server/blob/-/VERSION
Bug fixes should be based against the earliest maintained branch in which the bug can be reproduced.
The earliest maintained branch is found at https://mariadb.org/about/#maintenance-policy.
## Coding Style (C / C++ files)
Everyone has a preferred coding style, there is no real correct style for all projects around the world.

View File

@ -17,7 +17,7 @@
/* maintenance of mysql databases */
#define VER "9.1"
#define VER "10.0"
#include "client_priv.h"
#include <signal.h>
#include <my_pthread.h> /* because of signal() */
@ -40,12 +40,12 @@ char ex_var_names[MAX_MYSQL_VAR+100][FN_REFLEN];
ulonglong last_values[MAX_MYSQL_VAR+100];
static int interval=0;
static my_bool option_force=0,interrupted=0,new_line=0,
opt_compress= 0, opt_local= 0, opt_relative= 0, opt_verbose= 0,
opt_compress= 0, opt_local= 0, opt_relative= 0,
opt_vertical= 0, tty_password= 0, opt_nobeep,
opt_shutdown_wait_for_slaves= 0;
opt_shutdown_wait_for_slaves= 0, opt_not_used;
static my_bool debug_info_flag= 0, debug_check_flag= 0;
static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations;
static uint opt_count_iterations= 0, my_end_arg;
static uint opt_count_iterations= 0, my_end_arg, opt_verbose= 0;
static ulong opt_connect_timeout, opt_shutdown_timeout;
static char * unix_port=0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
@ -204,8 +204,10 @@ static struct my_option my_long_options[] =
{"user", 'u', "User for login if not current user.", &user,
&user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v', "Write more information.", &opt_verbose,
&opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Write more information."
"Using it will print more information for 'processlist."
"Using it 2 times will print even more information for 'processlist'.",
&opt_not_used, &opt_not_used, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"vertical", 'E',
@ -298,6 +300,11 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'I': /* Info */
usage();
exit(0);
case 'v': /* --verbose */
opt_verbose++;
if (argument == disabled_my_option)
opt_verbose= 0;
break;
case OPT_CHARSETS_DIR:
#if MYSQL_VERSION_ID > 32300
charsets_dir = argument;
@ -828,10 +835,17 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
MYSQL_RES *result;
MYSQL_ROW row;
const char *query;
if (mysql_query(mysql, (opt_verbose ? "show full processlist" :
"show processlist")) ||
!(result = mysql_store_result(mysql)))
if (!opt_verbose)
query= "show processlist";
else if (opt_verbose == 1)
query= "show full processlist";
else
query= "select * from information_schema.processlist where id != connection_id()";
if (mysql_query(mysql, query) ||
!(result = mysql_store_result(mysql)))
{
my_printf_error(0, "process list failed; error: '%s'", error_flags,
mysql_error(mysql));

View File

@ -80,6 +80,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
@ -1729,7 +1732,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;
}
@ -1865,7 +1868,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);
@ -1876,13 +1879,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));
@ -2017,8 +2020,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"
@ -2028,17 +2031,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)
@ -2818,9 +2822,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);
}
@ -3412,7 +3416,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'",
@ -3624,9 +3628,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"));
}
}
@ -4092,7 +4096,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);
@ -7786,9 +7790,10 @@ void append_metadata(DYNAMIC_STRING *ds,
uint num_fields)
{
MYSQL_FIELD *field_end;
dynstr_append(ds,"Catalog\tDatabase\tTable\tTable_alias\tColumn\t"
"Column_alias\tType\tLength\tMax length\tIs_null\t"
"Flags\tDecimals\tCharsetnr\n");
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"));
for (field_end= field+num_fields ;
field < field_end ;
@ -7851,9 +7856,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"));
}
}
@ -7899,7 +7904,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]);
@ -7907,10 +7912,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
@ -7919,16 +7924,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 */
}
@ -8328,7 +8333,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();
@ -8407,6 +8413,85 @@ 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 (!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
@ -8427,11 +8512,17 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
DYNAMIC_STRING *ds_warnings)
{
my_bool ignore_second_execution= 0;
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));
DBUG_PRINT("info",
@ -8447,7 +8538,7 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
/*
Init a new stmt if it's not already one created for this connection
*/
if(!(stmt= cn->stmt))
if (!(stmt= cn->stmt))
{
if (!(stmt= mysql_stmt_init(mysql)))
die("unable to init stmt structure");
@ -8461,6 +8552,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
*/
@ -8496,10 +8593,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))
{
@ -8507,12 +8606,32 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds);
goto end;
}
/*
We cannot run query twice if we get prepare warnings as these will otherwise be
disabled
*/
ignore_second_execution= (prepare_warnings_enabled &&
mysql_warning_count(mysql) != 0);
if (ignore_second_execution)
compare_2nd_execution = 0;
else
{
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;
}
else
handle_no_error(command);
}
}
/*
@ -8525,6 +8644,8 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
goto end;
}
DBUG_ASSERT(ds->length == 0);
int err;
do
{
@ -8535,75 +8656,82 @@ 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
*/
if (!disable_result_log &&
compare_2nd_execution &&
ps2_protocol_enabled &&
query_match_ps2_re &&
display_result_sorted)
{
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));
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 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))
if (read_stmt_results(stmt, ds_res_2_output, command))
{
handle_error(command, mysql_stmt_errno(stmt),
mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds);
goto end;
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 (!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 */
/*
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)
DYNAMIC_STRING *ds_res_1_execution_compare;
DYNAMIC_STRING ds_res_1_execution_sorted;
if (display_result_sorted)
{
DBUG_PRINT("info", ("warnings disabled"));
dynstr_set(&ds_prepare_warnings, NULL);
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);
}
}
else
{
/*
This is a query without resultset
*/
}
/*
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 ((mysql_stmt_result_metadata(stmt) != NULL) &&
!disable_warnings &&
!prepare_warnings_enabled)
dynstr_set(&ds_prepare_warnings, NULL);
/*
Fetch info before fetching warnings, since it will be reset
@ -8615,7 +8743,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 && !mysql_more_results(stmt->mysql))
{
/* Get the warnings from execute */
@ -8647,7 +8774,15 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
mysql_sqlstate(mysql), ds);
else
handle_no_error(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);
@ -9159,11 +9294,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;
@ -9176,10 +9314,10 @@ 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
*/
@ -9209,11 +9347,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
@ -9227,9 +9365,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 */
@ -9284,7 +9422,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);
@ -9340,9 +9478,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;
}
/*
@ -9363,20 +9501,20 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
All other statements can be run using prepared statement C API.
*/
!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)
@ -9399,11 +9537,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;
}
@ -9860,7 +9998,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);
@ -10287,7 +10425,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;
}
@ -10300,7 +10438,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);
@ -11963,7 +12101,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

@ -90,7 +90,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
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

@ -1,6 +1,7 @@
libmariadb.so.3 libmariadb3 #MINVER#
* Build-Depends-Package: libmariadb-dev
libmariadb_3@libmariadb_3 3.0.0
libmariadb_3_3_5@libmariadb_3_3_5 3.3.5
libmariadbclient_18@libmariadbclient_18 3.0.0
libmysqlclient_18@libmysqlclient_18 3.0.0
ma_pvio_register_callback@libmariadb_3 3.0.0
@ -8,6 +9,7 @@ libmariadb.so.3 libmariadb3 #MINVER#
mariadb_connection@libmariadb_3 3.0.0
mariadb_convert_string@libmariadb_3 3.0.0
mariadb_deinitialize_ssl@libmariadb_3 3.0.0
mariadb_field_attr@libmariadb_3 3.3.1
mariadb_free_rpl_event@libmariadb_3 3.1.0
mariadb_get_charset_by_name@libmariadb_3 3.0.0
mariadb_get_charset_by_nr@libmariadb_3 3.0.0
@ -15,8 +17,12 @@ libmariadb.so.3 libmariadb3 #MINVER#
mariadb_get_infov@libmariadb_3 3.0.0
mariadb_reconnect@libmariadb_3 3.0.0
mariadb_rpl_close@libmariadb_3 3.1.0
mariadb_rpl_errno@libmariadb_3_3_5 3.3.2
mariadb_rpl_error@libmariadb_3_3_5 3.3.2
mariadb_rpl_extract_rows@libmariadb_3_3_5 3.3.2
mariadb_rpl_fetch@libmariadb_3 3.1.0
mariadb_rpl_get_optionsv@libmariadb_3 3.1.0
mariadb_rpl_init_ex@libmariadb_3 3.3.0
mariadb_rpl_open@libmariadb_3 3.1.0
mariadb_rpl_optionsv@libmariadb_3 3.1.0
mariadb_stmt_execute_direct@libmariadb_3 3.0.0

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] = "./mariadb_backup_files/";
#define DEFAULT_TARGET_DIR "./mariadb_backup_files/"
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;
@ -410,6 +411,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];
@ -1269,22 +1273,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},
@ -1405,7 +1412,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},
@ -2448,6 +2457,7 @@ xtrabackup_read_metadata(char *filename)
{
FILE *fp;
my_bool r = TRUE;
int t;
fp = fopen(filename,"r");
if(!fp) {
@ -2478,6 +2488,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);
@ -2527,11 +2540,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));
}
/***********************************************************************
@ -5966,6 +5981,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)
@ -6151,6 +6186,20 @@ error:
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. */
@ -6352,7 +6401,7 @@ static bool check_all_privileges()
}
/* KILL ... */
if (!opt_no_lock && (opt_kill_long_queries_timeout || opt_kill_long_query_type)) {
if (!opt_no_lock && opt_kill_long_queries_timeout) {
check_result |= check_privilege(
granted_privileges,
"CONNECTION ADMIN", "*", "*",
@ -6373,7 +6422,7 @@ static bool check_all_privileges()
if (opt_galera_info || opt_slave_info
|| opt_safe_slave_backup) {
check_result |= check_privilege(granted_privileges,
"SLAVE MONITOR", "*", "*",
"REPLICA MONITOR", "*", "*",
PRIVILEGE_WARNING);
}
@ -6586,9 +6635,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

@ -171,7 +171,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

@ -447,7 +447,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

@ -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
@ -53,10 +55,6 @@ typedef struct st_mem_root
unsigned short first_block_usage;
unsigned short flags;
#ifdef PROTECT_STATEMENT_MEMROOT
int read_only;
#endif
void (*error_handler)(void);
PSI_memory_key psi_key;

View File

@ -667,15 +667,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

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

@ -268,7 +268,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 */
@ -290,7 +289,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;

View File

@ -121,5 +121,3 @@ MYSQL *mysql_real_connect_local(MYSQL *mysql);
#endif
#endif /*MYSQL_SERVICE_SQL */

View File

@ -459,6 +459,7 @@ static int emb_read_change_user_result(MYSQL *mysql)
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);
@ -470,6 +471,7 @@ static void emb_on_close_free(MYSQL *mysql)
}
}
MYSQL_METHODS embedded_methods=
{
emb_read_query_result,
@ -705,8 +707,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;
@ -1446,4 +1447,3 @@ int vprint_msg_to_log(enum loglevel level __attribute__((unused)),
}
return 0;
}

View File

@ -84,8 +84,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

@ -310,6 +310,19 @@ INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
--source include/explain_utils.inc
DROP TABLE t1;
--echo #30a
--echo #
--echo # MDEV-32957 Unusable key notes report wrong predicates for > and >=
--echo #
CREATE TABLE t1(a INT, i CHAR(2), INDEX(i(1)));
INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
(20),(21),(22),(23),(24),(25),(26),(27),(28),(29),
(30),(31),(32),(33),(34),(35);
--let $query = DELETE FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5
--let $select = SELECT * FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5
--source include/explain_utils.inc
DROP TABLE t1;
--echo #31
CREATE TABLE t1 (i INT);
INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),

View File

@ -0,0 +1,12 @@
#
# Include this file in your .test file if your testcase uses InnoDB tables
# requiring stable query plans, which likely requires that InnoDB produces
# stable estimates for #records in tables.
#
# How it works:
# Unstable InnoDB estimates are caused by InnoDB's background statistics
# collection. When you include this file, MTR will use server options from
# include/innodb_stable_estimates.opt, which disables background statistics
# collection.
# (and no, InnoDB team objects to using this configuration for all MTR tests)
#

View File

@ -0,0 +1 @@
--innodb_stats_auto_recalc=0

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

@ -1977,8 +1977,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

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

@ -95,7 +95,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 +197,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;

View File

@ -120,7 +120,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 +221,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;

View File

@ -1,6 +1,7 @@
#
# Testing which locks we get from all stages
#
InnoDB 0 transactions not purged
BACKUP STAGE START;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info
WHERE TABLE_NAME NOT LIKE 'innodb_%_stats';
@ -34,7 +35,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
connection con2;
backup stage start;
connection default;
@ -104,7 +106,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;
@ -132,6 +135,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;

View File

@ -15,6 +15,8 @@
let $mdl= LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info
WHERE TABLE_NAME NOT LIKE 'innodb_%_stats';
--source ../suite/innodb/include/wait_all_purged.inc
BACKUP STAGE START;
eval SELECT $mdl;
BACKUP STAGE FLUSH;
@ -39,7 +41,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
connection con2;
backup stage start;
@ -129,7 +132,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);
@ -165,6 +169,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;

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

@ -17,6 +17,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
connection con1;
# The connection default has removed the backup lock.
# And so the current connection con1 can reap for its BACKUP STAGE START

View File

@ -50,6 +50,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
--connection con1
--echo # The connection default has removed the backup lock.

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'<27><><EFBFBD><EFBFBD>' as char character set cp1251);
--enable_view_protocol
--enable_service_connection
create table t1 select cast(_koi8r'<27><><EFBFBD><EFBFBD>' 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 @@
set global secure_auth=0;
Warnings:
Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
create user test_nopw;
grant select on test.* to test_nopw;
create user test_oldpw identified by password "09301740536db389";
@ -90,6 +92,8 @@ NULL
FLUSH STATUS;
Value of com_select did not change
set global secure_auth=default;
Warnings:
Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
set timestamp=unix_timestamp('2010-10-10 10:10:10');
select now();
now()

View File

@ -1,4 +1,6 @@
SET global secure_auth=0;
Warnings:
Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
connect con1,localhost,root,,mysql;
show tables;
Tables_in_mysql
@ -412,6 +414,8 @@ test
test
drop procedure p1;
SET global secure_auth=default;
Warnings:
Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
#
# MDEV-19282: Log more specific warning with log_warnings=2 if
# connection is aborted prior to authentication

View File

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

View File

@ -216,6 +216,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;

View File

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

@ -614,18 +614,24 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
Warnings:
Note 1105 Cannot use key `s2` part[0] for lookup: `test`.`t1`.`s2` of collation `latin1_swedish_ci` >= "'a'" of collation `latin1_german1_ci`
EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range s1 s1 11 NULL 2 Using index condition
EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
Warnings:
Note 1105 Cannot use key `s2` part[0] for lookup: `test`.`t1`.`s2` of collation `latin1_swedish_ci` = "'a'" of collation `latin1_german1_ci`
EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range s1 s1 11 NULL 1 Using index condition
EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
Warnings:
Note 1105 Cannot use key `s2` part[0] for lookup: `test`.`t1`.`s2` of collation `latin1_swedish_ci` like "'a' collate latin1_german1_ci" of collation `latin1_german1_ci`
DROP TABLE t1;
create table t1(f1 varchar(10) character set latin2 collate latin2_hungarian_ci, key(f1));
insert into t1 set f1=0x3F3F9DC73F;

View File

@ -888,7 +888,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
#
@ -897,7 +897,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
#
@ -906,7 +906,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
#
@ -916,7 +916,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
#
@ -925,7 +925,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

@ -19619,7 +19619,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
#
@ -19628,7 +19628,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
#
@ -19637,7 +19637,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
#
@ -19647,7 +19647,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
#
@ -19656,7 +19656,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

@ -4309,6 +4309,51 @@ 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
#
# MDEV-31143: view with ORDER BY used in query with rownum() in WHERE

View File

@ -2767,6 +2767,42 @@ 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
--echo #

View File

@ -16,4 +16,3 @@ mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 chang
file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing
partition_open_files_limit : open_files_limit check broken by MDEV-18360
partition_innodb : Waiting for fix MDEV-20169

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;
SET GLOBAL enforce_storage_engine=NULL;

View File

@ -1,5 +1,6 @@
# In embedded server we don't really have a control over stack usage
-- source include/not_embedded.inc
-- source include/not_asan.inc
#
# Bug#21476: Lost Database Connection During Query

View File

@ -531,6 +531,8 @@ Warning 1292 Truncated incorrect DECIMAL value: 'b'
explain select f1 from t1 where f1 in (2,1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index t1f1_idx t1f1_idx 2 NULL 3 Using where; Using index
Warnings:
Note 1105 Cannot use key `t1f1_idx` part[0] for lookup: `test`.`t1`.`f1` of type `char` = "2" of type `int`
create table t2(f2 int, index t2f2(f2));
insert into t2 values(0),(1),(2);
select f2 from t2 where f2 in ('a',2);

View File

@ -0,0 +1,124 @@
#
# Start of 10.5 tests
#
#
# MDEV-17226 Column Data in Truncated on UNION to the length of the first value if using REPLACE
#
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (2),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
CREATE TABLE t2 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ("a", "ba");
INSERT INTO t2 (col1, col2) VALUES ("a", "ba");
SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
a
a
ba
SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t2;
a
a
ba
SELECT REPLACE('z', col1, col2) FROM t1 UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
REPLACE('z', col1, col2)
z
ba
SELECT REPLACE('z', col1, col2) FROM t2 UNION ALL SELECT REPLACE('a', col1, col2) FROM t2;
REPLACE('z', col1, col2)
z
ba
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (2),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'ba');
SELECT REPLACE('a', col1, col2) FROM t1;
REPLACE('a', col1, col2)
ba
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
SELECT * FROM t2;
a
a
ba
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (10),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', '0123456789');
SELECT REPLACE('aa', col1, col2) FROM t1;
REPLACE('aa', col1, col2)
01234567890123456789
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aa', col1, col2) FROM t1;
SELECT * FROM t2;
a
a
01234567890123456789
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` varchar(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (20),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'aaaaaaaaaabbbbbbbbbb');
SELECT REPLACE('aa', col1, col2) FROM t1;
REPLACE('aa', col1, col2)
aaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbb
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aa', col1, col2) FROM t1;
SELECT * FROM t2;
a
a
aaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbb
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` varchar(40) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (30),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'aaaaaaaaaabbbbbbbbbbcccccccccc');
SELECT REPLACE('aaa', col1, col2) FROM t1;
REPLACE('aaa', col1, col2)
aaaaaaaaaabbbbbbbbbbccccccccccaaaaaaaaaabbbbbbbbbbccccccccccaaaaaaaaaabbbbbbbbbbcccccccccc
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aaa', col1, col2) FROM t1;
SELECT * FROM t2;
a
a
aaaaaaaaaabbbbbbbbbbccccccccccaaaaaaaaaabbbbbbbbbbccccccccccaaaaaaaaaabbbbbbbbbbcccccccccc
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` varchar(90) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1, t2;
#
# End of 10.5 tests
#

View File

@ -0,0 +1,86 @@
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-17226 Column Data in Truncated on UNION to the length of the first value if using REPLACE
--echo #
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (2),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
CREATE TABLE t2 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ("a", "ba");
INSERT INTO t2 (col1, col2) VALUES ("a", "ba");
SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t2;
SELECT REPLACE('z', col1, col2) FROM t1 UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
SELECT REPLACE('z', col1, col2) FROM t2 UNION ALL SELECT REPLACE('a', col1, col2) FROM t2;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (2),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'ba');
SELECT REPLACE('a', col1, col2) FROM t1;
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (10),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', '0123456789');
SELECT REPLACE('aa', col1, col2) FROM t1;
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aa', col1, col2) FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (20),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'aaaaaaaaaabbbbbbbbbb');
SELECT REPLACE('aa', col1, col2) FROM t1;
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aa', col1, col2) FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (30),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'aaaaaaaaaabbbbbbbbbbcccccccccc');
SELECT REPLACE('aaa', col1, col2) FROM t1;
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aaa', col1, col2) FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
--echo #
--echo # End of 10.5 tests
--echo #

View File

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

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

@ -3312,6 +3312,8 @@ explain
SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref b b 4 const 1 Using where; Using index
Warnings:
Note 1105 Cannot use key `b` part[1] for lookup: `test`.`t1`.`a` of type `varchar` > "'0' = 'z'" of type `boolean`
SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b;
b min(a)
explain
@ -4018,12 +4020,18 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL id 27 NULL 64 Using where; Using index
Warnings:
Note 1105 Cannot use key `id` part[1] for lookup: `test`.`t1`.`a` of type `varchar` >= "DATE'2001-01-04'" of type `date`
EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL id 27 NULL 64 Using where; Using index
Warnings:
Note 1105 Cannot use key `id` part[1] for lookup: `test`.`t1`.`a` of type `varchar` >= "DATE'2001-01-04'" of type `date`
EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL id 27 NULL 64 Using where; Using index
Warnings:
Note 1105 Cannot use key `id` part[1] for lookup: `test`.`t1`.`a` of type `varchar` >= "<cache>('2001-01-04')" of type `date`
DROP TABLE t1;
#
# MIN() optimization didn't work correctly with BETWEEN when using too

View File

@ -331,6 +331,113 @@ JOIN t1 ON dt.a=t1.b;
a
Australia
DROP TABLES t1, t2;
#
# MDEV-15656: Assertion `is_last_prefix <= 0' failed in
# QUICK_GROUP_MIN_MAX_SELECT::get_next
#
SET @lru_depth.save= @@innodb_lru_scan_depth;
SET GLOBAL innodb_lru_scan_depth= 1024;
CREATE TABLE t1 (
pk_part1 INT AUTO_INCREMENT,
a VARCHAR(4),
row_start timestamp(6) default current_timestamp,
PRIMARY KEY (pk_part1, row_start)
) ENGINE=InnoDB;
INSERT INTO t1 (a) VALUES
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo');
connect con1,localhost,root,,test;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
disconnect con1;
connection default;
DROP TABLE t1;
SET GLOBAL innodb_lru_scan_depth= @lru_depth.save;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;

View File

@ -276,6 +276,53 @@ eval $query;
DROP TABLES t1, t2;
--echo #
--echo # MDEV-15656: Assertion `is_last_prefix <= 0' failed in
--echo # QUICK_GROUP_MIN_MAX_SELECT::get_next
--echo #
SET @lru_depth.save= @@innodb_lru_scan_depth;
SET GLOBAL innodb_lru_scan_depth= 1024;
CREATE TABLE t1 (
pk_part1 INT AUTO_INCREMENT,
a VARCHAR(4),
row_start timestamp(6) default current_timestamp,
PRIMARY KEY (pk_part1, row_start)
) ENGINE=InnoDB;
INSERT INTO t1 (a) VALUES
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo');
--connect (con1,localhost,root,,test)
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
--let $run= 20
--disable_result_log
while ($run)
{
--send
SELECT DISTINCT pk_part1 FROM t1;
--connection default
INSERT INTO t1 (pk_part1) VALUES (NULL);
--connection con1
--reap
--dec $run
}
--enable_result_log
--disconnect con1
--connection default
DROP TABLE t1;
SET GLOBAL innodb_lru_scan_depth= @lru_depth.save;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;

View File

@ -0,0 +1,20 @@
--- ./main/innodb_ext_key.result
+++ ./main/innodb_ext_key.reject
@@ -244,7 +244,7 @@
Variable_name Value
Handler_read_first 0
Handler_read_key 21
-Handler_read_last 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0
@@ -266,7 +266,7 @@
Variable_name Value
Handler_read_first 0
Handler_read_key 6
-Handler_read_last 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0

View File

@ -0,0 +1,20 @@
--- ./main/innodb_ext_key.result
+++ ./main/innodb_ext_key.reject
@@ -244,7 +244,7 @@
Variable_name Value
Handler_read_first 0
Handler_read_key 21
-Handler_read_last 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0
@@ -266,7 +266,7 @@
Variable_name Value
Handler_read_first 0
Handler_read_key 6
-Handler_read_last 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0

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

@ -301,15 +301,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

@ -170,16 +170,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

@ -19,9 +19,9 @@ create table mariadbtestdb2.t2 (a int);
create table mariadbtestdb.t3 (a int);
SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_long_host,getaddrinfo_fake_good_ipv4";
flush hosts;
# check connect
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,;
connection con1;
select current_user();
current_user()
user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345
@ -34,7 +34,6 @@ connection default;
grant SELECT ON *.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,;
connection con1;
select * from mariadbtestdb.t1;
a b
select * from mariadbtestdb2.t2;
@ -44,7 +43,6 @@ connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,;
connection con1;
select * from mariadbtestdb.t1;
ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1`
select * from mariadbtestdb2.t2;
@ -54,7 +52,6 @@ connection default;
grant SELECT ON mariadbtestdb.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,;
connection con1;
select * from mariadbtestdb.t1;
a b
select * from mariadbtestdb2.t2;
@ -67,7 +64,6 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_3456789
grant SELECT ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,;
connection con1;
select * from mariadbtestdb.t1;
a b
select * from mariadbtestdb2.t2;
@ -80,7 +76,6 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_3456789
grant SELECT (a) ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,;
connection con1;
select * from mariadbtestdb.t1;
ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1`
select * from mariadbtestdb2.t2;
@ -100,7 +95,6 @@ GRANT CREATE ROUTINE on test.* to user5678901_345678902_345678903_345678904_3456
grant role5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678 to user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,;
connection con1;
select * from mariadbtestdb.t1;
ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1`
select * from mariadbtestdb2.t2;

View File

@ -33,11 +33,11 @@ create table mariadbtestdb.t3 (a int);
SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_long_host,getaddrinfo_fake_good_ipv4";
flush hosts;
--echo # check connect
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,);
connection con1;
select current_user();
--echo # check global privileges
@ -51,7 +51,6 @@ connection default;
grant SELECT ON *.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,);
connection con1;
select * from mariadbtestdb.t1;
select * from mariadbtestdb2.t2;
@ -62,7 +61,6 @@ connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,);
connection con1;
--error ER_TABLEACCESS_DENIED_ERROR
select * from mariadbtestdb.t1;
--error ER_TABLEACCESS_DENIED_ERROR
@ -75,7 +73,6 @@ connection default;
grant SELECT ON mariadbtestdb.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,);
connection con1;
select * from mariadbtestdb.t1;
--error ER_TABLEACCESS_DENIED_ERROR
select * from mariadbtestdb2.t2;
@ -88,7 +85,6 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_3456789
grant SELECT ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,);
connection con1;
select * from mariadbtestdb.t1;
--error ER_TABLEACCESS_DENIED_ERROR
select * from mariadbtestdb2.t2;
@ -102,7 +98,6 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_3456789
grant SELECT (a) ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,);
connection con1;
--error ER_TABLEACCESS_DENIED_ERROR
select * from mariadbtestdb.t1;
--error ER_TABLEACCESS_DENIED_ERROR
@ -132,7 +127,6 @@ grant role5678901_345678902_345678903_345678904_345678905_345678906_345678907_34
disconnect con1;
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,);
connection con1;
--error ER_TABLEACCESS_DENIED_ERROR
select * from mariadbtestdb.t1;

View File

@ -574,5 +574,84 @@ insert into t1 values (1,10),(2,20);
update t1 set b = 30 limit 1;
drop table t1;
#
# MDEV-32839 LONG UNIQUE gives error when used with REPLACE
#
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=myisam;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
f1 f2 f3 f4 f5 f6 f7
2 00004 0001009089999 netstes psit d
4 00004 0001009089999 netstes psit e
drop table t1;
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=innodb;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
f1 f2 f3 f4 f5 f6 f7
2 00004 0001009089999 netstes psit d
4 00004 0001009089999 netstes psit e
drop table t1;
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=myisam partition by key(f1) partitions 2;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
f1 f2 f3 f4 f5 f6 f7
2 00004 0001009089999 netstes psit d
4 00004 0001009089999 netstes psit e
drop table t1;
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=innodb partition by key(f1) partitions 2;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
f1 f2 f3 f4 f5 f6 f7
2 00004 0001009089999 netstes psit d
4 00004 0001009089999 netstes psit e
drop table t1;
#
# End of 10.5 tests
#

View File

@ -563,6 +563,77 @@ insert into t1 values (1,10),(2,20);
update t1 set b = 30 limit 1;
drop table t1;
--echo #
--echo # MDEV-32839 LONG UNIQUE gives error when used with REPLACE
--echo #
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=myisam;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
drop table t1;
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=innodb;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
drop table t1;
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=myisam partition by key(f1) partitions 2;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
drop table t1;
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=innodb partition by key(f1) partitions 2;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
drop table t1;
--echo #
--echo # End of 10.5 tests
--echo #

View File

@ -0,0 +1,101 @@
create function bug10100f(prm int) returns int
begin
if prm > 1 then
return prm * bug10100f(prm - 1);
end if;
return 1;
end|
set statement sql_mode = '' for
create procedure bug10100p(prm int, inout res int)
begin
set res = res * prm;
if prm > 1 then
call bug10100p(prm - 1, res);
end if;
end|
set statement sql_mode = '' for
create procedure bug10100t(prm int)
begin
declare res int;
set res = 1;
call bug10100p(prm, res);
select res;
end|
create table t3 (a int)|
insert into t3 values (0)|
create view v1 as select a from t3|
create procedure bug10100pt(level int, lim int)
begin
if level < lim then
update t3 set a=level;
FLUSH TABLES;
call bug10100pt(level+1, lim);
else
select * from t3;
end if;
end|
create procedure bug10100pv(level int, lim int)
begin
if level < lim then
update v1 set a=level;
FLUSH TABLES;
call bug10100pv(level+1, lim);
else
select * from v1;
end if;
end|
prepare stmt2 from "select * from t3;";
create procedure bug10100pd(level int, lim int)
begin
if level < lim then
select level;
prepare stmt1 from "update t3 set a=a+2";
execute stmt1;
FLUSH TABLES;
execute stmt1;
FLUSH TABLES;
execute stmt1;
FLUSH TABLES;
deallocate prepare stmt1;
execute stmt2;
select * from t3;
call bug10100pd(level+1, lim);
else
execute stmt2;
end if;
end|
create procedure bug10100pc(level int, lim int)
begin
declare lv int;
declare c cursor for select a from t3;
open c;
if level < lim then
select level;
fetch c into lv;
select lv;
update t3 set a=level+lv;
FLUSH TABLES;
call bug10100pc(level+1, lim);
else
select * from t3;
end if;
close c;
end|
set @@max_sp_recursion_depth=255|
set @var=1|
call bug10100p(255, @var)|
call bug10100pt(1,255)|
call bug10100pv(1,255)|
call bug10100pd(1,255)|
call bug10100pc(1,255)|
set @@max_sp_recursion_depth=0|
deallocate prepare stmt2|
drop function bug10100f|
drop procedure bug10100p|
drop procedure bug10100t|
drop procedure bug10100pt|
drop procedure bug10100pv|
drop procedure bug10100pd|
drop procedure bug10100pc|
drop view v1|
drop table t3|

View File

@ -0,0 +1,133 @@
#
# For tests that need a lot of stack - they likely won't work under ASAN
#
source include/not_asan.inc;
source include/not_embedded.inc;
#
# Bug#10100 function (and stored procedure?) recursivity problem
#
# routines with simple recursion
delimiter |;
create function bug10100f(prm int) returns int
begin
if prm > 1 then
return prm * bug10100f(prm - 1);
end if;
return 1;
end|
set statement sql_mode = '' for
create procedure bug10100p(prm int, inout res int)
begin
set res = res * prm;
if prm > 1 then
call bug10100p(prm - 1, res);
end if;
end|
set statement sql_mode = '' for
create procedure bug10100t(prm int)
begin
declare res int;
set res = 1;
call bug10100p(prm, res);
select res;
end|
# a procedure which use tables and recursion
create table t3 (a int)|
insert into t3 values (0)|
create view v1 as select a from t3|
create procedure bug10100pt(level int, lim int)
begin
if level < lim then
update t3 set a=level;
FLUSH TABLES;
call bug10100pt(level+1, lim);
else
select * from t3;
end if;
end|
# view & recursion
create procedure bug10100pv(level int, lim int)
begin
if level < lim then
update v1 set a=level;
FLUSH TABLES;
call bug10100pv(level+1, lim);
else
select * from v1;
end if;
end|
# dynamic sql & recursion
prepare stmt2 from "select * from t3;";
create procedure bug10100pd(level int, lim int)
begin
if level < lim then
select level;
prepare stmt1 from "update t3 set a=a+2";
execute stmt1;
FLUSH TABLES;
execute stmt1;
FLUSH TABLES;
execute stmt1;
FLUSH TABLES;
deallocate prepare stmt1;
execute stmt2;
select * from t3;
call bug10100pd(level+1, lim);
else
execute stmt2;
end if;
end|
# cursor & recursion
create procedure bug10100pc(level int, lim int)
begin
declare lv int;
declare c cursor for select a from t3;
open c;
if level < lim then
select level;
fetch c into lv;
select lv;
update t3 set a=level+lv;
FLUSH TABLES;
call bug10100pc(level+1, lim);
else
select * from t3;
end if;
close c;
end|
# end of the stack checking
set @@max_sp_recursion_depth=255|
set @var=1|
# disable log because error about stack overrun contains numbers which
# depend on a system
-- disable_ps_protocol
-- disable_result_log
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100p(255, @var)|
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100pt(1,255)|
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100pv(1,255)|
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100pd(1,255)|
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100pc(1,255)|
-- enable_result_log
-- enable_ps_protocol
set @@max_sp_recursion_depth=0|
deallocate prepare stmt2|
drop function bug10100f|
drop procedure bug10100p|
drop procedure bug10100t|
drop procedure bug10100pt|
drop procedure bug10100pv|
drop procedure bug10100pd|
drop procedure bug10100pc|
drop view v1|
drop table t3|
delimiter ;|

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

@ -2403,6 +2403,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 +2428,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';

View File

@ -3085,6 +3085,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 +3111,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);

View File

@ -38,18 +38,24 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
Warnings:
Note 1105 Cannot use key `s2` part[0] for lookup: `test`.`t1`.`s2` of collation `latin1_swedish_ci` >= "'a'" of collation `latin1_german1_ci`
EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range s1 s1 11 NULL 2 Using index condition; Rowid-ordered scan
EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
Warnings:
Note 1105 Cannot use key `s2` part[0] for lookup: `test`.`t1`.`s2` of collation `latin1_swedish_ci` = "'a'" of collation `latin1_german1_ci`
EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range s1 s1 11 NULL 1 Using index condition; Rowid-ordered scan
EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
Warnings:
Note 1105 Cannot use key `s2` part[0] for lookup: `test`.`t1`.`s2` of collation `latin1_swedish_ci` like "'a' collate latin1_german1_ci" of collation `latin1_german1_ci`
DROP TABLE t1;
#
#

View File

@ -1385,7 +1385,7 @@ EXPLAIN DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 26 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` <= "18" of type `int`
FLUSH STATUS;
FLUSH TABLES;
@ -1393,7 +1393,7 @@ EXPLAIN EXTENDED DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` <= "18" of type `int`
Note 1003 delete from `test`.`t1` using dual where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED query
@ -1405,7 +1405,9 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL i NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` <= "18" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` <= "18" of type `int`
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
@ -1427,6 +1429,67 @@ Handler_read_rnd_next 27
Sort_rows 8
Sort_scan 1
DROP TABLE t1;
#30a
#
# MDEV-32957 Unusable key notes report wrong predicates for > and >=
#
CREATE TABLE t1(a INT, i CHAR(2), INDEX(i(1)));
INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
(20),(21),(22),(23),(24),(25),(26),(27),(28),(29),
(30),(31),(32),(33),(34),(35);
#
# query: DELETE FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5
# select: SELECT * FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5
#
EXPLAIN DELETE FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 26 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` < "18" of type `int`
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` < "18" of type `int`
Note 1003 delete from `test`.`t1` using dual where `test`.`t1`.`i` >= 10 and `test`.`t1`.`i` < 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL i NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` < "18" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` < "18" of type `int`
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` >= 10 and `test`.`t1`.`i` < 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
Handler_read_key 4
# Status of "equivalent" SELECT query execution:
Variable_name Value
Handler_read_key 4
Handler_read_rnd_next 27
Sort_priority_queue_sorts 1
Sort_rows 5
Sort_scan 1
# Status of testing query execution:
Variable_name Value
Handler_delete 5
Handler_read_key 4
Handler_read_rnd 5
Handler_read_rnd_next 27
Sort_rows 8
Sort_scan 1
DROP TABLE t1;
#31
CREATE TABLE t1 (i INT);
@ -1892,7 +1955,7 @@ EXPLAIN UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` <= "18" of type `int`
FLUSH STATUS;
FLUSH TABLES;
@ -1900,7 +1963,7 @@ EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` <= "18" of type `int`
Note 1003 update `test`.`t2` set `test`.`t2`.`a` = 10 where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5
# Status of EXPLAIN EXTENDED query
@ -1912,7 +1975,9 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL i NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` <= "18" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` <= "18" of type `int`
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution

View File

@ -24,7 +24,9 @@ rmdir $ddir;
# MDEV-23052
# 1. mysql_install_db works on existing, empty directory
mkdir $ddir;
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R > /dev/null;
disable_result_log;
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R --verbose-bootstrap;
enable_result_log;
rmdir $ddir;
# 2. mysql_install_db rejects existing, non-empty directory, and does not

View File

@ -565,9 +565,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=# Alias for log_slow_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

View File

@ -11630,6 +11630,7 @@ drop table t1;
# (on optimized builds)
#
CREATE TABLE t1( a INT, b INT, PRIMARY KEY( a ) );
insert t1 values (2,3);
SELECT sum(b), row_number() OVER (order by b) FROM t1 WHERE a = 101;
sum(b) row_number() OVER (order by b)
NULL 1
@ -11645,8 +11646,8 @@ JS
"rowid_ordered": true,
"using_mrr": false,
"index_only": false,
"rows": 0,
"cost": 0.001340684,
"rows": 1,
"cost": 0.002483968,
"chosen": true
}
]

View File

@ -600,6 +600,7 @@ drop table t1;
--echo #
CREATE TABLE t1( a INT, b INT, PRIMARY KEY( a ) );
insert t1 values (2,3);
SELECT sum(b), row_number() OVER (order by b) FROM t1 WHERE a = 101;
UPDATE t1 SET b=10 WHERE a=1;
SELECT JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;

View File

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

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

@ -38,7 +38,7 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b b 67 NULL 90 Using where; Using index
1 SIMPLE t1 index PRIMARY,b b 67 NULL 308 Using where; Using index
DROP TABLE t1;
#
# Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY
@ -198,6 +198,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
@ -401,7 +405,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
@ -412,11 +416,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)
@ -567,7 +571,7 @@ test.t1 optimize note Table does not support optimize, doing recreate + analyze
test.t1 optimize error Invalid default value for 'b'
test.t1 optimize status Operation failed
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b' at row 0
Error 1067 Invalid default value for 'b'
SET SESSION sql_mode = @old_mode;
DROP TABLE t1;

View File

@ -208,6 +208,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;
@ -420,7 +421,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;
@ -430,10 +433,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

@ -1008,7 +1008,7 @@ SHOW status LIKE 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 6
Handler_read_last 1
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0
@ -1024,7 +1024,7 @@ SHOW status LIKE 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 6
Handler_read_last 1
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0

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

@ -65,4 +65,20 @@ SET GLOBAL gtid_slave_pos='0-2-1003';
-- CHANGE MASTER TO MASTER_LOG_FILE='slave-bin.000001', MASTER_LOG_POS=BINLOG_START;
CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
SET GLOBAL gtid_slave_pos='0-2-1003';
connection master;
CREATE TABLE t (
id int
);
insert into t values (1);
insert into t values (2);
drop table t;
connection slave;
include/stop_slave.inc
change master to master_use_gtid=slave_pos;
connection master;
# Ensuring the binlog dump thread is killed on primary...
-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000002', MASTER_LOG_POS=BINLOG_START;
-- SET GLOBAL gtid_slave_pos='0-1-1005';
connection slave;
include/start_slave.inc
include/rpl_end.inc

View File

@ -83,6 +83,76 @@ DROP TABLE t2;
--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
--exec $MYSQL_DUMP_SLAVE --compact --master-data --single-transaction --gtid test
#
# MDEV-32611 Added test for mysqldump --delete-master-logs option.
# This options is alias of
# get binlogs: show master status -> flush logs -> purge binary logs to <new_binlog>
# sequence and this test is derived using the same pattern.
#
connection master;
CREATE TABLE t (
id int
);
insert into t values (1);
insert into t values (2);
drop table t;
--sync_slave_with_master
# MDEV-32953: Because --delete-master-logs immediately purges logs after
# flushing, it is possible the binlog dump threads will still be using the old
# log when the purge executes, disallowing the file from being deleted.
# Therefore, we temporarily stop the slave so there is no chance the old binlog
# is still being referenced. master_use_gtid=Slave_pos is necessary to still
# appear up-to-date to the master on restart after the master has flushed the
# logs (while the slave is offline). Otherwise (i.e. if using binlog file/pos),
# the slave would point to a purged log file, and receive an error immediately
# upon connecting to the master.
--source include/stop_slave.inc
change master to master_use_gtid=slave_pos;
connection master;
--echo # Ensuring the binlog dump thread is killed on primary...
--disable_query_log
--let $binlog_dump_thd_tid= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND LIKE 'Binlog Dump'`
if ($binlog_dump_thd_tid)
{
--eval kill $binlog_dump_thd_tid
}
--let $wait_condition= SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND LIKE 'Binlog Dump'
--source include/wait_condition.inc
--enable_query_log
--let $predump_binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1)
# Execute mysqldump with delete-master-logs option
--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
--exec $MYSQL_DUMP --compact --no-create-info --no-data --delete-master-logs test
--let $postdump_binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1)
--let $postdump_first_binary_log_filename= query_get_value(SHOW BINARY LOGS, Log_name, 1)
if ($predump_binlog_filename == $postdump_binlog_filename)
{
--echo # predump_binlog_filename: $predump_binlog_filename
--echo # postdump_binlog_filename: $postdump_binlog_filename
--die Master state didn't change after mariadb-dump with --delete-master-logs.
}
if ($postdump_first_binary_log_filename != $postdump_binlog_filename)
{
--echo # postdump_first_binary_log_filename: $postdump_first_binary_log_filename
--echo # postdump_binlog_filename: $postdump_binlog_filename
--die Master binlog wasn't deleted after mariadb-dump with --delete-master-logs.
}
connection slave;
--source include/start_slave.inc
--source include/rpl_end.inc

View File

@ -1,4 +1,6 @@
set global secure_auth=0;
Warnings:
Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
create user natauth@localhost identified via 'mysql_native_password' using '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29';
create user invalidauth@localhost identified via 'mysql_native_password' using 'invalid';
create user newpass@localhost identified by password '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29';
@ -186,6 +188,8 @@ drop user natauth@localhost, newpass@localhost, newpassnat@localhost;
drop user invalidauth@localhost, invalidpass@localhost, invalidpassnat@localhost,invalidmysql57auth@localhost;
drop user oldauth@localhost, oldpass@localhost, oldpassold@localhost;
set global secure_auth=default;
Warnings:
Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
# switching from mysql.global_priv to mysql.user
create user foo@localhost identified with mysql_native_password;
update mysql.user set authentication_string=password('foo'), plugin='mysql_native_password' where user='foo' and host='localhost';

View File

@ -104,19 +104,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

@ -244,9 +244,7 @@ set @foo= (select max(a) from t0 where sin(a) >0);
connection default;
show explain for $thr2;
ERROR HY000: Target is not executing an operation with a query plan
kill query $thr2;
connection con1;
ERROR 70100: Query execution was interrupted
SET debug_dbug=@old_debug;
#
# Attempt SHOW EXPLAIN for an UPDATE
@ -568,9 +566,14 @@ SELECT * FROM v1, t2;
connection default;
show explain for $thr2;
ERROR HY000: Target is not executing an operation with a query plan
kill query $thr2;
connection con1;
ERROR 70100: Query execution was interrupted
a b
8 4
8 5
8 6
8 7
8 8
8 9
SET debug_dbug=@old_debug;
DROP VIEW v1;
DROP TABLE t2, t3;

View File

@ -273,9 +273,7 @@ connection default;
--source include/wait_condition.inc
--error ER_TARGET_NOT_EXPLAINABLE
evalp show explain for $thr2;
evalp kill query $thr2;
connection con1;
--error ER_QUERY_INTERRUPTED
reap;
SET debug_dbug=@old_debug;
@ -504,9 +502,7 @@ connection default;
--source include/wait_condition.inc
--error ER_TARGET_NOT_EXPLAINABLE
evalp show explain for $thr2;
evalp kill query $thr2;
connection con1;
--error ER_QUERY_INTERRUPTED
reap;
SET debug_dbug=@old_debug;
DROP VIEW v1;

View File

@ -1,7 +1,5 @@
set @old_concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert= 0;
drop table if exists t1,t3;
drop procedure if exists bug4902|
create procedure bug4902()
begin
show grants for 'root'@'localhost';
@ -15,7 +13,6 @@ Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
drop procedure bug4902|
drop procedure if exists bug4902_2|
create procedure bug4902_2()
begin
show processlist;
@ -23,13 +20,10 @@ end|
call bug4902_2()|
show warnings|
Level Code Message
Note 1305 PROCEDURE test.bug4902_2 does not exist
call bug4902_2()|
show warnings|
Level Code Message
Note 1305 PROCEDURE test.bug4902_2 does not exist
drop procedure bug4902_2|
drop procedure if exists bug6807|
create procedure bug6807()
begin
declare a int;
@ -42,116 +36,6 @@ ERROR 70100: Query execution was interrupted
call bug6807()|
ERROR 70100: Query execution was interrupted
drop procedure bug6807|
drop function if exists bug10100f|
drop procedure if exists bug10100p|
drop procedure if exists bug10100t|
drop procedure if exists bug10100pt|
drop procedure if exists bug10100pv|
drop procedure if exists bug10100pd|
drop procedure if exists bug10100pc|
create function bug10100f(prm int) returns int
begin
if prm > 1 then
return prm * bug10100f(prm - 1);
end if;
return 1;
end|
set statement sql_mode = '' for
create procedure bug10100p(prm int, inout res int)
begin
set res = res * prm;
if prm > 1 then
call bug10100p(prm - 1, res);
end if;
end|
set statement sql_mode = '' for
create procedure bug10100t(prm int)
begin
declare res int;
set res = 1;
call bug10100p(prm, res);
select res;
end|
create table t3 (a int)|
insert into t3 values (0)|
create view v1 as select a from t3|
create procedure bug10100pt(level int, lim int)
begin
if level < lim then
update t3 set a=level;
FLUSH TABLES;
call bug10100pt(level+1, lim);
else
select * from t3;
end if;
end|
create procedure bug10100pv(level int, lim int)
begin
if level < lim then
update v1 set a=level;
FLUSH TABLES;
call bug10100pv(level+1, lim);
else
select * from v1;
end if;
end|
prepare stmt2 from "select * from t3;";
create procedure bug10100pd(level int, lim int)
begin
if level < lim then
select level;
prepare stmt1 from "update t3 set a=a+2";
execute stmt1;
FLUSH TABLES;
execute stmt1;
FLUSH TABLES;
execute stmt1;
FLUSH TABLES;
deallocate prepare stmt1;
execute stmt2;
select * from t3;
call bug10100pd(level+1, lim);
else
execute stmt2;
end if;
end|
create procedure bug10100pc(level int, lim int)
begin
declare lv int;
declare c cursor for select a from t3;
open c;
if level < lim then
select level;
fetch c into lv;
select lv;
update t3 set a=level+lv;
FLUSH TABLES;
call bug10100pc(level+1, lim);
else
select * from t3;
end if;
close c;
end|
set @@max_sp_recursion_depth=255|
set @var=1|
call bug10100p(255, @var)|
call bug10100pt(1,255)|
call bug10100pv(1,255)|
call bug10100pd(1,255)|
call bug10100pc(1,255)|
set @@max_sp_recursion_depth=0|
deallocate prepare stmt2|
drop function bug10100f|
drop procedure bug10100p|
drop procedure bug10100t|
drop procedure bug10100pt|
drop procedure bug10100pv|
drop procedure bug10100pd|
drop procedure bug10100pc|
drop view v1|
drop table t3|
drop procedure if exists bug15298_1;
drop procedure if exists bug15298_2;
create user 'mysqltest_1'@'localhost';
grant all privileges on test.* to 'mysqltest_1'@'localhost';
create procedure 15298_1 () sql security definer show grants for current_user;
@ -170,8 +54,6 @@ disconnect con1;
drop user mysqltest_1@localhost;
drop procedure 15298_1;
drop procedure 15298_2;
drop table if exists t1;
drop procedure if exists p1;
create table t1 (value varchar(15));
create procedure p1() update t1 set value='updated' where value='old';
call p1();
@ -283,7 +165,6 @@ disconnect con2;
# functions in databases which names contained dot.
#
connection default;
DROP DATABASE IF EXISTS `my.db`;
create database `my.db`;
use `my.db`;
CREATE FUNCTION f1(a int) RETURNS INT RETURN a;

View File

@ -7,19 +7,12 @@ set @@global.concurrent_insert= 0;
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1,t3;
--enable_warnings
delimiter |;
#
# Bug#4902 Stored procedure with SHOW WARNINGS leads to packet error
#
# Added tests for show grants command
--disable_warnings
drop procedure if exists bug4902|
--enable_warnings
create procedure bug4902()
begin
show grants for 'root'@'localhost';
@ -38,9 +31,6 @@ call bug4902()|
drop procedure bug4902|
# We need separate SP for SHOW PROCESSLIST since we want use replace_column
--disable_warnings
drop procedure if exists bug4902_2|
--enable_warnings
create procedure bug4902_2()
begin
show processlist;
@ -58,9 +48,6 @@ drop procedure bug4902_2|
#
# Bug#6807 Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
#
--disable_warnings
drop procedure if exists bug6807|
--enable_warnings
create procedure bug6807()
begin
declare a int;
@ -77,152 +64,11 @@ call bug6807()|
drop procedure bug6807|
#
# Bug#10100 function (and stored procedure?) recursivity problem
#
--disable_warnings
drop function if exists bug10100f|
drop procedure if exists bug10100p|
drop procedure if exists bug10100t|
drop procedure if exists bug10100pt|
drop procedure if exists bug10100pv|
drop procedure if exists bug10100pd|
drop procedure if exists bug10100pc|
--enable_warnings
# routines with simple recursion
create function bug10100f(prm int) returns int
begin
if prm > 1 then
return prm * bug10100f(prm - 1);
end if;
return 1;
end|
set statement sql_mode = '' for
create procedure bug10100p(prm int, inout res int)
begin
set res = res * prm;
if prm > 1 then
call bug10100p(prm - 1, res);
end if;
end|
set statement sql_mode = '' for
create procedure bug10100t(prm int)
begin
declare res int;
set res = 1;
call bug10100p(prm, res);
select res;
end|
# a procedure which use tables and recursion
create table t3 (a int)|
insert into t3 values (0)|
create view v1 as select a from t3|
create procedure bug10100pt(level int, lim int)
begin
if level < lim then
update t3 set a=level;
FLUSH TABLES;
call bug10100pt(level+1, lim);
else
select * from t3;
end if;
end|
# view & recursion
create procedure bug10100pv(level int, lim int)
begin
if level < lim then
update v1 set a=level;
FLUSH TABLES;
call bug10100pv(level+1, lim);
else
select * from v1;
end if;
end|
# dynamic sql & recursion
prepare stmt2 from "select * from t3;";
create procedure bug10100pd(level int, lim int)
begin
if level < lim then
select level;
prepare stmt1 from "update t3 set a=a+2";
execute stmt1;
FLUSH TABLES;
execute stmt1;
FLUSH TABLES;
execute stmt1;
FLUSH TABLES;
deallocate prepare stmt1;
execute stmt2;
select * from t3;
call bug10100pd(level+1, lim);
else
execute stmt2;
end if;
end|
# cursor & recursion
create procedure bug10100pc(level int, lim int)
begin
declare lv int;
declare c cursor for select a from t3;
open c;
if level < lim then
select level;
fetch c into lv;
select lv;
update t3 set a=level+lv;
FLUSH TABLES;
call bug10100pc(level+1, lim);
else
select * from t3;
end if;
close c;
end|
# end of the stack checking
set @@max_sp_recursion_depth=255|
set @var=1|
# disable log because error about stack overrun contains numbers which
# depend on a system
-- disable_ps_protocol
-- disable_result_log
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100p(255, @var)|
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100pt(1,255)|
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100pv(1,255)|
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100pd(1,255)|
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100pc(1,255)|
-- enable_result_log
-- enable_ps_protocol
set @@max_sp_recursion_depth=0|
deallocate prepare stmt2|
drop function bug10100f|
drop procedure bug10100p|
drop procedure bug10100t|
drop procedure bug10100pt|
drop procedure bug10100pv|
drop procedure bug10100pd|
drop procedure bug10100pc|
drop view v1|
drop table t3|
delimiter ;|
#
# Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context
#
--disable_warnings
drop procedure if exists bug15298_1;
drop procedure if exists bug15298_2;
--enable_warnings
create user 'mysqltest_1'@'localhost';
grant all privileges on test.* to 'mysqltest_1'@'localhost';
create procedure 15298_1 () sql security definer show grants for current_user;
@ -242,11 +88,6 @@ drop procedure 15298_2;
# Bug#29936 Stored Procedure DML ignores low_priority_updates setting
#
--disable_warnings
drop table if exists t1;
drop procedure if exists p1;
--enable_warnings
create table t1 (value varchar(15));
create procedure p1() update t1 set value='updated' where value='old';
@ -411,10 +252,6 @@ DROP FUNCTION f1;
connection default;
--disable_warnings
DROP DATABASE IF EXISTS `my.db`;
--enable_warnings
create database `my.db`;
use `my.db`;

View File

@ -1,4 +1,22 @@
connect ssl_con,localhost,root,,,,,SSL;
select variable_name from performance_schema.status_by_thread where VARIABLE_NAME LIKE 'Ssl%';
variable_name
Ssl_cipher
Ssl_cipher_list
Ssl_default_timeout
Ssl_server_not_after
Ssl_server_not_before
Ssl_verify_depth
Ssl_verify_mode
Ssl_version
Ssl_cipher
Ssl_cipher_list
Ssl_default_timeout
Ssl_server_not_after
Ssl_server_not_before
Ssl_verify_depth
Ssl_verify_mode
Ssl_version
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
have_ssl
1

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