Commit 82455a66 authored by Mats Kindahl's avatar Mats Kindahl

Merging patch for BUG#57108 with mysql-5.5-bugteam

parents e8cbcf15 de24c17d
Branches unavailable
Tags unavailable
No related merge requests found
......@@ -9,15 +9,19 @@
*.core
*.d
*.da
*.dll
*.exe
*.exp
*.gcda
*.gcno
*.gcov
*.idb
*.ilk
*.la
*.lai
*.lib
*.lo
*.manifest
*.map
*.o
*.obj
......@@ -148,6 +152,7 @@ Makefile
Makefile.in
Makefile.in'
PENDING/*
scripts/scripts
TAGS
VC++Files/client/mysql_amd64.dsp
ac_available_languages_fragment
......@@ -1981,6 +1986,7 @@ sql-bench/test-transactions
sql-bench/test-wisconsin
sql/*.cpp
sql/*.ds?
sql/*.def
sql/*.vcproj
sql/.deps/client.Po
sql/.deps/derror.Po
......@@ -2116,6 +2122,7 @@ sql/.libs/udf_example.lai
sql/.libs/udf_example.so.0
sql/.libs/udf_example.so.0.0.0
sql/client.c
sql/cmake_dummy.cc
sql/Doxyfile
sql/f.c
sql/gen_lex_hash
......@@ -3046,6 +3053,7 @@ vio/viotest.cpp
win/configure.data
win/vs71cache.txt
win/vs8cache.txt
win/nmake_cache.txt
ylwrap
zlib/*.ds?
zlib/*.vcproj
......
......@@ -63,6 +63,11 @@ IF(WITH_DEBUG)
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING ${BUILDTYPE_DOCSTRING} FORCE)
SET(MYSQL_MAINTAINER_MODE ON CACHE BOOL
"MySQL maintainer-specific development environment")
IF(UNIX AND NOT APPLE)
# Compiling with PIC speeds up embedded build, on PIC sensitive systems
# Predefine it to ON, in case user chooses to build embedded.
SET(WITH_PIC ON CACHE BOOL "Compile with PIC")
ENDIF()
SET(OLD_WITH_DEBUG 1 CACHE INTERNAL "" FORCE)
ELSEIF(NOT HAVE_CMAKE_BUILD_TYPE OR OLD_WITH_DEBUG)
IF(CUSTOM_C_FLAGS)
......@@ -110,18 +115,27 @@ ENDIF()
# Control aspects of the development environment which are
# specific to MySQL maintainers and developers.
#
INCLUDE (CheckCCompilerFlag)
OPTION(MYSQL_MAINTAINER_MODE "MySQL maintainer-specific development environment" OFF)
# Whether the maintainer mode should be enabled.
IF(MYSQL_MAINTAINER_MODE)
IF(CMAKE_COMPILER_IS_GNUCC)
CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement" HAVE_DECLARATION_AFTER_STATEMENT)
IF(HAVE_DECLARATION_AFTER_STATEMENT)
SET(MY_MAINTAINER_DECLARATION_AFTER_STATEMENT "-Wdeclaration-after-statement")
ENDIF()
SET(MY_MAINTAINER_C_WARNINGS
"-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror"
CACHE STRING "C warning options used in maintainer builds.")
"-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(MY_MAINTAINER_CXX_WARNINGS "${MY_MAINTAINER_C_WARNINGS} -Wno-unused-parameter"
CACHE STRING "C++ warning options used in maintainer builds.")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC)
SET(MY_MAINTAINER_C_WARNINGS
"${MY_MAINTAINER_C_WARNINGS} ${MY_MAINTAINER_DECLARATION_AFTER_STATEMENT}"
CACHE STRING "C warning options used in maintainer builds.")
ENDIF()
# Do not make warnings in checks into errors.
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error")
......
......@@ -1010,10 +1010,11 @@ static struct my_option my_long_options[] =
"row-based events; 'decode-rows' decodes row events into commented SQL "
"statements if the --verbose option is also given; 'auto' prints base64 "
"only when necessary (i.e., for row-based events and format description "
"events); 'always' prints base64 whenever possible. 'always' is for "
"debugging only and should not be used in a production system. If this "
"argument is not given, the default is 'auto'; if it is given with no "
"argument, 'always' is used.",
"events); 'always' prints base64 whenever possible. 'always' is "
"deprecated, will be removed in a future version, and should not be used "
"in a production system. --base64-output with no 'name' argument is "
"equivalent to --base64-output=always and is also deprecated. If no "
"--base64-output[=name] option is given at all, the default is 'auto'.",
&opt_base64_output_mode_str, &opt_base64_output_mode_str,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
/*
......@@ -2024,6 +2025,13 @@ int main(int argc, char** argv)
if (opt_base64_output_mode == BASE64_OUTPUT_UNSPEC)
opt_base64_output_mode= BASE64_OUTPUT_AUTO;
if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
warning("The --base64-output=always flag and the --base64-output flag "
"(with '=MODE' omitted), are deprecated. "
"The output generated when these flags are used cannot be "
"parsed by mysql 5.6.0 and later. "
"The flags will be removed in a future version. "
"Please use --base64-output=auto instead.");
my_set_max_open_files(open_files_limit);
......
......@@ -5398,8 +5398,13 @@ void do_connect(struct st_command *command)
opt_charsets_dir);
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
if (opt_use_ssl || con_ssl)
if (opt_use_ssl)
con_ssl= 1;
#endif
if (con_ssl)
{
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
mysql_ssl_set(&con_slot->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
#if MYSQL_VERSION_ID >= 50000
......@@ -5408,36 +5413,37 @@ void do_connect(struct st_command *command)
mysql_options(&con_slot->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
&opt_ssl_verify_server_cert);
#endif
}
#endif
}
#ifdef __WIN__
if (con_pipe)
{
#ifdef __WIN__
opt_protocol= MYSQL_PROTOCOL_PIPE;
}
#endif
}
if (opt_protocol)
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
#ifdef HAVE_SMEM
if (con_shm)
{
#ifdef HAVE_SMEM
uint protocol= MYSQL_PROTOCOL_MEMORY;
if (!ds_shm.length)
die("Missing shared memory base name");
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, ds_shm.str);
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
#endif
}
else if(shared_memory_base_name)
#ifdef HAVE_SMEM
else if (shared_memory_base_name)
{
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
shared_memory_base_name);
shared_memory_base_name);
}
#endif
/* Use default db name */
if (ds_database.length == 0)
dynstr_set(&ds_database, opt_db);
......@@ -5877,7 +5883,7 @@ int read_line(char *buf, int size)
/* Could be a multibyte character */
/* This code is based on the code in "sql_load.cc" */
#ifdef USE_MB
int charlen = my_mbcharlen(charset_info, c);
int charlen = my_mbcharlen(charset_info, (unsigned char) c);
/* We give up if multibyte character is started but not */
/* completed before we pass buf_end */
if ((charlen > 1) && (p + charlen) <= buf_end)
......@@ -5889,16 +5895,16 @@ int read_line(char *buf, int size)
for (i= 1; i < charlen; i++)
{
c= my_getc(cur_file->file);
if (feof(cur_file->file))
goto found_eof;
c= my_getc(cur_file->file);
*p++ = c;
}
if (! my_ismbchar(charset_info, mb_start, p))
{
/* It was not a multiline char, push back the characters */
/* We leave first 'c', i.e. pretend it was a normal char */
while (p > mb_start)
while (p-1 > mb_start)
my_ungetc(*--p);
}
}
......@@ -9959,6 +9965,7 @@ void free_pointer_array(POINTER_ARRAY *pa)
void replace_dynstr_append_mem(DYNAMIC_STRING *ds,
const char *val, int len)
{
char lower[512];
#ifdef __WIN__
fix_win_paths(val, len);
#endif
......@@ -9966,7 +9973,6 @@ void replace_dynstr_append_mem(DYNAMIC_STRING *ds,
if (display_result_lower)
{
/* Convert to lower case, and do this first */
char lower[512];
char *c= lower;
for (const char *v= val; *v; v++)
*c++= my_tolower(charset_info, *v);
......
......@@ -42,6 +42,9 @@ MACRO(GET_MYSQL_VERSION)
IF(NOT VERSION_STRING)
FILE(STRINGS configure.in str REGEX "AC_INIT\\(")
STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][a-zAZ0-9]+" VERSION_STRING "${str}")
IF(NOT VERSION_STRING)
STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}")
ENDIF()
ENDIF()
ENDIF()
ENDIF()
......
......@@ -33,7 +33,7 @@ ENDFOREACH()
# Ensure we have clean build for shared libraries
# without unresolved symbols
SET(LINK_FLAG_NO_UNDEFINED "--Wl,--no-undefined")
SET(LINK_FLAG_NO_UNDEFINED "-Wl,--no-undefined")
# 64 bit file offset support flag
SET(_FILE_OFFSET_BITS 64)
......
......@@ -1839,8 +1839,11 @@ rl_username_completion_function (text, state)
#else /* !__WIN32__ && !__OPENNT) */
static char *username = (char *)NULL;
static struct passwd *entry;
static int namelen, first_char, first_char_loc;
static int first_char, first_char_loc;
char *value;
#if defined (HAVE_GETPWENT)
static int namelen;
#endif
if (state == 0)
{
......@@ -1850,7 +1853,9 @@ rl_username_completion_function (text, state)
first_char_loc = first_char == '~';
username = savestring (&text[first_char_loc]);
#if defined (HAVE_GETPWENT)
namelen = strlen (username);
#endif
setpwent ();
}
......
......@@ -693,7 +693,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
case 's':
{
char *new_event;
int delimiter, failed, si, l_temp, ws, we;
int delimiter, failed, si, l_temp, we;
if (c == 's')
{
......@@ -792,7 +792,6 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
{
for (; temp[si] && whitespace (temp[si]); si++)
;
ws = si;
we = history_tokenize_word (temp, si);
}
......
......@@ -402,6 +402,7 @@ history_truncate_file (fname, lines)
if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
{
bytes_written= write (file, bp, chars_read - (bp - buffer));
(void) bytes_written;
#if defined (__BEOS__)
/* BeOS ignores O_TRUNC. */
......
......@@ -617,7 +617,7 @@ rl_search_history (direction, invoking_key)
int direction, invoking_key __attribute__((unused));
{
_rl_search_cxt *cxt; /* local for now, but saved globally */
int c, r;
int r;
RL_SETSTATE(RL_STATE_ISEARCH);
cxt = _rl_isearch_init (direction);
......@@ -632,7 +632,7 @@ rl_search_history (direction, invoking_key)
r = -1;
for (;;)
{
c = _rl_search_getchar (cxt);
_rl_search_getchar (cxt);
/* We might want to handle EOF here (c == 0) */
r = _rl_isearch_dispatch (cxt, cxt->lastc);
if (r <= 0)
......@@ -655,9 +655,9 @@ int
_rl_isearch_callback (cxt)
_rl_search_cxt *cxt;
{
int c, r;
int r;
c = _rl_search_getchar (cxt);
_rl_search_getchar (cxt);
/* We might want to handle EOF here */
r = _rl_isearch_dispatch (cxt, cxt->lastc);
......
......@@ -115,7 +115,7 @@ rl_insert_close (count, invoking_key)
else
{
#if defined (HAVE_SELECT)
int orig_point, match_point, ready;
int orig_point, match_point;
struct timeval timer;
fd_set readfds;
......@@ -136,7 +136,7 @@ rl_insert_close (count, invoking_key)
orig_point = rl_point;
rl_point = match_point;
(*rl_redisplay_function) ();
ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
rl_point = orig_point;
#else /* !HAVE_SELECT */
_rl_insert_char (count, invoking_key);
......
......@@ -447,11 +447,10 @@ readline_internal_char ()
readline_internal_charloop ()
#endif
{
static int lastc, eof_found;
static int lastc;
int c, code, lk;
lastc = -1;
eof_found = 0;
#if !defined (READLINE_CALLBACKS)
while (rl_done == 0)
......
......@@ -811,11 +811,10 @@ _rl_overwrite_char (count, c)
int i;
#if defined (HANDLE_MULTIBYTE)
char mbkey[MB_LEN_MAX];
int k;
/* Read an entire multibyte character sequence to insert COUNT times. */
if (count > 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0)
k = _rl_read_mbstring (c, mbkey, MB_LEN_MAX);
_rl_read_mbstring (c, mbkey, MB_LEN_MAX);
#endif
rl_begin_undo_group ();
......
......@@ -19,6 +19,7 @@ AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [
AS_IF([test "$GCC" = "yes"], [
C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror"
CXX_WARNINGS="${C_WARNINGS} -Wno-unused-parameter"
C_WARNINGS="${C_WARNINGS} -Wdeclaration-after-statement"
])
# Test whether the warning options work.
......
......@@ -27,7 +27,7 @@ dnl
dnl When changing the major version number please also check the switch
dnl statement in mysqlbinlog::check_master_version(). You may also need
dnl to update version.c in ndb.
AC_INIT([MySQL Server], [5.5.8-ga], [], [mysql])
AC_INIT([MySQL Server], [5.5.8], [], [mysql])
AC_CONFIG_SRCDIR([sql/mysqld.cc])
AC_CANONICAL_SYSTEM
......
......@@ -32,8 +32,15 @@
/* GNU C/C++ */
#if defined __GNUC__
/* Convenience macro to test the minimum required GCC version. */
# define MY_GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
/* Any after 2.95... */
# define MY_ALIGN_EXT
/* Comunicate to the compiler the unreachability of the code. */
# if MY_GNUC_PREREQ(4,5)
# define MY_ASSERT_UNREACHABLE() __builtin_unreachable()
# endif
/* Microsoft Visual C++ */
#elif defined _MSC_VER
......@@ -67,7 +74,7 @@
#endif
/**
Generic compiler-dependent features.
Generic (compiler-independent) features.
*/
#ifndef MY_ALIGNOF
# ifdef __cplusplus
......@@ -79,6 +86,10 @@
# endif
#endif
#ifndef MY_ASSERT_UNREACHABLE
# define MY_ASSERT_UNREACHABLE() do { assert(0); } while (0)
#endif
/**
C++ Type Traits
*/
......
......@@ -39,6 +39,13 @@ C_MODE_START
#define GET_ASK_ADDR 128
#define GET_TYPE_MASK 127
/**
Enumeration of the my_option::arg_type attributes.
It should be noted that for historical reasons variables with the combination
arg_type=NO_ARG, my_option::var_type=GET_BOOL still accepts
arguments. This is someone counter intuitive and care should be taken
if the code is refactored.
*/
enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
struct st_typelib;
......
......@@ -501,7 +501,8 @@ int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
uint line);
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
struct timespec *abstime, const char *file, uint line);
const struct timespec *abstime,
const char *file, uint line);
void safe_mutex_global_init(void);
void safe_mutex_end(FILE *file);
......
......@@ -90,8 +90,8 @@ typedef struct st_mysql_server_auth_info
int password_used;
/**
Set to the name of the connected client if it can be resolved, or to
the address otherwise
Set to the name of the connected client host, if it can be resolved,
or to its IP address otherwise.
*/
const char *host_or_ip;
......@@ -107,7 +107,7 @@ typedef struct st_mysql_server_auth_info
*/
struct st_mysql_auth
{
int interface_version; /**< version plugin uses */
int interface_version; /** version plugin uses */
/**
A plugin that a client must use for authentication with this server
plugin. Can be NULL to mean "any plugin".
......
......@@ -24,7 +24,6 @@ main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeou
rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again
rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically
rpl.rpl_innodb_bug28430* # Bug#46029
rpl.rpl_innodb_bug30888* @solaris # Bug#47646 2009-09-25 alik rpl.rpl_innodb_bug30888 fails sporadically on Solaris
rpl.rpl_killed_ddl @windows # Bug#47638 2010-01-20 alik The rpl_killed_ddl test fails on Windows
sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
......
......@@ -6,7 +6,7 @@ INSERT INTO t1 VALUES (1);
source include/show_binlog_events.inc;
eval $statement;
source include/show_binlog_events.inc;
if (`select '$cleanup' != ''`) {
if ($cleanup) {
eval $cleanup;
}
......@@ -22,7 +22,7 @@ INSERT INTO t1 VALUES (3);
source include/show_binlog_events.inc;
COMMIT;
source include/show_binlog_events.inc;
if (`select '$cleanup' != ''`) {
if ($cleanup) {
eval $cleanup;
}
......@@ -285,10 +285,10 @@ if (`SELECT $CRC_ARG_type = 7`) {
}
######## execute! ########
if (`SELECT '$CRC_RET_stmt_sidef' != ''`) {
if ($CRC_RET_stmt_sidef) {
--echo
--echo Invoking $CRC_RET_desc.
if (`SELECT '$CRC_create' != ''`) {
if ($CRC_create) {
--eval $CRC_create
}
......@@ -365,7 +365,7 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) {
# Invoke created object, discarding the return value. This should not
# give any warning.
if (`SELECT '$CRC_RET_sel_retval' != ''`) {
if ($CRC_RET_sel_retval) {
--echo * Invoke statement so that return value is dicarded: expect no warning.
--disable_result_log
--eval $CRC_RET_sel_retval
......
......@@ -34,7 +34,7 @@
#
connection slave;
if (`SELECT $debug_sync_action = ''`)
if (!$debug_sync_action)
{
--die Cannot continue. Please set value for debug_sync_action.
}
......
......@@ -25,7 +25,7 @@ CALL mtr.add_suppression("Unsafe statement written to the binary log using state
# MTR is not case-sensitive.
let $lower_stmt_head= load data;
let $UPPER_STMT_HEAD= LOAD DATA;
if (`SELECT '$lock_option' <> ''`)
if ($lock_option)
{
#if $lock_option is null, an extra blank is added into the statement,
#this will change the result of rpl_loaddata test case. so $lock_option
......
......@@ -35,10 +35,23 @@ connection master1;
send CALL test.p1();
connection master;
# To make sure tha the call on master1 arrived at the get_lock
sleep 1;
# Make sure that the call on master1 arrived at the get_lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = 'User lock' and
info = 'SELECT get_lock("test", 100)';
--source include/wait_condition.inc
CALL test.p2();
SELECT release_lock("test");
connection master1;
# Reap CALL test.p1() to ensure that it has fully completed
# before doing any selects on test.t1.
--reap
# Release lock acquired by it.
SELECT release_lock("test");
connection master;
SELECT * FROM test.t1;
#show binlog events;
--source include/wait_for_ndb_to_binlog.inc
......@@ -51,6 +64,7 @@ DROP TABLE IF EXISTS test.t1;
eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
CALL test.p2();
CALL test.p1();
SELECT release_lock("test");
SELECT * FROM test.t1;
sync_slave_with_master;
......
......@@ -23,7 +23,7 @@
# Reset DEBUG_SYNC facility for safety.
set debug_sync= "RESET";
if (`SELECT '$restore_table' <> ''`)
if ($restore_table)
{
--eval create temporary table t_backup select * from $restore_table;
}
......@@ -82,7 +82,7 @@ connection default;
--eval delete from $table where i = 0;
if (`SELECT '$restore_table' <> ''`)
if ($restore_table)
{
--eval truncate table $restore_table;
--eval insert into $restore_table select * from t_backup;
......
......@@ -23,7 +23,7 @@
# Reset DEBUG_SYNC facility for safety.
set debug_sync= "RESET";
if (`SELECT '$restore_table' <> ''`)
if ($restore_table)
{
--eval create temporary table t_backup select * from $restore_table;
}
......@@ -68,7 +68,7 @@ if (!$success)
--eval delete from $table where i = 0;
if (`SELECT '$restore_table' <> ''`)
if ($restore_table)
{
--eval truncate table $restore_table;
--eval insert into $restore_table select * from t_backup;
......
......@@ -10,12 +10,12 @@
# # at this point, get_relay_log_pos.inc sets $relay_log_pos. echo position
# # in $relay_log_file: $relay_log_pos.
if (`SELECT '$relay_log_file' = ''`)
if (!$relay_log_file)
{
--die 'variable $relay_log_file is null'
}
if (`SELECT '$master_log_pos' = ''`)
if (!$master_log_pos)
{
--die 'variable $master_log_pos is null'
}
......
--disable_query_log
--require r/true.require
select (PLUGIN_LIBRARY LIKE 'qa_auth_interface%') as `TRUE` FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME='qa_auth_interface';
--enable_query_log
--disable_query_log
--require r/true.require
select (PLUGIN_LIBRARY LIKE 'qa_auth_server%') as `TRUE` FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME='qa_auth_server';
--enable_query_log
......@@ -44,7 +44,7 @@ connection master;
# kill the query that is waiting
eval kill query $connection_id;
if (`SELECT '$debug_lock' != ''`)
if ($debug_lock)
{
# release the lock to allow binlog continue
eval SELECT RELEASE_LOCK($debug_lock);
......@@ -57,7 +57,7 @@ reap;
connection master;
if (`SELECT '$debug_lock' != ''`)
if ($debug_lock)
{
# get lock again to make the next query wait
eval SELECT GET_LOCK($debug_lock, 10);
......
......@@ -25,7 +25,7 @@ source include/kill_query.inc;
connection master;
disable_query_log;
disable_result_log;
if (`SELECT '$debug_lock' != ''`)
if ($debug_lock)
{
eval SELECT RELEASE_LOCK($debug_lock);
}
......@@ -36,8 +36,8 @@ source include/diff_master_slave.inc;
# Acquire the debug lock again if used
connection master;
disable_query_log; disable_result_log; if (`SELECT '$debug_lock' !=
''`) { eval SELECT GET_LOCK($debug_lock, 10); } enable_result_log;
enable_query_log;
disable_query_log; disable_result_log;
if ($debug_lock) { eval SELECT GET_LOCK($debug_lock, 10); }
enable_result_log; enable_query_log;
connection $connection_name;
......@@ -56,7 +56,7 @@ if (`SELECT "$_sql_running" = "Yes" OR "$_io_running" = "Yes"`) {
# Read server variables.
let $MYSQLD_DATADIR= `SELECT @@datadir`;
let $_fake_filename= query_get_value(SHOW VARIABLES LIKE 'relay_log', Value, 1);
if (`SELECT '$_fake_filename' = ''`) {
if (!$_fake_filename) {
--echo Badly written test case: relay_log variable is empty. Please use the
--echo server option --relay-log=FILE.
}
......
......@@ -18,13 +18,15 @@ if ($is_relay_log)
--let $_statement=show relaylog events
}
if (`SELECT '$binlog_file' <> ''`)
if ($binlog_file)
{
--let $_statement= $_statement in '$binlog_file'
}
--let $_statement= $_statement from $binlog_start
# Cannot use if($binlog_limit) since the variable may begin with a 0
if (`SELECT '$binlog_limit' <> ''`)
{
--let $_statement= $_statement limit $binlog_limit
......
......@@ -48,13 +48,13 @@ let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1);
eval SHOW BINLOG EVENTS IN '$binlog_name';
let $_master_con= $master_connection;
if (`SELECT '$_master_con' = ''`)
if (!$_master_con)
{
if (`SELECT '$_con' = 'slave'`)
{
let $_master_con= master;
}
if (`SELECT '$_master_con' = ''`)
if (!$_master_con)
{
--echo Unable to determine master connection. No debug info printed for master.
--echo Please fix the test case by setting $master_connection before sourcing
......@@ -62,7 +62,7 @@ if (`SELECT '$_master_con' = ''`)
}
}
if (`SELECT '$_master_con' != ''`)
if ($_master_con)
{
let $master_binlog_name_io= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1);
......
......@@ -31,7 +31,7 @@
# $master_connection
# See wait_for_slave_param.inc for description.
if (`SELECT '$slave_io_errno' = ''`) {
if (!$slave_io_errno) {
--die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc
}
......
......@@ -53,7 +53,7 @@ if (!$_slave_timeout_counter)
let $slave_tcnt= $_slave_timeout_counter;
let $_slave_param_comparison= $slave_param_comparison;
if (`SELECT '$_slave_param_comparison' = ''`)
if (!$_slave_param_comparison)
{
let $_slave_param_comparison= =;
}
......@@ -73,7 +73,7 @@ while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_
if (!$_slave_timeout_counter)
{
--echo **** ERROR: timeout after $slave_tcnt deci-seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value ****
if (`SELECT '$slave_error_message' != ''`)
if ($slave_error_message)
{
--echo Message: $slave_error_message
}
......
......@@ -24,7 +24,7 @@
# $master_connection
# See wait_for_slave_param.inc for description.
if (`SELECT '$slave_sql_errno' = ''`) {
if (!$slave_sql_errno) {
--die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc
}
......
......@@ -45,7 +45,7 @@ if (!$_status_timeout_counter)
}
let $_status_var_comparsion= $status_var_comparsion;
if (`SELECT '$_status_var_comparsion' = ''`)
if (!$_status_var_comparsion)
{
let $_status_var_comparsion= =;
}
......
......@@ -33,6 +33,13 @@ sub mtr_exe_maybe_exists(@);
sub mtr_milli_sleep($);
sub start_timer($);
sub has_expired($);
sub init_timers();
sub mark_time_used($);
sub add_total_times($);
sub print_times_used($$);
sub print_total_times($);
our $opt_report_times;
##############################################################################
#
......@@ -205,4 +212,81 @@ sub start_timer ($) { return time + $_[0]; }
sub has_expired ($) { return $_[0] && time gt $_[0]; }
# Below code is for time usage reporting
use Time::HiRes qw(gettimeofday);
my %time_used= (
'collect' => 0,
'restart' => 0,
'check' => 0,
'ch-warn' => 0,
'test' => 0,
'init' => 0,
);
my %time_text= (
'collect' => "Collecting test cases",
'restart' => "Server stop/start",
'check' => "Check-testcase",
'ch-warn' => "Check for warnings",
'test' => "Test execution",
'init' => "Initialization etc.",
);
# Counts number of reports from workers
my $time_totals= 0;
my $last_timer_set;
sub init_timers() {
$last_timer_set= gettimeofday();
}
sub mark_time_used($) {
my ($name)= @_;
return unless $opt_report_times;
die "Unknown timer $name" unless exists $time_used{$name};
my $curr_time= gettimeofday();
$time_used{$name}+= int (($curr_time - $last_timer_set) * 1000 + .5);
$last_timer_set= $curr_time;
}
sub add_total_times($) {
my ($dummy, $num, @line)= split (" ", $_[0]);
$time_totals++;
foreach my $elem (@line) {
my ($name, $spent)= split (":", $elem);
$time_used{$name}+= $spent;
}
}
sub print_times_used($$) {
my ($server, $num)= @_;
return unless $opt_report_times;
my $output= "SPENT $num";
foreach my $name (keys %time_used) {
my $spent= $time_used{$name};
$output.= " $name:$spent";
}
print $server $output . "\n";
}
sub print_total_times($) {
# Don't print if we haven't received all worker data
return if $time_totals != $_[0];
foreach my $name (keys %time_used)
{
my $spent= $time_used{$name}/1000;
my $text= $time_text{$name};
print ("Spent $spent seconds on $text\n");
}
}
1;
......@@ -116,18 +116,20 @@ sub sleep_until_file_created ($$$) {
return 1;
}
my $seconds= ($loop * $sleeptime) / 1000;
# Check if it died after the fork() was successful
if ( defined $proc and ! $proc->wait_one(0) )
{
mtr_warning("Process $proc died");
mtr_warning("Process $proc died after mysql-test-run waited $seconds " .
"seconds for $pidfile to be created.");
return 0;
}
mtr_debug("Sleep $sleeptime milliseconds waiting for $pidfile");
# Print extra message every 60 seconds
my $seconds= ($loop * $sleeptime) / 1000;
if ( $seconds > 1 and int($seconds * 10) % 600 == 0 )
if ( $seconds > 1 && int($seconds * 10) % 600 == 0 && $seconds < $timeout )
{
my $left= $timeout - $seconds;
mtr_warning("Waited $seconds seconds for $pidfile to be created, " .
......@@ -138,6 +140,8 @@ sub sleep_until_file_created ($$$) {
}
mtr_warning("Timeout after mysql-test-run waited $timeout seconds " .
"for the process $proc to create a pid file.");
return 0;
}
......
This diff is collapsed.
......@@ -21,7 +21,7 @@ ndb_binlog_index
plugin
proc
procs_priv
proxy_priv
proxies_priv
servers
slow_log
tables_priv
......
......@@ -15,7 +15,7 @@ ndb_binlog_index
plugin
proc
procs_priv
proxy_priv
proxies_priv
servers
slow_log
tables_priv
......@@ -49,7 +49,7 @@ ndb_binlog_index
plugin
proc
procs_priv
proxy_priv
proxies_priv
servers
slow_log
tables_priv
......@@ -91,7 +91,7 @@ ndb_binlog_index
plugin
proc
procs_priv
proxy_priv
proxies_priv
servers
slow_log
tables_priv
......
......@@ -1425,7 +1425,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varbinary(10) NOT NULL DEFAULT ''
`c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
......
......@@ -1507,7 +1507,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
`c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
......
......@@ -1835,7 +1835,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(10) NOT NULL DEFAULT ''
`c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
......
......@@ -2667,7 +2667,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
`c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
......
......@@ -3511,7 +3511,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
`c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
......
......@@ -134,3 +134,15 @@ INSERT INTO t1 VALUES ('abc\0\0');
INSERT INTO t1 VALUES ('abc\0\0');
ERROR 23000: Duplicate entry 'abc\x00\x00' for key 'PRIMARY'
DROP TABLE t1;
#
# Bug#57882: Item_func_conv_charset::val_str(String*):
# Assertion `fixed == 1' failed
#
SELECT (CONVERT('0' USING latin1) IN (CHAR(COT('v') USING utf8),''));
ERROR 22003: DOUBLE value is out of range in 'cot('v')'
SET NAMES utf8 COLLATE utf8_latvian_ci ;
SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null);
ERROR 22003: BIGINT value is out of range in '(-(73) * -(2465717823867977728))'
#
# End Bug#57882
#
......@@ -1315,6 +1315,20 @@ SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
1
1
DROP TABLE t1;
#
# Bug #52160: crash and inconsistent results when grouping
# by a function and column
#
CREATE TABLE t1(a CHAR(10) NOT NULL);
INSERT INTO t1 VALUES (''),('');
SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a);
COUNT(*)
2
Warnings:
Warning 1292 Truncated incorrect time value: ''
Warning 1292 Truncated incorrect time value: ''
Warning 1292 Truncated incorrect time value: ''
DROP TABLE t1;
End of 5.1 tests
#
# Bug#57039: constant subtime expression returns incorrect result.
......
......@@ -1448,8 +1448,6 @@ CREATE USER 'userbug33464'@'localhost';
GRANT CREATE ROUTINE ON dbbug33464.* TO 'userbug33464'@'localhost';
userbug33464@localhost dbbug33464
DROP PROCEDURE IF EXISTS sp3;
DROP FUNCTION IF EXISTS fn1;
CREATE PROCEDURE sp3(v1 char(20))
BEGIN
SELECT * from dbbug33464.t6 where t6.f2= 'xyz';
......
......@@ -88,7 +88,7 @@ host
plugin
proc
procs_priv
proxy_priv
proxies_priv
servers
slow_log
tables_priv
......@@ -1807,3 +1807,47 @@ USING (TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME)
WHERE COLUMNS.TABLE_SCHEMA = 'test'
AND COLUMNS.TABLE_NAME = 't1';
TABLE_SCHEMA TABLE_NAME COLUMN_NAME CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME TABLE_CATALOG ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
#
# A test case for Bug#56540 "Exception (crash) in sql_show.cc
# during rqg_info_schema test on Windows"
# Ensure that we never access memory of a closed table,
# in particular, never access table->field[] array.
# Before the fix, the below test case, produced
# valgrind errors.
#
drop table if exists t1;
drop view if exists v1;
create table t1 (a int, b int);
create view v1 as select t1.a, t1.b from t1;
alter table t1 change b c int;
lock table t1 read;
# --> connection con1
flush tables;
# --> connection default
select * from information_schema.views;
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME v1
VIEW_DEFINITION select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
CHECK_OPTION NONE
IS_UPDATABLE
DEFINER root@localhost
SECURITY_TYPE DEFINER
CHARACTER_SET_CLIENT latin1
COLLATION_CONNECTION latin1_swedish_ci
Warnings:
Level Warning
Code 1356
Message View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
unlock tables;
#
# Cleanup.
#
# --> connection con1
# Reaping 'flush tables'
# --> connection default
drop table t1;
drop view v1;
#
# End of 5.5 tests
#
......@@ -45,3 +45,227 @@ p1
max=1
drop procedure p1;
drop table t1;
CREATE TABLE slow (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
INSERT INTO slow(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
INSERT INTO slow(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
INSERT INTO slow(slow, general) VALUES (1,2), (5,6);
INSERT INTO slow(slow) VALUES (1), (5);
SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM slow ORDER BY slow;
slow general master_heartbeat_period ignore_server_ids
1 2 3 4
1 2 3 NULL
1 2 NULL NULL
1 NULL NULL NULL
5 6 7 8
5 6 7 NULL
5 6 NULL NULL
5 NULL NULL NULL
SELECT slow, general, master_heartbeat_period FROM slow ORDER BY slow;
slow general master_heartbeat_period
1 2 3
1 2 3
1 2 NULL
1 NULL NULL
5 6 7
5 6 7
5 6 NULL
5 NULL NULL
SELECT slow, master_heartbeat_period FROM slow ORDER BY slow;
slow master_heartbeat_period
1 3
1 3
1 NULL
1 NULL
5 7
5 7
5 NULL
5 NULL
SELECT slow FROM slow ORDER BY slow;
slow
1
1
1
1
5
5
5
5
DROP TABLE slow;
CREATE TABLE general (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
INSERT INTO general(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
INSERT INTO general(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
INSERT INTO general(slow, general) VALUES (1,2), (5,6);
INSERT INTO general(slow) VALUES (1), (5);
SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM general ORDER BY slow;
slow general master_heartbeat_period ignore_server_ids
1 2 3 4
1 2 3 NULL
1 2 NULL NULL
1 NULL NULL NULL
5 6 7 8
5 6 7 NULL
5 6 NULL NULL
5 NULL NULL NULL
SELECT slow, general, master_heartbeat_period FROM general ORDER BY slow;
slow general master_heartbeat_period
1 2 3
1 2 3
1 2 NULL
1 NULL NULL
5 6 7
5 6 7
5 6 NULL
5 NULL NULL
SELECT slow, master_heartbeat_period FROM general ORDER BY slow;
slow master_heartbeat_period
1 3
1 3
1 NULL
1 NULL
5 7
5 7
5 NULL
5 NULL
SELECT slow FROM general ORDER BY slow;
slow
1
1
1
1
5
5
5
5
DROP TABLE general;
CREATE TABLE master_heartbeat_period (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
INSERT INTO master_heartbeat_period(slow, general) VALUES (1,2), (5,6);
INSERT INTO master_heartbeat_period(slow) VALUES (1), (5);
SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM master_heartbeat_period ORDER BY slow;
slow general master_heartbeat_period ignore_server_ids
1 2 3 4
1 2 3 NULL
1 2 NULL NULL
1 NULL NULL NULL
5 6 7 8
5 6 7 NULL
5 6 NULL NULL
5 NULL NULL NULL
SELECT slow, general, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow;
slow general master_heartbeat_period
1 2 3
1 2 3
1 2 NULL
1 NULL NULL
5 6 7
5 6 7
5 6 NULL
5 NULL NULL
SELECT slow, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow;
slow master_heartbeat_period
1 3
1 3
1 NULL
1 NULL
5 7
5 7
5 NULL
5 NULL
SELECT slow FROM master_heartbeat_period ORDER BY slow;
slow
1
1
1
1
5
5
5
5
DROP TABLE master_heartbeat_period;
CREATE TABLE ignore_server_ids (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
INSERT INTO ignore_server_ids(slow, general) VALUES (1,2), (5,6);
INSERT INTO ignore_server_ids(slow) VALUES (1), (5);
SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM ignore_server_ids ORDER BY slow;
slow general master_heartbeat_period ignore_server_ids
1 2 3 4
1 2 3 NULL
1 2 NULL NULL
1 NULL NULL NULL
5 6 7 8
5 6 7 NULL
5 6 NULL NULL
5 NULL NULL NULL
SELECT slow, general, master_heartbeat_period FROM ignore_server_ids ORDER BY slow;
slow general master_heartbeat_period
1 2 3
1 2 3
1 2 NULL
1 NULL NULL
5 6 7
5 6 7
5 6 NULL
5 NULL NULL
SELECT slow, master_heartbeat_period FROM ignore_server_ids ORDER BY slow;
slow master_heartbeat_period
1 3
1 3
1 NULL
1 NULL
5 7
5 7
5 NULL
5 NULL
SELECT slow FROM ignore_server_ids ORDER BY slow;
slow
1
1
1
1
5
5
5
5
DROP TABLE ignore_server_ids;
CREATE TABLE t1 (slow INT, general INT, ignore_server_ids INT, master_heartbeat_period INT);
INSERT INTO t1 VALUES (1,2,3,4);
CREATE PROCEDURE p1()
BEGIN
DECLARE slow INT;
DECLARE general INT;
DECLARE ignore_server_ids INT;
DECLARE master_heartbeat_period INT;
SELECT max(t1.slow) INTO slow FROM t1;
SELECT max(t1.general) INTO general FROM t1;
SELECT max(t1.ignore_server_ids) INTO ignore_server_ids FROM t1;
SELECT max(t1.master_heartbeat_period) INTO master_heartbeat_period FROM t1;
SELECT slow, general, ignore_server_ids, master_heartbeat_period;
END|
CREATE PROCEDURE p2()
BEGIN
DECLARE n INT DEFAULT 2;
general: WHILE n > 0 DO
SET n = n -1;
END WHILE general;
SET n = 2;
slow: WHILE n > 0 DO
SET n = n -1;
END WHILE slow;
SET n = 2;
ignore_server_ids: WHILE n > 0 DO
SET n = n -1;
END WHILE ignore_server_ids;
SET n = 2;
master_heartbeat_period: WHILE n > 0 DO
SET n = n -1;
END WHILE master_heartbeat_period;
END|
CALL p1();
slow general ignore_server_ids master_heartbeat_period
1 2 3 4
call p2();
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP TABLE t1;
......@@ -704,3 +704,37 @@ SET DEBUG_SYNC="now SIGNAL query";
# Connection default
DROP EVENT e2;
SET DEBUG_SYNC="RESET";
#
# Bug#55930 Assertion `thd->transaction.stmt.is_empty() ||
# thd->in_sub_stmt || (thd->state..
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT) engine=InnoDB;
INSERT INTO t1 VALUES (1), (2);
# Connection con1
SET SESSION lock_wait_timeout= 1;
SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL opti_recreate WAIT_FOR opti_analyze';
# Sending:
OPTIMIZE TABLE t1;
# Connection con2
SET DEBUG_SYNC= 'now WAIT_FOR opti_recreate';
SET DEBUG_SYNC= 'after_lock_tables_takes_lock SIGNAL thrlock WAIT_FOR release_thrlock';
# Sending:
INSERT INTO t1 VALUES (3);
# Connection default
SET DEBUG_SYNC= 'now WAIT_FOR thrlock';
SET DEBUG_SYNC= 'now SIGNAL opti_analyze';
# Connection con1
# Reaping: OPTIMIZE TABLE t1
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize error Lock wait timeout exceeded; try restarting transaction
test.t1 optimize status Operation failed
Warnings:
Error 1205 Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC= 'now SIGNAL release_thrlock';
# Connection con2
# Reaping: INSERT INTO t1 VALUES (3)
# Connection default
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
......@@ -27,7 +27,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxy_priv OK
mysql.proxies_priv OK
mysql.renamed_general_log OK
mysql.servers OK
mysql.slow_log OK
......
......@@ -15,7 +15,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxy_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
......@@ -44,7 +44,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxy_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
......@@ -73,7 +73,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxy_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
......@@ -104,7 +104,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxy_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
......@@ -139,7 +139,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxy_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
......@@ -177,7 +177,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxy_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
......
......@@ -17,7 +17,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxy_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
......
......@@ -879,3 +879,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
End of 5.0 tests
End of 5.1 tests
# Expect deprecation warning.
WARNING: The --base64-output=always flag and the --base64-output flag (with '=MODE' omitted), are deprecated. The output generated when these flags are used cannot be parsed by mysql 5.6.0 and later. The flags will be removed in a future version. Please use --base64-output=auto instead.
# Expect deprecation warning again.
WARNING: The --base64-output=always flag and the --base64-output flag (with '=MODE' omitted), are deprecated. The output generated when these flags are used cannot be parsed by mysql 5.6.0 and later. The flags will be removed in a future version. Please use --base64-output=auto instead.
......@@ -18,7 +18,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxy_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log
note : The storage engine for the table doesn't support analyze
......@@ -46,7 +46,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxy_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log
note : The storage engine for the table doesn't support optimize
......@@ -72,7 +72,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxy_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log
note : The storage engine for the table doesn't support analyze
......@@ -98,7 +98,7 @@ mysql.ndb_binlog_index Table is already up to date
mysql.plugin Table is already up to date
mysql.proc Table is already up to date
mysql.procs_priv Table is already up to date
mysql.proxy_priv Table is already up to date
mysql.proxies_priv Table is already up to date
mysql.servers Table is already up to date
mysql.slow_log
note : The storage engine for the table doesn't support optimize
......
......@@ -19,6 +19,7 @@ The following options may be given as the first argument:
--auto-increment-offset[=#]
Offset added to Auto-increment columns. Used when
auto-increment-increment != 1
--autocommit Set default value for autocommit (0 or 1)
--automatic-sp-privileges
Creating and dropping stored procedures alters ACLs
(Defaults to on; use --skip-automatic-sp-privileges to disable.)
......
......@@ -19,6 +19,7 @@ The following options may be given as the first argument:
--auto-increment-offset[=#]
Offset added to Auto-increment columns. Used when
auto-increment-increment != 1
--autocommit Set default value for autocommit (0 or 1)
--automatic-sp-privileges
Creating and dropping stored procedures alters ACLs
(Defaults to on; use --skip-automatic-sp-privileges to disable.)
......
......@@ -11,6 +11,26 @@ test_plugin_server plug_dest
## test plugin auth
ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES)
GRANT PROXY ON plug_dest TO plug;
test proxies_priv columns
SELECT * FROM mysql.proxies_priv;
Host User Proxied_host Proxied_user With_grant Grantor Timestamp
xx root 1 xx
xx root 1 xx
xx plug % plug_dest 0 root@localhost xx
test mysql.proxies_priv;
SHOW CREATE TABLE mysql.proxies_priv;
Table Create Table
proxies_priv CREATE TABLE `proxies_priv` (
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proxied_host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proxied_user` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
`With_grant` tinyint(1) NOT NULL DEFAULT '0',
`Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`),
KEY `Grantor` (`Grantor`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User proxy privileges'
select USER(),CURRENT_USER();
USER() CURRENT_USER()
plug@localhost plug_dest@%
......@@ -146,8 +166,8 @@ Grants for test_drop@localhost
GRANT USAGE ON *.* TO 'test_drop'@'localhost'
GRANT PROXY ON 'future_user'@'%' TO 'test_drop'@'localhost'
DROP USER test_drop@localhost;
SELECT * FROM mysql.proxy_priv WHERE Host = 'test_drop' AND User = 'localhost';
Host User Proxied_Host Proxied_User With_Grant
SELECT * FROM mysql.proxies_priv WHERE Host = 'test_drop' AND User = 'localhost';
Host User Proxied_host Proxied_user With_grant Grantor Timestamp
DROP USER proxy_admin;
DROP USER grant_plug,grant_plug_dest,grant_plug_dest2;
## END GRANT PROXY tests
......
This diff is collapsed.
This diff is collapsed.
CREATE DATABASE test_user_db;
========== test 1.1.3.2 ====================================
=== check contens of components of info ====================
CREATE USER qa_test_1_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_1_dest';
CREATE USER qa_test_1_dest IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_1_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_1_dest TO qa_test_1_user;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
user plugin authentication_string
qa_test_1_dest
qa_test_1_user qa_auth_interface qa_test_1_dest
SELECT @@proxy_user;
@@proxy_user
NULL
SELECT @@external_user;
@@external_user
NULL
exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user
qa_test_1_user@% qa_test_1_user@localhost NULL NULL
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
user plugin authentication_string
qa_test_1_dest
qa_test_1_user qa_auth_interface qa_test_1_dest
DROP USER qa_test_1_user;
DROP USER qa_test_1_dest;
=== Assign values to components of info ====================
CREATE USER qa_test_2_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_2_dest';
CREATE USER qa_test_2_dest IDENTIFIED BY 'dest_passwd';
CREATE USER authenticated_as IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_2_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_2_dest TO qa_test_2_user;
GRANT PROXY ON authenticated_as TO qa_test_2_user;
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
user plugin authentication_string
authenticated_as
qa_test_2_dest
qa_test_2_user qa_auth_interface qa_test_2_dest
SELECT @@proxy_user;
@@proxy_user
NULL
SELECT @@external_user;
@@external_user
NULL
exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user
authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' 'qa_test_2_user'@'%'
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
user plugin authentication_string
authenticated_as
qa_test_2_dest
qa_test_2_user qa_auth_interface qa_test_2_dest
DROP USER qa_test_2_user;
DROP USER qa_test_2_dest;
DROP USER authenticated_as;
=== Assign too high values for *length, which should have no effect ====
CREATE USER qa_test_3_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_3_dest';
CREATE USER qa_test_3_dest IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_3_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_3_dest TO qa_test_3_user;
exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user
qa_test_3_dest@% qa_test_3_user@localhost 'qa_test_3_user'@'%' 'qa_test_3_user'@'%'
DROP USER qa_test_3_user;
DROP USER qa_test_3_dest;
=== Assign too low values for *length, which should have no effect ====
CREATE USER qa_test_4_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_4_dest';
CREATE USER qa_test_4_dest IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_4_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_4_dest TO qa_test_4_user;
exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user
qa_test_4_dest@% qa_test_4_user@localhost 'qa_test_4_user'@'%' 'qa_test_4_user'@'%'
DROP USER qa_test_4_user;
DROP USER qa_test_4_dest;
=== Assign empty string especially to authenticated_as (in plugin) ====
CREATE USER qa_test_5_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_5_dest';
CREATE USER qa_test_5_dest IDENTIFIED BY 'dest_passwd';
CREATE USER ''@'localhost' IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_5_dest identified by 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'localhost' identified by 'dest_passwd';
GRANT PROXY ON qa_test_5_dest TO qa_test_5_user;
GRANT PROXY ON qa_test_5_dest TO ''@'localhost';
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
user plugin authentication_string password
*DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_5_dest *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_5_user qa_auth_interface qa_test_5_dest
exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'qa_test_5_user'@'localhost' (using password: YES)
DROP USER qa_test_5_user;
DROP USER qa_test_5_dest;
DROP USER ''@'localhost';
=== Assign 'root' especially to authenticated_as (in plugin) ====
CREATE USER qa_test_6_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
CREATE USER qa_test_6_dest IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_6_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_6_dest TO qa_test_6_user;
SELECT user,plugin,authentication_string,password FROM mysql.user;
user plugin authentication_string password
qa_test_6_dest *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_6_user qa_auth_interface qa_test_6_dest
root
root
root
root
exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'qa_test_6_user'@'localhost' (using password: YES)
GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
SELECT user,plugin,authentication_string,password FROM mysql.user;
user plugin authentication_string password
qa_test_6_dest *DFCACE76914AD7BD801FC1A1ECF6562272621A22
qa_test_6_user qa_auth_interface qa_test_6_dest
root
root
root
root
root qa_auth_interface qa_test_6_dest
exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
REVOKE PROXY ON qa_test_6_dest FROM root;
SELECT user,plugin,authentication_string FROM mysql.user;
user plugin authentication_string
qa_test_6_dest
qa_test_6_user qa_auth_interface qa_test_6_dest
root
root
root
root
root qa_auth_interface qa_test_6_dest
exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
DROP USER qa_test_6_user;
DROP USER qa_test_6_dest;
DELETE FROM mysql.user WHERE user='root' AND plugin='qa_auth_interface';
SELECT user,plugin,authentication_string,password FROM mysql.user;
user plugin authentication_string password
root
root
root
root
=== Test of the --default_auth option for clients ====
CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_11_dest';
CREATE USER qa_test_11_dest IDENTIFIED BY 'dest_passwd';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'qa_test_11_user'@'localhost' (using password: YES)
DROP USER qa_test_11_user, qa_test_11_dest;
DROP DATABASE test_user_db;
CREATE DATABASE test_user_db;
CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_server AS 'qa_test_11_dest';
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user
qa_test_11_dest@% qa_test_11_user@localhost 'qa_test_11_user'@'%' 'qa_test_11_user'@'%'
exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'qa_test_2_user'@'localhost' (using password: NO)
DROP USER qa_test_11_user, qa_test_11_dest;
DROP DATABASE test_user_db;
......@@ -3005,6 +3005,44 @@ EXECUTE stmt;
1
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
#
# Bug#54494 crash with explain extended and prepared statements
#
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1),(2);
PREPARE stmt FROM 'EXPLAIN EXTENDED SELECT 1 FROM t1 RIGHT JOIN t1 t2 ON 1';
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select 1 AS `1` from `test`.`t1` `t2` left join `test`.`t1` on(1) where 1
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select 1 AS `1` from `test`.`t1` `t2` left join `test`.`t1` on(1) where 1
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
#
# Bug#54488 crash when using explain and prepared statements with subqueries
#
CREATE TABLE t1(f1 INT);
INSERT INTO t1 VALUES (1),(1);
PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 WHERE (SELECT (SELECT 1 FROM t1 GROUP BY f1))';
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
End of 5.1 tests.
......
......@@ -1379,9 +1379,6 @@ MESSAGE_TEXT = msg,
MYSQL_ERRNO = 1012;
end $$
insert into t1 values (1), (2) $$
Warnings:
Warning 1012 This trigger SIGNAL a warning, a=1
Warning 1012 This trigger SIGNAL a warning, a=2
drop trigger t1_ai $$
create trigger t1_ai after insert on t1 for each row
begin
......@@ -1416,11 +1413,7 @@ MESSAGE_TEXT = NEW.msg,
MYSQL_ERRNO = NEW.errno;
end $$
insert into t1 set errno=1012, msg='Warning message 1 in trigger' $$
Warnings:
Warning 1012 Warning message 1 in trigger
insert into t1 set errno=1013, msg='Warning message 2 in trigger' $$
Warnings:
Warning 1013 Warning message 2 in trigger
drop table t1 $$
drop table if exists t1 $$
drop procedure if exists p1 $$
......
......@@ -1877,9 +1877,6 @@ DROP PROCEDURE p1;
#
# Bug#5889: Exit handler for a warning doesn't hide the warning in trigger
#
# - Case 1
CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 VALUES (1, 2);
CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
......@@ -1889,40 +1886,13 @@ SET NEW.a = 10;
SET NEW.a = 99999999999;
END|
UPDATE t1 SET b = 20;
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
SHOW WARNINGS;
Level Code Message
Warning 1264 Out of range value for column 'a' at row 1
SELECT * FROM t1;
a b
10 20
DROP TRIGGER t1_bu;
DROP TABLE t1;
# - Case 2
CREATE TABLE t1(a INT);
CREATE TABLE t2(b CHAR(1));
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
INSERT INTO t2 VALUES('ab'); # Produces a warning.
INSERT INTO t2 VALUES('b'); # Does not produce a warning,
# previous warning should be cleared.
END|
INSERT INTO t1 VALUES(0);
SHOW WARNINGS;
Level Code Message
SELECT * FROM t1;
a
0
SELECT * FROM t2;
b
a
b
DROP TRIGGER t1_bi;
DROP TABLE t1;
DROP TABLE t2;
#
# Bug#9857: Stored procedures: handler for sqlwarning ignored
#
......@@ -1961,3 +1931,64 @@ Warning 1365 Division by 0
DROP PROCEDURE p1;
DROP PROCEDURE p2;
SET sql_mode = @sql_mode_saved;
#
# Bug#55850: Trigger warnings not cleared.
#
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP PROCEDURE IF EXISTS p1;
CREATE TABLE t1(x SMALLINT, y SMALLINT, z SMALLINT);
CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT,
d SMALLINT, e SMALLINT, f SMALLINT);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
INSERT INTO t2(a, b, c) VALUES(99999, 99999, 99999);
CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
INSERT INTO t2(d, e, f) VALUES(99999, 99999, 99999);
CREATE PROCEDURE p1()
INSERT INTO t1 VALUES(99999, 99999, 99999);
CALL p1();
Warnings:
Warning 1264 Out of range value for column 'x' at row 1
Warning 1264 Out of range value for column 'y' at row 1
Warning 1264 Out of range value for column 'z' at row 1
SHOW WARNINGS;
Level Code Message
Warning 1264 Out of range value for column 'x' at row 1
Warning 1264 Out of range value for column 'y' at row 1
Warning 1264 Out of range value for column 'z' at row 1
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
# ----------------------------------------------------------------------
CREATE TABLE t1(x SMALLINT, y SMALLINT, z SMALLINT);
CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT NOT NULL);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
INSERT INTO t2 VALUES(
CAST('111111 ' AS SIGNED),
CAST('222222 ' AS SIGNED),
NULL);
END|
CREATE PROCEDURE p1()
INSERT INTO t1 VALUES(99999, 99999, 99999);
CALL p1();
ERROR 23000: Column 'c' cannot be null
SHOW WARNINGS;
Level Code Message
Warning 1264 Out of range value for column 'x' at row 1
Warning 1264 Out of range value for column 'y' at row 1
Warning 1264 Out of range value for column 'z' at row 1
Warning 1292 Truncated incorrect INTEGER value: '111111 '
Warning 1264 Out of range value for column 'a' at row 1
Warning 1292 Truncated incorrect INTEGER value: '222222 '
Warning 1264 Out of range value for column 'b' at row 1
Error 1048 Column 'c' cannot be null
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
......@@ -44,7 +44,7 @@ ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1'
create procedure db1_secret.dummy() begin end;
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
drop procedure db1_secret.dummy;
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.dummy'
drop procedure db1_secret.stamp;
ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.stamp'
drop function db1_secret.db;
......@@ -58,7 +58,7 @@ ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1'
create procedure db1_secret.dummy() begin end;
ERROR 42000: Access denied for user ''@'%' to database 'db1_secret'
drop procedure db1_secret.dummy;
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.dummy'
drop procedure db1_secret.stamp;
ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.stamp'
drop function db1_secret.db;
......@@ -567,3 +567,28 @@ DROP USER 'tester';
DROP USER 'Tester';
DROP DATABASE B48872;
End of 5.0 tests.
#
# Test for bug#57061 "User without privilege on routine can discover
# its existence."
#
drop database if exists mysqltest_db;
create database mysqltest_db;
# Create user with no privileges on mysqltest_db database.
create user bug57061_user@localhost;
create function mysqltest_db.f1() returns int return 0;
create procedure mysqltest_db.p1() begin end;
# Connect as user 'bug57061_user@localhost'
# Attempt to drop routine on which user doesn't have privileges
# should result in the same 'access denied' type of error whether
# routine exists or not.
drop function if exists mysqltest_db.f_does_not_exist;
ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.f_does_not_exist'
drop procedure if exists mysqltest_db.p_does_not_exist;
ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.p_does_not_exist'
drop function if exists mysqltest_db.f1;
ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.f1'
drop procedure if exists mysqltest_db.p1;
ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.p1'
# Connection 'default'.
drop user bug57061_user@localhost;
drop database mysqltest_db;
......@@ -14,7 +14,7 @@ ndb_binlog_index
plugin
proc
procs_priv
proxy_priv
proxies_priv
servers
slow_log
tables_priv
......
......@@ -1072,8 +1072,6 @@ SELECT @x;
NULL
SET @x=2;
UPDATE t1 SET i1 = @x;
Warnings:
Warning 1365 Division by 0
SELECT @x;
@x
NULL
......@@ -1085,9 +1083,6 @@ SELECT @x;
NULL
SET @x=4;
UPDATE t1 SET i1 = @x;
Warnings:
Warning 1365 Division by 0
Warning 1365 Division by 0
SELECT @x;
@x
NULL
......@@ -1198,8 +1193,6 @@ Warnings:
Warning 1365 Division by 0
create trigger t1_bi before insert on t1 for each row set @a:=1/0|
insert into t1 values(20, 20)|
Warnings:
Warning 1365 Division by 0
drop trigger t1_bi|
create trigger t1_bi before insert on t1 for each row
begin
......@@ -1218,8 +1211,6 @@ set @a:=1/0;
end|
set @check=0, @t4_bi_called=0, @t4_bu_called=0|
insert into t1 values(30, 30)|
Warnings:
Warning 1365 Division by 0
select @check, @t4_bi_called, @t4_bu_called|
@check @t4_bi_called @t4_bu_called
2 1 1
......@@ -2090,12 +2081,8 @@ SELECT 1 FROM t1 c WHERE
END//
SET @bug51650 = 1;
INSERT IGNORE INTO t2 VALUES();
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
INSERT IGNORE INTO t1 SET b = '777';
INSERT IGNORE INTO t2 SET a = '111';
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
SET @bug51650 = 1;
INSERT IGNORE INTO t2 SET a = '777';
DROP TRIGGER trg1;
......@@ -2177,8 +2164,6 @@ SELECT 'ab' INTO a;
SELECT 'a' INTO a;
END|
INSERT INTO t1 VALUES (1);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
DROP TRIGGER trg1;
DROP TABLE t1;
DROP TRIGGER IF EXISTS trg1;
......@@ -2196,20 +2181,12 @@ DECLARE trg2 CHAR;
SELECT 'ab' INTO trg2;
END|
INSERT INTO t1 VALUES (0);
Warnings:
Warning 1265 Data truncated for column 'trg1' at row 1
Warning 1265 Data truncated for column 'trg2' at row 1
SELECT * FROM t1;
a
0
SHOW WARNINGS;
Level Code Message
INSERT INTO t1 VALUES (1),(2);
Warnings:
Warning 1265 Data truncated for column 'trg1' at row 1
Warning 1265 Data truncated for column 'trg2' at row 1
Warning 1265 Data truncated for column 'trg1' at row 1
Warning 1265 Data truncated for column 'trg2' at row 1
DROP TRIGGER trg1;
DROP TRIGGER trg2;
DROP TABLE t1;
......
......@@ -975,4 +975,14 @@ SELECT LENGTH(c) FROM t2;
LENGTH(c)
65535
DROP TABLE t1, t2;
# Bug #52160: crash and inconsistent results when grouping
# by a function and column
CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1;
CREATE TABLE t1(a CHAR(1));
INSERT INTO t1 VALUES ('0'), ('0');
SELECT COUNT(*) FROM t1 GROUP BY f1(), a;
COUNT(*)
2
DROP FUNCTION f1;
DROP TABLE t1;
End of 5.1 tests
......@@ -321,7 +321,7 @@ while (`SELECT $unsafe_type < 9`) {
--source extra/rpl_tests/create_recursive_construct.inc
# Drop created object.
if (`SELECT '$drop_3' != ''`) {
if ($drop_3) {
--eval $drop_3
}
--inc $call_type_3
......@@ -330,7 +330,7 @@ while (`SELECT $unsafe_type < 9`) {
} # if (!is_toplevel_2)
# Drop created object.
if (`SELECT '$drop_2' != ''`) {
if ($drop_2) {
--eval $drop_2
}
--inc $call_type_2
......@@ -338,7 +338,7 @@ while (`SELECT $unsafe_type < 9`) {
} # if (!is_toplevel_1)
# Drop created object.
if (`SELECT '$drop_1' != ''`) {
if ($drop_1) {
--eval $drop_1
}
--inc $call_type_1
......
......@@ -9,6 +9,5 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
binlog_truncate_innodb : BUG#42643 2009-02-06 mats Changes to InnoDB requires to complete fix for BUG#36763
binlog_truncate_innodb : BUG#57291 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed
binlog_spurious_ddl_errors : BUG#54195 2010-06-03 alik binlog_spurious_ddl_errors.test fails, thus disabled
......@@ -110,10 +110,10 @@ Ensure that root always has the GRANT CREATE ROUTINE privilege.
--------------------------------------------------------------------------------
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
DROP PROCEDURE IF EXISTS db_storedproc_1.sp3;
DROP FUNCTION IF EXISTS db_storedproc_1.fn1;
user_1@localhost db_storedproc_1
DROP PROCEDURE IF EXISTS sp3;
DROP FUNCTION IF EXISTS fn1;
CREATE PROCEDURE sp3(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
......
......@@ -353,8 +353,6 @@ B Test 3.5.8.5-case 00191 0000000016 C=one
C Test 3.5.8.5-case 00200 0000000001 C=one
Insert into tb3 (f120, f122, f136)
values ('d', 'Test 3.5.8.5-case', 152);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
......@@ -364,8 +362,6 @@ B Test 3.5.8.5-case 00191 0000000016 1*0000099999
C Test 3.5.8.5-case 00200 0000000001 1*0000099999
Insert into tb3 (f120, f122, f136, f144)
values ('e', 'Test 3.5.8.5-case', 200, 8);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
......
......@@ -134,11 +134,13 @@ def mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL utf8 utf8_general_
def mysql procs_priv Routine_type 5 NULL NO enum 9 27 NULL NULL utf8 utf8_bin enum('FUNCTION','PROCEDURE') PRI select,insert,update,references
def mysql procs_priv Timestamp 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
def mysql procs_priv User 3 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
def mysql proxy_priv Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
def mysql proxy_priv Proxied_Host 3 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
def mysql proxy_priv Proxied_User 4 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
def mysql proxy_priv User 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
def mysql proxy_priv With_Grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL tinyint(1) select,insert,update,references
def mysql proxies_priv Grantor 6 NO char 77 231 NULL NULL utf8 utf8_bin char(77) MUL select,insert,update,references
def mysql proxies_priv Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
def mysql proxies_priv Proxied_host 3 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
def mysql proxies_priv Proxied_user 4 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
def mysql proxies_priv Timestamp 7 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
def mysql proxies_priv User 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
def mysql proxies_priv With_grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL tinyint(1) select,insert,update,references
def mysql servers Db 3 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references
def mysql servers Host 2 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references
def mysql servers Owner 9 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references
......@@ -425,11 +427,13 @@ NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp
3.0000 mysql procs_priv Grantor char 77 231 utf8 utf8_bin char(77)
3.0000 mysql procs_priv Proc_priv set 27 81 utf8 utf8_general_ci set('Execute','Alter Routine','Grant')
NULL mysql procs_priv Timestamp timestamp NULL NULL NULL NULL timestamp
3.0000 mysql proxy_priv Host char 60 180 utf8 utf8_bin char(60)
3.0000 mysql proxy_priv User char 16 48 utf8 utf8_bin char(16)
3.0000 mysql proxy_priv Proxied_Host char 16 48 utf8 utf8_bin char(16)
3.0000 mysql proxy_priv Proxied_User char 60 180 utf8 utf8_bin char(60)
NULL mysql proxy_priv With_Grant tinyint NULL NULL NULL NULL tinyint(1)
3.0000 mysql proxies_priv Host char 60 180 utf8 utf8_bin char(60)
3.0000 mysql proxies_priv User char 16 48 utf8 utf8_bin char(16)
3.0000 mysql proxies_priv Proxied_host char 60 180 utf8 utf8_bin char(60)
3.0000 mysql proxies_priv Proxied_user char 16 48 utf8 utf8_bin char(16)
NULL mysql proxies_priv With_grant tinyint NULL NULL NULL NULL tinyint(1)
3.0000 mysql proxies_priv Grantor char 77 231 utf8 utf8_bin char(77)
NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp
3.0000 mysql servers Server_name char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Host char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Db char 64 192 utf8 utf8_general_ci char(64)
......
......@@ -106,10 +106,10 @@ def mysql PRIMARY def mysql procs_priv Db
def mysql PRIMARY def mysql procs_priv User
def mysql PRIMARY def mysql procs_priv Routine_name
def mysql PRIMARY def mysql procs_priv Routine_type
def mysql PRIMARY def mysql proxy_priv Host
def mysql PRIMARY def mysql proxy_priv User
def mysql PRIMARY def mysql proxy_priv Proxied_Host
def mysql PRIMARY def mysql proxy_priv Proxied_User
def mysql PRIMARY def mysql proxies_priv Host
def mysql PRIMARY def mysql proxies_priv User
def mysql PRIMARY def mysql proxies_priv Proxied_host
def mysql PRIMARY def mysql proxies_priv Proxied_user
def mysql PRIMARY def mysql servers Server_name
def mysql PRIMARY def mysql tables_priv Host
def mysql PRIMARY def mysql tables_priv Db
......
......@@ -118,10 +118,11 @@ def mysql procs_priv mysql PRIMARY
def mysql procs_priv mysql PRIMARY
def mysql procs_priv mysql PRIMARY
def mysql procs_priv mysql Grantor
def mysql proxy_priv mysql PRIMARY
def mysql proxy_priv mysql PRIMARY
def mysql proxy_priv mysql PRIMARY
def mysql proxy_priv mysql PRIMARY
def mysql proxies_priv mysql PRIMARY
def mysql proxies_priv mysql PRIMARY
def mysql proxies_priv mysql PRIMARY
def mysql proxies_priv mysql PRIMARY
def mysql proxies_priv mysql Grantor
def mysql servers mysql PRIMARY
def mysql tables_priv mysql PRIMARY
def mysql tables_priv mysql PRIMARY
......
......@@ -40,10 +40,11 @@ def mysql procs_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
def mysql procs_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE
def mysql procs_priv 0 mysql PRIMARY 4 Routine_name A #CARD# NULL NULL BTREE
def mysql procs_priv 0 mysql PRIMARY 5 Routine_type A #CARD# NULL NULL BTREE
def mysql proxy_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql proxy_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
def mysql proxy_priv 0 mysql PRIMARY 3 Proxied_Host A #CARD# NULL NULL BTREE
def mysql proxy_priv 0 mysql PRIMARY 4 Proxied_User A #CARD# NULL NULL BTREE
def mysql proxies_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE
def mysql proxies_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql proxies_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
def mysql proxies_priv 0 mysql PRIMARY 3 Proxied_host A #CARD# NULL NULL BTREE
def mysql proxies_priv 0 mysql PRIMARY 4 Proxied_user A #CARD# NULL NULL BTREE
def mysql servers 0 mysql PRIMARY 1 Server_name A #CARD# NULL NULL BTREE
def mysql tables_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
......
......@@ -73,7 +73,7 @@ def mysql PRIMARY mysql ndb_binlog_index
def mysql PRIMARY mysql plugin
def mysql PRIMARY mysql proc
def mysql PRIMARY mysql procs_priv
def mysql PRIMARY mysql proxy_priv
def mysql PRIMARY mysql proxies_priv
def mysql PRIMARY mysql servers
def mysql PRIMARY mysql tables_priv
def mysql PRIMARY mysql time_zone
......
......@@ -23,7 +23,7 @@ def mysql PRIMARY mysql ndb_binlog_index PRIMARY KEY
def mysql PRIMARY mysql plugin PRIMARY KEY
def mysql PRIMARY mysql proc PRIMARY KEY
def mysql PRIMARY mysql procs_priv PRIMARY KEY
def mysql PRIMARY mysql proxy_priv PRIMARY KEY
def mysql PRIMARY mysql proxies_priv PRIMARY KEY
def mysql PRIMARY mysql servers PRIMARY KEY
def mysql PRIMARY mysql tables_priv PRIMARY KEY
def mysql PRIMARY mysql time_zone PRIMARY KEY
......
......@@ -336,7 +336,7 @@ user_comment Procedure privileges
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME proxy_priv
TABLE_NAME proxies_priv
TABLE_TYPE BASE TABLE
ENGINE MyISAM
VERSION 10
......
......@@ -111,10 +111,10 @@ Ensure that root always has the GRANT CREATE ROUTINE privilege.
--------------------------------------------------------------------------------
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
DROP PROCEDURE IF EXISTS db_storedproc_1.sp3;
DROP FUNCTION IF EXISTS db_storedproc_1.fn1;
user_1@localhost db_storedproc_1
DROP PROCEDURE IF EXISTS sp3;
DROP FUNCTION IF EXISTS fn1;
CREATE PROCEDURE sp3(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
......
......@@ -354,8 +354,6 @@ B Test 3.5.8.5-case 00191 0000000016 C=one
C Test 3.5.8.5-case 00200 0000000001 C=one
Insert into tb3 (f120, f122, f136)
values ('d', 'Test 3.5.8.5-case', 152);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
......@@ -365,8 +363,6 @@ B Test 3.5.8.5-case 00191 0000000016 1*0000099999
C Test 3.5.8.5-case 00200 0000000001 1*0000099999
Insert into tb3 (f120, f122, f136, f144)
values ('e', 'Test 3.5.8.5-case', 200, 8);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
......
......@@ -111,10 +111,10 @@ Ensure that root always has the GRANT CREATE ROUTINE privilege.
--------------------------------------------------------------------------------
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
DROP PROCEDURE IF EXISTS db_storedproc_1.sp3;
DROP FUNCTION IF EXISTS db_storedproc_1.fn1;
user_1@localhost db_storedproc_1
DROP PROCEDURE IF EXISTS sp3;
DROP FUNCTION IF EXISTS fn1;
CREATE PROCEDURE sp3(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
......
......@@ -354,8 +354,6 @@ B Test 3.5.8.5-case 00191 0000000016 C=one
C Test 3.5.8.5-case 00200 0000000001 C=one
Insert into tb3 (f120, f122, f136)
values ('d', 'Test 3.5.8.5-case', 152);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
......@@ -365,8 +363,6 @@ B Test 3.5.8.5-case 00191 0000000016 1*0000099999
C Test 3.5.8.5-case 00200 0000000001 1*0000099999
Insert into tb3 (f120, f122, f136, f144)
values ('e', 'Test 3.5.8.5-case', 200, 8);
Warnings:
Warning 1265 Data truncated for column 'f120' at row 1
select f120, f122, f136, f144, @test_var
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
f120 f122 f136 f144 @test_var
......
......@@ -117,15 +117,15 @@ create user 'user_1'@'localhost';
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
--disable_warnings
DROP PROCEDURE IF EXISTS db_storedproc_1.sp3;
DROP FUNCTION IF EXISTS db_storedproc_1.fn1;
--enable_warnings
# disconnect default;
connect (user2, localhost, user_1, , db_storedproc_1);
--source suite/funcs_1/include/show_connection.inc
--disable_warnings
DROP PROCEDURE IF EXISTS sp3;
DROP FUNCTION IF EXISTS fn1;
--enable_warnings
delimiter //;
CREATE PROCEDURE sp3(v1 char(20))
BEGIN
......
This diff is collapsed.
This diff is collapsed.
SET GLOBAL tx_isolation='REPEATABLE-READ';
SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_per_table=on;
CREATE TABLE bug56680(
a INT AUTO_INCREMENT PRIMARY KEY,
b CHAR(1),
c INT,
INDEX(b))
ENGINE=InnoDB;
INSERT INTO bug56680 VALUES(0,'x',1);
BEGIN;
SELECT b FROM bug56680;
b
x
BEGIN;
UPDATE bug56680 SET b='X';
SELECT b FROM bug56680;
b
x
SELECT * FROM bug56680;
a b c
1 x 1
ROLLBACK;
SELECT b FROM bug56680;
b
x
SET GLOBAL tx_isolation='READ-UNCOMMITTED';
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
BEGIN;
SELECT b FROM bug56680 LIMIT 2;
b
x
x
BEGIN;
DELETE FROM bug56680 WHERE a=1;
INSERT INTO bug56680 VALUES(1,'X',1);
SELECT b FROM bug56680 LIMIT 3;
b
X
x
x
SELECT b FROM bug56680 LIMIT 2;
b
x
x
CHECK TABLE bug56680;
Table Op Msg_type Msg_text
test.bug56680 check status OK
ROLLBACK;
SELECT b FROM bug56680 LIMIT 2;
b
x
x
CHECK TABLE bug56680;
Table Op Msg_type Msg_text
test.bug56680 check status OK
SELECT b FROM bug56680 LIMIT 2;
b
x
x
CREATE TABLE bug56680_2(
a INT AUTO_INCREMENT PRIMARY KEY,
b VARCHAR(2) CHARSET latin1 COLLATE latin1_german2_ci,
c INT,
INDEX(b))
ENGINE=InnoDB;
INSERT INTO bug56680_2 SELECT 0,_latin1 0xdf,c FROM bug56680;
BEGIN;
SELECT HEX(b) FROM bug56680_2 LIMIT 2;
HEX(b)
DF
DF
DELETE FROM bug56680_2 WHERE a=1;
INSERT INTO bug56680_2 VALUES(1,'SS',1);
SELECT HEX(b) FROM bug56680_2 LIMIT 3;
HEX(b)
5353
DF
DF
CHECK TABLE bug56680_2;
Table Op Msg_type Msg_text
test.bug56680_2 check status OK
ALTER TABLE bug56680_2 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
SELECT HEX(b) FROM bug56680_2 LIMIT 2;
HEX(b)
5353
DF
DELETE FROM bug56680_2 WHERE a=1;
INSERT INTO bug56680_2 VALUES(1,_latin1 0xdf,1);
SELECT HEX(b) FROM bug56680_2 LIMIT 3;
HEX(b)
DF
DF
DF
CHECK TABLE bug56680_2;
Table Op Msg_type Msg_text
test.bug56680_2 check status OK
DROP TABLE bug56680_2;
DROP TABLE bug56680;
cardinality
10
Table Op Msg_type Msg_text
test.bug57252 analyze status OK
cardinality
10
create table A(id int not null primary key) engine=innodb;
create table B(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references A(id) on delete cascade) engine=innodb;
create table C(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references B(id) on delete cascade) engine=innodb;
insert into A values(1), (2);
DELETE FROM A where id = 1;
DELETE FROM C where f1 = 2;
DELETE FROM A where id = 1;
DROP TABLE C;
DROP TABLE B;
DROP TABLE A;
This diff is collapsed.
#
# Bug#56632: ALTER TABLE implicitly changes ROW_FORMAT to COMPRESSED
# http://bugs.mysql.com/56632
#
# Innodb automatically uses compressed mode when the KEY_BLOCK_SIZE
# parameter is used, except if the ROW_FORMAT is also specified, in
# which case the KEY_BLOCK_SIZE is ignored and a warning is shown.
# But Innodb was getting confused when neither of those parameters
# was used on the ALTER statement after they were both used on the
# CREATE.
#
# This will test the results of all 4 combinations of these two
# parameters of the CREATE and ALTER.
#
# Tests 1-5 use INNODB_STRICT_MODE=1 which returns an error
# if there is anything wrong with the statement.
#
# 1) CREATE with ROW_FORMAT=COMPACT & KEY_BLOCK_SIZE=1, ALTER with neither.
# Result; CREATE; fails with error ER_CANT_CREATE_TABLE
# 2) CREATE with ROW_FORMAT=COMPACT, ALTER with KEY_BLOCK_SIZE=1
# Result; CREATE succeeds,
# ALTER quietly converts ROW_FORMAT to compressed.
# 3) CREATE with KEY_BLOCK_SIZE=1, ALTER with ROW_FORMAT=COMPACT
# Result; CREATE quietly converts ROW_FORMAT to compressed,
# ALTER fails with error ER_CANT_CREATE_TABLE.
# 4) CREATE with neither, ALTER with ROW_FORMAT=COMPACT & KEY_BLOCK_SIZE=1
# Result; CREATE succeeds,
# ALTER; fails with error ER_CANT_CREATE_TABLE
# 5) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with neither.
# Result; CREATE; fails with error ER_CANT_CREATE_TABLE
#
# Tests 6-11 use INNODB_STRICT_MODE=0 which automatically makes
# adjustments if the prameters are incompatible.
#
# 6) CREATE with ROW_FORMAT=COMPACT & KEY_BLOCK_SIZE=1, ALTER with neither.
# Result; CREATE succeeds, warns that KEY_BLOCK_SIZE is ignored.
# ALTER succeeds, no warnings.
# 7) CREATE with ROW_FORMAT=COMPACT, ALTER with KEY_BLOCK_SIZE=1
# Result; CREATE succeeds,
# ALTER quietly converts ROW_FORMAT to compressed.
# 8) CREATE with KEY_BLOCK_SIZE=1, ALTER with ROW_FORMAT=COMPACT
# Result; CREATE quietly converts ROW_FORMAT to compressed,
# ALTER succeeds, warns that KEY_BLOCK_SIZE is ignored.
# 9) CREATE with neither, ALTER with ROW_FORMAT=COMPACT & KEY_BLOCK_SIZE=1
# Result; CREATE succeeds,
# ALTER succeeds, warns that KEY_BLOCK_SIZE is ignored.
# 10) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with neither.
# Result; CREATE succeeds, warns that KEY_BLOCK_SIZE=3 is ignored.
# ALTER succeeds, warns that KEY_BLOCK_SIZE=3 is ignored.
# 11) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with ROW_FORMAT=COMPACT.
# Result; CREATE succeeds, warns that KEY_BLOCK_SIZE=3 is ignored.
# ALTER succeeds, warns that KEY_BLOCK_SIZE=3 is ignored.
# 12) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with KEY_BLOCK_SIZE=1.
# Result; CREATE succeeds, warns that KEY_BLOCK_SIZE=3 is ignored.
# ALTER succeeds, quietly converts ROW_FORMAT to compressed.
-- source include/have_innodb.inc
SET storage_engine=InnoDB;
--disable_query_log
# These values can change during the test
LET $innodb_file_format_orig=`select @@innodb_file_format`;
LET $innodb_file_format_max_orig=`select @@innodb_file_format_max`;
LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
LET $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
--enable_query_log
SET GLOBAL innodb_file_format=`Barracuda`;
SET GLOBAL innodb_file_per_table=ON;
# Innodb strict mode will cause an error on the CREATE or ALTER when;
# 1. both ROW_FORMAT=COMPACT and KEY_BLOCK_SIZE=1,
# 2. KEY_BLOCK_SIZE is not a valid number (0,1,2,4,8,16).
# With innodb_strict_mode = OFF, These errors are corrected
# and just a warning is returned.
SET SESSION innodb_strict_mode = ON;
--echo # Test 1) CREATE with ROW_FORMAT & KEY_BLOCK_SIZE, ALTER with neither
DROP TABLE IF EXISTS bug56632;
--error ER_CANT_CREATE_TABLE
CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
--echo # Test 2) CREATE with ROW_FORMAT, ALTER with KEY_BLOCK_SIZE
DROP TABLE IF EXISTS bug56632;
CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
ALTER TABLE bug56632 KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
--echo # Test 3) CREATE with KEY_BLOCK_SIZE, ALTER with ROW_FORMAT
DROP TABLE IF EXISTS bug56632;
CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
--disable_result_log
--error ER_CANT_CREATE_TABLE
ALTER TABLE bug56632 ROW_FORMAT=COMPACT;
--enable_result_log
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
--echo # Test 4) CREATE with neither, ALTER with ROW_FORMAT & KEY_BLOCK_SIZE
DROP TABLE IF EXISTS bug56632;
CREATE TABLE bug56632 ( i INT );
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
--disable_result_log
--error ER_CANT_CREATE_TABLE
ALTER TABLE bug56632 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
--enable_result_log
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
--echo # Test 5) CREATE with KEY_BLOCK_SIZE=3 (invalid).
DROP TABLE IF EXISTS bug56632;
--error ER_CANT_CREATE_TABLE
CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3;
SHOW WARNINGS;
SET SESSION innodb_strict_mode = OFF;
--echo # Test 6) CREATE with ROW_FORMAT & KEY_BLOCK_SIZE, ALTER with neither
DROP TABLE IF EXISTS bug56632;
CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
ALTER TABLE bug56632 ADD COLUMN f1 INT;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
--echo # Test 7) CREATE with ROW_FORMAT, ALTER with KEY_BLOCK_SIZE
DROP TABLE IF EXISTS bug56632;
CREATE TABLE bug56632 ( i INT ) ROW_FORMAT=COMPACT;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
ALTER TABLE bug56632 KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
--echo # Test 8) CREATE with KEY_BLOCK_SIZE, ALTER with ROW_FORMAT
DROP TABLE IF EXISTS bug56632;
CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
ALTER TABLE bug56632 ROW_FORMAT=COMPACT;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
--echo # Test 9) CREATE with neither, ALTER with ROW_FORMAT & KEY_BLOCK_SIZE
DROP TABLE IF EXISTS bug56632;
CREATE TABLE bug56632 ( i INT );
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
ALTER TABLE bug56632 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
--echo # Test 10) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with neither.
DROP TABLE IF EXISTS bug56632;
CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
ALTER TABLE bug56632 ADD COLUMN f1 INT;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
--echo # Test 11) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with ROW_FORMAT=COMPACT.
DROP TABLE IF EXISTS bug56632;
CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
ALTER TABLE bug56632 ROW_FORMAT=COMPACT;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
--echo # Test 12) CREATE with KEY_BLOCK_SIZE=3 (invalid), ALTER with KEY_BLOCK_SIZE=1.
DROP TABLE IF EXISTS bug56632;
CREATE TABLE bug56632 ( i INT ) KEY_BLOCK_SIZE=3;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
ALTER TABLE bug56632 KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
SHOW CREATE TABLE bug56632;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 'bug56632';
--echo # Cleanup
DROP TABLE IF EXISTS bug56632;
--disable_query_log
EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
EVAL SET GLOBAL innodb_file_format_max=$innodb_file_format_max_orig;
EVAL SET GLOBAL innodb_file_format=$innodb_file_format_orig;
EVAL SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;
--enable_query_log
This diff is collapsed.
#
# Bug#57252 disabling innobase_stats_on_metadata disables ANALYZE
# http://bugs.mysql.com/57252
#
-- source include/have_innodb.inc
-- disable_query_log
-- disable_result_log
SET @innodb_stats_on_metadata_orig = @@innodb_stats_on_metadata;
CREATE TABLE bug57252 (a INT, KEY akey (a)) ENGINE=INNODB;
BEGIN;
let $i = 10;
while ($i) {
eval INSERT INTO bug57252 VALUES ($i);
dec $i;
}
COMMIT;
-- enable_result_log
SET GLOBAL innodb_stats_on_metadata=0;
# this calls ::info() without HA_STATUS_CONST and so
# index->stat_n_diff_key_vals[] is not copied to the mysql-visible
# rec_per_key
SELECT cardinality FROM information_schema.statistics
WHERE table_name='bug57252' AND index_name='akey';
# this calls ::info() with HA_STATUS_CONST and so
# index->stat_n_diff_key_vals[] is copied to the mysql-visible
# rec_per_key at the end; when the bug is present dict_update_statistics()
# is not called beforehand and so index->stat_n_diff_key_vals[] contains
# an outdated data and thus we get an outdated data in the result when the
# bug is present
ANALYZE TABLE bug57252;
SELECT cardinality FROM information_schema.statistics
WHERE table_name='bug57252' AND index_name='akey';
DROP TABLE bug57252;
SET GLOBAL innodb_stats_on_metadata = @innodb_stats_on_metadata_orig;
# Test Bug #57255. Cascade deletes that affect different rows should not
# result in DB_FOREIGN_EXCEED_MAX_CASCADE error
--source include/have_innodb.inc
create table A(id int not null primary key) engine=innodb;
create table B(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references A(id) on delete cascade) engine=innodb;
create table C(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references B(id) on delete cascade) engine=innodb;
insert into A values(1), (2);
--disable_query_log
let $i=257;
while ($i)
{
insert into B(f1) values(1);
dec $i;
}
let $i=486;
while ($i)
{
insert into C(f1) values(2);
dec $i;
}
--enable_query_log
# Following Deletes should not report error
DELETE FROM A where id = 1;
DELETE FROM C where f1 = 2;
DELETE FROM A where id = 1;
DROP TABLE C;
DROP TABLE B;
DROP TABLE A;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment