diff --git a/CMakeLists.txt b/CMakeLists.txt index 10859236f7f..8e72ee4b917 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ ENDIF() # in RPM's: #set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true") -FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0075 CMP0069 CMP0135) +FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0074 CMP0075 CMP0069 CMP0135) IF(POLICY ${p}) CMAKE_POLICY(SET ${p} NEW) ENDIF() @@ -186,7 +186,7 @@ ENDIF() OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON) IF (WITHOUT_SERVER) - SET (SKIP_COMPONENTS "Server|IniFiles|SuportFiles|Readme") + SET (SKIP_COMPONENTS "Server|IniFiles|SupportFiles|Readme") ELSE() SET (SKIP_COMPONENTS "N-O-N-E") ENDIF() diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 4dfce2478cd..a8e80bc8b5b 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -18,7 +18,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include ${PCRE_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/mysys_ssl - ${ZLIB_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/strings diff --git a/client/client_priv.h b/client/client_priv.h index 3856859f89d..8bf150daa31 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -1,6 +1,6 @@ /* Copyright (c) 2001, 2012, Oracle and/or its affiliates. - Copyright (c) 2009, 2022, MariaDB + Copyright (c) 2009, 2024, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,74 +38,32 @@ enum options_client { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, OPT_PAGER, OPT_TEE, - OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS, - OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE, - OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES, - OPT_MASTER_DATA, OPT_AUTOCOMMIT, OPT_AUTO_REHASH, - OPT_LINE_NUMBERS, OPT_COLUMN_NAMES, OPT_CONNECT_TIMEOUT, - OPT_MAX_ALLOWED_PACKET, OPT_NET_BUFFER_LENGTH, - OPT_SELECT_LIMIT, OPT_MAX_JOIN_SIZE, OPT_SSL_SSL, + OPT_OPTIMIZE, + OPT_TABLES, + OPT_MASTER_DATA, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH, - OPT_SSL_CIPHER, OPT_TLS_VERSION, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE, - OPT_DELETE_MASTER_LOGS, OPT_COMPACT, - OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL, - OPT_FRM, OPT_SKIP_OPTIMIZATION, - OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH, - OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_SERVER_ARG, - OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, - OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT, - OPT_FLUSH_TABLES, - OPT_TRIGGERS, - OPT_MYSQL_ONLY_PRINT, - OPT_MYSQL_LOCK_DIRECTORY, - OPT_USE_THREADS, - OPT_IMPORT_USE_THREADS, - OPT_MYSQL_NUMBER_OF_QUERY, + OPT_SSL_CIPHER, OPT_LOCAL_INFILE, + OPT_COMPACT, + OPT_MYSQL_PROTOCOL, + OPT_SKIP_OPTIMIZATION, + OPT_COMPATIBLE, OPT_DELIMITER, + OPT_SERVER_ARG, + OPT_START_DATETIME, OPT_STOP_DATETIME, OPT_IGNORE_DATABASE, - OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE, - OPT_TZ_UTC, OPT_CREATE_SLAP_SCHEMA, - OPT_MYSQLDUMP_SLAVE_APPLY, + OPT_IGNORE_TABLE, OPT_MYSQLDUMP_SLAVE_DATA, - OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT, -#ifdef WHEN_FLASHBACK_REVIEW_READY - OPT_REVIEW, - OPT_REVIEW_DBNAME, OPT_REVIEW_TABLENAME, -#endif - OPT_SLAP_CSV, OPT_SLAP_CREATE_STRING, - OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM, - OPT_SLAP_AUTO_GENERATE_ADD_AUTO, - OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY, - OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES, - OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES, - OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM, - OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM, - OPT_SLAP_PRE_QUERY, - OPT_SLAP_POST_QUERY, - OPT_SLAP_PRE_SYSTEM, - OPT_SLAP_POST_SYSTEM, - OPT_SLAP_COMMIT, - OPT_SLAP_DETACH, - OPT_SLAP_NO_DROP, - OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT_MODE, OPT_SERVER_ID, - OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT, - OPT_AUTO_VERTICAL_OUTPUT, - OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE, - OPT_WRITE_BINLOG, OPT_DUMP_DATE, - OPT_INIT_COMMAND, + OPT_SLAP_CSV, + OPT_BASE64_OUTPUT_MODE, + OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, + OPT_WRITE_BINLOG, OPT_PLUGIN_DIR, OPT_DEFAULT_AUTH, - OPT_ABORT_SOURCE_ON_ERROR, OPT_REWRITE_DB, - OPT_REPORT_PROGRESS, - OPT_SKIP_ANNOTATE_ROWS_EVENTS, OPT_SSL_CRL, OPT_SSL_CRLPATH, OPT_IGNORE_DATA, OPT_PRINT_ROW_COUNT, OPT_PRINT_ROW_EVENT_POSITIONS, OPT_CHECK_IF_UPGRADE_NEEDED, OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, - OPT_SHUTDOWN_WAIT_FOR_SLAVES, - OPT_COPY_S3_TABLES, - OPT_PRINT_TABLE_METADATA, OPT_MAX_CLIENT_OPTION /* should be always the last */ }; diff --git a/client/mysql.cc b/client/mysql.cc index 1a408a0a12c..5c002086213 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2009, 2022, MariaDB Corporation. + Copyright (c) 2009, 2024, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -136,7 +136,7 @@ typedef struct st_status ulong query_start_line; char *file_name; LINE_BUFFER *line_buff; - bool batch,add_to_history; + bool batch, add_to_history, sandbox; } STATUS; @@ -154,7 +154,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0, vertical=0, line_numbers=1, column_names=1,opt_html=0, opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0, tty_password= 0, opt_nobeep=0, opt_reconnect=1, - opt_secure_auth= 0, + opt_secure_auth= 0, default_pager_set= 0, opt_sigint_ignore= 0, auto_vertical_output= 0, show_warnings= 0, executing_query= 0, @@ -235,7 +235,8 @@ static int com_quit(String *str,char*), com_rehash(String *str, char*), com_tee(String *str, char*), com_notee(String *str, char*), com_charset(String *str,char*), com_prompt(String *str, char*), com_delimiter(String *str, char*), - com_warnings(String *str, char*), com_nowarnings(String *str, char*); + com_warnings(String *str, char*), com_nowarnings(String *str, char*), + com_sandbox(String *str, char*); #ifdef USE_POPEN static int com_nopager(String *str, char*), com_pager(String *str, char*), @@ -283,11 +284,12 @@ typedef struct { static COMMANDS commands[] = { { "?", '?', com_help, 1, "Synonym for `help'." }, + { "charset", 'C', com_charset, 1, + "Switch to another charset. Might be needed for processing binlog with multi-byte charsets." }, { "clear", 'c', com_clear, 0, "Clear the current input statement."}, { "connect",'r', com_connect,1, "Reconnect to the server. Optional arguments are db and host." }, - { "delimiter", 'd', com_delimiter, 1, - "Set statement delimiter." }, + { "delimiter", 'd', com_delimiter, 1, "Set statement delimiter." }, #ifdef USE_POPEN { "edit", 'e', com_edit, 0, "Edit command with $EDITOR."}, #endif @@ -300,6 +302,8 @@ static COMMANDS commands[] = { { "nopager",'n', com_nopager,0, "Disable pager, print to stdout." }, #endif { "notee", 't', com_notee, 0, "Don't write into outfile." }, + { "nowarning", 'w', com_nowarnings, 0, + "Don't show warnings after every statement." }, #ifdef USE_POPEN { "pager", 'P', com_pager, 1, "Set PAGER [to_pager]. Print the query results via PAGER." }, @@ -308,6 +312,8 @@ static COMMANDS commands[] = { { "prompt", 'R', com_prompt, 1, "Change your mysql prompt."}, { "quit", 'q', com_quit, 0, "Quit mysql." }, { "rehash", '#', com_rehash, 0, "Rebuild completion hash." }, + { "sandbox", '-', com_sandbox, 0, + "Disallow commands that access the file system (except \\P without an argument and \\e)." }, { "source", '.', com_source, 1, "Execute an SQL script file. Takes a file name as an argument."}, { "status", 's', com_status, 0, "Get status information from the server."}, @@ -318,12 +324,8 @@ static COMMANDS commands[] = { "Set outfile [to_outfile]. Append everything into given outfile." }, { "use", 'u', com_use, 1, "Use another database. Takes database name as argument." }, - { "charset", 'C', com_charset, 1, - "Switch to another charset. Might be needed for processing binlog with multi-byte charsets." }, { "warnings", 'W', com_warnings, 0, "Show warnings after every statement." }, - { "nowarning", 'w', com_nowarnings, 0, - "Don't show warnings after every statement." }, /* Get bash-like expansion for some commands */ { "create table", 0, 0, 0, ""}, { "create database", 0, 0, 0, ""}, @@ -1503,35 +1505,47 @@ static struct my_option my_long_options[] = 0, 0, 0, 0, 0}, {"help", 'I', "Synonym for -?", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"abort-source-on-error", OPT_ABORT_SOURCE_ON_ERROR, + {"abort-source-on-error", 0, "Abort 'source filename' operations in case of errors", &batch_abort_on_error, &batch_abort_on_error, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-rehash", OPT_AUTO_REHASH, + {"auto-rehash", 0, "Enable automatic rehashing. One doesn't need to use 'rehash' to get table " - "and field completion, but startup and reconnecting may take a longer time. " - "Disable with --disable-auto-rehash.", - &opt_rehash, &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, - 0, 0}, + "and field completion, but startup and reconnecting may take a longer time.", + &opt_rehash, &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"no-auto-rehash", 'A', "No automatic rehashing. One has to use 'rehash' to get table and field " "completion. This gives a quicker start of mysql and disables rehashing " "on reconnect.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-vertical-output", OPT_AUTO_VERTICAL_OUTPUT, + {"auto-vertical-output", 0, "Automatically switch to vertical output mode if the result is wider " - "than the terminal width.", - &auto_vertical_output, &auto_vertical_output, 0, GET_BOOL, NO_ARG, 0, - 0, 0, 0, 0, 0}, + "than the terminal width.", &auto_vertical_output, &auto_vertical_output, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"batch", 'B', "Don't use history file. Disable interactive behavior. (Enables --silent.)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"binary-as-hex", 0, "Print binary data as hex", &opt_binhex, &opt_binhex, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"binary-mode", 0, + "Binary mode allows certain character sequences to be processed as data " + "that would otherwise be treated with a special meaning by the parser. " + "Specifically, this switch turns off parsing of all client commands except " + "\\C and DELIMITER in non-interactive mode (i.e., when binary mode is " + "combined with either 1) piped input, 2) the --batch mysql option, or 3) " + "the 'source' command). Also, in binary mode, occurrences of '\\r\\n' and " + "ASCII '\\0' are preserved within strings, whereas by default, '\\r\\n' is " + "translated to '\\n' and '\\0' is disallowed in user input.", + &opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"column-type-info", OPT_COLUMN_TYPES, "Display column type information.", + {"column-names", 0, "Write column names in results.", + &column_names, &column_names, 0, GET_BOOL, + NO_ARG, 1, 0, 0, 0, 0, 0}, + {"skip-column-names", 'N', "Don't write column names in results.", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"column-type-info", 0, "Display column type information.", &column_types_flag, &column_types_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"comments", 'c', "Preserve comments. Send comments to the server." @@ -1541,6 +1555,16 @@ static struct my_option my_long_options[] = {"compress", 'C', "Use compression in server/client protocol.", &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"connect-expired-password", 0, + "Notify the server that this client is prepared to handle expired " + "password sandbox mode even if --batch was specified.", + &opt_connect_expired_password, &opt_connect_expired_password, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"connect_timeout", 0, "Number of seconds before connection timeout.", + &opt_connect_timeout, &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, + 0, 0, 3600*12, 0, 0, 0}, + {"database", 'D', "Database to use.", ¤t_db, + ¤t_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef DBUG_OFF {"debug", '#', "This is a non-debug version. Catch this and exit.", 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, @@ -1548,70 +1572,64 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log.", &default_dbug_option, &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"database", 'D', "Database to use.", ¤t_db, - ¤t_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", OPT_DEFAULT_CHARSET, + {"default-auth", 0, "Default authentication client-side plugin to use.", + &opt_default_auth, &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"default-character-set", 0, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"delimiter", OPT_DELIMITER, "Delimiter to be used.", &delimiter_str, &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"enable-cleartext-plugin", OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, + "Obsolete option. Exists only for MySQL compatibility.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"execute", 'e', "Execute command and quit. (Disables --force and history file.)", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"enable-cleartext-plugin", OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, "Obsolete option. Exists only for MySQL compatibility.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"vertical", 'E', "Print the output of a query (rows) vertically.", - &vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, - 0}, - {"force", 'f', "Continue even if we get an SQL error. Sets abort-source-on-error to 0", - &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0, - 0, 0, 0, 0}, + {"force", 'f', + "Continue even if we get an SQL error. Sets abort-source-on-error to 0", + &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"host", 'h', "Connect to host.", ¤t_host, + ¤t_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"html", 'H', "Produce HTML output.", &opt_html, &opt_html, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"ignore-spaces", 'i', "Ignore space after function names.", + &ignore_spaces, &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"init-command", 0, + "SQL Command to execute when connecting to MariaDB server. Will " + "automatically be re-executed when reconnecting.", &opt_init_command, + &opt_init_command, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"line-numbers", 0, "Write line numbers for errors.", + &line_numbers, &line_numbers, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"skip-line-numbers", 'L', "Don't write line number for errors.", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"local-infile", OPT_LOCAL_INFILE, "Enable LOAD DATA LOCAL INFILE.", + &opt_local_infile, &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"max-allowed-packet", 0, + "The maximum packet length to send to or receive from server.", + &opt_max_allowed_packet, &opt_max_allowed_packet, 0, GET_ULONG, + REQUIRED_ARG, 16*1024LL*1024LL, 4096, 2*1024LL*1024LL*1024LL, 0, 1024, 0}, + {"max-join-size", 0, + "Automatic limit for rows in a join when using --safe-updates.", + &max_join_size, &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, + 1, ULONG_MAX, 0, 1, 0}, {"named-commands", 'G', "Enable named commands. Named commands mean this program's internal " "commands; see mysql> help . When enabled, the named commands can be " "used from any line of the query, otherwise only from the first line, " "before an enter. Disable with --disable-named-commands. This option " "is disabled by default.", - &named_cmds, &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, - 0, 0}, - {"ignore-spaces", 'i', "Ignore space after function names.", - &ignore_spaces, &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0, - 0, 0, 0, 0}, - {"init-command", OPT_INIT_COMMAND, - "SQL Command to execute when connecting to MariaDB server. Will " - "automatically be re-executed when reconnecting.", - &opt_init_command, &opt_init_command, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.", - &opt_local_infile, &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, + &named_cmds, &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"net-buffer-length", 0, + "The buffer size for TCP/IP and socket communication.", + &opt_net_buffer_length, &opt_net_buffer_length, 0, GET_ULONG, + REQUIRED_ARG, 16384, 1024, 512*1024ULL*1024ULL, MALLOC_OVERHEAD, 1024, 0}, {"no-beep", 'b', "Turn off beep on error.", &opt_nobeep, &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"host", 'h', "Connect to host.", ¤t_host, - ¤t_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"html", 'H', "Produce HTML output.", &opt_html, &opt_html, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"xml", 'X', "Produce XML output.", &opt_xml, &opt_xml, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.", - &line_numbers, &line_numbers, 0, GET_BOOL, - NO_ARG, 1, 0, 0, 0, 0, 0}, - {"skip-line-numbers", 'L', "Don't write line number for errors.", 0, 0, 0, GET_NO_ARG, - NO_ARG, 0, 0, 0, 0, 0, 0}, - {"unbuffered", 'n', "Flush buffer after each query.", &unbuffered, - &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"column-names", OPT_COLUMN_NAMES, "Write column names in results.", - &column_names, &column_names, 0, GET_BOOL, - NO_ARG, 1, 0, 0, 0, 0, 0}, - {"skip-column-names", 'N', - "Don't write column names in results.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"sigint-ignore", OPT_SIGINT_IGNORE, "Ignore SIGINT (CTRL-C).", - &opt_sigint_ignore, &opt_sigint_ignore, 0, GET_BOOL, - NO_ARG, 0, 0, 0, 0, 0, 0}, {"one-database", 'o', "Ignore statements except those that occur while the default " "database is the one named at the command line.", @@ -1632,19 +1650,20 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"plugin-dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, + &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 "/etc/services, " #endif - "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", - &opt_mysql_port, - &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"progress-reports", OPT_REPORT_PROGRESS, + "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", &opt_mysql_port, + &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"progress-reports", 0, "Get progress reports for long running commands (like ALTER TABLE)", &opt_progress_reports, &opt_progress_reports, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"prompt", OPT_PROMPT, "Set the command line prompt to this value.", + {"prompt", 0, "Set the command line prompt to this value.", ¤t_prompt, ¤t_prompt, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe).", @@ -1655,11 +1674,27 @@ static struct my_option my_long_options[] = "if the output is suspended. Doesn't use history file.", &quick, &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"raw", 'r', "Write fields without conversion. Used with --batch.", - &opt_raw_data, &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, - 0, 0, 0}, - {"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable " - "with --disable-reconnect. This option is enabled by default.", + &opt_raw_data, &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"reconnect", 0, "Reconnect if the connection is lost.", &opt_reconnect, &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.", + &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.", + &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"sandbox", 0, "Disallow commands that access the file system (except \\P without an argument and \\e).", + &status.sandbox, &status.sandbox, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"secure-auth", 0, "Refuse client connecting to server if it" + " uses old (pre-4.1.1) protocol.", &opt_secure_auth, + &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"select-limit", 0, + "Automatic limit for SELECT when using --safe-updates.", &select_limit, + &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ULONG_MAX, 0, 1, 0}, + {"server-arg", OPT_SERVER_ARG, "Send embedded server this as a parameter.", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"show-warnings", 0, "Show warnings after every statement.", + &show_warnings, &show_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"sigint-ignore", 0, "Ignore SIGINT (CTRL-C).", &opt_sigint_ignore, + &opt_sigint_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"silent", 's', "Be more silent. Print results with a tab as separator, " "each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"socket", 'S', "The socket file to use for connection.", @@ -1673,73 +1708,22 @@ static struct my_option my_long_options[] = "Does not work in batch mode. Disable with --disable-tee. " "This option is disabled by default.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"unbuffered", 'n', "Flush buffer after each query.", &unbuffered, + &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifndef DONT_ALLOW_USER_CHANGE {"user", 'u', "User for login if not current user.", ¤t_user, ¤t_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.", - &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0, - 0, 0, 0, 0}, - {"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.", - &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0, - 0, 0, 0, 0}, {"verbose", 'v', "Write more. (-v -v -v gives the table output format).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 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', "Print the output of a query (rows) vertically.", + &vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"connect_timeout", OPT_CONNECT_TIMEOUT, - "Number of seconds before connection timeout.", - &opt_connect_timeout, &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, - 0, 0, 3600*12, 0, 0, 0}, - {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, - "The maximum packet length to send to or receive from server.", - &opt_max_allowed_packet, &opt_max_allowed_packet, 0, - GET_ULONG, REQUIRED_ARG, 16 *1024L*1024L, 4096, - (longlong) 2*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0}, - {"net_buffer_length", OPT_NET_BUFFER_LENGTH, - "The buffer size for TCP/IP and socket communication.", - &opt_net_buffer_length, &opt_net_buffer_length, 0, GET_ULONG, - REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0}, - {"select_limit", OPT_SELECT_LIMIT, - "Automatic limit for SELECT when using --safe-updates.", - &select_limit, &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, - 1, ULONG_MAX, 0, 1, 0}, - {"max_join_size", OPT_MAX_JOIN_SIZE, - "Automatic limit for rows in a join when using --safe-updates.", - &max_join_size, &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, - 1, ULONG_MAX, 0, 1, 0}, - {"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it" - " uses old (pre-4.1.1) protocol.", &opt_secure_auth, - &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"server-arg", OPT_SERVER_ARG, "Send embedded server this as a parameter.", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.", - &show_warnings, &show_warnings, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", - &opt_plugin_dir, &opt_plugin_dir, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, - "Default authentication client-side plugin to use.", - &opt_default_auth, &opt_default_auth, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"binary-mode", 0, - "Binary mode allows certain character sequences to be processed as data " - "that would otherwise be treated with a special meaning by the parser. " - "Specifically, this switch turns off parsing of all client commands except " - "\\C and DELIMITER in non-interactive mode (i.e., when binary mode is " - "combined with either 1) piped input, 2) the --batch mysql option, or 3) " - "the 'source' command). Also, in binary mode, occurrences of '\\r\\n' and " - "ASCII '\\0' are preserved within strings, whereas by default, '\\r\\n' is " - "translated to '\\n' and '\\0' is disallowed in user input.", - &opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"connect-expired-password", 0, - "Notify the server that this client is prepared to handle expired " - "password sandbox mode even if --batch was specified.", - &opt_connect_expired_password, &opt_connect_expired_password, 0, GET_BOOL, - NO_ARG, 0, 0, 0, 0, 0, 0}, + {"xml", 'X', "Produce XML output.", &opt_xml, &opt_xml, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -2818,9 +2802,7 @@ static void initialize_readline () array of matches, or NULL if there aren't any. */ -static char **new_mysql_completion(const char *text, - int start __attribute__((unused)), - int end __attribute__((unused))) +static char **new_mysql_completion(const char *text, int, int) { if (!status.batch && !quick) #if defined(USE_NEW_READLINE_INTERFACE) @@ -3143,8 +3125,7 @@ static void print_help_item(MYSQL_ROW *cur, int num_name, int num_cat, char *las } -static int com_server_help(String *buffer __attribute__((unused)), - char *line __attribute__((unused)), char *help_arg) +static int com_server_help(String *buffer, char *, char *help_arg) { MYSQL_ROW cur; const char *server_cmd; @@ -3246,18 +3227,16 @@ err: return error; } -static int -com_help(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_help(String *buffer, char *line) { int i, j; char * help_arg= strchr(line,' '), buff[32], *end; if (help_arg) { - while (my_isspace(charset_info,*help_arg)) + while (my_isspace(charset_info, *help_arg)) help_arg++; if (*help_arg) - return com_server_help(buffer,line,help_arg); + return com_server_help(buffer, line, help_arg); } put_info("\nGeneral information about MariaDB can be found at\n" @@ -3280,9 +3259,7 @@ com_help(String *buffer __attribute__((unused)), } - /* ARGSUSED */ -static int -com_clear(String *buffer,char *line __attribute__((unused))) +static int com_clear(String *buffer,char *) { #ifdef HAVE_READLINE if (status.add_to_history) @@ -3292,9 +3269,7 @@ com_clear(String *buffer,char *line __attribute__((unused))) return 0; } - /* ARGSUSED */ -static int -com_charset(String *buffer __attribute__((unused)), char *line) +static int com_charset(String *, char *line) { char buff[256], *param; CHARSET_INFO * new_cs; @@ -3326,8 +3301,7 @@ com_charset(String *buffer __attribute__((unused)), char *line) */ -static int -com_go(String *buffer,char *line __attribute__((unused))) +static int com_go(String *buffer, char *) { char buff[200]; /* about 110 chars used so far */ char time_buff[53+3+1]; /* time max + space & parens + NUL */ @@ -3907,9 +3881,7 @@ tee_print_sized_data(const char *data, unsigned int data_length, unsigned int to } - -static void -print_table_data_html(MYSQL_RES *result) +static void print_table_data_html(MYSQL_RES *result) { MYSQL_ROW cur; MYSQL_FIELD *field; @@ -4205,15 +4177,15 @@ print_tab_data(MYSQL_RES *result) } } -static int -com_tee(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_tee(String *, char *line) { char file_name[FN_REFLEN], *end, *param; + if (status.sandbox) + return put_info("Not allowed in the sandbox mode", INFO_ERROR, 0); if (status.batch) return 0; - while (my_isspace(charset_info,*line)) + while (my_isspace(charset_info, *line)) line++; if (!(param = strchr(line, ' '))) // if outfile wasn't given, use the default { @@ -4250,9 +4222,7 @@ com_tee(String *buffer __attribute__((unused)), } -static int -com_notee(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_notee(String *, char *) { if (opt_outfile) end_tee(); @@ -4265,9 +4235,7 @@ com_notee(String *buffer __attribute__((unused)), */ #ifdef USE_POPEN -static int -com_pager(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_pager(String *, char *line) { char pager_name[FN_REFLEN], *end, *param; @@ -4295,6 +4263,8 @@ com_pager(String *buffer __attribute__((unused)), } else { + if (status.sandbox) + return put_info("Not allowed in the sandbox mode", INFO_ERROR, 0); end= strmake_buf(pager_name, param); while (end > pager_name && (my_isspace(charset_info,end[-1]) || my_iscntrl(charset_info,end[-1]))) @@ -4309,9 +4279,7 @@ com_pager(String *buffer __attribute__((unused)), } -static int -com_nopager(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_nopager(String *, char *) { strmov(pager, "stdout"); opt_nopager=1; @@ -4323,7 +4291,7 @@ com_nopager(String *buffer __attribute__((unused)), #ifdef USE_POPEN static int -com_edit(String *buffer,char *line __attribute__((unused))) +com_edit(String *buffer,char *) { char filename[FN_REFLEN],buff[160]; int fd,tmp,error; @@ -4370,17 +4338,15 @@ err: /* If arg is given, exit without errors. This happens on command 'quit' */ -static int -com_quit(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_quit(String *, char *) { status.exit_status=0; return 1; } static int -com_rehash(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +com_rehash(String *, + char *) { #ifdef HAVE_READLINE build_completion_hash(1, 0); @@ -4390,12 +4356,13 @@ com_rehash(String *buffer __attribute__((unused)), #ifdef USE_POPEN -static int -com_shell(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_shell(String *, char *line) { char *shell_cmd; + if (status.sandbox) + return put_info("Not allowed in the sandbox mode", INFO_ERROR, 0); + /* Skip space from line begin */ while (my_isspace(charset_info, *line)) line++; @@ -4418,8 +4385,7 @@ com_shell(String *buffer __attribute__((unused)), #endif -static int -com_print(String *buffer,char *line __attribute__((unused))) +static int com_print(String *buffer,char *) { tee_puts("--------------", stdout); (void) tee_fputs(buffer->c_ptr(), stdout); @@ -4429,9 +4395,8 @@ com_print(String *buffer,char *line __attribute__((unused))) return 0; /* If empty buffer */ } - /* ARGSUSED */ -static int -com_connect(String *buffer, char *line) + +static int com_connect(String *buffer, char *line) { char *tmp, buff[256]; my_bool save_rehash= opt_rehash; @@ -4484,8 +4449,7 @@ com_connect(String *buffer, char *line) } -static int com_source(String *buffer __attribute__((unused)), - char *line) +static int com_source(String *, char *line) { char source_name[FN_REFLEN], *end, *param; LINE_BUFFER *line_buff; @@ -4494,6 +4458,9 @@ static int com_source(String *buffer __attribute__((unused)), FILE *sql_file; my_bool save_ignore_errors; + if (status.sandbox) + return put_info("Not allowed in the sandbox mode", INFO_ERROR, 0); + /* Skip space from file name */ while (my_isspace(charset_info,*line)) line++; @@ -4528,6 +4495,7 @@ static int com_source(String *buffer __attribute__((unused)), bfill((char*) &status,sizeof(status),(char) 0); status.batch=old_status.batch; // Run in batch mode + status.sandbox=old_status.sandbox; status.line_buff=line_buff; status.file_name=source_name; glob_buffer.length(0); // Empty command buffer @@ -4549,9 +4517,7 @@ static int com_source(String *buffer __attribute__((unused)), } - /* ARGSUSED */ -static int -com_delimiter(String *buffer __attribute__((unused)), char *line) +static int com_delimiter(String *, char *line) { char buff[256], *tmp; @@ -4578,9 +4544,7 @@ com_delimiter(String *buffer __attribute__((unused)), char *line) return 0; } - /* ARGSUSED */ -static int -com_use(String *buffer __attribute__((unused)), char *line) +static int com_use(String *, char *line) { char *tmp, buff[FN_REFLEN + 1]; int select_db; @@ -4653,18 +4617,21 @@ com_use(String *buffer __attribute__((unused)), char *line) return 0; } -static int -com_warnings(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_sandbox(String *, char *) +{ + status.sandbox= 1; + put_info("Sandbox mode.", INFO_INFO); + return 0; +} + +static int com_warnings(String *, char *) { show_warnings = 1; put_info("Show warnings enabled.",INFO_INFO); return 0; } -static int -com_nowarnings(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_nowarnings(String *, char *) { show_warnings = 0; put_info("Show warnings disabled.",INFO_INFO); @@ -4915,10 +4882,7 @@ sql_connect(char *host,char *database,char *user,char *password,uint silent) } - -static int -com_status(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_status(String *, char *) { const char *status_str; char buff[40]; @@ -5043,8 +5007,7 @@ select_limit, max_join_size); return 0; } -static const char * -server_version_string(MYSQL *con) +static const char * server_version_string(MYSQL *con) { /* Only one thread calls this, so no synchronization is needed */ if (server_version == NULL) @@ -5169,8 +5132,7 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate) } -static int -put_error(MYSQL *con) +static int put_error(MYSQL *con) { return put_info(mysql_error(con), INFO_ERROR, mysql_errno(con), mysql_sqlstate(con)); @@ -5236,7 +5198,7 @@ void tee_putc(int c, FILE *file) len("4294967296 days, 23 hours, 59 minutes, 60.000 seconds") -> 53 */ -static void nice_time(double sec,char *buff,bool part_second) +static void nice_time(double sec, char *buff, bool part_second) { ulong tmp; if (sec >= 3600.0*24) @@ -5517,8 +5479,7 @@ static void init_username() } } -static int com_prompt(String *buffer __attribute__((unused)), - char *line) +static int com_prompt(String *, char *line) { char *ptr=strchr(line, ' '); prompt_counter = 0; diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index aaf862c91ed..af6b9c4428b 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -1,6 +1,6 @@ /* Copyright (c) 2006, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB + Copyright (c) 2010, 2024, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -87,10 +87,10 @@ static struct my_option my_long_options[]= {"basedir", 'b', "Not used by mysql_upgrade. Only for backward compatibility.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"character-sets-dir", OPT_CHARSETS_DIR, + {"character-sets-dir", 0, "Not used by mysql_upgrade. Only for backward compatibility.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"compress", OPT_COMPRESS, + {"compress", 0, "Not used by mysql_upgrade. Only for backward compatibility.", ¬_used, ¬_used, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"datadir", 'd', @@ -103,12 +103,12 @@ static struct my_option my_long_options[]= {"debug", '#', "Output debug log.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", OPT_DEFAULT_CHARSET, + {"default-character-set", 0, "Not used by mysql_upgrade. Only for backward compatibility.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"default_auth", OPT_DEFAULT_AUTH, diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 367e415c319..02d04380336 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2010, 2019, MariaDB + Copyright (c) 2010, 2024, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -141,10 +141,10 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", + {"debug-info", 0, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', @@ -158,7 +158,7 @@ static struct my_option my_long_options[] = {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", OPT_DEFAULT_CHARSET, + {"default-character-set", 0, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, @@ -216,21 +216,21 @@ static struct my_option my_long_options[] = 0, 0, 0}, {"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_UINT, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"connect_timeout", OPT_CONNECT_TIMEOUT, "", &opt_connect_timeout, + {"connect_timeout", 0, "", &opt_connect_timeout, &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0, 3600*12, 0, 1, 0}, - {"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", &opt_shutdown_timeout, + {"shutdown_timeout", 0, "", &opt_shutdown_timeout, &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG, SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0}, - {"wait_for_all_slaves", OPT_SHUTDOWN_WAIT_FOR_SLAVES, + {"wait_for_all_slaves", 0, "Defers shutdown until after all binlogged events have been sent to " "all connected slaves", &opt_shutdown_wait_for_slaves, &opt_shutdown_wait_for_slaves, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index a0821475d26..b4d24711020 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB + Copyright (c) 2009, 2024, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1531,7 +1531,7 @@ static struct my_option my_options[] = like this: SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`; */ - {"character-sets-dir", OPT_CHARSETS_DIR, + {"character-sets-dir", 0, "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"database", 'd', "List entries for just this database (local log only).", @@ -1541,13 +1541,13 @@ static struct my_option my_options[] = {"debug", '#', "Output debug log.", ¤t_dbug_option, ¤t_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .", + {"debug-check", 0, "Check memory and open file usage at exit .", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", + {"debug-info", 0, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1583,7 +1583,7 @@ static struct my_option my_options[] = 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', "Password to connect to remote server.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugindir, &opt_plugindir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " @@ -1609,14 +1609,14 @@ static struct my_option my_options[] = &result_file_name, &result_file_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef WHEN_FLASHBACK_REVIEW_READY - {"review", opt_flashback_review, "Print review sql in output file.", + {"review", 0, "Print review sql in output file.", &opt_flashback_review, &opt_flashback_review, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"review-dbname", opt_flashback_flashback_review_dbname, + {"review-dbname", 0, "Writing flashback original row data into this db", &flashback_review_dbname, &flashback_review_dbname, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"review-tablename", opt_flashback_flashback_review_tablename, + {"review-tablename", 0, "Writing flashback original row data into this table", &flashback_review_tablename, &flashback_review_tablename, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1633,7 +1633,7 @@ static struct my_option my_options[] = "Extract only binlog entries created by the server having the given id.", &server_id, &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"set-charset", OPT_SET_CHARSET, + {"set-charset", 0, "Add 'SET NAMES character_set' to the output.", &charset, &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"short-form", 's', "Just show regular queries: no extra info, no " @@ -1681,7 +1681,7 @@ static struct my_option my_options[] = "The slave server_id used for --read-from-remote-server --stop-never.", &opt_stop_never_slave_server_id, &opt_stop_never_slave_server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"stop-position", OPT_STOP_POSITION, + {"stop-position", 0, "Stop reading the binlog at position N. Applies to the last binlog " "passed on the command line.", &stop_position, &stop_position, 0, GET_ULL, @@ -1704,7 +1704,7 @@ that may lead to an endless loop.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"open_files_limit", OPT_OPEN_FILES_LIMIT, + {"open_files_limit", 0, "Used to reserve file descriptors for use by this program.", &open_files_limit, &open_files_limit, 0, GET_ULONG, REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0}, @@ -1730,12 +1730,12 @@ that may lead to an endless loop.", "Updates to a database with a different name than the original. \ Example: rewrite-db='from->to'.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"skip-annotate-row-events", OPT_SKIP_ANNOTATE_ROWS_EVENTS, + {"skip-annotate-row-events", 0, "Don't print Annotate_rows events stored in the binary log.", (uchar**) &opt_skip_annotate_row_events, (uchar**) &opt_skip_annotate_row_events, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"print-table-metadata", OPT_PRINT_TABLE_METADATA, + {"print-table-metadata", 0, "Print metadata stored in Table_map_log_event", &opt_print_table_metadata, &opt_print_table_metadata, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -1951,11 +1951,6 @@ get_one_option(const struct my_option *opt, const char *argument, die(1); } break; -#ifdef WHEN_FLASHBACK_REVIEW_READY - case opt_flashback_review: - opt_flashback_review= 1; - break; -#endif case OPT_START_DATETIME: start_datetime= convert_str_to_timestamp(start_datetime_str); break; diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 25c2f795665..b5e59e64bd5 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2012, MariaDB + Copyright (c) 2010, 2024, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -82,11 +82,11 @@ static struct my_option my_long_options[] = "Instead of issuing one query for each table, use one query per database, naming all tables in the database in a comma-separated list.", &opt_all_in_1, &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-repair", OPT_AUTO_REPAIR, + {"auto-repair", 0, "If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found.", &opt_auto_repair, &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"character-sets-dir", OPT_CHARSETS_DIR, + {"character-sets-dir", 0, "Directory for character set files.", (char**) &charsets_dir, (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"check", 'c', "Check table for errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, @@ -97,7 +97,7 @@ static struct my_option my_long_options[] = {"check-upgrade", 'g', "Check tables for version-dependent changes. May be used with --auto-repair to correct tables requiring version-dependent updates.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"compress", OPT_COMPRESS, "Use compression in server/client protocol.", + {"compress", 0, "Use compression in server/client protocol.", &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"databases", 'B', @@ -111,16 +111,16 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", + {"debug-info", 0, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", OPT_DEFAULT_CHARSET, + {"default-character-set", 0, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -140,7 +140,7 @@ static struct my_option my_long_options[] = "If you are using this option with CHECK TABLE, it will ensure that the table is 100 percent consistent, but will take a long time. If you are using this option with REPAIR TABLE, it will force using old slow repair with keycache method, instead of much faster repair by sorting.", &opt_extended, &opt_extended, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"flush", OPT_FLUSH_TABLES, "Flush each table after check. This is useful if you don't want to have the checked tables take up space in the caches after the check", + {"flush", 0, "Flush each table after check. This is useful if you don't want to have the checked tables take up space in the caches after the check", &opt_flush_tables, &opt_flush_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, {"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG, @@ -150,7 +150,7 @@ static struct my_option my_long_options[] = {"medium-check", 'm', "Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"write-binlog", OPT_WRITE_BINLOG, + {"write-binlog", 0, "Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Use --skip-write-binlog " "when commands should not be sent to replication slaves.", &opt_write_binlog, &opt_write_binlog, 0, GET_BOOL, NO_ARG, @@ -168,7 +168,7 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " @@ -199,7 +199,7 @@ static struct my_option my_long_options[] = #include {"tables", OPT_TABLES, "Overrides option --databases (-B).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"use-frm", OPT_FRM, + {"use-frm", 0, "When used with REPAIR, get table structure from .frm file, so the table can be repaired even if .MYI header is corrupted.", &opt_frm, &opt_frm, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/client/mysqldump.c b/client/mysqldump.c index f275009c1e2..b0e827c616b 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2020, MariaDB Corporation. + Copyright (c) 2010, 2024, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -165,7 +165,6 @@ static my_bool server_supports_switching_charsets= TRUE; static ulong opt_compatible_mode= 0; #define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1 #define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2 -#define MYSQL_OPT_MAX_STATEMENT_TIME 0 #define MYSQL_OPT_SLAVE_DATA_EFFECTIVE_SQL 1 #define MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL 2 static uint opt_mysql_port= 0, opt_master_data; @@ -259,26 +258,26 @@ static struct my_option my_long_options[] = "Do not dump any tablespace information.", &opt_notspcs, &opt_notspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"add-drop-database", OPT_DROP_DATABASE, "Add a DROP DATABASE before each create.", + {"add-drop-database", 0, "Add a DROP DATABASE before each create.", &opt_drop_database, &opt_drop_database, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"add-drop-table", OPT_DROP, "Add a DROP TABLE before each create.", + {"add-drop-table", 0, "Add a DROP TABLE before each create.", &opt_drop, &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"add-drop-trigger", 0, "Add a DROP TRIGGER before each create.", &opt_drop_trigger, &opt_drop_trigger, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"add-locks", OPT_LOCKS, "Add locks around INSERT statements.", + {"add-locks", 0, "Add locks around INSERT statements.", &opt_lock, &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"allow-keywords", OPT_KEYWORDS, + {"allow-keywords", 0, "Allow creation of column names that are keywords.", &opt_keywords, &opt_keywords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"apply-slave-statements", OPT_MYSQLDUMP_SLAVE_APPLY, + {"apply-slave-statements", 0, "Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump.", &opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"character-sets-dir", OPT_CHARSETS_DIR, + {"character-sets-dir", 0, "Directory for character set files.", (char **)&charsets_dir, (char **)&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"comments", 'i', "Write additional information.", @@ -305,7 +304,7 @@ static struct my_option my_long_options[] = {"compress", 'C', "Use compression in server/client protocol.", &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"copy_s3_tables", OPT_COPY_S3_TABLES, + {"copy_s3_tables", 0, "If 'no' S3 tables will be ignored, otherwise S3 tables will be copied as " " Aria tables and then altered to S3", &opt_copy_s3_tables, &opt_copy_s3_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, @@ -325,19 +324,19 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log.", (char *)&default_dbug_option, (char *)&default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", + {"debug-info", 0, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"default-character-set", OPT_DEFAULT_CHARSET, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED.", + {"delayed-insert", 0, "Insert rows with INSERT DELAYED.", &opt_delayed, &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"delete-master-logs", OPT_DELETE_MASTER_LOGS, + {"delete-master-logs", 0, "Delete logs on master after backup. This automatically enables --master-data.", &opt_delete_master_logs, &opt_delete_master_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -365,17 +364,17 @@ static struct my_option my_long_options[] = "Use multiple-row INSERT syntax that include several VALUES lists.", &extended_insert, &extended_insert, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"fields-terminated-by", OPT_FTB, + {"fields-terminated-by", 0, "Fields in the output file are terminated by the given string.", &fields_terminated, &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"fields-enclosed-by", OPT_ENC, + {"fields-enclosed-by", 0, "Fields in the output file are enclosed by the given character.", &enclosed, &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0}, - {"fields-optionally-enclosed-by", OPT_O_ENC, + {"fields-optionally-enclosed-by", 0, "Fields in the output file are optionally enclosed by the given character.", &opt_enclosed, &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0}, - {"fields-escaped-by", OPT_ESC, + {"fields-escaped-by", 0, "Fields in the output file are escaped by the given character.", &escaped, &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"flush-logs", 'F', "Flush logs file in server before starting dump. " @@ -389,7 +388,7 @@ static struct my_option my_long_options[] = "--lock-all-tables or --master-data with --flush-logs.", &flush_logs, &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"flush-privileges", OPT_ESC, "Emit a FLUSH PRIVILEGES statement " + {"flush-privileges", 0, "Emit a FLUSH PRIVILEGES statement " "after dumping the mysql database. This option should be used any " "time the dump contains the mysql database and any other database " "that depends on the data in the mysql database for proper restore. ", @@ -407,7 +406,7 @@ static struct my_option my_long_options[] = 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"hex-blob", OPT_HEXBLOB, "Dump binary strings (BINARY, " + {"hex-blob", 0, "Dump binary strings (BINARY, " "VARBINARY, BLOB) in hexadecimal format.", &opt_hex_blob, &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host.", ¤t_host, @@ -429,15 +428,15 @@ static struct my_option my_long_options[] = "be specified with both database and table names, e.g., " "--ignore-table=database.table.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"include-master-host-port", OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT, + {"include-master-host-port", 0, "Adds 'MASTER_HOST=, MASTER_PORT=' to 'CHANGE MASTER TO..' " "in dump produced with --dump-slave.", &opt_include_master_host_port, &opt_include_master_host_port, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.", + {"insert-ignore", 0, "Insert rows with INSERT IGNORE.", &opt_ignore, &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"lines-terminated-by", OPT_LTB, + {"lines-terminated-by", 0, "Lines in the output file are terminated by the given string.", &lines_terminated, &lines_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -448,7 +447,7 @@ static struct my_option my_long_options[] = 0, 0, 0, 0, 0, 0}, {"lock-tables", 'l', "Lock all tables for read.", &lock_tables, &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.", + {"log-error", 0, "Append warnings and errors to given file.", &log_error_file, &log_error_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"log-queries", 0, "When restoring the dump, the server will, if logging turned on, log the queries to the general and slow query log.", @@ -465,21 +464,21 @@ static struct my_option my_long_options[] = "Option automatically turns --lock-tables off.", &opt_master_data, &opt_master_data, 0, GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_MASTER_DATA_COMMENTED_SQL, 0, 0, 0}, - {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, + {"max_allowed_packet", 0, "The maximum packet length to send to or receive from server.", &opt_max_allowed_packet, &opt_max_allowed_packet, 0, GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096, (longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0}, - {"max-statement-time", MYSQL_OPT_MAX_STATEMENT_TIME, + {"max-statement-time", 0, "Max statement execution time. If unset, overrides server default with 0.", &opt_max_statement_time, &opt_max_statement_time, 0, GET_DOUBLE, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"net_buffer_length", OPT_NET_BUFFER_LENGTH, + {"net_buffer_length", 0, "The buffer size for TCP/IP and socket communication.", &opt_net_buffer_length, &opt_net_buffer_length, 0, GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L, MALLOC_OVERHEAD-1024, 1024, 0}, - {"no-autocommit", OPT_AUTOCOMMIT, + {"no-autocommit", 0, "Wrap tables with autocommit/commit statements.", &opt_autocommit, &opt_autocommit, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -502,7 +501,7 @@ static struct my_option my_long_options[] = {"opt", OPT_OPTIMIZE, "Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"order-by-primary", OPT_ORDER_BY_PRIMARY, + {"order-by-primary", 0, "Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.", &opt_order_by_primary, &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', @@ -523,7 +522,7 @@ static struct my_option my_long_options[] = {"quote-names",'Q', "Quote table and column names with backticks (`).", &opt_quoted, &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"replace", OPT_MYSQL_REPLACE_INTO, "Use REPLACE INTO instead of INSERT INTO.", + {"replace", 0, "Use REPLACE INTO instead of INSERT INTO.", &opt_replace_into, &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"result-file", 'r', @@ -534,7 +533,7 @@ static struct my_option my_long_options[] = {"routines", 'R', "Dump stored routines (functions and procedures).", &opt_routines, &opt_routines, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"set-charset", OPT_SET_CHARSET, + {"set-charset", 0, "Add 'SET NAMES default_character_set' to the output.", &opt_set_charset, &opt_set_charset, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, @@ -543,7 +542,7 @@ static struct my_option my_long_options[] = will give bullet-proof binlog position only if server >=4.1.3. That's the old "FLUSH TABLES WITH READ LOCK does not block commit" fixed bug. */ - {"single-transaction", OPT_TRANSACTION, + {"single-transaction", 0, "Creates a consistent snapshot by dumping all tables in a single " "transaction. Works ONLY for tables stored in storage engines which " "support multiversioning (currently only InnoDB does); the dump is NOT " @@ -555,7 +554,7 @@ static struct my_option my_long_options[] = "isolated from them. Option automatically turns off --lock-tables.", &opt_single_transaction, &opt_single_transaction, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"dump-date", OPT_DUMP_DATE, "Put a dump date to the end of the output.", + {"dump-date", 0, "Put a dump date to the end of the output.", &opt_dump_date, &opt_dump_date, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"skip-opt", OPT_SKIP_OPTIMIZATION, @@ -565,7 +564,7 @@ static struct my_option my_long_options[] = &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #include - {"system", 256, "Dump system tables as portable SQL", + {"system", 0, "Dump system tables as portable SQL", &opt_system, &opt_system, &opt_system_types, GET_SET, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"tab",'T', "Create tab-separated textfile for each table to given path. (Create .sql " @@ -574,10 +573,10 @@ static struct my_option my_long_options[] = &path, &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"tables", OPT_TABLES, "Overrides option --databases (-B).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"triggers", OPT_TRIGGERS, "Dump triggers for each dumped table.", + {"triggers", 0, "Dump triggers for each dumped table.", &opt_dump_triggers, &opt_dump_triggers, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"tz-utc", OPT_TZ_UTC, + {"tz-utc", 0, "SET TIME_ZONE='+00:00' at top of dump to allow dumping of TIMESTAMP data when a server has data in different time zones or data is being moved between servers with different time zones.", &opt_tz_utc, &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, #ifndef DONT_ALLOW_USER_CHANGE @@ -593,10 +592,10 @@ static struct my_option my_long_options[] = &where, &where, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"xml", 'X', "Dump a database as well formed XML.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -754,56 +753,59 @@ static void write_header(FILE *sql_file, const char *db_name) fputs(">\n", sql_file); check_io(sql_file); } - else if (!opt_compact) + else { - print_comment(sql_file, 0, - "-- MariaDB dump %s Distrib %s, for %s (%s)\n--\n", - DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE, - MACHINE_TYPE); - print_comment(sql_file, 0, "-- Host: %s ", - fix_for_comment(current_host ? current_host : "localhost")); - print_comment(sql_file, 0, "Database: %s\n", - fix_for_comment(db_name ? db_name : "")); - print_comment(sql_file, 0, - "-- ------------------------------------------------------\n" - ); - print_comment(sql_file, 0, "-- Server version\t%s\n", - mysql_get_server_info(&mysql_connection)); - - if (!opt_logging) - fprintf(sql_file, -"\n/*M!100101 SET LOCAL SQL_LOG_OFF=0, LOCAL SLOW_QUERY_LOG=0 */;"); - - if (opt_set_charset) - fprintf(sql_file, -"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;" -"\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;" -"\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;" -"\n/*!40101 SET NAMES %s */;\n",default_charset); - - if (opt_tz_utc) + fprintf(sql_file, "/*!999999\\- enable the sandbox mode */ \n"); + if (!opt_compact) { - fprintf(sql_file, "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n"); - fprintf(sql_file, "/*!40103 SET TIME_ZONE='+00:00' */;\n"); - } + print_comment(sql_file, 0, + "-- MariaDB dump %s Distrib %s, for %s (%s)\n--\n", + DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE, + MACHINE_TYPE); + print_comment(sql_file, 0, "-- Host: %s ", + fix_for_comment(current_host ? current_host : "localhost")); + print_comment(sql_file, 0, "Database: %s\n", + fix_for_comment(db_name ? db_name : "")); + print_comment(sql_file, 0, + "-- ------------------------------------------------------\n" + ); + print_comment(sql_file, 0, "-- Server version\t%s\n", + mysql_get_server_info(&mysql_connection)); - if (!path) - { - if (!opt_no_create_info) + if (!opt_logging) + fprintf(sql_file, + "\n/*M!100101 SET LOCAL SQL_LOG_OFF=0, LOCAL SLOW_QUERY_LOG=0 */;"); + + if (opt_set_charset) + fprintf(sql_file, + "\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;" + "\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;" + "\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;" + "\n/*!40101 SET NAMES %s */;\n",default_charset); + + if (opt_tz_utc) { - /* We don't need unique checks as the table is created just before */ - fprintf(md_result_file,"\ -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n"); + fprintf(sql_file, "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n"); + fprintf(sql_file, "/*!40103 SET TIME_ZONE='+00:00' */;\n"); } - fprintf(md_result_file,"\ -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n\ -"); + + if (!path) + { + if (!opt_no_create_info) + { + /* We don't need unique checks as the table is created just before */ + fprintf(md_result_file, + "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n"); + } + fprintf(md_result_file, + "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n"); + } + fprintf(sql_file, + "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='%s%s%s' */;\n" + "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n", + path?"":"NO_AUTO_VALUE_ON_ZERO",compatible_mode_normal_str[0]==0?"":",", + compatible_mode_normal_str); } - fprintf(sql_file, - "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='%s%s%s' */;\n" - "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n", - path?"":"NO_AUTO_VALUE_ON_ZERO",compatible_mode_normal_str[0]==0?"":",", - compatible_mode_normal_str); check_io(sql_file); } } /* write_header */ diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 4db6cd73ef8..9ae0a4b0269 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2011, 2022, MariaDB + Copyright (c) 2011, 2024, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -70,10 +70,10 @@ static char **argv_to_free; static struct my_option my_long_options[] = { - {"character-sets-dir", OPT_CHARSETS_DIR, + {"character-sets-dir", 0, "Directory for character set files.", (char**) &charsets_dir, (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", OPT_DEFAULT_CHARSET, + {"default-character-set", 0, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"columns", 'c', @@ -85,31 +85,31 @@ static struct my_option my_long_options[] = 0, 0, 0}, {"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", + {"debug-info", 0, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"delete", 'd', "First delete all rows from table.", &opt_delete, &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"fields-terminated-by", OPT_FTB, + {"fields-terminated-by", 0, "Fields in the input file are terminated by the given string.", &fields_terminated, &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"fields-enclosed-by", OPT_ENC, + {"fields-enclosed-by", 0, "Fields in the import file are enclosed by the given character.", &enclosed, &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"fields-optionally-enclosed-by", OPT_O_ENC, + {"fields-optionally-enclosed-by", 0, "Fields in the input file are optionally enclosed by the given character.", &opt_enclosed, &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"fields-escaped-by", OPT_ESC, + {"fields-escaped-by", 0, "Fields in the input file are escaped by the given character.", &escaped, &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -126,10 +126,10 @@ static struct my_option my_long_options[] = "Disable foreign key checks while importing the data.", &ignore_foreign_keys, &ignore_foreign_keys, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.", + {"ignore-lines", 0, "Ignore first n lines of data infile.", &opt_ignore_lines, &opt_ignore_lines, 0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"lines-terminated-by", OPT_LTB, + {"lines-terminated-by", 0, "Lines in the input file are terminated by the given string.", &lines_terminated, &lines_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -138,7 +138,7 @@ static struct my_option my_long_options[] = {"lock-tables", 'l', "Lock all tables for write (this disables threads).", &lock_tables, &lock_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"low-priority", OPT_LOW_PRIORITY, + {"low-priority", 0, "Use LOW_PRIORITY when updating the table.", &opt_low_priority, &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', @@ -148,7 +148,7 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " @@ -170,7 +170,7 @@ static struct my_option my_long_options[] = &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #include - {"use-threads", OPT_USE_THREADS, + {"use-threads", 0, "Load files in parallel. The argument is the number " "of threads to use for loading data.", &opt_use_threads, &opt_use_threads, 0, diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 0913d0d0555..2792269a70e 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2019, MariaDB + Copyright (c) 2010, 2024, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -190,10 +190,10 @@ static struct my_option my_long_options[] = {"character-sets-dir", 'c', "Directory for character set files.", (char**) &charsets_dir, (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", OPT_DEFAULT_CHARSET, + {"default-character-set", 0, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"count", OPT_COUNT, + {"count", 0, "Show number of rows per table (may be slow for non-MyISAM tables).", &opt_count, &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -202,13 +202,13 @@ static struct my_option my_long_options[] = 0, 0, 0}, {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", + {"debug-info", 0, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -225,7 +225,7 @@ static struct my_option my_long_options[] = "Password to use when connecting to server. If password is not given, it's " "solicited on the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " diff --git a/client/mysqlslap.c b/client/mysqlslap.c index ea821242733..035a7f0d7ae 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2022, MariaDB + Copyright (c) 2010, 2024, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -535,50 +535,45 @@ static struct my_option my_long_options[] = "Generate SQL where not supplied by file or command line.", &auto_generate_sql, &auto_generate_sql, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-generate-sql-add-autoincrement", OPT_SLAP_AUTO_GENERATE_ADD_AUTO, + {"auto-generate-sql-add-autoincrement", 0, "Add an AUTO_INCREMENT column to auto-generated tables.", - &auto_generate_sql_autoincrement, - &auto_generate_sql_autoincrement, + &auto_generate_sql_autoincrement, &auto_generate_sql_autoincrement, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-generate-sql-execute-number", OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES, + {"auto-generate-sql-execute-number", 0, "Set this number to generate a set number of queries to run.", &auto_actual_queries, &auto_actual_queries, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-generate-sql-guid-primary", OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY, + {"auto-generate-sql-guid-primary", 0, "Add GUID based primary keys to auto-generated tables.", - &auto_generate_sql_guid_primary, - &auto_generate_sql_guid_primary, + &auto_generate_sql_guid_primary, &auto_generate_sql_guid_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-generate-sql-load-type", OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, + {"auto-generate-sql-load-type", 0, "Specify test load type: mixed, update, write, key, or read; default is mixed.", (char**) &auto_generate_sql_type, (char**) &auto_generate_sql_type, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-generate-sql-secondary-indexes", - OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES, + {"auto-generate-sql-secondary-indexes", 0, "Number of secondary indexes to add to auto-generated tables.", &auto_generate_sql_secondary_indexes, &auto_generate_sql_secondary_indexes, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-generate-sql-unique-query-number", - OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM, + {"auto-generate-sql-unique-query-number", 0, "Number of unique queries to generate for automatic tests.", &auto_generate_sql_unique_query_number, &auto_generate_sql_unique_query_number, 0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0}, - {"auto-generate-sql-unique-write-number", - OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM, + {"auto-generate-sql-unique-write-number", 0, "Number of unique queries to generate for auto-generate-sql-write-number.", &auto_generate_sql_unique_write_number, &auto_generate_sql_unique_write_number, 0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0}, - {"auto-generate-sql-write-number", OPT_SLAP_AUTO_GENERATE_WRITE_NUM, + {"auto-generate-sql-write-number", 0, "Number of row inserts to perform for each thread (default is 100).", &auto_generate_sql_number, &auto_generate_sql_number, 0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", (char **)&charsets_dir, (char **)&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"commit", OPT_SLAP_COMMIT, "Commit records every X number of statements.", + {"commit", 0, "Commit records every X number of statements.", &commit_rate, &commit_rate, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"compress", 'C', "Use compression in server/client protocol.", @@ -587,10 +582,10 @@ static struct my_option my_long_options[] = {"concurrency", 'c', "Number of clients to simulate for query to run.", (char**) &concurrency_str, (char**) &concurrency_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"create", OPT_SLAP_CREATE_STRING, "File or string to use create tables.", + {"create", 0, "File or string to use create tables.", &create_string, &create_string, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"create-schema", OPT_CREATE_SLAP_SCHEMA, "Schema to run tests in.", + {"create-schema", 0, "Schema to run tests in.", (char**) &create_schema_string, (char**) &create_schema_string, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"csv", OPT_SLAP_CSV, @@ -604,12 +599,12 @@ static struct my_option my_long_options[] = (char**) &default_dbug_option, (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -617,7 +612,7 @@ static struct my_option my_long_options[] = "Delimiter to use in SQL statements supplied in file or command line.", (char**) &delimiter, (char**) &delimiter, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"detach", OPT_SLAP_DETACH, + {"detach", 0, "Detach (close and reopen) connections after X number of requests.", &detach_rate, &detach_rate, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -629,14 +624,14 @@ static struct my_option my_long_options[] = GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"init-command", OPT_INIT_COMMAND, + {"init-command", 0, "SQL Command to execute when connecting to MariaDB server. Will " "automatically be re-executed when reconnecting.", &opt_init_command, &opt_init_command, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"iterations", 'i', "Number of times to run the tests.", &iterations, &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0}, - {"no-drop", OPT_SLAP_NO_DROP, "Do not drop the schema after the test.", + {"no-drop", 0, "Do not drop the schema after the test.", &opt_no_drop, &opt_no_drop, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"number-char-cols", 'x', "Number of VARCHAR columns to create in table if specifying --auto-generate-sql.", @@ -646,11 +641,11 @@ static struct my_option my_long_options[] = "Number of INT columns to create in table if specifying --auto-generate-sql.", (char**) &num_int_cols_opt, (char**) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"number-of-queries", OPT_MYSQL_NUMBER_OF_QUERY, + {"number-of-queries", 0, "Limit each client to this number of queries (this is not exact).", &num_of_query, &num_of_query, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"only-print", OPT_MYSQL_ONLY_PRINT, + {"only-print", 0, "Do not connect to the databases, but instead print out what would have " "been done.", &opt_only_print, &opt_only_print, 0, GET_BOOL, NO_ARG, @@ -662,25 +657,25 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection.", &opt_mysql_port, &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, - {"post-query", OPT_SLAP_POST_QUERY, + {"post-query", 0, "Query to run or file containing query to execute after tests have completed.", &user_supplied_post_statements, &user_supplied_post_statements, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"post-system", OPT_SLAP_POST_SYSTEM, + {"post-system", 0, "system() string to execute after tests have completed.", &post_system, &post_system, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"pre-query", OPT_SLAP_PRE_QUERY, + {"pre-query", 0, "Query to run or file containing query to execute before running tests.", &user_supplied_pre_statements, &user_supplied_pre_statements, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"pre-system", OPT_SLAP_PRE_SYSTEM, + {"pre-system", 0, "system() string to execute before running tests.", &pre_system, &pre_system, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake index 31880d21328..f42db939bd3 100644 --- a/cmake/pcre.cmake +++ b/cmake/pcre.cmake @@ -44,16 +44,16 @@ MACRO(BUNDLE_PCRE2) SET(byproducts ${byproducts} BUILD_BYPRODUCTS ${file} ${file_d}) SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION ${file}) ENDFOREACH() + FOREACH(v "" "_DEBUG" "_RELWITHDEBINFO" "_RELEASE" "_MINSIZEREL") - STRING(REPLACE "/WX" "" pcre2_flags${v} "${CMAKE_C_FLAGS${v}}") - SET(pcre2_flags${v} "${pcre2_flags${v}} -std=c99 ") + SET(pcre2_flags${v} "${CMAKE_C_FLAGS${v}}") IF(MSVC) + STRING(REPLACE "/WX" "" pcre2_flags${v} "${pcre2_flags${v}}") # Suppress a warning STRING(APPEND pcre2_flags${v} " /wd4244 /wd4267 " ) - # Disable asan support - STRING(REPLACE "-fsanitize=address" "" pcre2_flags${v} "${pcre2_flags${v}}") ENDIF() ENDFOREACH() + ExternalProject_Add( pcre2 PREFIX "${dir}" diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 6efd40fd1bd..378fc5f5f1c 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -46,7 +46,7 @@ MACRO(MYSQL_ADD_PLUGIN) ${CMAKE_SOURCE_DIR}/sql ${PCRE_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS} - ${ZLIB_INCLUDE_DIR}) + ${ZLIB_INCLUDE_DIRS}) LIST(GET ARG_UNPARSED_ARGUMENTS 0 plugin) SET(SOURCES ${ARG_UNPARSED_ARGUMENTS}) diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake index 51176a84c51..8be48e2a597 100644 --- a/cmake/ssl.cmake +++ b/cmake/ssl.cmake @@ -60,6 +60,7 @@ MACRO (MYSQL_USE_BUNDLED_SSL) SET(HAVE_EncryptAes128Ctr OFF CACHE INTERNAL "wolfssl does support AES-CTR, but differently from openssl") SET(HAVE_EncryptAes128Gcm OFF CACHE INTERNAL "wolfssl does not support AES-GCM") SET(HAVE_X509_check_host ON CACHE INTERNAL "wolfssl does support X509_check_host") + SET(HAVE_des ON CACHE INTERNAL "wolfssl does support DES API") CHANGE_SSL_SETTINGS("bundled") ADD_SUBDIRECTORY(extra/wolfssl) MESSAGE_ONCE(SSL_LIBRARIES "SSL_LIBRARIES = ${SSL_LIBRARIES}") @@ -158,6 +159,8 @@ MACRO (MYSQL_CHECK_SSL) HAVE_EncryptAes128Gcm) CHECK_SYMBOL_EXISTS(X509_check_host "openssl/x509v3.h" HAVE_X509_check_host) + CHECK_SYMBOL_EXISTS(DES_set_key_unchecked "openssl/des.h" + HAVE_des) SET(CMAKE_REQUIRED_INCLUDES) SET(CMAKE_REQUIRED_LIBRARIES) SET(CMAKE_REQUIRED_DEFINITIONS) diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake index ee47eb427d9..a933194cd33 100644 --- a/cmake/zlib.cmake +++ b/cmake/zlib.cmake @@ -14,9 +14,12 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA MACRO (MYSQL_USE_BUNDLED_ZLIB) - SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_BINARY_DIR}/zlib) + SET(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_BINARY_DIR}/zlib) SET(BUILD_BUNDLED_ZLIB 1) - SET(ZLIB_LIBRARY zlib CACHE INTERNAL "Bundled zlib library") + SET(ZLIB_LIBRARIES zlib CACHE INTERNAL "Bundled zlib library") + # temporarily define ZLIB_LIBRARY and ZLIB_INCLUDE_DIR for libmariadb + SET(ZLIB_LIBRARY ${ZLIB_LIBRARIES}) + SET(ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRS}) SET(ZLIB_FOUND TRUE) SET(WITH_ZLIB "bundled" CACHE STRING "Use bundled zlib") ADD_SUBDIRECTORY(zlib) @@ -29,7 +32,7 @@ ENDMACRO() # If this is set,we use bundled zlib # If this is not set,search for system zlib. # if system zlib is not found, use bundled copy -# ZLIB_LIBRARIES, ZLIB_INCLUDE_DIR and ZLIB_SOURCES +# ZLIB_LIBRARIES, ZLIB_INCLUDE_DIRS # are set after this macro has run MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS) @@ -52,7 +55,6 @@ MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS) IF(HAVE_CRC32 AND HAVE_COMPRESSBOUND AND HAVE_DEFLATEBOUND) SET(WITH_ZLIB "system" CACHE STRING "Which zlib to use (possible values are 'bundled' or 'system')") - SET(ZLIB_SOURCES "") ELSE() SET(ZLIB_FOUND FALSE CACHE INTERNAL "Zlib found but not usable") MESSAGE(STATUS "system zlib found but not usable") diff --git a/config.h.cmake b/config.h.cmake index 9127a768cd4..1f7d6b7940e 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -499,6 +499,7 @@ #cmakedefine HAVE_COMPRESS 1 #cmakedefine HAVE_EncryptAes128Ctr 1 #cmakedefine HAVE_EncryptAes128Gcm 1 +#cmakedefine HAVE_des 1 /* Stuff that always need to be defined (compile breaks without it) diff --git a/configure.cmake b/configure.cmake index c9445bc83e3..edd4714f23b 100644 --- a/configure.cmake +++ b/configure.cmake @@ -60,15 +60,6 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND (NOT MSVC)) ENDIF() ENDIF() -# workaround for old gcc on x86, gcc atomic ops only work under -march=i686 -IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND CMAKE_COMPILER_IS_GNUCC AND - CMAKE_C_COMPILER_VERSION VERSION_LESS "4.4.0") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686") - # query_response_time.cc causes "error: unable to find a register to spill" - SET(PLUGIN_QUERY_RESPONSE_TIME NO CACHE BOOL "Disabled, gcc is too old") -ENDIF() - # use runtime atomic-support detection in aarch64 IF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") MY_CHECK_AND_SET_COMPILER_FLAG("-moutline-atomics") diff --git a/debian/rules b/debian/rules index b92e49e12c5..04061be5694 100755 --- a/debian/rules +++ b/debian/rules @@ -24,7 +24,7 @@ ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS))) endif BUILDDIR := builddir -DEB_VERSION_REVISION := $(shell echo $(DEB_VERSION) | sed -e 's/^.*-//') +DEB_VERSION_REVISION := $(shell echo $(DEB_VERSION) | sed -e 's/.*[~-]\(.*\)/\1/') RELEASE := $(shell lsb_release -r -s) # Use changelog based DEB_DISTRIBUTION instead? TMP:=$(CURDIR)/debian/tmp diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index 5021128ed35..06dc8900968 100644 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -13,7 +13,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${ZLIB_INCLUDE_DIR}) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${ZLIB_INCLUDE_DIRS}) # Default install component for the files is Server here SET(MYSQL_INSTALL_COMPONENT Server) diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index ea28bc58316..9586f4faa53 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -66,7 +66,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include "page0zip.h" char *tool_name; -char tool_args[2048]; +char tool_args[8192]; /* mysql flavor and version */ mysql_flavor_t server_flavor = FLAVOR_UNKNOWN; @@ -1942,9 +1942,11 @@ char *make_argv(char *buf, size_t len, int argc, char **argv) if (strncmp(*argv, "--password", strlen("--password")) == 0) { arg = "--password=..."; } - left-= snprintf(buf + len - left, left, + uint l= snprintf(buf + len - left, left, "%s%c", arg, argc > 1 ? ' ' : 0); ++argv; --argc; + if (l < left) + left-= l; } return buf; diff --git a/extra/mariabackup/encryption_plugin.cc b/extra/mariabackup/encryption_plugin.cc index dbaa67e1324..ab87ce0b7bd 100644 --- a/extra/mariabackup/encryption_plugin.cc +++ b/extra/mariabackup/encryption_plugin.cc @@ -71,7 +71,16 @@ static std::string get_encryption_plugin_from_cnf() plugin_load = line + 12; // remote \n at the end of string plugin_load.resize(plugin_load.size() - 1); - break; + } + + if (strncmp(line, "innodb_encrypt_tables=", 22) == 0) + { + if (!strncmp(line + 22, "ON", 2) || + !strncmp(line + 22, "1", 1)) + srv_encrypt_tables= 1; + else if (!strncmp(line + 22, "FORCE", 5) || + !strncmp(line + 22, "2", 1)) + srv_encrypt_tables= 2; } } fclose(f); @@ -154,6 +163,17 @@ void encryption_plugin_backup_init(MYSQL *mysql) mysql_free_result(result); + result = xb_mysql_query(mysql, "select @@innodb_encrypt_tables", true, true); + row = mysql_fetch_row(result); + if (!row); + else if (const char *r= row[0]) + { + if (!strcmp(r, "ON")) srv_encrypt_tables= 1; + else if (!strcmp(r, "FORCE")) srv_encrypt_tables= 2; + oss << "innodb_encrypt_tables=" << r << std::endl; + } + + mysql_free_result(result); encryption_plugin_config = oss.str(); argc = 0; diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index b9d58517b9b..a677475054d 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4,7 +4,7 @@ MariaBackup: hot backup tool for InnoDB Originally Created 3/3/2009 Yasufumi Kinoshita Written by Alexey Kopytov, Aleksandr Kuzminsky, Stewart Smith, Vadim Tkachenko, Yasufumi Kinoshita, Ignacio Nin and Baron Schwartz. -(c) 2017, 2022, MariaDB Corporation. +(c) 2017, 2024, MariaDB Corporation. Portions written by Marko Mäkelä. This program is free software; you can redistribute it and/or modify @@ -1759,7 +1759,7 @@ struct my_option xb_server_options[] = &aria_log_dir_path, &aria_log_dir_path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"open_files_limit", OPT_OPEN_FILES_LIMIT, "the maximum number of file " + {"open_files_limit", 0, "the maximum number of file " "descriptors to reserve with setrlimit().", (G_PTR*) &xb_open_files_limit, (G_PTR*) &xb_open_files_limit, 0, GET_ULONG, REQUIRED_ARG, 0, 0, UINT_MAX, 0, 1, 0}, diff --git a/extra/wolfssl/wolfssl b/extra/wolfssl/wolfssl index 66596ad9e1d..8970ff4c340 160000 --- a/extra/wolfssl/wolfssl +++ b/extra/wolfssl/wolfssl @@ -1 +1 @@ -Subproject commit 66596ad9e1d7efa8479656872cf09c9c1870a02e +Subproject commit 8970ff4c34034dbb3594943d11f8c9d4c5512bd5 diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h index ee90d17fb64..53cf1d1a597 100644 --- a/include/sslopt-longopts.h +++ b/include/sslopt-longopts.h @@ -19,13 +19,12 @@ #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) - {"ssl", OPT_SSL_SSL, + {"ssl", 0, "Enable SSL for connection (automatically enabled with other flags).", &opt_use_ssl, &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"ssl-ca", OPT_SSL_CA, "CA file in PEM format (check OpenSSL docs, implies --ssl).", - &opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, + &opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ssl-capath", OPT_SSL_CAPATH, "CA directory (check OpenSSL docs, implies --ssl).", &opt_ssl_capath, &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG, @@ -46,13 +45,12 @@ "Certificate revocation list path (implies --ssl).", &opt_ssl_crlpath, &opt_ssl_crlpath, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"tls-version", OPT_TLS_VERSION, - "TLS protocol version for secure connection.", + {"tls-version", 0, "TLS protocol version for secure connection.", &opt_tls_version, &opt_tls_version, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef MYSQL_CLIENT - {"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT, + {"ssl-verify-server-cert", 0, "Verify server's \"Common Name\" in its cert against hostname used " "when connecting. This option is disabled by default.", &opt_ssl_verify_server_cert, &opt_ssl_verify_server_cert, diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index ff6e2cbf36d..2b3bafed83f 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -24,7 +24,7 @@ ${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/tpool ${CMAKE_BINARY_DIR}/sql ${PCRE_INCLUDE_DIRS} -${ZLIB_INCLUDE_DIR} +${ZLIB_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS} ${SSL_INTERNAL_INCLUDE_DIRS} ) @@ -174,7 +174,7 @@ ENDIF() SET(LIBS dbug strings mysys mysys_ssl pcre2-8 vio - ${ZLIB_LIBRARY} ${SSL_LIBRARIES} + ${ZLIB_LIBRARIES} ${SSL_LIBRARIES} ${LIBWRAP} ${LIBCRYPT} ${CMAKE_DL_LIBS} ${EMBEDDED_PLUGIN_LIBS} sql_embedded diff --git a/mysql-test/dgcov.pl b/mysql-test/dgcov.pl index 679529d9abe..0595a75f97c 100755 --- a/mysql-test/dgcov.pl +++ b/mysql-test/dgcov.pl @@ -112,8 +112,7 @@ sub print_gcov_for_diff { $acc.=sprintf '%9s:%5s:%s', '', $lnum, $' if /^ /; ++$printme, $acc.=sprintf '%9s:%5s:%s', gcov_prefix($fcov->{$lnum}), $lnum, $' if /^\+/; die "$_^^^ dying", unless /^[- +]/; - ++$lnum; - --$cnt; + ++$lnum, --$cnt unless /^-/; } print $acc if $printme; close PIPE or die "command '$cmd' failed: $!: $?"; diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 4c00327ea65..4ac43d8d1c1 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -71,7 +71,7 @@ loose-performance-schema-hosts-size=100 loose-performance-schema-users-size=100 loose-performance-schema-max-mutex-instances=5000 loose-performance-schema-max-rwlock-instances=5000 -loose-performance-schema-max-cond-instances=1000 +loose-performance-schema-max-cond-instances=1500 loose-performance-schema-max-file-instances=10000 loose-performance-schema-max-socket-instances=1000 loose-performance-schema-max-table-instances=500 diff --git a/mysql-test/include/have_innodb.combinations b/mysql-test/include/have_innodb.combinations deleted file mode 100644 index f1131c448f3..00000000000 --- a/mysql-test/include/have_innodb.combinations +++ /dev/null @@ -1,39 +0,0 @@ -[innodb_plugin] -ignore-builtin-innodb -plugin-load-add=$HA_INNODB_SO -innodb -innodb-cmpmem -innodb-cmp-per-index -innodb-trx -innodb-locks -innodb-lock-waits -innodb-buffer-pool-stats -innodb-buffer-page -innodb-buffer-page-lru -innodb-sys-columns -innodb-sys-fields -innodb-sys-foreign -innodb-sys-foreign-cols -innodb-sys-indexes -innodb-sys-tables -innodb-sys-virtual -innodb-metrics - -[innodb] -innodb -innodb-cmpmem -innodb-cmp-per-index -innodb-trx -innodb-locks -innodb-lock-waits -innodb-metrics -innodb-buffer-pool-stats -innodb-buffer-page -innodb-buffer-page-lru -innodb-sys-columns -innodb-sys-fields -innodb-sys-foreign -innodb-sys-foreign-cols -innodb-sys-indexes -innodb-sys-tables -innodb-sys-virtual diff --git a/mysql-test/include/have_innodb.opt b/mysql-test/include/have_innodb.opt new file mode 100644 index 00000000000..0a6d4d9c819 --- /dev/null +++ b/mysql-test/include/have_innodb.opt @@ -0,0 +1,17 @@ +--innodb +--innodb-cmpmem +--innodb-cmp-per-index +--innodb-trx +--innodb-locks +--innodb-lock-waits +--innodb-metrics +--innodb-buffer-pool-stats +--innodb-buffer-page +--innodb-buffer-page-lru +--innodb-sys-columns +--innodb-sys-fields +--innodb-sys-foreign +--innodb-sys-foreign-cols +--innodb-sys-indexes +--innodb-sys-tables +--innodb-sys-virtual diff --git a/mysql-test/include/innodb_rollback_on_timeout.inc b/mysql-test/include/innodb_rollback_on_timeout.inc index 883b0820589..d41e1f1ec9f 100644 --- a/mysql-test/include/innodb_rollback_on_timeout.inc +++ b/mysql-test/include/innodb_rollback_on_timeout.inc @@ -1,4 +1,3 @@ ---source include/have_innodb.inc # # Bug #24200: Provide backwards compatibility mode for 4.x "rollback on # transaction timeout" diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm index 2b32ef87b81..f33875e14aa 100644 --- a/mysql-test/lib/My/Platform.pm +++ b/mysql-test/lib/My/Platform.pm @@ -23,7 +23,7 @@ use File::Path; use Carp; use base qw(Exporter); -our @EXPORT= qw(IS_CYGWIN IS_MSYS IS_WINDOWS IS_WIN32PERL IS_AIX +our @EXPORT= qw(IS_CYGWIN IS_MSYS IS_WINDOWS IS_WIN32PERL IS_AIX IS_MAC native_path posix_path mixed_path check_socket_path_length process_alive open_for_append); @@ -70,6 +70,14 @@ BEGIN { } } +BEGIN { + if ($^O eq "darwin") { + eval 'sub IS_MAC { 1 }'; + } + else { + eval 'sub IS_MAC { 0 }'; + } +} # # native_path diff --git a/mysql-test/main/ddl_i18n_koi8r.result b/mysql-test/main/ddl_i18n_koi8r.result index 6504e129693..d9579926ea4 100644 --- a/mysql-test/main/ddl_i18n_koi8r.result +++ b/mysql-test/main/ddl_i18n_koi8r.result @@ -719,6 +719,7 @@ ca cb utf8mb3_general_ci utf8mb3_general_ci ---> Dump of mysqltest1 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -795,6 +796,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; ---> Dumping mysqltest1 to ddl_i18n_koi8r.sp.mysqltest1.sql ---> Dump of mysqltest2 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -1723,6 +1725,7 @@ koi8r_general_ci utf8mb3_general_ci koi8r_general_ci koi8r_general_ci utf8mb3_ge DELETE FROM mysqltest2.log| ---> Dump of mysqltest1 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -1802,6 +1805,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; ---> Dumping mysqltest1 to ddl_i18n_koi8r.triggers.mysqltest1.sql ---> Dump of mysqltest2 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -2485,6 +2489,7 @@ COLLATION( ' END ONE TIME 1970-01-02 00:00:00 NULL NULL NULL NULL DISABLED PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8mb3_unicode_ci ---> Dump of mysqltest1 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -2552,6 +2557,7 @@ DELIMITER ; ---> Dumping mysqltest1 to ddl_i18n_koi8r.events.mysqltest1.sql ---> Dump of mysqltest2 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; diff --git a/mysql-test/main/ddl_i18n_utf8.result b/mysql-test/main/ddl_i18n_utf8.result index 35234d4fa23..bc99547b675 100644 --- a/mysql-test/main/ddl_i18n_utf8.result +++ b/mysql-test/main/ddl_i18n_utf8.result @@ -719,6 +719,7 @@ ca cb utf8mb3_general_ci utf8mb3_general_ci ---> Dump of mysqltest1 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -795,6 +796,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; ---> Dumping mysqltest1 to ddl_i18n_utf8sp.mysqltest1.sql ---> Dump of mysqltest2 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -1723,6 +1725,7 @@ utf8mb3_general_ci utf8mb3_general_ci koi8r_general_ci utf8mb3_general_ci utf8mb DELETE FROM mysqltest2.log| ---> Dump of mysqltest1 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -1802,6 +1805,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; ---> Dumping mysqltest1 to ddl_i18n_utf8triggers.mysqltest1.sql ---> Dump of mysqltest2 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -2485,6 +2489,7 @@ COLLATION( 'текÑÑ‚') AS c4, END ONE TIME 1970-01-02 00:00:00 NULL NULL NULL NULL DISABLED PRESERVE CREATED LAST_ALTERED NULL 1 utf8mb3 utf8mb3_general_ci utf8mb3_unicode_ci ---> Dump of mysqltest1 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -2552,6 +2557,7 @@ DELIMITER ; ---> Dumping mysqltest1 to ddl_i18n_utf8events.mysqltest1.sql ---> Dump of mysqltest2 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result index 5397522aca5..b822a377962 100644 --- a/mysql-test/main/derived_split_innodb.result +++ b/mysql-test/main/derived_split_innodb.result @@ -858,5 +858,62 @@ SELECT * FROM t1 WHERE t1.a IN (SELECT b FROM (SELECT t2.b FROM t2 WHERE NOT EXISTS (SELECT 1 FROM t3) GROUP BY b) sq); a DROP TABLE t1, t2, t3; +# +# MDEV-23878: Wrong result with semi-join and splittable derived table +# +CREATE TABLE t1 ( +groupId int, +id int unsigned, +PRIMARY KEY (groupId, id) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES +(8,1),(8,2),(8,3),(8,4),(8,5),(8,6),(8,7),(8,8),(8,9),(8,10), +(8,11),(8,12),(8,13),(8,14),(8,15),(8,16),(8,17),(8,18),(8,19); +set statement in_predicate_conversion_threshold=2 for SELECT COUNT(*) AS cnt FROM t1 +JOIN +( +SELECT groupId, id +FROM t1 +WHERE id IN (1,2,3,4,5,6) +GROUP BY groupId, id +) AS t2 +USING (groupId, id) +WHERE id IN (1,2,3,4,5,6,7,8); +cnt +6 +set statement in_predicate_conversion_threshold=2 for EXPLAIN SELECT COUNT(*) AS cnt FROM t1 +JOIN +( +SELECT groupId, id +FROM t1 +WHERE id IN (1,2,3,4,5,6) +GROUP BY groupId, id +) AS t2 +USING (groupId, id) +WHERE id IN (1,2,3,4,5,6,7,8); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index PRIMARY PRIMARY 8 NULL 19 Using index +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY ref key0 key0 8 test.t1.groupId,test.t1.id 2 +4 MATERIALIZED ALL NULL NULL NULL NULL 8 +5 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +3 LATERAL DERIVED t1 eq_ref PRIMARY PRIMARY 8 test.t1.groupId,test.t1.id 1 Using index +3 LATERAL DERIVED ref key0 key0 4 test.t1.id 2 Using where; FirstMatch(t1) +7 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +set statement optimizer_switch='split_materialized=off, loosescan=off' for +set statement in_predicate_conversion_threshold=2 for +SELECT COUNT(*) AS cnt FROM t1 +JOIN +( +SELECT groupId, id +FROM t1 +WHERE id IN (1,2,3,4,5,6) +GROUP BY groupId, id +) AS t2 +USING (groupId, id) +WHERE id IN (1,2,3,4,5,6,7,8); +cnt +6 +DROP TABLE t1; # End of 10.4 tests SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent; diff --git a/mysql-test/main/derived_split_innodb.test b/mysql-test/main/derived_split_innodb.test index 075d6e81e17..67db02f7483 100644 --- a/mysql-test/main/derived_split_innodb.test +++ b/mysql-test/main/derived_split_innodb.test @@ -505,6 +505,48 @@ SELECT * FROM t1 WHERE t1.a IN (SELECT b FROM DROP TABLE t1, t2, t3; +--echo # +--echo # MDEV-23878: Wrong result with semi-join and splittable derived table +--echo # + +CREATE TABLE t1 ( + groupId int, + id int unsigned, + PRIMARY KEY (groupId, id) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +INSERT INTO t1 VALUES + (8,1),(8,2),(8,3),(8,4),(8,5),(8,6),(8,7),(8,8),(8,9),(8,10), + (8,11),(8,12),(8,13),(8,14),(8,15),(8,16),(8,17),(8,18),(8,19); + +let $query= +SELECT COUNT(*) AS cnt FROM t1 +JOIN +( + SELECT groupId, id + FROM t1 + WHERE id IN (1,2,3,4,5,6) + GROUP BY groupId, id +) AS t2 +USING (groupId, id) +WHERE id IN (1,2,3,4,5,6,7,8); + +let $tvc_conversion_threshold = + set statement in_predicate_conversion_threshold=2 for; + +eval $tvc_conversion_threshold $query; +eval $tvc_conversion_threshold EXPLAIN $query; + +let $no_split_materialized_loosescan= + set statement optimizer_switch='split_materialized=off, loosescan=off' for; + +# Correct result with split materializied optimization disabled +eval $no_split_materialized_loosescan + $tvc_conversion_threshold + $query; + +DROP TABLE t1; + --echo # End of 10.4 tests SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent; diff --git a/mysql-test/main/func_encrypt_nossl.result b/mysql-test/main/func_encrypt_nossl.result index dd45717a22f..73bb5c591b9 100644 --- a/mysql-test/main/func_encrypt_nossl.result +++ b/mysql-test/main/func_encrypt_nossl.result @@ -2,83 +2,83 @@ select des_encrypt("test", 'akeystr'); des_encrypt("test", 'akeystr') NULL Warnings: -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_encrypt("test", 1); des_encrypt("test", 1) NULL Warnings: -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_encrypt("test", 9); des_encrypt("test", 9) NULL Warnings: -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_encrypt("test", 100); des_encrypt("test", 100) NULL Warnings: -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_encrypt("test", NULL); des_encrypt("test", NULL) NULL Warnings: -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_encrypt(NULL, NULL); des_encrypt(NULL, NULL) NULL Warnings: -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt("test", 'anotherkeystr'); des_decrypt("test", 'anotherkeystr') NULL Warnings: -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt(1, 1); des_decrypt(1, 1) NULL Warnings: -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt(des_encrypt("test", 'thekey')); des_decrypt(des_encrypt("test", 'thekey')) NULL Warnings: -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select hex(des_encrypt("hello")),des_decrypt(des_encrypt("hello")); hex(des_encrypt("hello")) des_decrypt(des_encrypt("hello")) NULL NULL Warnings: -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt(des_encrypt("hello",4)); des_decrypt(des_encrypt("hello",4)) NULL Warnings: -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt(des_encrypt("hello",'test'),'test'); des_decrypt(des_encrypt("hello",'test'),'test') NULL Warnings: -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select hex(des_encrypt("hello")),hex(des_encrypt("hello",5)),hex(des_encrypt("hello",'default_password')); hex(des_encrypt("hello")) hex(des_encrypt("hello",5)) hex(des_encrypt("hello",'default_password')) NULL NULL NULL Warnings: -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt(des_encrypt("hello"),'default_password'); des_decrypt(des_encrypt("hello"),'default_password') NULL Warnings: -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt(des_encrypt("hello",4),'password4'); des_decrypt(des_encrypt("hello",4),'password4') NULL Warnings: -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working SET @a=des_decrypt(des_encrypt("hello")); Warnings: -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working flush des_key_file; select @a = des_decrypt(des_encrypt("hello")); @a = des_decrypt(des_encrypt("hello")) @@ -90,9 +90,9 @@ select hex(des_decrypt(des_encrypt("hello",4),'password2')); hex(des_decrypt(des_encrypt("hello",4),'password2')) NULL Warnings: -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select hex(des_decrypt(des_encrypt("hello","hidden"))); hex(des_decrypt(des_encrypt("hello","hidden"))) NULL Warnings: -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 464e9285dfe..5be979ba016 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -1690,6 +1690,12 @@ select json_arrayagg('ä'), json_objectagg(1, 'ä'); json_arrayagg('ä') json_objectagg(1, 'ä') ["ä"] {"1":"ä"} # +# MDEV-32287: JSON_EXTRACT not returning multiple values for same path +# +select JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][1]'); +JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][1]') +[40, 40] +# # MDEV-31402: SIGSEGV in json_get_path_next | Item_func_json_extract::read_json # CREATE TABLE t (id CHAR AS (JSON_COMPACT (JSON_EXTRACT(doc,"$._id"))) UNIQUE KEY,doc JSON,CONSTRAINT notnu CHECK (id IS NOT NULL)); @@ -1697,6 +1703,20 @@ INSERT INTO t (doc) VALUES ('{ "_id" : { "$oid" : "0ca0b0f0" },"a" : [ { "a" : [ ERROR 22001: Data too long for column 'id' at row 1 DROP TABLE t; # +# MDEV-19487: JSON_TYPE doesnt detect the type of String Values (returns NULL) and for Date/DateTime returns "INTEGER" +# +SELECT JSON_TYPE(json_value(JSON_OBJECT("id", 1, "name", 'Monty', "date", Cast('2019-01-01' as Date) ), '$.date')) as x; +x +NULL +Warnings: +Warning 4038 Syntax error in JSON text in argument 1 to function 'json_type' at position 5 +# +# MDEV-22141: JSON_REMOVE returns NULL on valid arguments +# +SELECT JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D'); +JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D') +{"A": {"B": 1}} +# # End of 10.5 tests # # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index f594b43b564..5572ac0894b 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -1118,6 +1118,14 @@ set names latin1; select json_arrayagg('ä'), json_objectagg(1, 'ä'); --enable_service_connection + +--echo # +--echo # MDEV-32287: JSON_EXTRACT not returning multiple values for same path +--echo # + +select JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][1]'); + + --echo # --echo # MDEV-31402: SIGSEGV in json_get_path_next | Item_func_json_extract::read_json --echo # @@ -1128,6 +1136,20 @@ INSERT INTO t (doc) VALUES ('{ "_id" : { "$oid" : "0ca0b0f0" },"a" : [ { "a" : [ DROP TABLE t; +--echo # +--echo # MDEV-19487: JSON_TYPE doesnt detect the type of String Values (returns NULL) and for Date/DateTime returns "INTEGER" +--echo # + +SELECT JSON_TYPE(json_value(JSON_OBJECT("id", 1, "name", 'Monty', "date", Cast('2019-01-01' as Date) ), '$.date')) as x; + + +--echo # +--echo # MDEV-22141: JSON_REMOVE returns NULL on valid arguments +--echo # + +SELECT JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D'); + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/func_regexp.result b/mysql-test/main/func_regexp.result index 8e32732e12d..7a9e24f8262 100644 --- a/mysql-test/main/func_regexp.result +++ b/mysql-test/main/func_regexp.result @@ -192,4 +192,20 @@ SELECT SUM(a.t) FROM (SELECT (c1 RLIKE c1) = (c0 IS NULL) as t FROM t0) as a; SUM(a.t) 0 DROP TABLE t0; +# +# MDEV-21058 CREATE TABLE with generated column and RLIKE results in sigabrt +# +CREATE TABLE t1 (c0 INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT ('' RLIKE '[') AS c1 FROM t1; +ERROR 42000: Regex error 'missing terminating ] for character class at offset 1' +SELECT REGEXP_INSTR('','[') AS c1 FROM t1; +ERROR 42000: Regex error 'missing terminating ] for character class at offset 1' +SELECT c0, '' RLIKE NULL AS c1, REGEXP_INSTR('', NULL) AS c2 +FROM t1 ORDER BY c0; +c0 c1 c2 +1 NULL NULL +2 NULL NULL +3 NULL NULL +DROP TABLE t1; # End of 10.5 tests diff --git a/mysql-test/main/func_regexp.test b/mysql-test/main/func_regexp.test index 48a273f6979..fb441bde4d2 100644 --- a/mysql-test/main/func_regexp.test +++ b/mysql-test/main/func_regexp.test @@ -132,5 +132,22 @@ SELECT (c1 RLIKE c1), (c0 IS NULL) FROM t0; SELECT SUM(a.t) FROM (SELECT (c1 RLIKE c1) = (c0 IS NULL) as t FROM t0) as a; DROP TABLE t0; +--echo # +--echo # MDEV-21058 CREATE TABLE with generated column and RLIKE results in sigabrt +--echo # + +CREATE TABLE t1 (c0 INT); +INSERT INTO t1 VALUES (1),(2),(3); + +--error ER_REGEXP_ERROR +SELECT ('' RLIKE '[') AS c1 FROM t1; + +--error ER_REGEXP_ERROR +SELECT REGEXP_INSTR('','[') AS c1 FROM t1; + +SELECT c0, '' RLIKE NULL AS c1, REGEXP_INSTR('', NULL) AS c2 +FROM t1 ORDER BY c0; + +DROP TABLE t1; --echo # End of 10.5 tests diff --git a/mysql-test/main/function_defaults.result b/mysql-test/main/function_defaults.result index d53e929c128..5f5a4c878e6 100644 --- a/mysql-test/main/function_defaults.result +++ b/mysql-test/main/function_defaults.result @@ -3145,3 +3145,28 @@ a b c 2 2010-10-10 10:10:10 x drop table t1; set timestamp=default; +# +# MDEV-33790: Incorrect DEFAULT expression evaluated in UPDATE +# +create table t1 ( +a int, +b timestamp default '2010-10-10 10:10:10' on update now(), +c varchar(100) default 'x'); +create table t2 (a int primary key); +insert t1 (a) values (1),(2); +insert t2 (a) values (1),(2); +select * from t1; +a b c +1 2010-10-10 10:10:10 x +2 2010-10-10 10:10:10 x +set timestamp=unix_timestamp('2011-11-11 11-11-11'); +update t1,t2 set b=default, c=default(b) where t1.a=1 and t1.a= t2.a; +select * from t1; +a b c +1 2010-10-10 10:10:10 2010-10-10 10:10:10 +2 2010-10-10 10:10:10 x +drop table t1, t2; +set timestamp=default; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/function_defaults.test b/mysql-test/main/function_defaults.test index dd3ba109b2a..59776118e56 100644 --- a/mysql-test/main/function_defaults.test +++ b/mysql-test/main/function_defaults.test @@ -67,3 +67,26 @@ update t1 set b=default, c=default(b) where a=1; select * from t1; drop table t1; set timestamp=default; + +--echo # +--echo # MDEV-33790: Incorrect DEFAULT expression evaluated in UPDATE +--echo # + +create table t1 ( + a int, + b timestamp default '2010-10-10 10:10:10' on update now(), + c varchar(100) default 'x'); +create table t2 (a int primary key); +insert t1 (a) values (1),(2); +insert t2 (a) values (1),(2); + +select * from t1; +set timestamp=unix_timestamp('2011-11-11 11-11-11'); +update t1,t2 set b=default, c=default(b) where t1.a=1 and t1.a= t2.a; +select * from t1; +drop table t1, t2; +set timestamp=default; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/information_schema2.result b/mysql-test/main/information_schema2.result index e23e81b885c..fa4d71bf227 100644 --- a/mysql-test/main/information_schema2.result +++ b/mysql-test/main/information_schema2.result @@ -1,3 +1,6 @@ +# +# MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling +# select variable_name from information_schema.session_status where variable_name = (select variable_name from information_schema.session_status where variable_name = 'uptime'); variable_name @@ -6,6 +9,9 @@ select variable_name from information_schema.session_variables where variable_na (select variable_name from information_schema.session_variables where variable_name = 'basedir'); variable_name BASEDIR +# +# MDEV-8796 Delete with sub query with information_schema.TABLES deletes too many rows +# create table t1 (x int); create table t2 (x int); create table t3 (x int); @@ -18,3 +24,15 @@ t2 t3 t4 drop table t1, t2, t3, t4; +# End of 5.5 tests +# INFORMATION_SCHEMA.STATISTICS doesn't show if the index is disabled +create table t1 (a int, key(a)); +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +index_name comment +a +alter table t1 disable keys; +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +index_name comment +a disabled +drop table t1; +# End of 10.5 tests diff --git a/mysql-test/main/information_schema2.test b/mysql-test/main/information_schema2.test index d2fa3da2b5f..50ceec2c5d3 100644 --- a/mysql-test/main/information_schema2.test +++ b/mysql-test/main/information_schema2.test @@ -1,15 +1,15 @@ -# -# MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling -# +--echo # +--echo # MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling +--echo # select variable_name from information_schema.session_status where variable_name = (select variable_name from information_schema.session_status where variable_name = 'uptime'); select variable_name from information_schema.session_variables where variable_name = (select variable_name from information_schema.session_variables where variable_name = 'basedir'); -# -# MDEV-8796 Delete with sub query with information_schema.TABLES deletes too many rows -# +--echo # +--echo # MDEV-8796 Delete with sub query with information_schema.TABLES deletes too many rows +--echo # create table t1 (x int); create table t2 (x int); create table t3 (x int); @@ -17,3 +17,14 @@ create table t4 AS select table_name from information_schema.TABLES where table_ delete from t4 where table_name not in (select table_name from information_schema.TABLES where table_schema = database() and table_type = 'BASE TABLE'); select * from t4 order by table_name; drop table t1, t2, t3, t4; + +--echo # End of 5.5 tests + +--echo # INFORMATION_SCHEMA.STATISTICS doesn't show if the index is disabled +create table t1 (a int, key(a)); +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +alter table t1 disable keys; +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +drop table t1; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/innodb_ext_key,covering,innodb,on.rdiff b/mysql-test/main/innodb_ext_key,covering,on.rdiff similarity index 100% rename from mysql-test/main/innodb_ext_key,covering,innodb,on.rdiff rename to mysql-test/main/innodb_ext_key,covering,on.rdiff diff --git a/mysql-test/main/innodb_ext_key,off.rdiff b/mysql-test/main/innodb_ext_key,off.rdiff index 8061d87990b..0eb123fcfcf 100644 --- a/mysql-test/main/innodb_ext_key,off.rdiff +++ b/mysql-test/main/innodb_ext_key,off.rdiff @@ -163,7 +163,7 @@ where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000 @@ -220,12 +220,12 @@ 5959 3 - show status like 'handler_read_next'; + show /*a*/ status like 'handler_read_next'; Variable_name Value -Handler_read_next 3 +Handler_read_next 9 @@ -177,7 +177,7 @@ select max(l_orderkey) from lineitem where l_partkey between 1 and 10 group by l_partkey; @@ -243,9 +243,9 @@ - show status like 'handler_read%'; + show /*b*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 -Handler_read_key 21 @@ -199,7 +199,7 @@ select max(l_orderkey) from lineitem where l_suppkey in (1,4) group by l_suppkey; @@ -265,9 +265,9 @@ - show status like 'handler_read%'; + show /*c*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 -Handler_read_key 6 diff --git a/mysql-test/main/innodb_ext_key,innodb,on,unoptimized.rdiff b/mysql-test/main/innodb_ext_key,on,unoptimized.rdiff similarity index 100% rename from mysql-test/main/innodb_ext_key,innodb,on,unoptimized.rdiff rename to mysql-test/main/innodb_ext_key,on,unoptimized.rdiff diff --git a/mysql-test/main/innodb_ext_key.result b/mysql-test/main/innodb_ext_key.result index efd068ae880..fc3c974fd95 100644 --- a/mysql-test/main/innodb_ext_key.result +++ b/mysql-test/main/innodb_ext_key.result @@ -14,7 +14,7 @@ flush status; select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01'; count(*) 1 -show status like 'handler_read%'; +show /*1*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -35,7 +35,7 @@ select count(*) from lineitem use index(primary) where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01'; count(*) 1 -show status like 'handler_read%'; +show /*2*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -56,7 +56,7 @@ select count(*) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000; count(*) 1 -show status like 'handler_read%'; +show /*3*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -79,7 +79,7 @@ l_orderkey l_linenumber 1088 3 1217 1 1221 3 -show status like 'handler_read%'; +show /*4*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -98,7 +98,7 @@ flush status; select min(l_orderkey) from lineitem where l_shipdate='1992-07-01'; min(l_orderkey) 130 -show status like 'handler_read%'; +show /*5*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -119,7 +119,7 @@ select min(l_orderkey) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; min(l_orderkey) 1088 -show status like 'handler_read%'; +show /*6*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -140,7 +140,7 @@ select max(l_linenumber) from lineitem where l_shipdate='1992-07-01' and l_orderkey=130; max(l_linenumber) 2 -show status like 'handler_read%'; +show /*7*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -166,7 +166,7 @@ or l_receiptdate='1992-07-01' and l_orderkey=5603; l_orderkey l_linenumber 130 2 5603 2 -show status like 'handler_read%'; +show /*8*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 2 @@ -193,7 +193,7 @@ l_orderkey l_linenumber 130 2 5603 2 5959 3 -show status like 'handler_read%'; +show /*9*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 2 @@ -218,7 +218,7 @@ l_orderkey l_linenumber 130 2 5603 2 5959 3 -show status like 'handler_read_next'; +show /*a*/ status like 'handler_read_next'; Variable_name Value Handler_read_next 3 explain @@ -240,7 +240,7 @@ max(l_orderkey) 5894 5859 5632 -show status like 'handler_read%'; +show /*b*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 21 @@ -262,7 +262,7 @@ where l_suppkey in (1,4) group by l_suppkey; max(l_orderkey) 5988 5984 -show status like 'handler_read%'; +show /*c*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 6 @@ -292,7 +292,7 @@ where p_retailprice > 1100 and o_orderdate='1997-01-01' and o_orderkey=l_orderkey and p_partkey=l_partkey; o_orderkey p_partkey 5895 200 -show status like 'handler_read%'; +show /*d*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 3 @@ -457,7 +457,7 @@ select * from t1, t2 where t2.a=t1.a and t2.b < 2; a pk a b 0 0 0 0 1 1 1 1 -show status like 'handler_read%'; +show /*e*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 10 diff --git a/mysql-test/main/innodb_ext_key.test b/mysql-test/main/innodb_ext_key.test index bb46f7d47fc..3d3a14c801f 100644 --- a/mysql-test/main/innodb_ext_key.test +++ b/mysql-test/main/innodb_ext_key.test @@ -34,7 +34,7 @@ explain select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01'; flush status; select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01'; -show status like 'handler_read%'; +show /*1*/ status like 'handler_read%'; explain select count(*) from lineitem use index(primary) @@ -42,7 +42,7 @@ select count(*) from lineitem use index(primary) flush status; select count(*) from lineitem use index(primary) where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01'; -show status like 'handler_read%'; +show /*2*/ status like 'handler_read%'; explain select count(*) from lineitem @@ -50,7 +50,7 @@ select count(*) from lineitem flush status; select count(*) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000; -show status like 'handler_read%'; +show /*3*/ status like 'handler_read%'; explain select l_orderkey, l_linenumber from lineitem @@ -58,13 +58,13 @@ select l_orderkey, l_linenumber from lineitem flush status; select l_orderkey, l_linenumber from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; -show status like 'handler_read%'; +show /*4*/ status like 'handler_read%'; explain select min(l_orderkey) from lineitem where l_shipdate='1992-07-01'; flush status; select min(l_orderkey) from lineitem where l_shipdate='1992-07-01'; -show status like 'handler_read%'; +show /*5*/ status like 'handler_read%'; explain select min(l_orderkey) from lineitem @@ -72,7 +72,7 @@ select min(l_orderkey) from lineitem flush status; select min(l_orderkey) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; -show status like 'handler_read%'; +show /*6*/ status like 'handler_read%'; explain select max(l_linenumber) from lineitem @@ -80,7 +80,7 @@ select max(l_linenumber) from lineitem flush status; select max(l_linenumber) from lineitem where l_shipdate='1992-07-01' and l_orderkey=130; -show status like 'handler_read%'; +show /*7*/ status like 'handler_read%'; explain select l_orderkey, l_linenumber @@ -92,7 +92,7 @@ select l_orderkey, l_linenumber from lineitem use index (i_l_shipdate, i_l_receiptdate) where l_shipdate='1992-07-01' and l_orderkey=130 or l_receiptdate='1992-07-01' and l_orderkey=5603; -show status like 'handler_read%'; +show /*8*/ status like 'handler_read%'; --replace_column 7 # explain @@ -105,7 +105,7 @@ select l_orderkey, l_linenumber from lineitem use index (i_l_shipdate, i_l_receiptdate) where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000 or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000; -show status like 'handler_read%'; +show /*9*/ status like 'handler_read%'; --replace_column 7 # 9 # 10 Using explain @@ -116,7 +116,7 @@ flush status; select l_orderkey, l_linenumber from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000 or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000; -show status like 'handler_read_next'; +show /*a*/ status like 'handler_read_next'; --replace_column 9 # explain @@ -125,7 +125,7 @@ select max(l_orderkey) from lineitem flush status; select max(l_orderkey) from lineitem where l_partkey between 1 and 10 group by l_partkey; -show status like 'handler_read%'; +show /*b*/ status like 'handler_read%'; --replace_column 9 # explain @@ -134,7 +134,7 @@ select max(l_orderkey) from lineitem flush status; select max(l_orderkey) from lineitem where l_suppkey in (1,4) group by l_suppkey; -show status like 'handler_read%'; +show /*c*/ status like 'handler_read%'; create index i_p_retailprice on part(p_retailprice); @@ -151,7 +151,7 @@ select o_orderkey, p_partkey lineitem use index (i_l_partkey), orders where p_retailprice > 1100 and o_orderdate='1997-01-01' and o_orderkey=l_orderkey and p_partkey=l_partkey; -show status like 'handler_read%'; +show /*d*/ status like 'handler_read%'; --enable_ps2_protocol --echo # @@ -327,7 +327,7 @@ explain select * from t1, t2 where t2.a=t1.a and t2.b < 2; flush status; select * from t1, t2 where t2.a=t1.a and t2.b < 2; -show status like 'handler_read%'; +show /*e*/ status like 'handler_read%'; --enable_ps2_protocol drop table t1,t2; diff --git a/mysql-test/main/insert_select.result b/mysql-test/main/insert_select.result index 29618c6ddd4..463f571b096 100644 --- a/mysql-test/main/insert_select.result +++ b/mysql-test/main/insert_select.result @@ -973,7 +973,6 @@ select * from t1; a 3 1 -2 delete from t1; insert into t1 values (3), (1); insert into t1 @@ -984,8 +983,6 @@ select * from t1; a 3 1 -3 -2 delete from t1; insert into t1 values (3), (1); insert into t1 @@ -996,6 +993,7 @@ select * from t1; a 3 1 +3 2 delete from t1; insert into t1 values (3), (1); @@ -1022,7 +1020,6 @@ select * from t1; a 3 1 -2 delete from t1; insert into t1 values (3), (1); execute stmt; @@ -1030,7 +1027,6 @@ select * from t1; a 3 1 -2 delete from t1; insert into t1 values (3), (1); delete from t1 @@ -1040,6 +1036,8 @@ group by (select * from (select a from t1) dt where a = 1))); select * from t1; a +3 +1 deallocate prepare stmt; drop table t1,t2,t3; # diff --git a/mysql-test/main/lock_view.result b/mysql-test/main/lock_view.result index 47a7e58ea0d..3d710f38936 100644 --- a/mysql-test/main/lock_view.result +++ b/mysql-test/main/lock_view.result @@ -16,6 +16,7 @@ create definer=definer@localhost view mysqltest3.v3is as select schema_name from create definer=definer@localhost view mysqltest3.v3ps as select user from performance_schema.users where current_connections>0 order by user; create definer=definer@localhost view mysqltest3.v3nt as select 1; create definer=definer@localhost sql security invoker view mysqltest3.v3i as select * from mysqltest1.t1; +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; @@ -235,6 +236,7 @@ create view v1 as select * from (select * from t1) dt; lock table v1 read; disconnect con1; connection default; +/*!999999\- enable the sandbox mode */ SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE VIEW `v1` AS SELECT diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result index b8fbd40baed..03d40be897f 100644 --- a/mysql-test/main/long_unique_bugs.result +++ b/mysql-test/main/long_unique_bugs.result @@ -676,6 +676,59 @@ SELECT * FROM t1; a b c 3 2 2 DROP TABLE t1; +# MDEV-30046 wrong row targeted with "insert ... on duplicate" and +# "replace", leading to data corruption +create table t (s blob, n int, unique (s)) engine=innodb; +insert into t values ('Hrecvx_0004ln-00',1), ('Hrecvx_0004mm-00',1); +replace into t values ('Hrecvx_0004mm-00',2); +select * from t; +s n +Hrecvx_0004ln-00 1 +Hrecvx_0004mm-00 2 +drop table t; +create table t (s blob, n int, unique (s)) engine=innodb; +insert into t values ('Hrecvx_0004ln-00',1), ('Hrecvx_0004mm-00',1); +insert into t values ('Hrecvx_0004mm-00',2) +on duplicate key update n = values (n); +select * from t; +s n +Hrecvx_0004ln-00 1 +Hrecvx_0004mm-00 2 +drop table t; # +# MDEV-29345 update case insensitive (large) unique key with insensitive change of value - duplicate key +# +create table t1 (a int, b text, unique (b)); +insert ignore t1 values (1, 'a'), (2, 'A'); +Warnings: +Warning 1062 Duplicate entry 'A' for key 'b' +select * from t1; +a b +1 a +update t1 set b='A' where a=1; +select * from t1; +a b +1 A +drop table t1; +create table t1 (a int, b blob, unique (b)); +insert t1 values (1, 'a'), (2, 'A'); +select * from t1; +a b +1 a +2 A +update t1 set b='A' where a=1; +ERROR 23000: Duplicate entry 'A' for key 'b' +drop table t1; +# +# MDEV-25102 UNIQUE USING HASH error after ALTER ... DISABLE KEYS +# +create table t1 (i int, unique key (i) using hash); +alter table t1 disable keys; +insert into t1 values (1),(2); +insert into t1 values (1); +ERROR 23000: Duplicate entry '1' for key 'i' +alter table t1 enable keys; +insert into t1 values (2); +ERROR 23000: Duplicate entry '2' for key 'i' +drop table t1; # End of 10.5 tests -# diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index 2441dfa59e8..aa89a78e0bd 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -503,7 +503,6 @@ start transaction; alter table tmp alter column a set default 8; unlock tables; drop table t2; ---source include/have_innodb.inc --echo # --echo # MDEV-22218 InnoDB: Failing assertion: node->pcur->rel_pos == BTR_PCUR_ON upon LOAD DATA with NO_BACKSLASH_ESCAPES in SQL_MODE and unique blob in table @@ -642,7 +641,6 @@ insert into t1 values (0); check table t1 extended; drop table t1; - --echo # --echo # MDEV-32837 long unique does not work like unique key when using replace --echo # @@ -655,6 +653,49 @@ REPLACE INTO t1 VALUES (3,2,2); SELECT * FROM t1; DROP TABLE t1; +--echo # MDEV-30046 wrong row targeted with "insert ... on duplicate" and +--echo # "replace", leading to data corruption +--source include/have_innodb.inc +create table t (s blob, n int, unique (s)) engine=innodb; +insert into t values ('Hrecvx_0004ln-00',1), ('Hrecvx_0004mm-00',1); +replace into t values ('Hrecvx_0004mm-00',2); +select * from t; +drop table t; + +create table t (s blob, n int, unique (s)) engine=innodb; +insert into t values ('Hrecvx_0004ln-00',1), ('Hrecvx_0004mm-00',1); +insert into t values ('Hrecvx_0004mm-00',2) + on duplicate key update n = values (n); +select * from t; +drop table t; --echo # +--echo # MDEV-29345 update case insensitive (large) unique key with insensitive change of value - duplicate key +--echo # +create table t1 (a int, b text, unique (b)); +insert ignore t1 values (1, 'a'), (2, 'A'); +select * from t1; +update t1 set b='A' where a=1; +select * from t1; +drop table t1; + +create table t1 (a int, b blob, unique (b)); +insert t1 values (1, 'a'), (2, 'A'); +select * from t1; +--error ER_DUP_ENTRY +update t1 set b='A' where a=1; +drop table t1; + +--echo # +--echo # MDEV-25102 UNIQUE USING HASH error after ALTER ... DISABLE KEYS +--echo # +create table t1 (i int, unique key (i) using hash); +alter table t1 disable keys; +insert into t1 values (1),(2); +--error ER_DUP_ENTRY +insert into t1 values (1); +alter table t1 enable keys; +--error ER_DUP_ENTRY +insert into t1 values (2); +drop table t1; + --echo # End of 10.5 tests ---echo # diff --git a/mysql-test/main/myisam.result b/mysql-test/main/myisam.result index e0923ee037e..210023d5f7b 100644 --- a/mysql-test/main/myisam.result +++ b/mysql-test/main/myisam.result @@ -1,7 +1,5 @@ call mtr.add_suppression("Can't find record in '.*'"); call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); -drop table if exists t1,t2,t3; -SET SQL_WARNINGS=1; CREATE TABLE t1 ( STRING_DATA char(255) default NULL, KEY string_data (STRING_DATA) diff --git a/mysql-test/main/myisam.test b/mysql-test/main/myisam.test index 58d094d7d08..0af0ceb8ad3 100644 --- a/mysql-test/main/myisam.test +++ b/mysql-test/main/myisam.test @@ -7,12 +7,6 @@ call mtr.add_suppression("Can't find record in '.*'"); call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); -# Initialise ---disable_warnings -drop table if exists t1,t2,t3; ---enable_warnings -SET SQL_WARNINGS=1; - # # Test problem with CHECK TABLE; # diff --git a/mysql-test/main/mysql.result b/mysql-test/main/mysql.result index 5363bcd12b2..32d2bbb28d9 100644 --- a/mysql-test/main/mysql.result +++ b/mysql-test/main/mysql.result @@ -552,6 +552,7 @@ Table Create Table a1\`b1 CREATE TABLE `a1\``b1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `a1\``b1` ( @@ -581,6 +582,7 @@ Table Create Table a1\"b1 CREATE TABLE "a1\""b1" ( "a" int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE "a1\""b1" ( @@ -603,11 +605,11 @@ set sql_mode=default; create table t1 (a text); select count(*) from t1; count(*) -41 +42 truncate table t1; select count(*) from t1; count(*) -41 +42 truncate table t1; select count(*) from t1; count(*) @@ -619,7 +621,7 @@ count(*) truncate table t1; select count(*) from t1; count(*) -41 +42 truncate table t1; select count(*) from t1; count(*) @@ -633,3 +635,27 @@ drop table t1; WARNING: option '--enable-cleartext-plugin' is obsolete. 1 1 +# End of 10.3 tests +# +# MDEV-21778 Disable system commands in mysql/mariadb client +# +ERROR at line 1: Not allowed in the sandbox mode +1 +ERROR at line 1: Not allowed in the sandbox mode +2 +ERROR at line 1: Not allowed in the sandbox mode +3 +1 +entering sandbox +system +tee +source +^^^ +2 +entering sandbox +system +tee +source +^^^ +3 +# End of 10.5 tests diff --git a/mysql-test/main/mysql.test b/mysql-test/main/mysql.test index 0f41add821a..2f189e70b18 100644 --- a/mysql-test/main/mysql.test +++ b/mysql-test/main/mysql.test @@ -610,6 +610,7 @@ EOF create database `aa``bb````cc`; --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/backticks.sql drop database `aa``bb````cc`; +--remove_file $MYSQLTEST_VARDIR/tmp/backticks.sql # # MySQL Bug#13639125 DELIMITER STRIPS THE NEXT NEW LINE IN A SQL STATEMENT @@ -620,6 +621,7 @@ delimiter <<" as a; EOF --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/13639125.sql +--remove_file $MYSQLTEST_VARDIR/tmp/13639125.sql # # --skip-column-names and alignment @@ -702,7 +704,7 @@ select count(*) from t1; truncate table t1; --exec $MYSQL --disable-local-infile -e "/*q*/$ldli" select count(*) from t1; truncate table t1; drop table t1; - +--remove_file $MYSQLTEST_VARDIR/tmp/bug.sql --echo # --echo # MDEV-15538 '-N' Produce html output wrong @@ -716,3 +718,43 @@ drop table t1; # --echo --exec $MYSQL test --enable-cleartext-plugin -e "select 1" + +--echo # End of 10.3 tests + +--echo # +--echo # MDEV-21778 Disable system commands in mysql/mariadb client +--echo # + +--error 1 +--exec $MYSQL --sandbox -Ne "select 1; \! echo foo; select 0" 2>&1 +--error 1 +--exec $MYSQL --sandbox -Ne "select 2; \T echo foo; select 0" 2>&1 +--error 1 +--exec $MYSQL --sandbox -Ne "select 3; \. echo.foo; select 0" 2>&1 + +--write_file $MYSQL_TMP_DIR/mysql_in +select 'entering sandbox'; +\- +select 'system'; +\! echo foo +select 'tee'; +\T echo foo +select 'source'; +\. echo.foo +select '^^^'; +EOF + +write_line "select 1; +source $MYSQL_TMP_DIR/mysql_in; +select 2; +source $MYSQL_TMP_DIR/mysql_in; +sandbox; +select 3; +source $MYSQL_TMP_DIR/mysql_in;" $MYSQL_TMP_DIR/mysql_in2; + +--exec $MYSQL -fN <$MYSQL_TMP_DIR/mysql_in2 + +--remove_file $MYSQL_TMP_DIR/mysql_in +--remove_file $MYSQL_TMP_DIR/mysql_in2 + +--echo # End of 10.5 tests diff --git a/mysql-test/main/mysqlbinlog_row_minimal.result b/mysql-test/main/mysqlbinlog_row_minimal.result index cd59d24f007..731479b9717 100644 --- a/mysql-test/main/mysqlbinlog_row_minimal.result +++ b/mysql-test/main/mysqlbinlog_row_minimal.result @@ -382,7 +382,7 @@ START TRANSACTION # server id 1 end_log_pos END_LOG_POS CRC32 XXX Annotate_rows: #Q> UPDATE t1 t1 INNER JOIN t2 t2 ON t1.ref_id = t2.id #Q> SET t1.is_deleted = TRUE -#Q> WHERE t1.id = +#Q> WHERE t1.id = 1 # server id 1 end_log_pos END_LOG_POS CRC32 XXX Table_map: `test`.`t1` mapped to number TID # at POS # server id 1 end_log_pos END_LOG_POS CRC32 XXX Update_rows: table id TID flags: STMT_END_F diff --git a/mysql-test/main/mysqldump-compat-102.result b/mysql-test/main/mysqldump-compat-102.result index 86a2ebc47e0..d5ed54570e2 100644 --- a/mysql-test/main/mysqldump-compat-102.result +++ b/mysql-test/main/mysqldump-compat-102.result @@ -58,6 +58,7 @@ BEGIN log(0, 'Session ' || connection_id() || ' ' || current_user || ' started'); END; $$ +/*!999999\- enable the sandbox mode */ -- MariaDB dump DUMPVERSION Distrib DISTVERSION, for OS -- -- Host: localhost Database: db1_mdev17429 diff --git a/mysql-test/main/mysqldump-max.result b/mysql-test/main/mysqldump-max.result index 4a53a5f3328..28c111d37b7 100644 --- a/mysql-test/main/mysqldump-max.result +++ b/mysql-test/main/mysqldump-max.result @@ -77,6 +77,7 @@ id name 3 first value 4 first value 5 first value +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -174,6 +175,7 @@ INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first val /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; diff --git a/mysql-test/main/mysqldump-nl.result b/mysql-test/main/mysqldump-nl.result index 66902492934..1e9928308fc 100644 --- a/mysql-test/main/mysqldump-nl.result +++ b/mysql-test/main/mysqldump-nl.result @@ -12,6 +12,7 @@ create procedure sp() select * from `v1 1v`; flush tables; use test; +/*!999999\- enable the sandbox mode */ -- -- Current Database: `mysqltest1 @@ -134,6 +135,7 @@ test\` \! ls # test` +/*!999999\- enable the sandbox mode */ -- -- Current Database: `test``` diff --git a/mysql-test/main/mysqldump-no-binlog.result b/mysql-test/main/mysqldump-no-binlog.result index 223034d8401..669675ff21b 100644 --- a/mysql-test/main/mysqldump-no-binlog.result +++ b/mysql-test/main/mysqldump-no-binlog.result @@ -1 +1,2 @@ mariadb-dump: Error: Binlogging on server not active +/*!999999\- enable the sandbox mode */ diff --git a/mysql-test/main/mysqldump-system.result b/mysql-test/main/mysqldump-system.result index 0a3048a7116..19004edad3c 100644 --- a/mysql-test/main/mysqldump-system.result +++ b/mysql-test/main/mysqldump-system.result @@ -39,6 +39,7 @@ CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; # # mysqldump of system tables with --system=all # +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -165,6 +166,7 @@ UNLOCK TABLES; # # mysqldump of system tables with --system=all --replace # +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -314,6 +316,7 @@ UNLOCK TABLES; # # mysqldump of system tables with --system=all --insert-ignore # +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; diff --git a/mysql-test/main/mysqldump-timing.result b/mysql-test/main/mysqldump-timing.result index fe44a1eadd4..e70aaf3b0f8 100644 --- a/mysql-test/main/mysqldump-timing.result +++ b/mysql-test/main/mysqldump-timing.result @@ -7,6 +7,7 @@ CREATE TABLE t1 (i INT); INSERT INTO t1 VALUES (0); LOCK TABLE t1 WRITE; timeout without t1 contents expected +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -30,6 +31,7 @@ SET @save_max_statement_time=@@max_statement_time; SET GLOBAL max_statement_time=0.1; UNLOCK TABLES;; This would be a race condition otherwise, but default max_statement_time=0 makes it succeed +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; diff --git a/mysql-test/main/mysqldump-utf8mb4.result b/mysql-test/main/mysqldump-utf8mb4.result index 50c23c5efa9..2928e4a0401 100644 --- a/mysql-test/main/mysqldump-utf8mb4.result +++ b/mysql-test/main/mysqldump-utf8mb4.result @@ -32,6 +32,7 @@ Testing XML format output ---- Testing text format output ---- +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result index 39ef6a2ce47..d67d402ddb5 100644 --- a/mysql-test/main/mysqldump.result +++ b/mysql-test/main/mysqldump.result @@ -31,6 +31,7 @@ DROP TABLE t1; CREATE TABLE t1 (a decimal(64, 20)); INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), ("0987654321098765432109876543210987654321"); +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -46,6 +47,7 @@ CREATE TABLE t1 (a double); INSERT IGNORE INTO t1 VALUES ('-9e999999'); Warnings: Warning 1264 Out of range value for column 'a' at row 1 +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -67,6 +69,7 @@ INSERT INTO t1 VALUES ('1.2345', 2.3456); INSERT INTO t1 VALUES ("1.2345", 2.3456); ERROR 42S22: Unknown column '1.2345' in 'field list' SET SQL_MODE=@OLD_SQL_MODE; +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -75,6 +78,7 @@ CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456); +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -83,6 +87,7 @@ CREATE TABLE `t1` ( ); /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -118,6 +123,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -194,6 +200,7 @@ DROP TABLE t1; # CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r; INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -235,6 +242,7 @@ DROP TABLE t1; # CREATE TABLE t1 (a int) ENGINE=MYISAM; INSERT INTO t1 VALUES (1), (2); +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -258,6 +266,7 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -286,6 +295,7 @@ DROP TABLE t1; # Bug#2592 mysqldump doesn't quote "tricky" names correctly # create table ```a` (i int); +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE ```a` ( @@ -297,6 +307,7 @@ drop table ```a`; # Bug#2591 mysqldump quotes names inconsistently # create table t1(a int); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -330,6 +341,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -356,6 +368,7 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; set global sql_mode='ANSI_QUOTES'; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -389,6 +402,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -421,6 +435,7 @@ drop table t1; # create table t1(a int); insert into t1 values (1),(2),(3); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -453,6 +468,7 @@ drop table t1; # # Bug#6101 create database problem # +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -479,6 +495,7 @@ USE `test`; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; create database mysqldump_test_db character set latin2 collate latin2_bin; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -513,6 +530,7 @@ drop database mysqldump_test_db; # if it is explicitly set. CREATE TABLE t1 (a CHAR(10)); INSERT INTO t1 VALUES (_latin1 'ÄÖÜß'); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -554,6 +572,7 @@ UNLOCK TABLES; # If the future we can move this command into a separate test with # checking that "mysqldump" is compiled with "latin1" # +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -577,6 +596,7 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -600,6 +620,7 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -631,6 +652,7 @@ CREATE TABLE t1 (a int); CREATE TABLE t2 (a int); INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t2 VALUES (4),(5),(6); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -672,6 +694,7 @@ DROP TABLE t2; # CREATE TABLE t1 (`b` blob); INSERT INTO `t1` VALUES (0x602010000280100005E71A); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -713,6 +736,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t1 VALUES (4),(5),(6); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -747,6 +771,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1116,6 +1141,7 @@ F_cd00692c3bfe59267d5ecfac5310286c int, F_6faa8040da20ef399b63a72d0e4ab575 int, F_fe73f687e5bc5280214e0486b273a5f9 int); insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1485,6 +1511,7 @@ drop table t1; # CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1),(2),(3); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1535,6 +1562,7 @@ CREATE TABLE t1 ( a INT ); CREATE TABLE t2 ( a INT ); INSERT INTO t1 VALUES (1), (2); INSERT INTO t2 VALUES (1), (2); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1570,6 +1598,7 @@ CREATE TABLE `t2` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1642,21 +1671,35 @@ create table t3(a varchar(30) primary key, b int not null); test_sequence ------ Testing with illegal table names ------ mariadb-dump: Couldn't find table: "\d-2-1.sql" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "\t1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "\t1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "\\t1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "t\1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "t\1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "t/1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "T_1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "T%1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "T'1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "T_1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "T_" +/*!999999\- enable the sandbox mode */ test_sequence ------ Testing with illegal database names ------ mariadb-dump: Got error: 1049: "Unknown database 'mysqldump_test_d'" when selecting the database +/*!999999\- enable the sandbox mode */ mariadb-dump: Got error: 1049: "Unknown database 'mysqld\ump_test_db'" when selecting the database +/*!999999\- enable the sandbox mode */ drop table t1, t2, t3; drop database mysqldump_test_db; use test; @@ -1718,6 +1761,7 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1749,6 +1793,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1867,6 +1912,7 @@ create table t1(a int); create table t2(a int); create table t3(a int); mariadb-dump: Couldn't find table: "non_existing" +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1916,6 +1962,7 @@ drop table t1, t2, t3; create table t1 (a int); mariadb-dump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ `a` FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064) mariadb-dump: Got error: 1064: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1" when retrieving data from server +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1957,6 +2004,7 @@ CREATE TABLE `t1` ( PRIMARY KEY (`a b`, `c"d`, `e``f`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; insert into t1 values (0815, 4711, 2006); +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -1986,6 +2034,7 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2040,6 +2089,7 @@ INSERT INTO t2 VALUES ('bingo'); INSERT INTO t2 VALUES ('waffle'); INSERT INTO t2 VALUES ('lemon'); create view v2 as select * from t2 where a like 'a%' with check option; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2134,6 +2184,7 @@ drop database db1; use test; create table t1(a int); create view v1 as select * from t1; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2204,6 +2255,7 @@ INSERT INTO t2 VALUES ('bingo'); INSERT INTO t2 VALUES ('waffle'); INSERT INTO t2 VALUES ('lemon'); create view v2 as select * from t2 where a like 'a%' with check option; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2269,6 +2321,7 @@ use test; # CREATE TABLE t1 (a char(10)); INSERT INTO t1 VALUES ('\''); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2315,6 +2368,7 @@ create view v1 as select * from v3 where b in (1, 2, 3, 4, 5, 6, 7); create view v2 as select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2464,6 +2518,7 @@ end if; end AFTER 0000-00-00 00:00:00 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci INSERT INTO t1 (a) VALUES (1),(2),(3),(22); update t1 set a = 4 where a=3; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2593,6 +2648,7 @@ DELIMITER ; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2740,6 +2796,7 @@ Warning 1287 '