mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.1-new-rpl
into mysql.com:/nfsdisk1/lars/MERGE/mysql-5.1-merge
This commit is contained in:
@@ -105,7 +105,7 @@ if [ "x$warning_mode" != "xpedantic" ]; then
|
||||
# Added unless --with-debug=full
|
||||
debug_extra_cflags="-O1 -Wuninitialized"
|
||||
else
|
||||
warnings="-W -Wall -ansi -pedantic -Wno-long-long -D_POSIX_SOURCE"
|
||||
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
|
||||
c_warnings="$warnings"
|
||||
cxx_warnings="$warnings -std=c++98"
|
||||
# NOTE: warning mode should not influence optimize/debug mode.
|
||||
@@ -207,3 +207,28 @@ then
|
||||
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
|
||||
echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
|
||||
fi
|
||||
|
||||
# gcov
|
||||
|
||||
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
|
||||
# code with profiling information used by gcov.
|
||||
# The -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
|
||||
# The -DHAVE_gcov enables code to write out coverage info even when crashing.
|
||||
|
||||
gcov_compile_flags="-fprofile-arcs -ftest-coverage"
|
||||
gcov_compile_flags="$gcov_compile_flags -DDISABLE_TAO_ASM"
|
||||
gcov_compile_flags="$gcov_compile_flags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov"
|
||||
|
||||
# GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well
|
||||
# as on the compiler command line), and this requires setting LDFLAGS for BDB.
|
||||
|
||||
gcov_link_flags="-fprofile-arcs -ftest-coverage"
|
||||
|
||||
gcov_configs="--disable-shared"
|
||||
|
||||
# gprof
|
||||
|
||||
gprof_compile_flags="-O2 -pg -g"
|
||||
|
||||
gprof_link_flags="--disable-shared $static_link"
|
||||
|
||||
|
17
BUILD/compile-amd64-gcov
Executable file
17
BUILD/compile-amd64-gcov
Executable file
@@ -0,0 +1,17 @@
|
||||
#! /bin/sh
|
||||
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh"
|
||||
|
||||
# Need to disable ccache, or we loose the gcov-needed compiler output files.
|
||||
CCACHE_DISABLE=1
|
||||
export CCACHE_DISABLE
|
||||
|
||||
export LDFLAGS="$gcov_link_flags"
|
||||
|
||||
extra_flags="$amd64_cflags $debug_cflags $max_cflags $gcov_compile_flags"
|
||||
c_warnings="$c_warnings $debug_extra_warnings"
|
||||
cxx_warnings="$cxx_warnings $debug_extra_warnings"
|
||||
extra_configs="$amd64_configs $debug_configs $gcov_configs $max_configs"
|
||||
|
||||
. "$path/FINISH.sh"
|
9
BUILD/compile-amd64-gprof
Executable file
9
BUILD/compile-amd64-gprof
Executable file
@@ -0,0 +1,9 @@
|
||||
#! /bin/sh
|
||||
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh"
|
||||
|
||||
extra_flags="$amd64_cflags $gprof_compile_flags"
|
||||
extra_configs="$amd64_configs $debug_configs $gprof_link_flags"
|
||||
|
||||
. "$path/FINISH.sh"
|
@@ -20,18 +20,11 @@ export CCACHE_GCOV_VERSION_ENABLED
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh"
|
||||
|
||||
# GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well
|
||||
# as on the compiler command line), and this requires setting LDFLAGS for BDB.
|
||||
export LDFLAGS="-fprofile-arcs -ftest-coverage"
|
||||
export LDFLAGS="$gcov_link_flags"
|
||||
|
||||
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
|
||||
# code with profiling information used by gcov.
|
||||
# The -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
|
||||
# The -DHAVE_gcov enables code to write out coverage info even when crashing.
|
||||
extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM -DHAVE_MUTEX_THREAD_ONLY $debug_extra_flags $debug_cflags $max_cflags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov"
|
||||
extra_configs="$pentium_configs $debug_configs --disable-shared $static_link"
|
||||
extra_configs="$extra_configs $max_configs"
|
||||
extra_flags="$pentium_cflags $debug_cflags $max_cflags $gcov_compile_flags"
|
||||
c_warnings="$c_warnings $debug_extra_warnings"
|
||||
cxx_warnings="$cxx_warnings $debug_extra_warnings"
|
||||
extra_configs="$pentium_configs $debug_configs $gcov_configs $max_configs"
|
||||
|
||||
. "$path/FINISH.sh"
|
||||
|
@@ -3,7 +3,7 @@
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh"
|
||||
|
||||
extra_flags="$pentium_cflags -O2 -pg -g"
|
||||
extra_configs="$pentium_configs $debug_configs --disable-shared $static_link"
|
||||
extra_flags="$pentium_cflags $gprof_compile_flags"
|
||||
extra_configs="$pentium_configs $debug_configs $gprof_link_flags"
|
||||
|
||||
. "$path/FINISH.sh"
|
||||
|
17
BUILD/compile-pentium64-gcov
Executable file
17
BUILD/compile-pentium64-gcov
Executable file
@@ -0,0 +1,17 @@
|
||||
#! /bin/sh
|
||||
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh"
|
||||
|
||||
# Need to disable ccache, or we loose the gcov-needed compiler output files.
|
||||
CCACHE_DISABLE=1
|
||||
export CCACHE_DISABLE
|
||||
|
||||
export LDFLAGS="$gcov_link_flags"
|
||||
|
||||
extra_flags="$pentium64_cflags $debug_cflags $max_cflags $gcov_compile_flags"
|
||||
c_warnings="$c_warnings $debug_extra_warnings"
|
||||
cxx_warnings="$cxx_warnings $debug_extra_warnings"
|
||||
extra_configs="$pentium64_configs $debug_configs $gcov_configs $max_configs"
|
||||
|
||||
. "$path/FINISH.sh"
|
9
BUILD/compile-pentium64-gprof
Executable file
9
BUILD/compile-pentium64-gprof
Executable file
@@ -0,0 +1,9 @@
|
||||
#! /bin/sh
|
||||
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh"
|
||||
|
||||
extra_flags="$pentium64_cflags $gprof_compile_flags"
|
||||
extra_configs="$pentium64_configs $debug_configs $gprof_link_flags"
|
||||
|
||||
. "$path/FINISH.sh"
|
@@ -1263,6 +1263,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
||||
char buff[80], *pos, *out;
|
||||
COMMANDS *com;
|
||||
bool need_space= 0;
|
||||
bool ss_comment= 0;
|
||||
DBUG_ENTER("add_line");
|
||||
|
||||
if (!line[0] && buffer.is_empty())
|
||||
@@ -1316,6 +1317,19 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
||||
if ((*com->func)(&buffer,pos-1) > 0)
|
||||
DBUG_RETURN(1); // Quit
|
||||
if (com->takes_params)
|
||||
{
|
||||
if (ss_comment)
|
||||
{
|
||||
/*
|
||||
If a client-side macro appears inside a server-side comment,
|
||||
discard all characters in the comment after the macro (that is,
|
||||
until the end of the comment rather than the next delimiter)
|
||||
*/
|
||||
for (pos++; *pos && (*pos != '*' || *(pos + 1) != '/'); pos++)
|
||||
;
|
||||
pos--;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (pos++ ;
|
||||
*pos && (*pos != *delimiter ||
|
||||
@@ -1326,6 +1340,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
||||
else
|
||||
pos+= delimiter_length - 1; // Point at last delim char
|
||||
}
|
||||
}
|
||||
out=line;
|
||||
}
|
||||
else
|
||||
@@ -1386,7 +1401,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
||||
out=line;
|
||||
}
|
||||
}
|
||||
else if (*ml_comment && inchar == '*' && *(pos + 1) == '/')
|
||||
else if (*ml_comment && !ss_comment && inchar == '*' && *(pos + 1) == '/')
|
||||
{
|
||||
pos++;
|
||||
*ml_comment= 0;
|
||||
@@ -1394,6 +1409,11 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
||||
}
|
||||
else
|
||||
{ // Add found char to buffer
|
||||
if (!*in_string && inchar == '/' && *(pos + 1) == '*' &&
|
||||
*(pos + 2) == '!')
|
||||
ss_comment= 1;
|
||||
else if (!*in_string && ss_comment && inchar == '*' && *(pos + 1) == '/')
|
||||
ss_comment= 0;
|
||||
if (inchar == *in_string)
|
||||
*in_string= 0;
|
||||
else if (!*ml_comment && !*in_string &&
|
||||
|
@@ -352,16 +352,11 @@ static my_bool get_full_path_to_executable(char* path)
|
||||
|
||||
/*
|
||||
Look for the tool in the same directory as mysql_upgrade.
|
||||
|
||||
When running in a not yet installed build the the program
|
||||
will exist but it need to be invoked via it's libtool wrapper.
|
||||
Check if the found tool can executed and if not look in the
|
||||
directory one step higher up where the libtool wrapper normally
|
||||
is found
|
||||
*/
|
||||
|
||||
static void find_tool(char *tool_path, const char *tool_name)
|
||||
{
|
||||
size_t path_len;
|
||||
char path[FN_REFLEN];
|
||||
DYNAMIC_STRING ds_tmp;
|
||||
DBUG_ENTER("find_tool");
|
||||
@@ -395,17 +390,32 @@ static void find_tool(char *tool_path, const char *tool_name)
|
||||
path[0]= 0;
|
||||
}
|
||||
}
|
||||
do
|
||||
{
|
||||
size_t path_len;
|
||||
DBUG_PRINT("enter", ("path: %s", path));
|
||||
|
||||
/* Chop off last char(since it might be a /) */
|
||||
path[max((strlen(path)-1), 0)]= 0;
|
||||
DBUG_PRINT("info", ("path: '%s'", path));
|
||||
|
||||
/* Chop off last dir part */
|
||||
/* Chop off binary name (i.e mysql-upgrade) from path */
|
||||
dirname_part(path, path, &path_len);
|
||||
|
||||
/*
|
||||
When running in a not yet installed build and using libtool,
|
||||
the program(mysql_upgrade) will be in .libs/ and executed
|
||||
through a libtool wrapper in order to use the dynamic libraries
|
||||
from this build. The same must be done for the tools(mysql and
|
||||
mysqlcheck). Thus if path ends in .libs/, step up one directory
|
||||
and execute the tools from there
|
||||
*/
|
||||
path[max(path_len-1, 0)]= 0; /* Chop off last / */
|
||||
if (strncmp(path + dirname_length(path), ".libs", 5) == 0)
|
||||
{
|
||||
DBUG_PRINT("info", ("Chopping off .libs from '%s'", path));
|
||||
|
||||
/* Chop off .libs */
|
||||
dirname_part(path, path, &path_len);
|
||||
}
|
||||
|
||||
|
||||
DBUG_PRINT("info", ("path: '%s'", path));
|
||||
|
||||
/* Format name of the tool to search for */
|
||||
fn_format(tool_path, tool_name,
|
||||
path, "", MYF(MY_REPLACE_DIR));
|
||||
@@ -417,16 +427,15 @@ static void find_tool(char *tool_path, const char *tool_name)
|
||||
die("Can't find '%s'", tool_path);
|
||||
|
||||
/*
|
||||
Make sure it can be executed, otherwise try again
|
||||
in higher level directory
|
||||
Make sure it can be executed
|
||||
*/
|
||||
}
|
||||
while(run_tool(tool_path,
|
||||
if (run_tool(tool_path,
|
||||
&ds_tmp, /* Get output from command, discard*/
|
||||
"--help",
|
||||
"2>&1",
|
||||
IF_WIN("> NUL", "> /dev/null"),
|
||||
NULL));
|
||||
NULL))
|
||||
die("Can't execute '%s'", tool_path);
|
||||
|
||||
dynstr_free(&ds_tmp);
|
||||
|
||||
@@ -457,6 +466,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
|
||||
|
||||
ret= run_tool(mysql_path,
|
||||
ds_res,
|
||||
"--no-defaults",
|
||||
ds_args.str,
|
||||
"--database=mysql",
|
||||
"--batch", /* Turns off pager etc. */
|
||||
@@ -468,6 +478,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
|
||||
NULL);
|
||||
|
||||
my_close(fd, MYF(0));
|
||||
my_delete(query_file_path, MYF(0));
|
||||
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
@@ -618,6 +629,7 @@ static int run_mysqlcheck_upgrade(void)
|
||||
verbose("Running 'mysqlcheck'...");
|
||||
return run_tool(mysqlcheck_path,
|
||||
NULL, /* Send output from mysqlcheck directly to screen */
|
||||
"--no-defaults",
|
||||
ds_args.str,
|
||||
"--check-upgrade",
|
||||
"--all-databases",
|
||||
|
@@ -1309,7 +1309,7 @@ static char *cover_definer_clause_in_trigger(const char *trigger_def_str,
|
||||
@note This function will go away when WL#3995 is implemented.
|
||||
|
||||
@param[in] def_str CREATE FUNCTION|PROCEDURE statement string.
|
||||
@param[in] def_length length of the def_str.
|
||||
@param[in] def_str_length length of the def_str.
|
||||
|
||||
@return pointer to the new allocated query string.
|
||||
*/
|
||||
|
@@ -1416,13 +1416,13 @@ get_options(int *argc,char ***argv)
|
||||
tmp_string[sbuf.st_size]= '\0';
|
||||
my_close(data_file,MYF(0));
|
||||
if (user_supplied_pre_statements)
|
||||
actual_queries= parse_delimiter(tmp_string, &pre_statements,
|
||||
(void)parse_delimiter(tmp_string, &pre_statements,
|
||||
delimiter[0]);
|
||||
my_free(tmp_string, MYF(0));
|
||||
}
|
||||
else if (user_supplied_pre_statements)
|
||||
{
|
||||
actual_queries= parse_delimiter(user_supplied_pre_statements,
|
||||
(void)parse_delimiter(user_supplied_pre_statements,
|
||||
&pre_statements,
|
||||
delimiter[0]);
|
||||
}
|
||||
@@ -1447,13 +1447,13 @@ get_options(int *argc,char ***argv)
|
||||
tmp_string[sbuf.st_size]= '\0';
|
||||
my_close(data_file,MYF(0));
|
||||
if (user_supplied_post_statements)
|
||||
parse_delimiter(tmp_string, &post_statements,
|
||||
(void)parse_delimiter(tmp_string, &post_statements,
|
||||
delimiter[0]);
|
||||
my_free(tmp_string, MYF(0));
|
||||
}
|
||||
else if (user_supplied_post_statements)
|
||||
{
|
||||
parse_delimiter(user_supplied_post_statements, &post_statements,
|
||||
(void)parse_delimiter(user_supplied_post_statements, &post_statements,
|
||||
delimiter[0]);
|
||||
}
|
||||
|
||||
@@ -1673,6 +1673,7 @@ static int
|
||||
run_statements(MYSQL *mysql, statement *stmt)
|
||||
{
|
||||
statement *ptr;
|
||||
MYSQL_RES *result;
|
||||
DBUG_ENTER("run_statements");
|
||||
|
||||
for (ptr= stmt; ptr && ptr->length; ptr= ptr->next)
|
||||
@@ -1683,6 +1684,11 @@ run_statements(MYSQL *mysql, statement *stmt)
|
||||
my_progname, (uint)ptr->length, ptr->string, mysql_error(mysql));
|
||||
exit(1);
|
||||
}
|
||||
if (mysql_field_count(mysql))
|
||||
{
|
||||
result= mysql_store_result(mysql);
|
||||
mysql_free_result(result);
|
||||
}
|
||||
}
|
||||
|
||||
DBUG_RETURN(0);
|
||||
@@ -1813,6 +1819,13 @@ limit_not_met:
|
||||
{
|
||||
mysql_close(mysql);
|
||||
|
||||
if (!(mysql= mysql_init(NULL)))
|
||||
{
|
||||
fprintf(stderr,"%s: mysql_init() failed ERROR : %s\n",
|
||||
my_progname, mysql_error(mysql));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (slap_connect(mysql))
|
||||
goto end;
|
||||
}
|
||||
@@ -2002,7 +2015,6 @@ parse_delimiter(const char *script, statement **stmt, char delm)
|
||||
ptr+= retstr - ptr + 1;
|
||||
if (isspace(*ptr))
|
||||
ptr++;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (ptr != script+length)
|
||||
|
File diff suppressed because it is too large
Load Diff
10
configure.in
10
configure.in
@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
|
||||
#
|
||||
# When changing major version number please also check switch statement
|
||||
# in mysqlbinlog::check_master_version().
|
||||
AM_INIT_AUTOMAKE(mysql, 5.1.22-beta)
|
||||
AM_INIT_AUTOMAKE(mysql, 5.1.23-beta)
|
||||
AM_CONFIG_HEADER([include/config.h:config.h.in])
|
||||
|
||||
PROTOCOL_VERSION=10
|
||||
@@ -2623,6 +2623,14 @@ AC_SUBST(CC)
|
||||
AC_SUBST(GXX)
|
||||
|
||||
# Set configuration options for make_binary_distribution
|
||||
case $SYSTEM_TYPE in
|
||||
*netware*)
|
||||
MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --no-strip"
|
||||
;;
|
||||
*)
|
||||
: # no change for other platforms yet
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
|
||||
|
||||
# Output results
|
||||
|
@@ -9,6 +9,7 @@
|
||||
|
||||
const char* SSLeay_version(int type);
|
||||
|
||||
#define SSLEAY_NUMBER_DEFINED
|
||||
#define SSLEAY_VERSION 0x0900L
|
||||
#define SSLEAY_VERSION_NUMBER SSLEAY_VERSION
|
||||
|
||||
|
1
extra/yassl/include/openssl/des_old.h
Normal file
1
extra/yassl/include/openssl/des_old.h
Normal file
@@ -0,0 +1 @@
|
||||
/* des_old.h for openvn */
|
10
extra/yassl/include/openssl/evp.h
Normal file
10
extra/yassl/include/openssl/evp.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/* evp.h for openSSL */
|
||||
|
||||
#ifndef SSLEAY_NUMBER_DEFINED
|
||||
#define SSLEAY_NUMBER_DEFINED
|
||||
|
||||
/* for OpenVPN */
|
||||
#define SSLEAY_VERSION_NUMBER 0x0090700f
|
||||
|
||||
|
||||
#endif /* SSLEAY_NUMBER_DEFINED */
|
1
extra/yassl/include/openssl/hmac.h
Normal file
1
extra/yassl/include/openssl/hmac.h
Normal file
@@ -0,0 +1 @@
|
||||
/* hmac.h for openvpn */
|
1
extra/yassl/include/openssl/objects.h
Normal file
1
extra/yassl/include/openssl/objects.h
Normal file
@@ -0,0 +1 @@
|
||||
/* objects.h for openvpn */
|
@@ -30,6 +30,7 @@
|
||||
#define SSL_CTX_new yaSSL_CTX_new
|
||||
#define SSL_new yaSSL_new
|
||||
#define SSL_set_fd yaSSL_set_fd
|
||||
#define SSL_get_fd yaSSL_get_fd
|
||||
#define SSL_connect yaSSL_connect
|
||||
#define SSL_write yaSSL_write
|
||||
#define SSL_read yaSSL_read
|
||||
@@ -91,6 +92,8 @@
|
||||
#define SSL_set_rfd yaSSL_set_rfd
|
||||
#define SSL_set_wfd yaSSL_set_wfd
|
||||
#define SSL_set_shutdown yaSSL_set_shutdown
|
||||
#define SSL_set_quiet_shutdown yaSSL_set_quiet_shutdown
|
||||
#define SSL_get_quiet_shutdown yaSSL_get_quiet_shutdown
|
||||
#define SSL_want_read yaSSL_want_read
|
||||
#define SSL_want_write yaSSL_want_write
|
||||
#define SSL_pending yaSSL_pending
|
||||
|
1
extra/yassl/include/openssl/sha.h
Normal file
1
extra/yassl/include/openssl/sha.h
Normal file
@@ -0,0 +1 @@
|
||||
/* sha.h for openvpn */
|
@@ -34,7 +34,7 @@
|
||||
#include "rsa.h"
|
||||
|
||||
|
||||
#define YASSL_VERSION "1.6.5"
|
||||
#define YASSL_VERSION "1.7.2"
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
@@ -201,6 +201,7 @@ typedef int YASSL_SOCKET_T;
|
||||
SSL_CTX* SSL_CTX_new(SSL_METHOD*);
|
||||
SSL* SSL_new(SSL_CTX*);
|
||||
int SSL_set_fd (SSL*, YASSL_SOCKET_T);
|
||||
YASSL_SOCKET_T SSL_get_fd(const SSL*);
|
||||
int SSL_connect(SSL*);
|
||||
int SSL_write(SSL*, const void*, int);
|
||||
int SSL_read(SSL*, void*, int);
|
||||
|
@@ -584,7 +584,7 @@ class SSL {
|
||||
Socket socket_; // socket wrapper
|
||||
Buffers buffers_; // buffered handshakes and data
|
||||
Log log_; // logger
|
||||
bool quietShutdown_; // shutdown without handshakes
|
||||
bool quietShutdown_;
|
||||
|
||||
// optimization variables
|
||||
bool has_data_; // buffered data ready?
|
||||
|
@@ -719,6 +719,10 @@ int DoProcessReply(SSL& ssl)
|
||||
|
||||
// add new data
|
||||
uint read = ssl.useSocket().receive(buffer.get_buffer() + buffSz, ready);
|
||||
if (read == static_cast<uint>(-1)) {
|
||||
ssl.SetError(receive_error);
|
||||
return 0;
|
||||
}
|
||||
buffer.add_size(read);
|
||||
uint offset = 0;
|
||||
const MessageFactory& mf = ssl.getFactory().getMessage();
|
||||
|
@@ -114,8 +114,6 @@ uint Socket::send(const byte* buf, unsigned int sz, int flags) const
|
||||
const byte* pos = buf;
|
||||
const byte* end = pos + sz;
|
||||
|
||||
assert(socket_ != INVALID_SOCKET);
|
||||
|
||||
while (pos != end) {
|
||||
int sent = ::send(socket_, reinterpret_cast<const char *>(pos),
|
||||
static_cast<int>(end - pos), flags);
|
||||
@@ -132,7 +130,6 @@ uint Socket::send(const byte* buf, unsigned int sz, int flags) const
|
||||
|
||||
uint Socket::receive(byte* buf, unsigned int sz, int flags)
|
||||
{
|
||||
assert(socket_ != INVALID_SOCKET);
|
||||
wouldBlock_ = false;
|
||||
|
||||
int recvd = ::recv(socket_, reinterpret_cast<char *>(buf), sz, flags);
|
||||
@@ -163,7 +160,6 @@ bool Socket::wait()
|
||||
|
||||
void Socket::shutDown(int how)
|
||||
{
|
||||
assert(socket_ != INVALID_SOCKET);
|
||||
shutdown(socket_, how);
|
||||
}
|
||||
|
||||
|
@@ -239,6 +239,12 @@ int SSL_set_fd(SSL* ssl, YASSL_SOCKET_T fd)
|
||||
}
|
||||
|
||||
|
||||
YASSL_SOCKET_T SSL_get_fd(const SSL* ssl)
|
||||
{
|
||||
return ssl->getSocket().get_fd();
|
||||
}
|
||||
|
||||
|
||||
int SSL_connect(SSL* ssl)
|
||||
{
|
||||
if (ssl->GetError() == YasslError(SSL_ERROR_WANT_READ))
|
||||
|
@@ -773,6 +773,7 @@ void SSL::SetError(YasslError ye)
|
||||
// TODO: add string here
|
||||
}
|
||||
|
||||
|
||||
// set the quiet shutdown mode (close_nofiy not sent or received on shutdown)
|
||||
void SSL::SetQuietShutdown(bool mode)
|
||||
{
|
||||
|
@@ -107,11 +107,12 @@ void HexDecoder::Decode()
|
||||
// sanity checks
|
||||
assert( b < sizeof(hexDecode)/sizeof(hexDecode[0]) );
|
||||
assert( b2 < sizeof(hexDecode)/sizeof(hexDecode[0]) );
|
||||
assert( b != bad && b2 != bad );
|
||||
|
||||
b = hexDecode[b];
|
||||
b2 = hexDecode[b2];
|
||||
|
||||
assert( b != bad && b2 != bad );
|
||||
|
||||
decoded_[i++] = (b << 4) | b2;
|
||||
bytes -= 2;
|
||||
}
|
||||
@@ -184,7 +185,7 @@ void Base64Decoder::Decode()
|
||||
{
|
||||
word32 bytes = coded_.size();
|
||||
word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz);
|
||||
plainSz = ((plainSz * 3) / 4) + 3;
|
||||
plainSz = (plainSz * 3 + 3) / 4;
|
||||
decoded_.New(plainSz);
|
||||
|
||||
word32 i = 0;
|
||||
|
@@ -26,6 +26,11 @@ extern "C" {
|
||||
// locking handled internally by library
|
||||
char CRYPTO_lock() { return 0;}
|
||||
char CRYPTO_add_lock() { return 0;}
|
||||
|
||||
|
||||
// for openvpn, test are the signatures they use
|
||||
char EVP_CIPHER_CTX_init() { return 0; }
|
||||
char CRYPTO_mem_ctrl() { return 0; }
|
||||
} // extern "C"
|
||||
|
||||
|
||||
|
@@ -15,18 +15,17 @@
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
|
||||
# FIXME 'abi_check' should be in BUILT_SOURCES, disabled for now
|
||||
BUILT_SOURCES = $(HEADERS_GEN) link_sources
|
||||
HEADERS_GEN = mysql_version.h my_config.h
|
||||
HEADERS_ABI = mysql.h mysql_com.h mysql_time.h \
|
||||
my_list.h my_alloc.h typelib.h
|
||||
my_list.h my_alloc.h typelib.h mysql/plugin.h
|
||||
pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
|
||||
my_xml.h mysql_embed.h \
|
||||
my_pthread.h my_no_pthread.h \
|
||||
decimal.h errmsg.h my_global.h my_net.h \
|
||||
my_getopt.h sslopt-longopts.h my_dir.h \
|
||||
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
|
||||
m_ctype.h mysql/plugin.h my_attribute.h $(HEADERS_GEN)
|
||||
m_ctype.h my_attribute.h $(HEADERS_GEN)
|
||||
noinst_HEADERS = config-win.h config-netware.h \
|
||||
heap.h my_bitmap.h my_uctype.h \
|
||||
myisam.h myisampack.h myisammrg.h ft_global.h\
|
||||
@@ -72,9 +71,8 @@ dist-hook:
|
||||
abi_check: $(HEADERS_ABI) mysql_version.h mysql_h.ic
|
||||
@set -ex; \
|
||||
if [ @ICHECK@ != no ] ; then \
|
||||
@ICHECK@ --canonify --skip-from-re /usr/ -o $@.ic mysql.h; \
|
||||
@ICHECK@ --compare mysql_h.ic $@.ic; \
|
||||
$(RM) -f $@.ic; \
|
||||
@ICHECK@ --canonify --skip-from-re /usr/ -o $@ $(HEADERS_ABI); \
|
||||
@ICHECK@ --compare mysql_h.ic $@; \
|
||||
fi; \
|
||||
touch abi_check;
|
||||
|
||||
|
@@ -562,12 +562,6 @@ int __void__;
|
||||
#define PURIFY_OR_LINT_INIT(var)
|
||||
#endif
|
||||
|
||||
/* Define some useful general macros */
|
||||
#if !defined(max)
|
||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_UINT)
|
||||
#undef HAVE_UINT
|
||||
#define HAVE_UINT
|
||||
@@ -1508,4 +1502,10 @@ inline void operator delete[](void*, void*) { /* Do nothing */ }
|
||||
/* Length of decimal number represented by INT64. */
|
||||
#define MY_INT64_NUM_DECIMAL_DIGITS 21
|
||||
|
||||
/* Define some useful general macros (should be done after all headers). */
|
||||
#if !defined(max)
|
||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#endif /* my_global_h */
|
||||
|
@@ -29,25 +29,6 @@ extern "C" {
|
||||
#define EXTERNC
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
BUG#24507: Race conditions inside current NPTL pthread_exit() implementation.
|
||||
|
||||
If macro NPTL_PTHREAD_EXIT_HACK is defined then a hack described in the bug
|
||||
report will be implemented inside my_thread_global_init() in my_thr_init.c.
|
||||
|
||||
This amounts to spawning a dummy thread which does nothing but executes
|
||||
pthread_exit(0).
|
||||
|
||||
This bug is fixed in version 2.5 of glibc library.
|
||||
|
||||
TODO: Remove this code when fixed versions of glibc6 are in common use.
|
||||
*/
|
||||
|
||||
#if defined(TARGET_OS_LINUX) && defined(HAVE_NPTL) && \
|
||||
defined(__GLIBC__) && ( __GLIBC__ < 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ < 5 )
|
||||
#define NPTL_PTHREAD_EXIT_BUG 1
|
||||
#endif
|
||||
|
||||
#if defined(__WIN__)
|
||||
typedef CRITICAL_SECTION pthread_mutex_t;
|
||||
typedef HANDLE pthread_t;
|
||||
@@ -179,7 +160,7 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
|
||||
#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
|
||||
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
|
||||
#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B))
|
||||
#define pthread_kill(A,B) pthread_dummy(0)
|
||||
#define pthread_kill(A,B) pthread_dummy(ESRCH)
|
||||
|
||||
#define pthread_join(A,B) (WaitForSingleObject((A), INFINITE) != WAIT_OBJECT_0)
|
||||
|
||||
@@ -361,14 +342,14 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res);
|
||||
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
|
||||
#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D))
|
||||
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
|
||||
#define pthread_kill(A,B) pthread_dummy(0)
|
||||
#define pthread_kill(A,B) pthread_dummy(ESRCH)
|
||||
#undef pthread_detach_this_thread
|
||||
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DARWIN5_THREADS
|
||||
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
|
||||
#define pthread_kill(A,B) pthread_dummy(0)
|
||||
#define pthread_kill(A,B) pthread_dummy(ESRCH)
|
||||
#define pthread_condattr_init(A) pthread_dummy(0)
|
||||
#define pthread_condattr_destroy(A) pthread_dummy(0)
|
||||
#undef pthread_detach_this_thread
|
||||
@@ -388,7 +369,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res);
|
||||
#ifndef pthread_sigmask
|
||||
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
|
||||
#endif
|
||||
#define pthread_kill(A,B) pthread_dummy(0)
|
||||
#define pthread_kill(A,B) pthread_dummy(ESRCH)
|
||||
#undef pthread_detach_this_thread
|
||||
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
|
||||
#elif !defined(__NETWARE__) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */
|
||||
@@ -646,6 +627,11 @@ extern pthread_mutexattr_t my_errorcheck_mutexattr;
|
||||
#define MY_MUTEX_INIT_ERRCHK NULL
|
||||
#endif
|
||||
|
||||
#ifndef ESRCH
|
||||
/* Define it to something */
|
||||
#define ESRCH 1
|
||||
#endif
|
||||
|
||||
typedef ulong my_thread_id;
|
||||
|
||||
extern my_bool my_thread_global_init(void);
|
||||
|
@@ -750,7 +750,7 @@ void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
|
||||
@param thd user thread connection handle
|
||||
@param lex_str pointer to LEX_STRING object to be initialized
|
||||
@param str initializer to be copied into lex_str
|
||||
@param length length of str, in bytes
|
||||
@param size length of str, in bytes
|
||||
@param allocate_lex_string flag: if TRUE, allocate new LEX_STRING object,
|
||||
instead of using lex_str value
|
||||
@return NULL on failure, or pointer to the LEX_STRING object
|
||||
@@ -773,7 +773,7 @@ void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid);
|
||||
Invalidate the query cache for a given table.
|
||||
|
||||
@param thd user thread connection handle
|
||||
@param key databasename\0tablename\0
|
||||
@param key databasename\\0tablename\\0
|
||||
@param key_length length of key in bytes, including the NUL bytes
|
||||
@param using_trx flag: TRUE if using transactions, FALSE otherwise
|
||||
*/
|
||||
@@ -785,5 +785,28 @@ void mysql_query_cache_invalidate4(MYSQL_THD thd,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
/**
|
||||
Provide a handler data getter to simplify coding
|
||||
*/
|
||||
inline
|
||||
void *
|
||||
thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton)
|
||||
{
|
||||
return *thd_ha_data(thd, hton);
|
||||
}
|
||||
|
||||
/**
|
||||
Provide a handler data setter to simplify coding
|
||||
*/
|
||||
inline
|
||||
void
|
||||
thd_set_ha_data(const MYSQL_THD thd, const struct handlerton *hton,
|
||||
const void *ha_data)
|
||||
{
|
||||
*thd_ha_data(thd, hton)= (void*) ha_data;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
1073
include/mysql_h.ic
1073
include/mysql_h.ic
File diff suppressed because it is too large
Load Diff
@@ -4676,9 +4676,17 @@ int cli_read_binary_rows(MYSQL_STMT *stmt)
|
||||
MYSQL *mysql= stmt->mysql;
|
||||
MYSQL_DATA *result= &stmt->result;
|
||||
MYSQL_ROWS *cur, **prev_ptr= &result->data;
|
||||
NET *net = &mysql->net;
|
||||
NET *net;
|
||||
|
||||
if (!mysql)
|
||||
{
|
||||
set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate);
|
||||
return 1;
|
||||
}
|
||||
|
||||
DBUG_ENTER("cli_read_binary_rows");
|
||||
|
||||
net = &mysql->net;
|
||||
mysql= mysql->last_used_con;
|
||||
|
||||
while ((pkt_len= cli_safe_read(mysql)) != packet_error)
|
||||
|
@@ -564,6 +564,17 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag)
|
||||
init_alloc_root(&mysql->field_alloc, 8192, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Initialize a new THD for a connection in the embedded server
|
||||
|
||||
@param client_flag Client capabilities which this thread supports
|
||||
@return pointer to the created THD object
|
||||
|
||||
@todo
|
||||
This function copies code from several places in the server, including
|
||||
create_new_thread(), and prepare_new_connection_state(). This should
|
||||
be refactored to avoid code duplication.
|
||||
*/
|
||||
void *create_embedded_thd(int client_flag)
|
||||
{
|
||||
THD * thd= new THD;
|
||||
|
@@ -144,4 +144,29 @@ disconnect con1;
|
||||
disconnect con2;
|
||||
drop table t1, t2;
|
||||
|
||||
# End of 4.1 tests
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#25164 create table `a` as select * from `A` hangs
|
||||
#
|
||||
|
||||
set storage_engine=innodb;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists a;
|
||||
drop table if exists A;
|
||||
--enable_warnings
|
||||
|
||||
create table A (c int);
|
||||
insert into A (c) values (0);
|
||||
--error 0,ER_LOCK_DEADLOCK,ER_UPDATE_TABLE_USED
|
||||
create table a as select * from A;
|
||||
drop table A;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists a;
|
||||
--enable_warnings
|
||||
|
||||
set storage_engine=default;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
@@ -465,3 +465,36 @@ select * from t1;
|
||||
# Just to be sure and not confuse the next test case writer.
|
||||
drop table if exists t1;
|
||||
|
||||
#
|
||||
# Bug#25856 - HANDLER table OPEN in one connection lock DROP TABLE in another one
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
eval create table t1 (a int) ENGINE=$other_engine_type;
|
||||
--echo --> client 2
|
||||
connection con2;
|
||||
--error 1031
|
||||
handler t1 open;
|
||||
--echo --> client 1
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#30632 HANDLER read failure causes hang
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
handler t1 open as t1_alias;
|
||||
--error 1176
|
||||
handler t1_alias read a next;
|
||||
--error 1054
|
||||
handler t1_alias READ a next where inexistent > 0;
|
||||
--error 1176
|
||||
handler t1_alias read a next;
|
||||
--error 1054
|
||||
handler t1_alias READ a next where inexistent > 0;
|
||||
handler t1_alias close;
|
||||
drop table t1;
|
||||
|
@@ -939,6 +939,36 @@ alter table t1 add index(a(1024));
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #28570: handler::index_read() is called with different find_flag when
|
||||
# ORDER BY is used
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a INT,
|
||||
b INT,
|
||||
KEY (b)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES (1,10), (2,10), (2,20), (3,30);
|
||||
|
||||
START TRANSACTION;
|
||||
SELECT * FROM t1 WHERE b=20 FOR UPDATE;
|
||||
|
||||
--connect (conn2, localhost, root,,test)
|
||||
|
||||
# This statement gives a "failed: 1205: Lock wait timeout exceeded; try
|
||||
# restarting transaction" message when the bug is present.
|
||||
START TRANSACTION;
|
||||
SELECT * FROM t1 WHERE b=10 ORDER BY A FOR UPDATE;
|
||||
ROLLBACK;
|
||||
|
||||
--disconnect conn2
|
||||
--connection default
|
||||
|
||||
ROLLBACK;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
|
||||
|
@@ -9,5 +9,6 @@ eval SHOW CREATE TABLE t1;
|
||||
# listing of files belonging to the table t1
|
||||
if ($ls)
|
||||
{
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
|
||||
}
|
||||
|
@@ -275,5 +275,223 @@ drop table t1;
|
||||
--echo ---- disconnect connection con1 ----
|
||||
disconnect con1;
|
||||
|
||||
#
|
||||
# Bug #25843 Changing default database between PREPARE and EXECUTE of statement
|
||||
# breaks binlog.
|
||||
#
|
||||
# There were actually two problems discovered by this bug:
|
||||
#
|
||||
# 1. Default (current) database is not fixed at the creation time.
|
||||
# That leads to wrong output of DATABASE() function.
|
||||
#
|
||||
# 2. Database attributes (@@collation_database) are not fixed at the creation
|
||||
# time. That leads to wrong resultset.
|
||||
#
|
||||
# Binlog breakage and Query Cache wrong output happened because of the first
|
||||
# problem.
|
||||
#
|
||||
|
||||
--echo ########################################################################
|
||||
--echo #
|
||||
--echo # BUG#25843: Changing default database between PREPARE and EXECUTE of
|
||||
--echo # statement breaks binlog.
|
||||
--echo #
|
||||
--echo ########################################################################
|
||||
|
||||
###############################################################################
|
||||
|
||||
--echo
|
||||
--echo #
|
||||
--echo # Check that default database and its attributes are fixed at the
|
||||
--echo # creation time.
|
||||
--echo #
|
||||
|
||||
# Prepare data structures.
|
||||
|
||||
--echo
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqltest1;
|
||||
DROP DATABASE IF EXISTS mysqltest2;
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
CREATE DATABASE mysqltest1 COLLATE utf8_unicode_ci;
|
||||
CREATE DATABASE mysqltest2 COLLATE utf8_general_ci;
|
||||
|
||||
--echo
|
||||
CREATE TABLE mysqltest1.t1(msg VARCHAR(255));
|
||||
CREATE TABLE mysqltest2.t1(msg VARCHAR(255));
|
||||
|
||||
# - Create a prepared statement with mysqltest1 as default database;
|
||||
|
||||
--echo
|
||||
|
||||
use mysqltest1;
|
||||
|
||||
PREPARE stmt_a_1 FROM 'INSERT INTO t1 VALUES(DATABASE())';
|
||||
PREPARE stmt_a_2 FROM 'INSERT INTO t1 VALUES(@@collation_database)';
|
||||
|
||||
# - Execute on mysqltest1.
|
||||
|
||||
--echo
|
||||
|
||||
EXECUTE stmt_a_1;
|
||||
EXECUTE stmt_a_2;
|
||||
|
||||
# - Execute on mysqltest2.
|
||||
|
||||
--echo
|
||||
|
||||
use mysqltest2;
|
||||
|
||||
EXECUTE stmt_a_1;
|
||||
EXECUTE stmt_a_2;
|
||||
|
||||
# - Check the results;
|
||||
|
||||
--echo
|
||||
SELECT * FROM mysqltest1.t1;
|
||||
|
||||
--echo
|
||||
SELECT * FROM mysqltest2.t1;
|
||||
|
||||
# - Drop prepared statements.
|
||||
|
||||
--echo
|
||||
DROP PREPARE stmt_a_1;
|
||||
DROP PREPARE stmt_a_2;
|
||||
|
||||
###############################################################################
|
||||
|
||||
--echo
|
||||
--echo #
|
||||
--echo # The Query Cache test case.
|
||||
--echo #
|
||||
|
||||
--echo
|
||||
DELETE FROM mysqltest1.t1;
|
||||
DELETE FROM mysqltest2.t1;
|
||||
|
||||
--echo
|
||||
INSERT INTO mysqltest1.t1 VALUES('mysqltest1.t1');
|
||||
INSERT INTO mysqltest2.t1 VALUES('mysqltest2.t1');
|
||||
|
||||
--echo
|
||||
use mysqltest1;
|
||||
PREPARE stmt_b_1 FROM 'SELECT * FROM t1';
|
||||
|
||||
--echo
|
||||
use mysqltest2;
|
||||
PREPARE stmt_b_2 FROM 'SELECT * FROM t1';
|
||||
|
||||
--echo
|
||||
EXECUTE stmt_b_1;
|
||||
|
||||
--echo
|
||||
EXECUTE stmt_b_2;
|
||||
|
||||
--echo
|
||||
use mysqltest1;
|
||||
|
||||
--echo
|
||||
EXECUTE stmt_b_1;
|
||||
|
||||
--echo
|
||||
EXECUTE stmt_b_2;
|
||||
|
||||
--echo
|
||||
DROP PREPARE stmt_b_1;
|
||||
DROP PREPARE stmt_b_2;
|
||||
|
||||
# Cleanup.
|
||||
|
||||
--echo
|
||||
use test;
|
||||
|
||||
--echo
|
||||
DROP DATABASE mysqltest1;
|
||||
DROP DATABASE mysqltest2;
|
||||
|
||||
###############################################################################
|
||||
|
||||
--echo
|
||||
--echo #
|
||||
--echo # Check that prepared statements work properly when there is no current
|
||||
--echo # database.
|
||||
--echo #
|
||||
|
||||
--echo
|
||||
CREATE DATABASE mysqltest1 COLLATE utf8_unicode_ci;
|
||||
CREATE DATABASE mysqltest2 COLLATE utf8_general_ci;
|
||||
|
||||
--echo
|
||||
use mysqltest1;
|
||||
|
||||
--echo
|
||||
PREPARE stmt_c_1 FROM 'SELECT DATABASE(), @@collation_database';
|
||||
|
||||
--echo
|
||||
use mysqltest2;
|
||||
|
||||
--echo
|
||||
PREPARE stmt_c_2 FROM 'SELECT DATABASE(), @@collation_database';
|
||||
|
||||
--echo
|
||||
DROP DATABASE mysqltest2;
|
||||
|
||||
--echo
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
|
||||
# -- Here we have: current db: NULL; stmt db: mysqltest1;
|
||||
--echo
|
||||
EXECUTE stmt_c_1;
|
||||
|
||||
--echo
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
|
||||
# -- Here we have: current db: NULL; stmt db: mysqltest2 (non-existent);
|
||||
--echo
|
||||
EXECUTE stmt_c_2;
|
||||
|
||||
--echo
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
|
||||
# -- Create prepared statement, which has no current database.
|
||||
|
||||
--echo
|
||||
PREPARE stmt_c_3 FROM 'SELECT DATABASE(), @@collation_database';
|
||||
|
||||
# -- Here we have: current db: NULL; stmt db: NULL;
|
||||
--echo
|
||||
EXECUTE stmt_c_3;
|
||||
|
||||
--echo
|
||||
use mysqltest1;
|
||||
|
||||
# -- Here we have: current db: mysqltest1; stmt db: mysqltest2 (non-existent);
|
||||
--echo
|
||||
EXECUTE stmt_c_2;
|
||||
|
||||
--echo
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
|
||||
# -- Here we have: current db: mysqltest1; stmt db: NULL;
|
||||
--echo
|
||||
EXECUTE stmt_c_3;
|
||||
|
||||
--echo
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
|
||||
--echo
|
||||
DROP DATABASE mysqltest1;
|
||||
|
||||
--echo
|
||||
use test;
|
||||
|
||||
--echo
|
||||
--echo ########################################################################
|
||||
|
||||
###############################################################################
|
||||
|
||||
set @@global.query_cache_size=@initial_query_cache_size;
|
||||
flush status; # reset Qcache status variables for next tests
|
||||
|
@@ -35,7 +35,7 @@ eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB";
|
||||
--error ER_CANT_FIND_DL_ENTRY
|
||||
eval CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB";
|
||||
--replace_column 3 UDF_LIB
|
||||
SELECT * FROM mysql.func;
|
||||
SELECT * FROM mysql.func ORDER BY name;
|
||||
--disable_info
|
||||
|
||||
save_master_pos;
|
||||
@@ -46,7 +46,7 @@ sync_with_master;
|
||||
--echo "Running on the slave"
|
||||
--enable_info
|
||||
--replace_column 3 UDF_LIB
|
||||
SELECT * FROM mysql.func;
|
||||
SELECT * FROM mysql.func ORDER BY name;
|
||||
--disable_info
|
||||
|
||||
connection master;
|
||||
@@ -81,7 +81,7 @@ connection master;
|
||||
--enable_info
|
||||
DROP FUNCTION myfunc_double;
|
||||
DROP FUNCTION myfunc_int;
|
||||
SELECT * FROM mysql.func;
|
||||
SELECT * FROM mysql.func ORDER BY name;
|
||||
--disable_info
|
||||
|
||||
sync_slave_with_master;
|
||||
@@ -89,7 +89,7 @@ sync_slave_with_master;
|
||||
# Check to see if the UDFs were dropped on the slave
|
||||
--echo "Running on the slave"
|
||||
--enable_info
|
||||
SELECT * FROM mysql.func;
|
||||
SELECT * FROM mysql.func ORDER BY name;
|
||||
--disable_info
|
||||
|
||||
connection master;
|
||||
@@ -108,7 +108,7 @@ DROP TABLE t1;
|
||||
--enable_info
|
||||
CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i;
|
||||
CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00;
|
||||
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
|
||||
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
||||
--disable_info
|
||||
|
||||
sync_slave_with_master;
|
||||
@@ -116,7 +116,7 @@ sync_slave_with_master;
|
||||
# Check to see that UDF CREATE statements were replicated
|
||||
--echo "Running on the slave"
|
||||
--enable_info
|
||||
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
|
||||
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
||||
--disable_info
|
||||
|
||||
connection master;
|
||||
@@ -147,7 +147,7 @@ connection master;
|
||||
--enable_info
|
||||
ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
|
||||
ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
|
||||
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
|
||||
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
||||
--disable_info
|
||||
|
||||
sync_slave_with_master;
|
||||
@@ -155,7 +155,7 @@ sync_slave_with_master;
|
||||
# Check to see if data was replicated
|
||||
--echo "Running on the slave"
|
||||
--enable_info
|
||||
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
|
||||
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
||||
|
||||
# Check to see that the functions are available for execution on the slave
|
||||
SELECT myfuncsql_int(25);
|
||||
@@ -169,7 +169,7 @@ connection master;
|
||||
--enable_info
|
||||
DROP FUNCTION myfuncsql_double;
|
||||
DROP FUNCTION myfuncsql_int;
|
||||
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
|
||||
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
||||
--disable_info
|
||||
|
||||
sync_slave_with_master;
|
||||
@@ -177,7 +177,7 @@ sync_slave_with_master;
|
||||
# Check to see if the UDFs were dropped on the slave
|
||||
--echo "Running on the slave"
|
||||
--enable_info
|
||||
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%';
|
||||
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
|
||||
--disable_info
|
||||
|
||||
connection master;
|
||||
|
@@ -17,6 +17,7 @@
|
||||
# let $wait_condition=
|
||||
# SELECT c = 3 FROM t;
|
||||
# --source include/wait_condition.inc
|
||||
# --echo Executed the test condition $wait_condition_reps times
|
||||
#
|
||||
# EXAMPLE
|
||||
# events_bugs.test, events_time_zone.test
|
||||
@@ -33,9 +34,13 @@ if ($wait_timeout)
|
||||
# calls, and default will be used instead.
|
||||
let $wait_timeout= 0;
|
||||
|
||||
# Keep track of how many times the wait condition is tested
|
||||
# This is used by some tests (e.g., main.status)
|
||||
let $wait_condition_reps= 0;
|
||||
while ($wait_counter)
|
||||
{
|
||||
let $success= `$wait_condition`;
|
||||
inc $wait_condition_reps;
|
||||
if ($success)
|
||||
{
|
||||
let $wait_counter= 0;
|
||||
|
@@ -53,7 +53,8 @@ sub collect_test_cases ($) {
|
||||
my $found= 0;
|
||||
foreach my $test ( @$cases )
|
||||
{
|
||||
if ( mtr_match_extension($test->{'name'}, $tname) )
|
||||
if ( $test->{'name'} eq $tname ||
|
||||
mtr_match_extension($test->{'name'}, $tname) )
|
||||
{
|
||||
$found= 1;
|
||||
}
|
||||
@@ -192,8 +193,9 @@ sub collect_one_suite($$)
|
||||
if ( @::opt_cases )
|
||||
{
|
||||
# Collect in specified order, no sort
|
||||
foreach my $tname ( @::opt_cases )
|
||||
foreach my $tname2 ( @::opt_cases )
|
||||
{
|
||||
my $tname= $tname2; # Don't modify @::opt_cases !
|
||||
my $elem= undef;
|
||||
my $component_id= undef;
|
||||
|
||||
@@ -202,6 +204,9 @@ sub collect_one_suite($$)
|
||||
|
||||
$tname = basename($tname);
|
||||
|
||||
# Get rid of suite part
|
||||
$tname =~ s/^$suite\.//;
|
||||
|
||||
# Check if the extenstion has been specified.
|
||||
|
||||
if ( mtr_match_extension($tname, "test") )
|
||||
|
@@ -19,9 +19,8 @@
|
||||
# same name.
|
||||
|
||||
use strict;
|
||||
use File::Find;
|
||||
|
||||
sub mtr_full_hostname ();
|
||||
sub mtr_short_hostname ();
|
||||
sub mtr_native_path($);
|
||||
sub mtr_init_args ($);
|
||||
sub mtr_add_arg ($$@);
|
||||
@@ -31,6 +30,7 @@ sub mtr_file_exists(@);
|
||||
sub mtr_exe_exists(@);
|
||||
sub mtr_exe_maybe_exists(@);
|
||||
sub mtr_copy_dir($$);
|
||||
sub mtr_rmtree($);
|
||||
sub mtr_same_opts($$);
|
||||
sub mtr_cmp_opts($$);
|
||||
|
||||
@@ -40,30 +40,6 @@ sub mtr_cmp_opts($$);
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# We want the fully qualified host name and hostname() may have returned
|
||||
# only the short name. So we use the resolver to find out.
|
||||
# Note that this might fail on some platforms
|
||||
|
||||
sub mtr_full_hostname () {
|
||||
|
||||
my $hostname= hostname();
|
||||
if ( $hostname !~ /\./ )
|
||||
{
|
||||
my $address= gethostbyname($hostname)
|
||||
or mtr_error("Couldn't resolve $hostname : $!");
|
||||
my $fullname= gethostbyaddr($address, AF_INET);
|
||||
$hostname= $fullname if $fullname;
|
||||
}
|
||||
return $hostname;
|
||||
}
|
||||
|
||||
sub mtr_short_hostname () {
|
||||
|
||||
my $hostname= hostname();
|
||||
$hostname =~ s/\..+$//;
|
||||
return $hostname;
|
||||
}
|
||||
|
||||
# Convert path to OS native format
|
||||
sub mtr_native_path($)
|
||||
{
|
||||
@@ -226,6 +202,57 @@ sub mtr_copy_dir($$) {
|
||||
}
|
||||
|
||||
|
||||
sub mtr_rmtree($) {
|
||||
my ($dir)= @_;
|
||||
mtr_verbose("mtr_rmtree: $dir");
|
||||
|
||||
# Try to use File::Path::rmtree. Recent versions
|
||||
# handles removal of directories and files that don't
|
||||
# have full permissions, while older versions
|
||||
# may have a problem with that and we use our own version
|
||||
|
||||
eval { rmtree($dir); };
|
||||
if ( $@ ) {
|
||||
mtr_warning("rmtree($dir) failed, trying with File::Find...");
|
||||
|
||||
my $errors= 0;
|
||||
|
||||
# chmod
|
||||
find( {
|
||||
no_chdir => 1,
|
||||
wanted => sub {
|
||||
chmod(0777, $_)
|
||||
or mtr_warning("couldn't chmod(0777, $_): $!") and $errors++;
|
||||
}
|
||||
},
|
||||
$dir
|
||||
);
|
||||
|
||||
# rm
|
||||
finddepth( {
|
||||
no_chdir => 1,
|
||||
wanted => sub {
|
||||
my $file= $_;
|
||||
# Use special underscore (_) filehandle, caches stat info
|
||||
if (!-l $file and -d _ ) {
|
||||
rmdir($file) or
|
||||
mtr_warning("couldn't rmdir($file): $!") and $errors++;
|
||||
} else {
|
||||
unlink($file)
|
||||
or mtr_warning("couldn't unlink($file): $!") and $errors++;
|
||||
}
|
||||
}
|
||||
},
|
||||
$dir
|
||||
);
|
||||
|
||||
mtr_error("Failed to remove '$dir'") if $errors;
|
||||
|
||||
mtr_report("OK, that worked!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub mtr_same_opts ($$) {
|
||||
my $l1= shift;
|
||||
my $l2= shift;
|
||||
|
@@ -99,25 +99,26 @@ sub spawn_impl ($$$$$$$) {
|
||||
|
||||
if ( $::opt_script_debug )
|
||||
{
|
||||
print STDERR "\n";
|
||||
print STDERR "#### ", "-" x 78, "\n";
|
||||
print STDERR "#### ", "STDIN $input\n" if $input;
|
||||
print STDERR "#### ", "STDOUT $output\n" if $output;
|
||||
print STDERR "#### ", "STDERR $error\n" if $error;
|
||||
print STDERR "#### ", "$mode : $path ", join(" ",@$arg_list_t), "\n";
|
||||
print STDERR "#### ", "spawn options:\n";
|
||||
mtr_report("");
|
||||
mtr_debug("-" x 73);
|
||||
mtr_debug("STDIN $input") if $input;
|
||||
mtr_debug("STDOUT $output") if $output;
|
||||
mtr_debug("STDERR $error") if $error;
|
||||
mtr_debug("$mode: $path ", join(" ",@$arg_list_t));
|
||||
mtr_debug("spawn options:");
|
||||
if ($spawn_opts)
|
||||
{
|
||||
foreach my $key (sort keys %{$spawn_opts})
|
||||
{
|
||||
print STDERR "#### ", " - $key: $spawn_opts->{$key}\n";
|
||||
mtr_debug(" - $key: $spawn_opts->{$key}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "#### ", " none\n";
|
||||
mtr_debug(" none");
|
||||
}
|
||||
print STDERR "#### ", "-" x 78, "\n";
|
||||
mtr_debug("-" x 73);
|
||||
mtr_report("");
|
||||
}
|
||||
|
||||
mtr_error("Can't spawn with empty \"path\"") unless defined $path;
|
||||
|
@@ -19,6 +19,7 @@
|
||||
# same name.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub mtr_report_test_name($);
|
||||
sub mtr_report_test_passed($);
|
||||
@@ -26,7 +27,6 @@ sub mtr_report_test_failed($);
|
||||
sub mtr_report_test_skipped($);
|
||||
sub mtr_report_test_not_skipped_though_disabled($);
|
||||
|
||||
sub mtr_show_failed_diff ($);
|
||||
sub mtr_report_stats ($);
|
||||
sub mtr_print_line ();
|
||||
sub mtr_print_thick_line ();
|
||||
@@ -38,6 +38,9 @@ sub mtr_child_error (@);
|
||||
sub mtr_debug (@);
|
||||
sub mtr_verbose (@);
|
||||
|
||||
my $tot_real_time= 0;
|
||||
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -45,43 +48,10 @@ sub mtr_verbose (@);
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# We can't use diff -u or diff -a as these are not portable
|
||||
|
||||
sub mtr_show_failed_diff ($) {
|
||||
my $tinfo= shift;
|
||||
|
||||
# The reject and log files have been dumped to
|
||||
# to filenames based on the result_file's name
|
||||
my $base_file= mtr_match_extension($tinfo->{'result_file'},
|
||||
"result"); # Trim extension
|
||||
my $reject_file= "$base_file.reject";
|
||||
my $result_file= "$base_file.result";
|
||||
my $log_file= "$base_file.log";
|
||||
|
||||
my $diffopts= $::opt_udiff ? "-u" : "-c";
|
||||
|
||||
if ( -f $reject_file )
|
||||
{
|
||||
print "Below are the diffs between actual and expected results:\n";
|
||||
print "-------------------------------------------------------\n";
|
||||
# FIXME check result code?!
|
||||
mtr_run("diff",[$diffopts,$result_file,$reject_file], "", "", "", "");
|
||||
print "-------------------------------------------------------\n";
|
||||
print "Please follow the instructions outlined at\n";
|
||||
print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n";
|
||||
print "to find the reason to this problem and how to report this.\n\n";
|
||||
}
|
||||
|
||||
if ( -f $log_file )
|
||||
{
|
||||
print "Result from queries before failure can be found in $log_file\n";
|
||||
# FIXME Maybe a tail -f -n 10 $log_file here
|
||||
}
|
||||
}
|
||||
|
||||
sub mtr_report_test_name ($) {
|
||||
my $tinfo= shift;
|
||||
|
||||
_mtr_log("$tinfo->{name}");
|
||||
printf "%-30s ", $tinfo->{'name'};
|
||||
}
|
||||
|
||||
@@ -91,15 +61,15 @@ sub mtr_report_test_skipped ($) {
|
||||
$tinfo->{'result'}= 'MTR_RES_SKIPPED';
|
||||
if ( $tinfo->{'disable'} )
|
||||
{
|
||||
print "[ disabled ] $tinfo->{'comment'}\n";
|
||||
mtr_report("[ disabled ] $tinfo->{'comment'}");
|
||||
}
|
||||
elsif ( $tinfo->{'comment'} )
|
||||
{
|
||||
print "[ skipped ] $tinfo->{'comment'}\n";
|
||||
mtr_report("[ skipped ] $tinfo->{'comment'}");
|
||||
}
|
||||
else
|
||||
{
|
||||
print "[ skipped ]\n";
|
||||
mtr_report("[ skipped ]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,11 +97,11 @@ sub mtr_report_test_passed ($) {
|
||||
if ( $::opt_timer and -f "$::opt_vardir/log/timer" )
|
||||
{
|
||||
$timer= mtr_fromfile("$::opt_vardir/log/timer");
|
||||
$::glob_tot_real_time += ($timer/1000);
|
||||
$tot_real_time += ($timer/1000);
|
||||
$timer= sprintf "%12s", $timer;
|
||||
}
|
||||
$tinfo->{'result'}= 'MTR_RES_PASSED';
|
||||
print "[ pass ] $timer\n";
|
||||
mtr_report("[ pass ] $timer");
|
||||
}
|
||||
|
||||
sub mtr_report_test_failed ($) {
|
||||
@@ -140,27 +110,34 @@ sub mtr_report_test_failed ($) {
|
||||
$tinfo->{'result'}= 'MTR_RES_FAILED';
|
||||
if ( defined $tinfo->{'timeout'} )
|
||||
{
|
||||
print "[ fail ] timeout\n";
|
||||
mtr_report("[ fail ] timeout");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "[ fail ]\n";
|
||||
mtr_report("[ fail ]");
|
||||
}
|
||||
|
||||
if ( $tinfo->{'comment'} )
|
||||
{
|
||||
print "\nERROR: $tinfo->{'comment'}\n";
|
||||
# The test failure has been detected by mysql-test-run.pl
|
||||
# when starting the servers or due to other error, the reason for
|
||||
# failing the test is saved in "comment"
|
||||
mtr_report("\nERROR: $tinfo->{'comment'}");
|
||||
}
|
||||
elsif ( -f $::path_timefile )
|
||||
{
|
||||
print "\nErrors are (from $::path_timefile) :\n";
|
||||
# Test failure was detected by test tool and it's report
|
||||
# about what failed has been saved to file. Display the report.
|
||||
print "\n";
|
||||
print mtr_fromfile($::path_timefile); # FIXME print_file() instead
|
||||
print "\n(the last lines may be the most important ones)\n";
|
||||
print "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "\nUnexpected termination, probably when starting mysqld\n";
|
||||
# Neither this script or the test tool has recorded info
|
||||
# about why the test has failed. Should be debugged.
|
||||
mtr_report("\nUnexpected termination, probably when starting mysqld");;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,8 +205,10 @@ sub mtr_report_stats ($) {
|
||||
|
||||
if ( $::opt_timer )
|
||||
{
|
||||
print
|
||||
"Spent $::glob_tot_real_time seconds actually executing testcases\n"
|
||||
use English;
|
||||
|
||||
mtr_report("Spent", sprintf("%.3f", $tot_real_time),"of",
|
||||
time - $BASETIME, "seconds executing testcases");
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
@@ -484,35 +463,66 @@ sub mtr_print_header () {
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Misc
|
||||
# Log and reporting functions
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
use IO::File;
|
||||
|
||||
my $log_file_ref= undef;
|
||||
|
||||
sub mtr_log_init ($) {
|
||||
my ($filename)= @_;
|
||||
|
||||
mtr_error("Log is already open") if defined $log_file_ref;
|
||||
|
||||
$log_file_ref= IO::File->new($filename, "a") or
|
||||
mtr_warning("Could not create logfile $filename: $!");
|
||||
}
|
||||
|
||||
sub _mtr_log (@) {
|
||||
print $log_file_ref join(" ", @_),"\n"
|
||||
if defined $log_file_ref;
|
||||
}
|
||||
|
||||
sub mtr_report (@) {
|
||||
# Print message to screen and log
|
||||
_mtr_log(@_);
|
||||
print join(" ", @_),"\n";
|
||||
}
|
||||
|
||||
sub mtr_warning (@) {
|
||||
# Print message to screen and log
|
||||
_mtr_log("WARNING: ", @_);
|
||||
print STDERR "mysql-test-run: WARNING: ",join(" ", @_),"\n";
|
||||
}
|
||||
|
||||
sub mtr_error (@) {
|
||||
# Print message to screen and log
|
||||
_mtr_log("ERROR: ", @_);
|
||||
print STDERR "mysql-test-run: *** ERROR: ",join(" ", @_),"\n";
|
||||
mtr_exit(1);
|
||||
}
|
||||
|
||||
sub mtr_child_error (@) {
|
||||
# Print message to screen and log
|
||||
_mtr_log("ERROR(child): ", @_);
|
||||
print STDERR "mysql-test-run: *** ERROR(child): ",join(" ", @_),"\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sub mtr_debug (@) {
|
||||
# Only print if --script-debug is used
|
||||
if ( $::opt_script_debug )
|
||||
{
|
||||
_mtr_log("###: ", @_);
|
||||
print STDERR "####: ",join(" ", @_),"\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub mtr_verbose (@) {
|
||||
# Always print to log, print to screen only when --verbose is used
|
||||
_mtr_log("> ",@_);
|
||||
if ( $::opt_verbose )
|
||||
{
|
||||
print STDERR "> ",join(" ", @_),"\n";
|
||||
|
@@ -18,7 +18,6 @@
|
||||
# and is part of the translation of the Bourne shell script with the
|
||||
# same name.
|
||||
|
||||
use Socket;
|
||||
use Errno;
|
||||
use strict;
|
||||
|
||||
@@ -52,12 +51,10 @@ sub mtr_init_timers () {
|
||||
sub mtr_timer_start($$$) {
|
||||
my ($timers,$name,$duration)= @_;
|
||||
|
||||
mtr_verbose("mtr_timer_start: $name, $duration");
|
||||
|
||||
if ( exists $timers->{'timers'}->{$name} )
|
||||
{
|
||||
# We have an old running timer, kill it
|
||||
mtr_verbose("There is an old timer running");
|
||||
mtr_warning("There is an old timer running");
|
||||
mtr_timer_stop($timers,$name);
|
||||
}
|
||||
|
||||
@@ -75,22 +72,22 @@ sub mtr_timer_start($$$) {
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_error("can't fork");
|
||||
mtr_error("can't fork timer, error: $!");
|
||||
}
|
||||
}
|
||||
|
||||
if ( $tpid )
|
||||
{
|
||||
# Parent, record the information
|
||||
mtr_verbose("timer parent, record info($name, $tpid, $duration)");
|
||||
mtr_verbose("Starting timer for '$name',",
|
||||
"duration: $duration, pid: $tpid");
|
||||
$timers->{'timers'}->{$name}->{'pid'}= $tpid;
|
||||
$timers->{'timers'}->{$name}->{'duration'}= $duration;
|
||||
$timers->{'pids'}->{$tpid}= $name;
|
||||
}
|
||||
else
|
||||
{
|
||||
# Child, redirect output and exec
|
||||
# FIXME do we need to redirect streams?
|
||||
# Child, install signal handlers and sleep for "duration"
|
||||
|
||||
# Don't do the ^C cleanup in the timeout child processes!
|
||||
# There is actually a race here, if we get ^C after fork(), but before
|
||||
@@ -98,13 +95,13 @@ sub mtr_timer_start($$$) {
|
||||
$SIG{INT}= 'DEFAULT';
|
||||
|
||||
$SIG{TERM}= sub {
|
||||
mtr_verbose("timer woke up, exiting!");
|
||||
mtr_verbose("timer $$ woke up, exiting!");
|
||||
exit(0);
|
||||
};
|
||||
|
||||
$0= "mtr_timer(timers,$name,$duration)";
|
||||
sleep($duration);
|
||||
mtr_verbose("timer expired after $duration seconds");
|
||||
mtr_verbose("timer $$ expired after $duration seconds");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
@@ -114,12 +111,10 @@ sub mtr_timer_start($$$) {
|
||||
sub mtr_timer_stop ($$) {
|
||||
my ($timers,$name)= @_;
|
||||
|
||||
mtr_verbose("mtr_timer_stop: $name");
|
||||
|
||||
if ( exists $timers->{'timers'}->{$name} )
|
||||
{
|
||||
my $tpid= $timers->{'timers'}->{$name}->{'pid'};
|
||||
mtr_verbose("Stopping timer with pid $tpid");
|
||||
mtr_verbose("Stopping timer for '$name' with pid $tpid");
|
||||
|
||||
# FIXME as Cygwin reuses pids fast, maybe check that is
|
||||
# the expected process somehow?!
|
||||
@@ -134,11 +129,8 @@ sub mtr_timer_stop ($$) {
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_error("Asked to stop timer \"$name\" not started");
|
||||
return 0;
|
||||
}
|
||||
|
||||
mtr_error("Asked to stop timer '$name' not started");
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +150,8 @@ sub mtr_timer_timeout ($$) {
|
||||
|
||||
return "" unless exists $timers->{'pids'}->{$pid};
|
||||
|
||||
# We got a timeout, return the name ot the timer
|
||||
# Got a timeout(the process with $pid is recorded as being a timer)
|
||||
# return the name of the timer
|
||||
return $timers->{'pids'}->{$pid};
|
||||
}
|
||||
|
||||
|
@@ -61,7 +61,6 @@ use File::Copy;
|
||||
use File::Temp qw /tempdir/;
|
||||
use Cwd;
|
||||
use Getopt::Long;
|
||||
use Sys::Hostname;
|
||||
use IO::Socket;
|
||||
use IO::Socket::INET;
|
||||
use strict;
|
||||
@@ -83,7 +82,6 @@ require "lib/mtr_io.pl";
|
||||
require "lib/mtr_gcov.pl";
|
||||
require "lib/mtr_gprof.pl";
|
||||
require "lib/mtr_report.pl";
|
||||
require "lib/mtr_diff.pl";
|
||||
require "lib/mtr_match.pl";
|
||||
require "lib/mtr_misc.pl";
|
||||
require "lib/mtr_stress.pl";
|
||||
@@ -101,7 +99,6 @@ $Devel::Trace::TRACE= 1;
|
||||
our $mysql_version_id;
|
||||
our $glob_mysql_test_dir= undef;
|
||||
our $glob_mysql_bench_dir= undef;
|
||||
our $glob_hostname= undef;
|
||||
our $glob_scriptname= undef;
|
||||
our $glob_timers= undef;
|
||||
our $glob_use_embedded_server= 0;
|
||||
@@ -234,7 +231,6 @@ my $opt_report_features;
|
||||
our $opt_check_testcases;
|
||||
our $opt_mark_progress;
|
||||
|
||||
our $opt_skip;
|
||||
our $opt_skip_rpl;
|
||||
our $max_slave_num= 0;
|
||||
our $max_master_num= 1;
|
||||
@@ -277,13 +273,8 @@ our $opt_stress_test_duration= 0;
|
||||
our $opt_stress_init_file= "";
|
||||
our $opt_stress_test_file= "";
|
||||
|
||||
our $opt_wait_for_master;
|
||||
our $opt_wait_for_slave;
|
||||
|
||||
our $opt_warnings;
|
||||
|
||||
our $opt_udiff;
|
||||
|
||||
our $opt_skip_ndbcluster= 0;
|
||||
our $opt_skip_ndbcluster_slave= 0;
|
||||
our $opt_with_ndbcluster= 0;
|
||||
@@ -307,7 +298,6 @@ our @data_dir_lst;
|
||||
our $used_binlog_format;
|
||||
our $used_default_engine;
|
||||
our $debug_compiled_binaries;
|
||||
our $glob_tot_real_time= 0;
|
||||
|
||||
our %mysqld_variables;
|
||||
|
||||
@@ -619,7 +609,6 @@ sub command_line_setup () {
|
||||
'start-dirty' => \$opt_start_dirty,
|
||||
'start-and-exit' => \$opt_start_and_exit,
|
||||
'timer!' => \$opt_timer,
|
||||
'unified-diff|udiff' => \$opt_udiff,
|
||||
'user=s' => \$opt_user,
|
||||
'testcase-timeout=i' => \$opt_testcase_timeout,
|
||||
'suite-timeout=i' => \$opt_suite_timeout,
|
||||
@@ -655,8 +644,6 @@ sub command_line_setup () {
|
||||
$source_dist= 1;
|
||||
}
|
||||
|
||||
$glob_hostname= mtr_short_hostname();
|
||||
|
||||
# Find the absolute path to the test directory
|
||||
$glob_mysql_test_dir= cwd();
|
||||
if ( $glob_cygwin_perl )
|
||||
@@ -933,26 +920,6 @@ sub command_line_setup () {
|
||||
mtr_error("Will not run in record mode without a specific test case");
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Embedded server flag
|
||||
# --------------------------------------------------------------------------
|
||||
if ( $opt_embedded_server )
|
||||
{
|
||||
$glob_use_embedded_server= 1;
|
||||
push(@glob_test_mode, "embedded");
|
||||
$opt_skip_rpl= 1; # We never run replication with embedded
|
||||
$opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
|
||||
$opt_skip_ssl= 1; # Turn off use of SSL
|
||||
|
||||
# Turn off use of bin log
|
||||
push(@opt_extra_mysqld_opt, "--skip-log-bin");
|
||||
|
||||
if ( $opt_extern )
|
||||
{
|
||||
mtr_error("Can't use --extern with --embedded-server");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# ps protcol flag
|
||||
@@ -2229,7 +2196,7 @@ sub remove_stale_vardir () {
|
||||
{
|
||||
# Remove the directory which the link points at
|
||||
mtr_verbose("Removing " . readlink($opt_vardir));
|
||||
rmtree(readlink($opt_vardir));
|
||||
mtr_rmtree(readlink($opt_vardir));
|
||||
|
||||
# Remove the "var" symlink
|
||||
mtr_verbose("unlink($opt_vardir)");
|
||||
@@ -2257,7 +2224,7 @@ sub remove_stale_vardir () {
|
||||
foreach my $bin ( glob("$opt_vardir/*") )
|
||||
{
|
||||
mtr_verbose("Removing bin $bin");
|
||||
rmtree($bin);
|
||||
mtr_rmtree($bin);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2265,7 +2232,7 @@ sub remove_stale_vardir () {
|
||||
{
|
||||
# Remove the entire "var" dir
|
||||
mtr_verbose("Removing $opt_vardir/");
|
||||
rmtree("$opt_vardir/");
|
||||
mtr_rmtree("$opt_vardir/");
|
||||
}
|
||||
|
||||
if ( $opt_mem )
|
||||
@@ -2274,7 +2241,7 @@ sub remove_stale_vardir () {
|
||||
# remove the $opt_mem dir to assure the symlink
|
||||
# won't point at an old directory
|
||||
mtr_verbose("Removing $opt_mem");
|
||||
rmtree($opt_mem);
|
||||
mtr_rmtree($opt_mem);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2287,11 +2254,11 @@ sub remove_stale_vardir () {
|
||||
# Remove the var/ dir in mysql-test dir if any
|
||||
# this could be an old symlink that shouldn't be there
|
||||
mtr_verbose("Removing $default_vardir");
|
||||
rmtree($default_vardir);
|
||||
mtr_rmtree($default_vardir);
|
||||
|
||||
# Remove the "var" dir
|
||||
mtr_verbose("Removing $opt_vardir/");
|
||||
rmtree("$opt_vardir/");
|
||||
mtr_rmtree("$opt_vardir/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2944,13 +2911,16 @@ sub initialize_servers () {
|
||||
}
|
||||
}
|
||||
check_running_as_root();
|
||||
|
||||
mtr_log_init("$opt_vardir/log/mysql-test-run.log");
|
||||
|
||||
}
|
||||
|
||||
sub mysql_install_db () {
|
||||
|
||||
install_db('master', $master->[0]->{'path_myddir'});
|
||||
|
||||
if ($max_master_num)
|
||||
if ($max_master_num > 1)
|
||||
{
|
||||
copy_install_db('master', $master->[1]->{'path_myddir'});
|
||||
}
|
||||
@@ -3112,11 +3082,15 @@ sub install_db ($$) {
|
||||
mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql",
|
||||
$bootstrap_sql_file);
|
||||
|
||||
mtr_tofile($bootstrap_sql_file,
|
||||
"DELETE FROM mysql.user where user= '';");
|
||||
|
||||
# Log bootstrap command
|
||||
my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
|
||||
mtr_tofile($path_bootstrap_log,
|
||||
"$exe_mysqld_bootstrap " . join(" ", @$args) . "\n");
|
||||
|
||||
|
||||
if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file,
|
||||
$path_bootstrap_log, $path_bootstrap_log,
|
||||
"", { append_log_file => 1 }) != 0 )
|
||||
@@ -3241,7 +3215,7 @@ sub restore_slave_databases ($) {
|
||||
{
|
||||
my $data_dir= $slave->[$idx]->{'path_myddir'};
|
||||
my $name= basename($data_dir);
|
||||
rmtree($data_dir);
|
||||
mtr_rmtree($data_dir);
|
||||
mtr_copy_dir("$path_snapshot/$name", $data_dir);
|
||||
}
|
||||
}
|
||||
@@ -3414,56 +3388,6 @@ sub find_testcase_skipped_reason($)
|
||||
}
|
||||
|
||||
|
||||
sub analyze_testcase_failure_sync_with_master($)
|
||||
{
|
||||
my ($tinfo)= @_;
|
||||
|
||||
my $args;
|
||||
mtr_init_args(\$args);
|
||||
|
||||
mtr_add_arg($args, "--no-defaults");
|
||||
mtr_add_arg($args, "--silent");
|
||||
mtr_add_arg($args, "--skip-safemalloc");
|
||||
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
|
||||
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
|
||||
|
||||
mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
|
||||
mtr_add_arg($args, "--port=%d", $master->[0]->{'port'});
|
||||
mtr_add_arg($args, "--database=test");
|
||||
mtr_add_arg($args, "--user=%s", $opt_user);
|
||||
mtr_add_arg($args, "--password=");
|
||||
|
||||
# Run the test file and append output to log file
|
||||
mtr_run_test($exe_mysqltest,$args,
|
||||
"include/analyze_failure_sync_with_master.test",
|
||||
"$path_timefile", "$path_timefile","",
|
||||
{ append_log_file => 1 });
|
||||
|
||||
}
|
||||
|
||||
sub analyze_testcase_failure($)
|
||||
{
|
||||
my ($tinfo)= @_;
|
||||
|
||||
# Open mysqltest.log
|
||||
my $F= IO::File->new($path_timefile)
|
||||
or return;
|
||||
|
||||
while ( my $line= <$F> )
|
||||
{
|
||||
# Look for "mysqltest: At line nnn: <error>
|
||||
if ( $line =~ /mysqltest: At line [0-9]*: (.*)/ )
|
||||
{
|
||||
my $error= $1;
|
||||
# Look for "could not sync with master"
|
||||
if ( $error =~ /could not sync with master/ )
|
||||
{
|
||||
analyze_testcase_failure_sync_with_master($tinfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Run a single test case
|
||||
@@ -3563,10 +3487,6 @@ sub run_testcase ($) {
|
||||
}
|
||||
elsif ( $res == 1 )
|
||||
{
|
||||
if ( $opt_force )
|
||||
{
|
||||
analyze_testcase_failure($tinfo);
|
||||
}
|
||||
# Test case failure reported by mysqltest
|
||||
report_failure_and_restart($tinfo);
|
||||
}
|
||||
@@ -3600,7 +3520,7 @@ sub run_testcase ($) {
|
||||
sub save_installed_db () {
|
||||
|
||||
mtr_report("Saving snapshot of installed databases");
|
||||
rmtree($path_snapshot);
|
||||
mtr_rmtree($path_snapshot);
|
||||
|
||||
foreach my $data_dir (@data_dir_lst)
|
||||
{
|
||||
@@ -3647,7 +3567,7 @@ sub restore_installed_db ($) {
|
||||
{
|
||||
my $name= basename($data_dir);
|
||||
save_files_before_restore($test_name, $data_dir);
|
||||
rmtree("$data_dir");
|
||||
mtr_rmtree("$data_dir");
|
||||
mtr_copy_dir("$path_snapshot/$name", "$data_dir");
|
||||
}
|
||||
|
||||
@@ -3657,7 +3577,7 @@ sub restore_installed_db ($) {
|
||||
{
|
||||
foreach my $ndbd (@{$cluster->{'ndbds'}})
|
||||
{
|
||||
rmtree("$ndbd->{'path_fs'}" );
|
||||
mtr_rmtree("$ndbd->{'path_fs'}" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3672,7 +3592,6 @@ sub report_failure_and_restart ($) {
|
||||
my $tinfo= shift;
|
||||
|
||||
mtr_report_test_failed($tinfo);
|
||||
mtr_show_failed_diff($tinfo);
|
||||
print "\n";
|
||||
if ( $opt_force )
|
||||
{
|
||||
@@ -3681,13 +3600,13 @@ sub report_failure_and_restart ($) {
|
||||
|
||||
# Restore the snapshot of the installed test db
|
||||
restore_installed_db($tinfo->{'name'});
|
||||
print "Resuming Tests\n\n";
|
||||
mtr_report("Resuming Tests\n");
|
||||
return;
|
||||
}
|
||||
|
||||
my $test_mode= join(" ", @::glob_test_mode) || "default";
|
||||
print "Aborting: $tinfo->{'name'} failed in $test_mode mode. ";
|
||||
print "To continue, re-run with '--force'.\n";
|
||||
mtr_report("Aborting: $tinfo->{'name'} failed in $test_mode mode. ");
|
||||
mtr_report("To continue, re-run with '--force'.");
|
||||
if ( ! $glob_debugger and
|
||||
! $opt_extern and
|
||||
! $glob_use_embedded_server )
|
||||
@@ -4113,6 +4032,9 @@ sub mysqld_start ($$$) {
|
||||
$wait_for_pid_file= 0;
|
||||
}
|
||||
|
||||
# Remove the pidfile
|
||||
unlink($mysqld->{'path_pid'});
|
||||
|
||||
if ( defined $exe )
|
||||
{
|
||||
$pid= mtr_spawn($exe, $args, "",
|
||||
@@ -4146,11 +4068,11 @@ sub mysqld_start ($$$) {
|
||||
|
||||
sub stop_all_servers () {
|
||||
|
||||
print "Stopping All Servers\n";
|
||||
mtr_report("Stopping All Servers");
|
||||
|
||||
if ( ! $opt_skip_im )
|
||||
{
|
||||
print "Shutting-down Instance Manager\n";
|
||||
mtr_report("Shutting-down Instance Manager");
|
||||
unless (mtr_im_stop($instance_manager, "stop_all_servers"))
|
||||
{
|
||||
mtr_error("Failed to stop Instance Manager.")
|
||||
@@ -4860,6 +4782,9 @@ sub run_mysqltest ($) {
|
||||
|
||||
mtr_add_arg($args, "--test-file=%s", $tinfo->{'path'});
|
||||
|
||||
# Number of lines of resut to include in failure report
|
||||
mtr_add_arg($args, "--tail-lines=20");
|
||||
|
||||
if ( defined $tinfo->{'result_file'} ) {
|
||||
mtr_add_arg($args, "--result-file=%s", $tinfo->{'result_file'});
|
||||
}
|
||||
@@ -5273,7 +5198,6 @@ Misc options
|
||||
fast Don't try to clean up from earlier runs
|
||||
reorder Reorder tests to get fewer server restarts
|
||||
help Get this help text
|
||||
unified-diff | udiff When presenting differences, use unified diff
|
||||
|
||||
testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout)
|
||||
suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout)
|
||||
|
@@ -36,3 +36,18 @@ select 1/*!999992*/;
|
||||
select 1 + /*!00000 2 */ + 3 /*!99999 noise*/ + 4;
|
||||
1 + 2 + 3 + 4
|
||||
10
|
||||
drop table if exists table_28779;
|
||||
create table table_28779 (a int);
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*' AND b = 'bar'' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';*";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*' AND b = 'bar';*' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;*";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';*' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!98765' AND b = 'bar'' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';*";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!98765' AND b = 'bar';*' at line 1
|
||||
drop table table_28779;
|
||||
|
177
mysql-test/r/ctype_ascii.result
Normal file
177
mysql-test/r/ctype_ascii.result
Normal file
@@ -0,0 +1,177 @@
|
||||
set names ascii;
|
||||
select 'e'='`';
|
||||
'e'='`'
|
||||
0
|
||||
select 'y'='~';
|
||||
'y'='~'
|
||||
0
|
||||
create table t1 (a char(1) character set ascii);
|
||||
insert into t1 (a) values (' '), ('a'), ('b'), ('c'), ('d'), ('e'), ('f'), ('g'), ('h'), ('i'), ('j'), ('k'), ('l'), ('m'), ('n'), ('o'), ('p'), ('q'), ('r'), ('s'), ('t'), ('u'), ('v'), ('w'), ('x'), ('y'), ('z'), ('A'), ('B'), ('C'), ('D'), ('E'), ('F'), ('G'), ('H'), ('I'), ('J'), ('K'), ('L'), ('M'), ('N'), ('O'), ('P'), ('Q'), ('R'), ('S'), ('T'), ('U'), ('V'), ('W'), ('X'), ('Y'), ('Z'), ('!'), ('@'), ('#'), ('$'), ('%'), ('^'), ('&'), ('*'), ('('), (')'), ('_'), ('+'), ('`'), ('~'), ('1'), ('2'), ('3'), ('4'), ('5'), ('6'), ('7'), ('8'), ('9'), ('0'), ('['), (']'), ('\\'), ('|'), ('}'), ('{'), ('"'), (':'), (''''), (';'), ('/'), ('.'), (','), ('?'), ('>'), ('<'), ('\n'), ('\t'), ('\a'), ('\f'), ('\v');
|
||||
select t1a.a, t1b.a from t1 as t1a, t1 as t1b where t1a.a=t1b.a order by binary t1a.a, binary t1b.a;
|
||||
a a
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
! !
|
||||
" "
|
||||
# #
|
||||
$ $
|
||||
% %
|
||||
& &
|
||||
' '
|
||||
( (
|
||||
) )
|
||||
* *
|
||||
+ +
|
||||
, ,
|
||||
. .
|
||||
/ /
|
||||
0 0
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
: :
|
||||
; ;
|
||||
< <
|
||||
> >
|
||||
? ?
|
||||
@ @
|
||||
A A
|
||||
A a
|
||||
A a
|
||||
B B
|
||||
B b
|
||||
C C
|
||||
C c
|
||||
D D
|
||||
D d
|
||||
E E
|
||||
E e
|
||||
F F
|
||||
F f
|
||||
F f
|
||||
G G
|
||||
G g
|
||||
H H
|
||||
H h
|
||||
I I
|
||||
I i
|
||||
J J
|
||||
J j
|
||||
K K
|
||||
K k
|
||||
L L
|
||||
L l
|
||||
M M
|
||||
M m
|
||||
N N
|
||||
N n
|
||||
O O
|
||||
O o
|
||||
P P
|
||||
P p
|
||||
Q Q
|
||||
Q q
|
||||
R R
|
||||
R r
|
||||
S S
|
||||
S s
|
||||
T T
|
||||
T t
|
||||
U U
|
||||
U u
|
||||
V V
|
||||
V v
|
||||
V v
|
||||
W W
|
||||
W w
|
||||
X X
|
||||
X x
|
||||
Y Y
|
||||
Y y
|
||||
Z Z
|
||||
Z z
|
||||
[ [
|
||||
\ \
|
||||
] ]
|
||||
^ ^
|
||||
_ _
|
||||
` `
|
||||
a A
|
||||
a A
|
||||
a a
|
||||
a a
|
||||
a a
|
||||
a a
|
||||
b B
|
||||
b b
|
||||
c C
|
||||
c c
|
||||
d D
|
||||
d d
|
||||
e E
|
||||
e e
|
||||
f F
|
||||
f F
|
||||
f f
|
||||
f f
|
||||
f f
|
||||
f f
|
||||
g G
|
||||
g g
|
||||
h H
|
||||
h h
|
||||
i I
|
||||
i i
|
||||
j J
|
||||
j j
|
||||
k K
|
||||
k k
|
||||
l L
|
||||
l l
|
||||
m M
|
||||
m m
|
||||
n N
|
||||
n n
|
||||
o O
|
||||
o o
|
||||
p P
|
||||
p p
|
||||
q Q
|
||||
q q
|
||||
r R
|
||||
r r
|
||||
s S
|
||||
s s
|
||||
t T
|
||||
t t
|
||||
u U
|
||||
u u
|
||||
v V
|
||||
v V
|
||||
v v
|
||||
v v
|
||||
v v
|
||||
v v
|
||||
w W
|
||||
w w
|
||||
x X
|
||||
x x
|
||||
y Y
|
||||
y y
|
||||
z Z
|
||||
z z
|
||||
{ {
|
||||
| |
|
||||
} }
|
||||
~ ~
|
||||
drop table t1;
|
||||
End of 5.0 tests.
|
@@ -80,7 +80,7 @@ select STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T');
|
||||
STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T')
|
||||
NULL
|
||||
Warnings:
|
||||
Error 1411 Incorrect time value: '22.30.61' for function str_to_time
|
||||
Error 1411 Incorrect time value: '22.30.61' for function str_to_date
|
||||
create table t1 (date char(30), format char(30) not null);
|
||||
insert into t1 values
|
||||
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
|
||||
@@ -352,21 +352,21 @@ Tuesday 52 2001 %W %u %x NULL
|
||||
7 53 1998 %w %u %Y NULL
|
||||
NULL %m.%d.%Y NULL
|
||||
Warnings:
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_date
|
||||
select date,format,concat(str_to_date(date, format),'') as con from t1;
|
||||
date format con
|
||||
2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
|
||||
@@ -386,21 +386,21 @@ Tuesday 52 2001 %W %u %x NULL
|
||||
7 53 1998 %w %u %Y NULL
|
||||
NULL %m.%d.%Y NULL
|
||||
Warnings:
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_date
|
||||
truncate table t1;
|
||||
insert into t1 values
|
||||
('10:20:10AM', '%h:%i:%s'),
|
||||
@@ -440,7 +440,7 @@ select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
|
||||
str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'))
|
||||
NULL
|
||||
Warnings:
|
||||
Error 1411 Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_date
|
||||
explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
|
@@ -112,3 +112,14 @@ id x
|
||||
commit;
|
||||
# Switch to connection default + disconnect con1 and con2
|
||||
drop table t1, t2;
|
||||
End of 4.1 tests
|
||||
set storage_engine=innodb;
|
||||
drop table if exists a;
|
||||
drop table if exists A;
|
||||
create table A (c int);
|
||||
insert into A (c) values (0);
|
||||
create table a as select * from A;
|
||||
drop table A;
|
||||
drop table if exists a;
|
||||
set storage_engine=default;
|
||||
End of 5.0 tests.
|
||||
|
@@ -454,8 +454,11 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
|
||||
select definer, name, db from mysql.event;
|
||||
definer name db
|
||||
root@localhost закачка events_test
|
||||
"Should be only 1 process"
|
||||
select /*1*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
|
||||
"Should be only 0 process"
|
||||
select /*1*/ user, host, db, command, state, info
|
||||
from information_schema.processlist
|
||||
where (user='event_scheduler')
|
||||
order by info;
|
||||
user host db command state info
|
||||
select release_lock("test_lock1");
|
||||
release_lock("test_lock1")
|
||||
@@ -472,14 +475,15 @@ get_lock("test_lock2", 20)
|
||||
1
|
||||
"Create an event which tries to acquire a mutex. The event locks on the mutex"
|
||||
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
|
||||
"Let some time pass to the event starts"
|
||||
"Should have only 2 processes: the scheduler and the locked event"
|
||||
select /*2*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
|
||||
select /*2*/ user, host, db, command, state, info
|
||||
from information_schema.processlist
|
||||
where (info like "select get_lock%" OR user='event_scheduler')
|
||||
order by info;
|
||||
user host db command state info
|
||||
event_scheduler localhost NULL Daemon Waiting for next activation NULL
|
||||
root localhost events_test Connect User lock select get_lock("test_lock2", 20)
|
||||
"Release the mutex, the event worker should finish."
|
||||
"Release the mutex, the event worker should finish."
|
||||
select release_lock("test_lock2");
|
||||
release_lock("test_lock2")
|
||||
1
|
||||
@@ -489,16 +493,25 @@ select get_lock("test_lock2_1", 20);
|
||||
get_lock("test_lock2_1", 20)
|
||||
1
|
||||
create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
|
||||
"Should have only 3 processes: the scheduler, our conn and the locked event"
|
||||
select /*3*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
|
||||
"Should have only 2 processes: the scheduler and the locked event"
|
||||
select /*3*/ user, host, db, command, state, info
|
||||
from information_schema.processlist
|
||||
where (info like "select get_lock%" OR user='event_scheduler')
|
||||
order by info;
|
||||
user host db command state info
|
||||
event_scheduler localhost NULL Daemon Waiting for next activation NULL
|
||||
root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
|
||||
set global event_scheduler=off;
|
||||
"Should have only our process now:"
|
||||
select /*4*/ user, host, db, command, state, info from information_schema.processlist where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') order by info;
|
||||
select /*4*/ user, host, db, command, state, info
|
||||
from information_schema.processlist
|
||||
where (info like "select get_lock%" OR user='event_scheduler')
|
||||
order by info;
|
||||
user host db command state info
|
||||
root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
|
||||
select release_lock("test_lock2_1");
|
||||
release_lock("test_lock2_1")
|
||||
1
|
||||
drop event закачка21;
|
||||
create table t_16 (s1 int);
|
||||
create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
|
||||
|
@@ -52,7 +52,8 @@ do select 'events_logs_test' as inside_event, sleep(1.5);
|
||||
|
||||
Nothing should be logged
|
||||
|
||||
select user_host, db, sql_text from mysql.slow_log where sql_text not like 'create event%';
|
||||
select user_host, db, sql_text from mysql.slow_log
|
||||
where sql_text like 'select \'events_logs_test\'%';
|
||||
user_host db sql_text
|
||||
set @@global.long_query_time=1;
|
||||
truncate mysql.slow_log;
|
||||
@@ -61,7 +62,8 @@ do select 'events_logs_test' as inside_event, sleep(1.5);
|
||||
|
||||
Event sub-statement should be logged.
|
||||
|
||||
select user_host, db, sql_text from mysql.slow_log where sql_text not like 'create event%';
|
||||
select user_host, db, sql_text from mysql.slow_log
|
||||
where sql_text like 'select \'events_logs_test\'%';
|
||||
user_host db sql_text
|
||||
USER_HOST events_test select 'events_logs_test' as inside_event, sleep(1.5)
|
||||
drop database events_test;
|
||||
|
@@ -191,3 +191,7 @@ drop table table_26093;
|
||||
drop function func_26093_a;
|
||||
drop function func_26093_b;
|
||||
End of 5.0 tests
|
||||
select connection_id() > 0;
|
||||
connection_id() > 0
|
||||
1
|
||||
End of tests
|
||||
|
@@ -515,3 +515,23 @@ ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
drop table if exists t1;
|
||||
create table t1 (a int) ENGINE=MEMORY;
|
||||
--> client 2
|
||||
handler t1 open;
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
--> client 1
|
||||
drop table t1;
|
||||
drop table if exists t1;
|
||||
create table t1 (a int);
|
||||
handler t1 open as t1_alias;
|
||||
handler t1_alias read a next;
|
||||
ERROR 42000: Key 'a' doesn't exist in table 't1_alias'
|
||||
handler t1_alias READ a next where inexistent > 0;
|
||||
ERROR 42S22: Unknown column 'inexistent' in 'field list'
|
||||
handler t1_alias read a next;
|
||||
ERROR 42000: Key 'a' doesn't exist in table 't1_alias'
|
||||
handler t1_alias READ a next where inexistent > 0;
|
||||
ERROR 42S22: Unknown column 'inexistent' in 'field list'
|
||||
handler t1_alias close;
|
||||
drop table t1;
|
||||
|
@@ -515,3 +515,23 @@ ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
drop table if exists t1;
|
||||
create table t1 (a int) ENGINE=MEMORY;
|
||||
--> client 2
|
||||
handler t1 open;
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
--> client 1
|
||||
drop table t1;
|
||||
drop table if exists t1;
|
||||
create table t1 (a int);
|
||||
handler t1 open as t1_alias;
|
||||
handler t1_alias read a next;
|
||||
ERROR 42000: Key 'a' doesn't exist in table 't1_alias'
|
||||
handler t1_alias READ a next where inexistent > 0;
|
||||
ERROR 42S22: Unknown column 'inexistent' in 'field list'
|
||||
handler t1_alias read a next;
|
||||
ERROR 42000: Key 'a' doesn't exist in table 't1_alias'
|
||||
handler t1_alias READ a next where inexistent > 0;
|
||||
ERROR 42S22: Unknown column 'inexistent' in 'field list'
|
||||
handler t1_alias close;
|
||||
drop table t1;
|
||||
|
@@ -196,7 +196,6 @@ t1 a select
|
||||
show columns from mysqltest.t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) YES NULL
|
||||
b varchar(30) YES MUL NULL
|
||||
select table_name, column_name, privileges from information_schema.columns
|
||||
where table_schema = 'mysqltest' and table_name = 'v1';
|
||||
table_name column_name privileges
|
||||
@@ -1410,6 +1409,31 @@ alter database;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
|
||||
alter database test;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1(a int, b int, c int);
|
||||
create trigger mysqltest.t1_ai after insert on mysqltest.t1
|
||||
for each row set @a = new.a + new.b + new.c;
|
||||
grant select(b) on mysqltest.t1 to mysqltest_1@localhost;
|
||||
select trigger_name from information_schema.triggers
|
||||
where event_object_table='t1';
|
||||
trigger_name
|
||||
t1_ai
|
||||
show triggers from mysqltest;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
t1_ai INSERT t1 set @a = new.a + new.b + new.c AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
show columns from t1;
|
||||
Field Type Null Key Default Extra
|
||||
b int(11) YES NULL
|
||||
select column_name from information_schema.columns where table_name='t1';
|
||||
column_name
|
||||
b
|
||||
show triggers;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
select trigger_name from information_schema.triggers
|
||||
where event_object_table='t1';
|
||||
trigger_name
|
||||
drop user mysqltest_1@localhost;
|
||||
drop database mysqltest;
|
||||
End of 5.0 tests.
|
||||
select * from information_schema.engines WHERE ENGINE="MyISAM";
|
||||
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||
|
@@ -151,13 +151,11 @@ create view v2 as select f1 from testdb_1.v1;
|
||||
create view v4 as select f1,f2 from testdb_1.v3;
|
||||
show fields from testdb_1.v5;
|
||||
Field Type Null Key Default Extra
|
||||
f1 char(4) YES NULL
|
||||
show create view testdb_1.v5;
|
||||
View Create View character_set_client collation_connection
|
||||
v5 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_1`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v5` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1` latin1 latin1_swedish_ci
|
||||
show fields from testdb_1.v6;
|
||||
Field Type Null Key Default Extra
|
||||
f1 char(4) YES NULL
|
||||
show create view testdb_1.v6;
|
||||
View Create View character_set_client collation_connection
|
||||
v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v6` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1` latin1 latin1_swedish_ci
|
||||
|
@@ -501,7 +501,7 @@ ERROR 23000: Duplicate entry 'test2' for key 'ggid'
|
||||
select * from t1;
|
||||
id ggid email passwd
|
||||
1 this will work
|
||||
3 test2 this will work
|
||||
4 test2 this will work
|
||||
select * from t1 where id=1;
|
||||
id ggid email passwd
|
||||
1 this will work
|
||||
@@ -1086,39 +1086,6 @@ n d
|
||||
1 30
|
||||
2 20
|
||||
drop table t1,t2;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL auto_increment,
|
||||
`b` int(11) default NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
|
||||
CREATE TABLE `t2` (
|
||||
`a` int(11) NOT NULL auto_increment,
|
||||
`b` int(11) default NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=INNODB DEFAULT CHARSET=latin1 ;
|
||||
insert into t1 values (1,1),(2,2);
|
||||
insert into t2 values (1,1),(4,4);
|
||||
reset master;
|
||||
UPDATE t2,t1 SET t2.a=t1.a+2;
|
||||
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
|
||||
select * from t2 /* must be (3,1), (4,4) */;
|
||||
a b
|
||||
1 1
|
||||
4 4
|
||||
show master status /* there must no UPDATE in binlog */;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 106
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
insert into t1 values (1,2),(3,4),(4,4);
|
||||
insert into t2 values (1,2),(3,4),(4,4);
|
||||
reset master;
|
||||
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
|
||||
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
|
||||
show master status /* there must be no UPDATE query event */;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 106
|
||||
drop table t1, t2;
|
||||
create table t1 (a int, b int) engine=innodb;
|
||||
insert into t1 values(20,null);
|
||||
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
|
||||
@@ -1784,13 +1751,13 @@ Variable_name Value
|
||||
Innodb_page_size 16384
|
||||
show status like "Innodb_rows_deleted";
|
||||
Variable_name Value
|
||||
Innodb_rows_deleted 72
|
||||
Innodb_rows_deleted 70
|
||||
show status like "Innodb_rows_inserted";
|
||||
Variable_name Value
|
||||
Innodb_rows_inserted 1088
|
||||
Innodb_rows_inserted 1083
|
||||
show status like "Innodb_rows_updated";
|
||||
Variable_name Value
|
||||
Innodb_rows_updated 888
|
||||
Innodb_rows_updated 886
|
||||
show status like "Innodb_row_lock_waits";
|
||||
Variable_name Value
|
||||
Innodb_row_lock_waits 0
|
||||
|
@@ -1123,6 +1123,24 @@ t1 CREATE TABLE `t1` (
|
||||
KEY `a` (`a`(255))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a INT,
|
||||
b INT,
|
||||
KEY (b)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,10), (2,10), (2,20), (3,30);
|
||||
START TRANSACTION;
|
||||
SELECT * FROM t1 WHERE b=20 FOR UPDATE;
|
||||
a b
|
||||
2 20
|
||||
START TRANSACTION;
|
||||
SELECT * FROM t1 WHERE b=10 ORDER BY A FOR UPDATE;
|
||||
a b
|
||||
1 10
|
||||
2 10
|
||||
ROLLBACK;
|
||||
ROLLBACK;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
CREATE TABLE `t2` (
|
||||
`k` int(11) NOT NULL auto_increment,
|
||||
|
@@ -105,3 +105,22 @@ DROP VIEW view_target2;
|
||||
DROP VIEW view_target3;
|
||||
DROP USER user20989@localhost;
|
||||
DROP DATABASE meow;
|
||||
connection: default
|
||||
set low_priority_updates=1;
|
||||
drop table if exists t1;
|
||||
create table t1 (a int, b int, unique key t1$a (a));
|
||||
lock table t1 read;
|
||||
connection: update
|
||||
set low_priority_updates=1;
|
||||
show variables like 'low_priority_updates';
|
||||
Variable_name Value
|
||||
low_priority_updates ON
|
||||
insert into t1 values (1, 2) ON DUPLICATE KEY UPDATE b = 2;;
|
||||
connection: select
|
||||
select * from t1;
|
||||
a b
|
||||
connection: default
|
||||
select * from t1;
|
||||
a b
|
||||
drop table t1;
|
||||
set low_priority_updates=default;
|
||||
|
@@ -106,4 +106,11 @@ i
|
||||
ERROR 70100: Query execution was interrupted
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
drop table if exists t1;
|
||||
create table t1 (a int) ENGINE=MEMORY;
|
||||
--> client 2
|
||||
handler t1 open;
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
--> client 1
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
@@ -176,5 +176,7 @@ ERROR at line 1: DELIMITER cannot contain a backslash character
|
||||
ERROR at line 1: DELIMITER cannot contain a backslash character
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
End of 5.0 tests
|
||||
WARNING: --server-arg option not supported in this configuration.
|
||||
|
@@ -3,7 +3,9 @@ mysql.columns_priv OK
|
||||
mysql.db OK
|
||||
mysql.event OK
|
||||
mysql.func OK
|
||||
mysql.general_log OK
|
||||
mysql.general_log
|
||||
Error : You can't use locks with log tables.
|
||||
status : OK
|
||||
mysql.help_category OK
|
||||
mysql.help_keyword OK
|
||||
mysql.help_relation OK
|
||||
@@ -14,7 +16,9 @@ mysql.plugin OK
|
||||
mysql.proc OK
|
||||
mysql.procs_priv OK
|
||||
mysql.servers OK
|
||||
mysql.slow_log OK
|
||||
mysql.slow_log
|
||||
Error : You can't use locks with log tables.
|
||||
status : OK
|
||||
mysql.tables_priv OK
|
||||
mysql.time_zone OK
|
||||
mysql.time_zone_leap_second OK
|
||||
@@ -29,7 +33,9 @@ mysql.columns_priv OK
|
||||
mysql.db OK
|
||||
mysql.event OK
|
||||
mysql.func OK
|
||||
mysql.general_log OK
|
||||
mysql.general_log
|
||||
Error : You can't use locks with log tables.
|
||||
status : OK
|
||||
mysql.help_category OK
|
||||
mysql.help_keyword OK
|
||||
mysql.help_relation OK
|
||||
@@ -40,7 +46,9 @@ mysql.plugin OK
|
||||
mysql.proc OK
|
||||
mysql.procs_priv OK
|
||||
mysql.servers OK
|
||||
mysql.slow_log OK
|
||||
mysql.slow_log
|
||||
Error : You can't use locks with log tables.
|
||||
status : OK
|
||||
mysql.tables_priv OK
|
||||
mysql.time_zone OK
|
||||
mysql.time_zone_leap_second OK
|
||||
@@ -55,7 +63,9 @@ mysql.columns_priv OK
|
||||
mysql.db OK
|
||||
mysql.event OK
|
||||
mysql.func OK
|
||||
mysql.general_log OK
|
||||
mysql.general_log
|
||||
Error : You can't use locks with log tables.
|
||||
status : OK
|
||||
mysql.help_category OK
|
||||
mysql.help_keyword OK
|
||||
mysql.help_relation OK
|
||||
@@ -66,7 +76,9 @@ mysql.plugin OK
|
||||
mysql.proc OK
|
||||
mysql.procs_priv OK
|
||||
mysql.servers OK
|
||||
mysql.slow_log OK
|
||||
mysql.slow_log
|
||||
Error : You can't use locks with log tables.
|
||||
status : OK
|
||||
mysql.tables_priv OK
|
||||
mysql.time_zone OK
|
||||
mysql.time_zone_leap_second OK
|
||||
@@ -83,7 +95,9 @@ mysql.columns_priv OK
|
||||
mysql.db OK
|
||||
mysql.event OK
|
||||
mysql.func OK
|
||||
mysql.general_log OK
|
||||
mysql.general_log
|
||||
Error : You can't use locks with log tables.
|
||||
status : OK
|
||||
mysql.help_category OK
|
||||
mysql.help_keyword OK
|
||||
mysql.help_relation OK
|
||||
@@ -94,7 +108,9 @@ mysql.plugin OK
|
||||
mysql.proc OK
|
||||
mysql.procs_priv OK
|
||||
mysql.servers OK
|
||||
mysql.slow_log OK
|
||||
mysql.slow_log
|
||||
Error : You can't use locks with log tables.
|
||||
status : OK
|
||||
mysql.tables_priv OK
|
||||
mysql.time_zone OK
|
||||
mysql.time_zone_leap_second OK
|
||||
|
@@ -18,7 +18,11 @@ insert into t1 values(null, "f");
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
# at {pos}
|
||||
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Start: binlog v #, server v ## created {yymmdd} {HH:MM:SS} at startup
|
||||
ROLLBACK/*!*/;
|
||||
# at {pos}
|
||||
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1579609942/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
|
||||
@@ -26,21 +30,43 @@ SET @@session.sql_mode=0/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||
create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
|
||||
# at {pos}
|
||||
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar
|
||||
SET INSERT_ID=1/*!*/;
|
||||
# at {pos}
|
||||
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0
|
||||
SET TIMESTAMP=1579609942/*!*/;
|
||||
insert into t1 values(null, "a")/*!*/;
|
||||
# at {pos}
|
||||
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar
|
||||
SET INSERT_ID=2/*!*/;
|
||||
# at {pos}
|
||||
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0
|
||||
SET TIMESTAMP=1579609942/*!*/;
|
||||
insert into t1 values(null, "b")/*!*/;
|
||||
# at {pos}
|
||||
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar
|
||||
SET INSERT_ID=3/*!*/;
|
||||
# at {pos}
|
||||
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0
|
||||
SET TIMESTAMP=1579609944/*!*/;
|
||||
insert into t1 values(null, "c")/*!*/;
|
||||
# at {pos}
|
||||
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar
|
||||
SET INSERT_ID=4/*!*/;
|
||||
# at {pos}
|
||||
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0
|
||||
SET TIMESTAMP=1579609946/*!*/;
|
||||
insert into t1 values(null, "d")/*!*/;
|
||||
# at {pos}
|
||||
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar
|
||||
SET INSERT_ID=5/*!*/;
|
||||
# at {pos}
|
||||
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0
|
||||
SET TIMESTAMP=1579609946/*!*/;
|
||||
insert into t1 values(null, "e")/*!*/;
|
||||
# at {pos}
|
||||
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Rotate to master-bin.000002 pos: {pos}
|
||||
DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
|
@@ -129,7 +129,6 @@ INSERT INTO t1 VALUES (1, 'This is a test');
|
||||
insert into t2 values ('test', 'test2');
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
select * from t1;
|
||||
DROP SCHEMA IF EXISTS `mysqlslap`;
|
||||
DROP SCHEMA IF EXISTS `mysqlslap`;
|
||||
CREATE SCHEMA `mysqlslap`;
|
||||
@@ -141,7 +140,6 @@ INSERT INTO t1 VALUES (1, 'This is a test');
|
||||
insert into t2 values ('test', 'test2');
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
select * from t1;
|
||||
DROP SCHEMA IF EXISTS `mysqlslap`;
|
||||
DROP SCHEMA IF EXISTS `mysqlslap`;
|
||||
CREATE SCHEMA `mysqlslap`;
|
||||
@@ -153,6 +151,7 @@ INSERT INTO t1 VALUES (1, 'This is a test');
|
||||
insert into t2 values ('test', 'test2');
|
||||
SHOW TABLES;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
SHOW TABLES;
|
||||
DROP SCHEMA IF EXISTS `mysqlslap`;
|
||||
DROP SCHEMA IF EXISTS `mysqlslap`;
|
||||
@@ -165,6 +164,7 @@ INSERT INTO t1 VALUES (1, 'This is a test');
|
||||
insert into t2 values ('test', 'test2');
|
||||
SHOW TABLES;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
SHOW TABLES;
|
||||
DROP SCHEMA IF EXISTS `mysqlslap`;
|
||||
DROP SCHEMA IF EXISTS `mysqlslap`;
|
||||
|
@@ -280,8 +280,20 @@ let $B = changed value of B;
|
||||
var2: content of variable 1
|
||||
var3: content of variable 1 content of variable 1
|
||||
length of var3 is longer than 0
|
||||
var1
|
||||
hi 1 hi there
|
||||
var2
|
||||
2
|
||||
var2 again
|
||||
2
|
||||
var3 two columns with same name
|
||||
1 2 3
|
||||
var4 from query that returns NULL
|
||||
var5 from query that returns no row
|
||||
failing query in let
|
||||
mysqltest: At line 1: Error running query 'failing query': 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing query' at line 1
|
||||
mysqltest: At line 1: Missing required argument 'filename' to command 'source'
|
||||
mysqltest: At line 1: Could not open file ./non_existingFile
|
||||
mysqltest: At line 1: Could not open file './non_existingFile'
|
||||
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep
|
||||
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
|
||||
|
||||
@@ -340,6 +352,8 @@ here is the sourced script
|
||||
In loop
|
||||
here is the sourced script
|
||||
here is the sourced script
|
||||
"hello"
|
||||
"hello"
|
||||
mysqltest: At line 1: Missing argument to sleep
|
||||
mysqltest: At line 1: Missing argument to real_sleep
|
||||
mysqltest: At line 1: Invalid argument to sleep "abc"
|
||||
@@ -461,7 +475,6 @@ root@localhost
|
||||
--------------------------------------------------------------------------------
|
||||
this will be executed
|
||||
this will be executed
|
||||
mysqltest: Result length mismatch
|
||||
mysqltest: The test didn't produce any output
|
||||
Failing multi statement query
|
||||
mysqltest: At line 3: query 'create table t1 (a int primary key);
|
||||
@@ -473,6 +486,8 @@ mysqltest: At line 3: query 'create table t1 (a int primary key);
|
||||
insert into t1 values (1);
|
||||
select 'select-me';
|
||||
insertz 'error query'' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz 'error query'' at line 1
|
||||
|
||||
More results from queries before failure can be found in MYSQLTEST_VARDIR/log/bug11731.log
|
||||
drop table t1;
|
||||
Multi statement using expected error
|
||||
create table t1 (a int primary key);
|
||||
@@ -520,17 +535,19 @@ drop table t1;
|
||||
mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file'
|
||||
mysqltest: At line 1: Missing required argument 'filename' to command 'write_file'
|
||||
mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found
|
||||
Content for test_file1
|
||||
mysqltest: At line 1: File already exist: 'MYSQLTEST_VARDIR/tmp/test_file1.tmp'
|
||||
Some data
|
||||
for cat_file command
|
||||
of mysqltest
|
||||
mysqltest: At line 1: Failed to open file non_existing_file
|
||||
mysqltest: At line 1: Failed to open file 'non_existing_file'
|
||||
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
|
||||
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
|
||||
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
|
||||
mysqltest: At line 1: Missing required argument 'mode' to command 'chmod'
|
||||
mysqltest: At line 1: You must write a 4 digit octal number for mode
|
||||
mysqltest: At line 1: You must write a 4 digit octal number for mode
|
||||
mysqltest: At line 1: Missing required argument 'file' to command 'chmod'
|
||||
mysqltest: At line 1: Missing required argument 'filename' to command 'chmod'
|
||||
mysqltest: At line 1: You must write a 4 digit octal number for mode
|
||||
mysqltest: At line 1: You must write a 4 digit octal number for mode
|
||||
hello
|
||||
|
@@ -273,6 +273,16 @@ create table VAR_SAMP(a int);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VAR_SAMP(a int)' at line 1
|
||||
create table VAR_SAMP (a int);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VAR_SAMP (a int)' at line 1
|
||||
DROP TABLE IF EXISTS table_25930_a;
|
||||
DROP TABLE IF EXISTS table_25930_b;
|
||||
SET SQL_MODE = 'ANSI_QUOTES';
|
||||
CREATE TABLE table_25930_a ( "blah" INT );
|
||||
CREATE TABLE table_25930_b SELECT "blah" - 1 FROM table_25930_a;
|
||||
desc table_25930_b;
|
||||
Field Type Null Key Default Extra
|
||||
"blah" - 1 bigint(12) YES NULL
|
||||
DROP TABLE table_25930_a;
|
||||
DROP TABLE table_25930_b;
|
||||
SET @@sql_mode=@save_sql_mode;
|
||||
select pi(3.14);
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'pi'
|
||||
|
747
mysql-test/r/parser_precedence.result
Normal file
747
mysql-test/r/parser_precedence.result
Normal file
@@ -0,0 +1,747 @@
|
||||
drop table if exists t1_30237_bool;
|
||||
create table t1_30237_bool(A boolean, B boolean, C boolean);
|
||||
insert into t1_30237_bool values
|
||||
(FALSE, FALSE, FALSE),
|
||||
(FALSE, FALSE, NULL),
|
||||
(FALSE, FALSE, TRUE),
|
||||
(FALSE, NULL, FALSE),
|
||||
(FALSE, NULL, NULL),
|
||||
(FALSE, NULL, TRUE),
|
||||
(FALSE, TRUE, FALSE),
|
||||
(FALSE, TRUE, NULL),
|
||||
(FALSE, TRUE, TRUE),
|
||||
(NULL, FALSE, FALSE),
|
||||
(NULL, FALSE, NULL),
|
||||
(NULL, FALSE, TRUE),
|
||||
(NULL, NULL, FALSE),
|
||||
(NULL, NULL, NULL),
|
||||
(NULL, NULL, TRUE),
|
||||
(NULL, TRUE, FALSE),
|
||||
(NULL, TRUE, NULL),
|
||||
(NULL, TRUE, TRUE),
|
||||
(TRUE, FALSE, FALSE),
|
||||
(TRUE, FALSE, NULL),
|
||||
(TRUE, FALSE, TRUE),
|
||||
(TRUE, NULL, FALSE),
|
||||
(TRUE, NULL, NULL),
|
||||
(TRUE, NULL, TRUE),
|
||||
(TRUE, TRUE, FALSE),
|
||||
(TRUE, TRUE, NULL),
|
||||
(TRUE, TRUE, TRUE) ;
|
||||
Testing OR, XOR, AND
|
||||
select A, B, A OR B, A XOR B, A AND B
|
||||
from t1_30237_bool where C is null order by A, B;
|
||||
A B A OR B A XOR B A AND B
|
||||
NULL NULL NULL NULL NULL
|
||||
NULL 0 NULL NULL 0
|
||||
NULL 1 1 NULL NULL
|
||||
0 NULL NULL NULL 0
|
||||
0 0 0 0 0
|
||||
0 1 1 1 0
|
||||
1 NULL 1 NULL NULL
|
||||
1 0 1 1 0
|
||||
1 1 1 0 1
|
||||
Testing that OR is associative
|
||||
select A, B, C, (A OR B) OR C, A OR (B OR C), A OR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A OR B) OR C A OR (B OR C) A OR B OR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 1 1 1
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 1 1 1
|
||||
NULL 1 NULL 1 1 1
|
||||
NULL 1 0 1 1 1
|
||||
NULL 1 1 1 1 1
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 1 1 1
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL 1 1 1
|
||||
0 1 0 1 1 1
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL 1 1 1
|
||||
1 NULL 0 1 1 1
|
||||
1 NULL 1 1 1 1
|
||||
1 0 NULL 1 1 1
|
||||
1 0 0 1 1 1
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL 1 1 1
|
||||
1 1 0 1 1 1
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A OR B) OR C) != (A OR (B OR C));
|
||||
count(*)
|
||||
0
|
||||
Testing that XOR is associative
|
||||
select A, B, C, (A XOR B) XOR C, A XOR (B XOR C), A XOR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A XOR B) XOR C A XOR (B XOR C) A XOR B XOR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 NULL NULL NULL
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 NULL NULL NULL
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 1 1 1
|
||||
0 1 1 0 0 0
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL NULL NULL NULL
|
||||
1 0 0 1 1 1
|
||||
1 0 1 0 0 0
|
||||
1 1 NULL NULL NULL NULL
|
||||
1 1 0 0 0 0
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) XOR C) != (A XOR (B XOR C));
|
||||
count(*)
|
||||
0
|
||||
Testing that AND is associative
|
||||
select A, B, C, (A AND B) AND C, A AND (B AND C), A AND B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A AND B) AND C A AND (B AND C) A AND B AND C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 0 0 0
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL 0 0 0
|
||||
NULL 0 0 0 0 0
|
||||
NULL 0 1 0 0 0
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 0 0 0
|
||||
NULL 1 1 NULL NULL NULL
|
||||
0 NULL NULL 0 0 0
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 0 0 0
|
||||
0 0 NULL 0 0 0
|
||||
0 0 0 0 0 0
|
||||
0 0 1 0 0 0
|
||||
0 1 NULL 0 0 0
|
||||
0 1 0 0 0 0
|
||||
0 1 1 0 0 0
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 0 0 0
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL 0 0 0
|
||||
1 0 0 0 0 0
|
||||
1 0 1 0 0 0
|
||||
1 1 NULL NULL NULL NULL
|
||||
1 1 0 0 0 0
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) AND C) != (A AND (B AND C));
|
||||
count(*)
|
||||
0
|
||||
Testing that AND has precedence over OR
|
||||
select A, B, C, (A OR B) AND C, A OR (B AND C), A OR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A OR B) AND C A OR (B AND C) A OR B AND C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 0 NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 NULL NULL
|
||||
NULL 0 1 NULL NULL NULL
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 0 NULL NULL
|
||||
NULL 1 1 1 1 1
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL 0 0 0
|
||||
0 0 0 0 0 0
|
||||
0 0 1 0 0 0
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL NULL 1 1
|
||||
1 NULL 0 0 1 1
|
||||
1 NULL 1 1 1 1
|
||||
1 0 NULL NULL 1 1
|
||||
1 0 0 0 1 1
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL NULL 1 1
|
||||
1 1 0 0 1 1
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B AND C)) != (A OR B AND C);
|
||||
count(*)
|
||||
0
|
||||
select A, B, C, (A AND B) OR C, A AND (B OR C), A AND B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A AND B) OR C A AND (B OR C) A AND B OR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 1 NULL 1
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 0 0
|
||||
NULL 0 1 1 NULL 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 1 NULL 1
|
||||
0 NULL NULL NULL 0 NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 1 0 1
|
||||
0 0 NULL NULL 0 NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 0 1
|
||||
0 1 NULL NULL 0 NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 0 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 1 1 1
|
||||
1 0 NULL NULL NULL NULL
|
||||
1 0 0 0 0 0
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL 1 1 1
|
||||
1 1 0 1 1 1
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) OR C) != (A AND B OR C);
|
||||
count(*)
|
||||
0
|
||||
Testing that AND has precedence over XOR
|
||||
select A, B, C, (A XOR B) AND C, A XOR (B AND C), A XOR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A XOR B) AND C A XOR (B AND C) A XOR B AND C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 0 NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 NULL NULL
|
||||
NULL 0 1 NULL NULL NULL
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 0 NULL NULL
|
||||
NULL 1 1 NULL NULL NULL
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL 0 0 0
|
||||
0 0 0 0 0 0
|
||||
0 0 1 0 0 0
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 0 1 1
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL NULL 1 1
|
||||
1 0 0 0 1 1
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL 0 NULL NULL
|
||||
1 1 0 0 1 1
|
||||
1 1 1 0 0 0
|
||||
select count(*) from t1_30237_bool
|
||||
where (A XOR (B AND C)) != (A XOR B AND C);
|
||||
count(*)
|
||||
0
|
||||
select A, B, C, (A AND B) XOR C, A AND (B XOR C), A AND B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A AND B) XOR C A AND (B XOR C) A AND B XOR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 0 0
|
||||
NULL 0 1 1 NULL 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 NULL 0 NULL
|
||||
0 NULL NULL NULL 0 NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 1 0 1
|
||||
0 0 NULL NULL 0 NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 0 1
|
||||
0 1 NULL NULL 0 NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 0 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL NULL NULL NULL
|
||||
1 0 0 0 0 0
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL NULL NULL NULL
|
||||
1 1 0 1 1 1
|
||||
1 1 1 0 0 0
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) XOR C) != (A AND B XOR C);
|
||||
count(*)
|
||||
0
|
||||
Testing that XOR has precedence over OR
|
||||
select A, B, C, (A XOR B) OR C, A XOR (B OR C), A XOR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A XOR B) OR C A XOR (B OR C) A XOR B OR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 1 NULL 1
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 1 NULL 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 1 NULL 1
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 1 1 1
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL 1 1 1
|
||||
0 1 0 1 1 1
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 1 0 1
|
||||
1 0 NULL 1 NULL 1
|
||||
1 0 0 1 1 1
|
||||
1 0 1 1 0 1
|
||||
1 1 NULL NULL 0 NULL
|
||||
1 1 0 0 0 0
|
||||
1 1 1 1 0 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) OR C) != (A XOR B OR C);
|
||||
count(*)
|
||||
0
|
||||
select A, B, C, (A OR B) XOR C, A OR (B XOR C), A OR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A OR B) XOR C A OR (B XOR C) A OR B XOR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 NULL 1 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 1 1 1
|
||||
NULL 1 1 0 NULL NULL
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 1 1 1
|
||||
0 1 1 0 0 0
|
||||
1 NULL NULL NULL 1 1
|
||||
1 NULL 0 1 1 1
|
||||
1 NULL 1 0 1 1
|
||||
1 0 NULL NULL 1 1
|
||||
1 0 0 1 1 1
|
||||
1 0 1 0 1 1
|
||||
1 1 NULL NULL 1 1
|
||||
1 1 0 1 1 1
|
||||
1 1 1 0 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B XOR C)) != (A OR B XOR C);
|
||||
count(*)
|
||||
0
|
||||
drop table t1_30237_bool;
|
||||
Testing that NOT has precedence over OR
|
||||
select (NOT FALSE) OR TRUE, NOT (FALSE OR TRUE), NOT FALSE OR TRUE;
|
||||
(NOT FALSE) OR TRUE NOT (FALSE OR TRUE) NOT FALSE OR TRUE
|
||||
1 0 1
|
||||
Testing that NOT has precedence over XOR
|
||||
select (NOT FALSE) XOR FALSE, NOT (FALSE XOR FALSE), NOT FALSE XOR FALSE;
|
||||
(NOT FALSE) XOR FALSE NOT (FALSE XOR FALSE) NOT FALSE XOR FALSE
|
||||
1 1 1
|
||||
Testing that NOT has precedence over AND
|
||||
select (NOT FALSE) AND FALSE, NOT (FALSE AND FALSE), NOT FALSE AND FALSE;
|
||||
(NOT FALSE) AND FALSE NOT (FALSE AND FALSE) NOT FALSE AND FALSE
|
||||
0 1 0
|
||||
Testing that NOT is associative
|
||||
select NOT NOT TRUE, NOT NOT NOT FALSE;
|
||||
NOT NOT TRUE NOT NOT NOT FALSE
|
||||
1 1
|
||||
Testing that IS has precedence over NOT
|
||||
select (NOT NULL) IS TRUE, NOT (NULL IS TRUE), NOT NULL IS TRUE;
|
||||
(NOT NULL) IS TRUE NOT (NULL IS TRUE) NOT NULL IS TRUE
|
||||
0 1 1
|
||||
select (NOT NULL) IS NOT TRUE, NOT (NULL IS NOT TRUE), NOT NULL IS NOT TRUE;
|
||||
(NOT NULL) IS NOT TRUE NOT (NULL IS NOT TRUE) NOT NULL IS NOT TRUE
|
||||
1 0 0
|
||||
select (NOT NULL) IS FALSE, NOT (NULL IS FALSE), NOT NULL IS FALSE;
|
||||
(NOT NULL) IS FALSE NOT (NULL IS FALSE) NOT NULL IS FALSE
|
||||
0 1 1
|
||||
select (NOT NULL) IS NOT FALSE, NOT (NULL IS NOT FALSE), NOT NULL IS NOT FALSE;
|
||||
(NOT NULL) IS NOT FALSE NOT (NULL IS NOT FALSE) NOT NULL IS NOT FALSE
|
||||
1 0 0
|
||||
select (NOT TRUE) IS UNKNOWN, NOT (TRUE IS UNKNOWN), NOT TRUE IS UNKNOWN;
|
||||
(NOT TRUE) IS UNKNOWN NOT (TRUE IS UNKNOWN) NOT TRUE IS UNKNOWN
|
||||
0 1 1
|
||||
select (NOT TRUE) IS NOT UNKNOWN, NOT (TRUE IS NOT UNKNOWN), NOT TRUE IS NOT UNKNOWN;
|
||||
(NOT TRUE) IS NOT UNKNOWN NOT (TRUE IS NOT UNKNOWN) NOT TRUE IS NOT UNKNOWN
|
||||
1 0 0
|
||||
select (NOT TRUE) IS NULL, NOT (TRUE IS NULL), NOT TRUE IS NULL;
|
||||
(NOT TRUE) IS NULL NOT (TRUE IS NULL) NOT TRUE IS NULL
|
||||
0 1 1
|
||||
select (NOT TRUE) IS NOT NULL, NOT (TRUE IS NOT NULL), NOT TRUE IS NOT NULL;
|
||||
(NOT TRUE) IS NOT NULL NOT (TRUE IS NOT NULL) NOT TRUE IS NOT NULL
|
||||
1 0 0
|
||||
Testing that IS [NOT] TRUE/FALSE/UNKNOWN predicates are not associative
|
||||
select TRUE IS TRUE IS TRUE IS TRUE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS TRUE IS TRUE' at line 1
|
||||
select FALSE IS NOT TRUE IS NOT TRUE IS NOT TRUE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NOT TRUE IS NOT TRUE' at line 1
|
||||
select NULL IS FALSE IS FALSE IS FALSE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS FALSE IS FALSE' at line 1
|
||||
select TRUE IS NOT FALSE IS NOT FALSE IS NOT FALSE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NOT FALSE IS NOT FALSE' at line 1
|
||||
select FALSE IS UNKNOWN IS UNKNOWN IS UNKNOWN;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS UNKNOWN IS UNKNOWN' at line 1
|
||||
select TRUE IS NOT UNKNOWN IS NOT UNKNOWN IS NOT UNKNOWN;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NOT UNKNOWN IS NOT UNKNOWN' at line 1
|
||||
Testing that IS [NOT] NULL predicates are associative
|
||||
select FALSE IS NULL IS NULL IS NULL;
|
||||
FALSE IS NULL IS NULL IS NULL
|
||||
0
|
||||
select TRUE IS NOT NULL IS NOT NULL IS NOT NULL;
|
||||
TRUE IS NOT NULL IS NOT NULL IS NOT NULL
|
||||
1
|
||||
Testing that comparison operators are left associative
|
||||
select 1 <=> 2 <=> 2, (1 <=> 2) <=> 2, 1 <=> (2 <=> 2);
|
||||
1 <=> 2 <=> 2 (1 <=> 2) <=> 2 1 <=> (2 <=> 2)
|
||||
0 0 1
|
||||
select 1 = 2 = 2, (1 = 2) = 2, 1 = (2 = 2);
|
||||
1 = 2 = 2 (1 = 2) = 2 1 = (2 = 2)
|
||||
0 0 1
|
||||
select 1 != 2 != 3, (1 != 2) != 3, 1 != (2 != 3);
|
||||
1 != 2 != 3 (1 != 2) != 3 1 != (2 != 3)
|
||||
1 1 0
|
||||
select 1 <> 2 <> 3, (1 <> 2) <> 3, 1 <> (2 <> 3);
|
||||
1 <> 2 <> 3 (1 <> 2) <> 3 1 <> (2 <> 3)
|
||||
1 1 0
|
||||
select 1 < 2 < 3, (1 < 2) < 3, 1 < (2 < 3);
|
||||
1 < 2 < 3 (1 < 2) < 3 1 < (2 < 3)
|
||||
1 1 0
|
||||
select 3 <= 2 <= 1, (3 <= 2) <= 1, 3 <= (2 <= 1);
|
||||
3 <= 2 <= 1 (3 <= 2) <= 1 3 <= (2 <= 1)
|
||||
1 1 0
|
||||
select 1 > 2 > 3, (1 > 2) > 3, 1 > (2 > 3);
|
||||
1 > 2 > 3 (1 > 2) > 3 1 > (2 > 3)
|
||||
0 0 1
|
||||
select 1 >= 2 >= 3, (1 >= 2) >= 3, 1 >= (2 >= 3);
|
||||
1 >= 2 >= 3 (1 >= 2) >= 3 1 >= (2 >= 3)
|
||||
0 0 1
|
||||
Testing that | is associative
|
||||
select 0xF0 | 0x0F | 0x55, (0xF0 | 0x0F) | 0x55, 0xF0 | (0x0F | 0x55);
|
||||
0xF0 | 0x0F | 0x55 (0xF0 | 0x0F) | 0x55 0xF0 | (0x0F | 0x55)
|
||||
255 255 255
|
||||
Testing that & is associative
|
||||
select 0xF5 & 0x5F & 0x55, (0xF5 & 0x5F) & 0x55, 0xF5 & (0x5F & 0x55);
|
||||
0xF5 & 0x5F & 0x55 (0xF5 & 0x5F) & 0x55 0xF5 & (0x5F & 0x55)
|
||||
85 85 85
|
||||
Testing that << is left associative
|
||||
select 4 << 3 << 2, (4 << 3) << 2, 4 << (3 << 2);
|
||||
4 << 3 << 2 (4 << 3) << 2 4 << (3 << 2)
|
||||
128 128 16384
|
||||
Testing that >> is left associative
|
||||
select 256 >> 3 >> 2, (256 >> 3) >> 2, 256 >> (3 >> 2);
|
||||
256 >> 3 >> 2 (256 >> 3) >> 2 256 >> (3 >> 2)
|
||||
8 8 256
|
||||
Testing that & has precedence over |
|
||||
select 0xF0 & 0x0F | 0x55, (0xF0 & 0x0F) | 0x55, 0xF0 & (0x0F | 0x55);
|
||||
0xF0 & 0x0F | 0x55 (0xF0 & 0x0F) | 0x55 0xF0 & (0x0F | 0x55)
|
||||
85 85 80
|
||||
select 0x55 | 0xF0 & 0x0F, (0x55 | 0xF0) & 0x0F, 0x55 | (0xF0 & 0x0F);
|
||||
0x55 | 0xF0 & 0x0F (0x55 | 0xF0) & 0x0F 0x55 | (0xF0 & 0x0F)
|
||||
85 5 85
|
||||
Testing that << has precedence over |
|
||||
select 0x0F << 4 | 0x0F, (0x0F << 4) | 0x0F, 0x0F << (4 | 0x0F);
|
||||
0x0F << 4 | 0x0F (0x0F << 4) | 0x0F 0x0F << (4 | 0x0F)
|
||||
255 255 491520
|
||||
select 0x0F | 0x0F << 4, (0x0F | 0x0F) << 4, 0x0F | (0x0F << 4);
|
||||
0x0F | 0x0F << 4 (0x0F | 0x0F) << 4 0x0F | (0x0F << 4)
|
||||
255 240 255
|
||||
Testing that >> has precedence over |
|
||||
select 0xF0 >> 4 | 0xFF, (0xF0 >> 4) | 0xFF, 0xF0 >> (4 | 0xFF);
|
||||
0xF0 >> 4 | 0xFF (0xF0 >> 4) | 0xFF 0xF0 >> (4 | 0xFF)
|
||||
255 255 0
|
||||
select 0xFF | 0xF0 >> 4, (0xFF | 0xF0) >> 4, 0xFF | (0xF0 >> 4);
|
||||
0xFF | 0xF0 >> 4 (0xFF | 0xF0) >> 4 0xFF | (0xF0 >> 4)
|
||||
255 15 255
|
||||
Testing that << has precedence over &
|
||||
select 0x0F << 4 & 0xF0, (0x0F << 4) & 0xF0, 0x0F << (4 & 0xF0);
|
||||
0x0F << 4 & 0xF0 (0x0F << 4) & 0xF0 0x0F << (4 & 0xF0)
|
||||
240 240 15
|
||||
select 0xF0 & 0x0F << 4, (0xF0 & 0x0F) << 4, 0xF0 & (0x0F << 4);
|
||||
0xF0 & 0x0F << 4 (0xF0 & 0x0F) << 4 0xF0 & (0x0F << 4)
|
||||
240 0 240
|
||||
Testing that >> has precedence over &
|
||||
select 0xF0 >> 4 & 0x55, (0xF0 >> 4) & 0x55, 0xF0 >> (4 & 0x55);
|
||||
0xF0 >> 4 & 0x55 (0xF0 >> 4) & 0x55 0xF0 >> (4 & 0x55)
|
||||
5 5 15
|
||||
select 0x0F & 0xF0 >> 4, (0x0F & 0xF0) >> 4, 0x0F & (0xF0 >> 4);
|
||||
0x0F & 0xF0 >> 4 (0x0F & 0xF0) >> 4 0x0F & (0xF0 >> 4)
|
||||
15 0 15
|
||||
Testing that >> and << have the same precedence
|
||||
select 0xFF >> 4 << 2, (0xFF >> 4) << 2, 0xFF >> (4 << 2);
|
||||
0xFF >> 4 << 2 (0xFF >> 4) << 2 0xFF >> (4 << 2)
|
||||
60 60 0
|
||||
select 0x0F << 4 >> 2, (0x0F << 4) >> 2, 0x0F << (4 >> 2);
|
||||
0x0F << 4 >> 2 (0x0F << 4) >> 2 0x0F << (4 >> 2)
|
||||
60 60 30
|
||||
Testing that binary + is associative
|
||||
select 1 + 2 + 3, (1 + 2) + 3, 1 + (2 + 3);
|
||||
1 + 2 + 3 (1 + 2) + 3 1 + (2 + 3)
|
||||
6 6 6
|
||||
Testing that binary - is left associative
|
||||
select 1 - 2 - 3, (1 - 2) - 3, 1 - (2 - 3);
|
||||
1 - 2 - 3 (1 - 2) - 3 1 - (2 - 3)
|
||||
-4 -4 2
|
||||
Testing that binary + and binary - have the same precedence
|
||||
select 1 + 2 - 3, (1 + 2) - 3, 1 + (2 - 3);
|
||||
1 + 2 - 3 (1 + 2) - 3 1 + (2 - 3)
|
||||
0 0 0
|
||||
select 1 - 2 + 3, (1 - 2) + 3, 1 - (2 + 3);
|
||||
1 - 2 + 3 (1 - 2) + 3 1 - (2 + 3)
|
||||
2 2 -4
|
||||
Testing that binary + has precedence over |
|
||||
select 0xF0 + 0x0F | 0x55, (0xF0 + 0x0F) | 0x55, 0xF0 + (0x0F | 0x55);
|
||||
0xF0 + 0x0F | 0x55 (0xF0 + 0x0F) | 0x55 0xF0 + (0x0F | 0x55)
|
||||
255 255 335
|
||||
select 0x55 | 0xF0 + 0x0F, (0x55 | 0xF0) + 0x0F, 0x55 | (0xF0 + 0x0F);
|
||||
0x55 | 0xF0 + 0x0F (0x55 | 0xF0) + 0x0F 0x55 | (0xF0 + 0x0F)
|
||||
255 260 255
|
||||
Testing that binary + has precedence over &
|
||||
select 0xF0 + 0x0F & 0x55, (0xF0 + 0x0F) & 0x55, 0xF0 + (0x0F & 0x55);
|
||||
0xF0 + 0x0F & 0x55 (0xF0 + 0x0F) & 0x55 0xF0 + (0x0F & 0x55)
|
||||
85 85 245
|
||||
select 0x55 & 0xF0 + 0x0F, (0x55 & 0xF0) + 0x0F, 0x55 & (0xF0 + 0x0F);
|
||||
0x55 & 0xF0 + 0x0F (0x55 & 0xF0) + 0x0F 0x55 & (0xF0 + 0x0F)
|
||||
85 95 85
|
||||
Testing that binary + has precedence over <<
|
||||
select 2 + 3 << 4, (2 + 3) << 4, 2 + (3 << 4);
|
||||
2 + 3 << 4 (2 + 3) << 4 2 + (3 << 4)
|
||||
80 80 50
|
||||
select 3 << 4 + 2, (3 << 4) + 2, 3 << (4 + 2);
|
||||
3 << 4 + 2 (3 << 4) + 2 3 << (4 + 2)
|
||||
192 50 192
|
||||
Testing that binary + has precedence over >>
|
||||
select 4 + 3 >> 2, (4 + 3) >> 2, 4 + (3 >> 2);
|
||||
4 + 3 >> 2 (4 + 3) >> 2 4 + (3 >> 2)
|
||||
1 1 4
|
||||
select 3 >> 2 + 1, (3 >> 2) + 1, 3 >> (2 + 1);
|
||||
3 >> 2 + 1 (3 >> 2) + 1 3 >> (2 + 1)
|
||||
0 1 0
|
||||
Testing that binary - has precedence over |
|
||||
select 0xFF - 0x0F | 0x55, (0xFF - 0x0F) | 0x55, 0xFF - (0x0F | 0x55);
|
||||
0xFF - 0x0F | 0x55 (0xFF - 0x0F) | 0x55 0xFF - (0x0F | 0x55)
|
||||
245 245 160
|
||||
select 0x55 | 0xFF - 0xF0, (0x55 | 0xFF) - 0xF0, 0x55 | (0xFF - 0xF0);
|
||||
0x55 | 0xFF - 0xF0 (0x55 | 0xFF) - 0xF0 0x55 | (0xFF - 0xF0)
|
||||
95 15 95
|
||||
Testing that binary - has precedence over &
|
||||
select 0xFF - 0xF0 & 0x55, (0xFF - 0xF0) & 0x55, 0xFF - (0xF0 & 0x55);
|
||||
0xFF - 0xF0 & 0x55 (0xFF - 0xF0) & 0x55 0xFF - (0xF0 & 0x55)
|
||||
5 5 175
|
||||
select 0x55 & 0xFF - 0xF0, (0x55 & 0xFF) - 0xF0, 0x55 & (0xFF - 0xF0);
|
||||
0x55 & 0xFF - 0xF0 (0x55 & 0xFF) - 0xF0 0x55 & (0xFF - 0xF0)
|
||||
5 -155 5
|
||||
Testing that binary - has precedence over <<
|
||||
select 16 - 3 << 2, (16 - 3) << 2, 16 - (3 << 2);
|
||||
16 - 3 << 2 (16 - 3) << 2 16 - (3 << 2)
|
||||
52 52 4
|
||||
select 4 << 3 - 2, (4 << 3) - 2, 4 << (3 - 2);
|
||||
4 << 3 - 2 (4 << 3) - 2 4 << (3 - 2)
|
||||
8 30 8
|
||||
Testing that binary - has precedence over >>
|
||||
select 16 - 3 >> 2, (16 - 3) >> 2, 16 - (3 >> 2);
|
||||
16 - 3 >> 2 (16 - 3) >> 2 16 - (3 >> 2)
|
||||
3 3 16
|
||||
select 16 >> 3 - 2, (16 >> 3) - 2, 16 >> (3 - 2);
|
||||
16 >> 3 - 2 (16 >> 3) - 2 16 >> (3 - 2)
|
||||
8 0 8
|
||||
Testing that * is associative
|
||||
select 2 * 3 * 4, (2 * 3) * 4, 2 * (3 * 4);
|
||||
2 * 3 * 4 (2 * 3) * 4 2 * (3 * 4)
|
||||
24 24 24
|
||||
Testing that * has precedence over |
|
||||
select 2 * 0x40 | 0x0F, (2 * 0x40) | 0x0F, 2 * (0x40 | 0x0F);
|
||||
2 * 0x40 | 0x0F (2 * 0x40) | 0x0F 2 * (0x40 | 0x0F)
|
||||
143 143 158
|
||||
select 0x0F | 2 * 0x40, (0x0F | 2) * 0x40, 0x0F | (2 * 0x40);
|
||||
0x0F | 2 * 0x40 (0x0F | 2) * 0x40 0x0F | (2 * 0x40)
|
||||
143 960 143
|
||||
Testing that * has precedence over &
|
||||
select 2 * 0x40 & 0x55, (2 * 0x40) & 0x55, 2 * (0x40 & 0x55);
|
||||
2 * 0x40 & 0x55 (2 * 0x40) & 0x55 2 * (0x40 & 0x55)
|
||||
0 0 128
|
||||
select 0xF0 & 2 * 0x40, (0xF0 & 2) * 0x40, 0xF0 & (2 * 0x40);
|
||||
0xF0 & 2 * 0x40 (0xF0 & 2) * 0x40 0xF0 & (2 * 0x40)
|
||||
128 0 128
|
||||
Testing that * has precedence over <<
|
||||
select 5 * 3 << 4, (5 * 3) << 4, 5 * (3 << 4);
|
||||
5 * 3 << 4 (5 * 3) << 4 5 * (3 << 4)
|
||||
240 240 240
|
||||
select 2 << 3 * 4, (2 << 3) * 4, 2 << (3 * 4);
|
||||
2 << 3 * 4 (2 << 3) * 4 2 << (3 * 4)
|
||||
8192 64 8192
|
||||
Testing that * has precedence over >>
|
||||
select 3 * 4 >> 2, (3 * 4) >> 2, 3 * (4 >> 2);
|
||||
3 * 4 >> 2 (3 * 4) >> 2 3 * (4 >> 2)
|
||||
3 3 3
|
||||
select 4 >> 2 * 3, (4 >> 2) * 3, 4 >> (2 * 3);
|
||||
4 >> 2 * 3 (4 >> 2) * 3 4 >> (2 * 3)
|
||||
0 3 0
|
||||
Testing that * has precedence over binary +
|
||||
select 2 * 3 + 4, (2 * 3) + 4, 2 * (3 + 4);
|
||||
2 * 3 + 4 (2 * 3) + 4 2 * (3 + 4)
|
||||
10 10 14
|
||||
select 2 + 3 * 4, (2 + 3) * 4, 2 + (3 * 4);
|
||||
2 + 3 * 4 (2 + 3) * 4 2 + (3 * 4)
|
||||
14 20 14
|
||||
Testing that * has precedence over binary -
|
||||
select 4 * 3 - 2, (4 * 3) - 2, 4 * (3 - 2);
|
||||
4 * 3 - 2 (4 * 3) - 2 4 * (3 - 2)
|
||||
10 10 4
|
||||
select 4 - 3 * 2, (4 - 3) * 2, 4 - (3 * 2);
|
||||
4 - 3 * 2 (4 - 3) * 2 4 - (3 * 2)
|
||||
-2 2 -2
|
||||
Testing that / is left associative
|
||||
select 15 / 5 / 3, (15 / 5) / 3, 15 / (5 / 3);
|
||||
15 / 5 / 3 (15 / 5) / 3 15 / (5 / 3)
|
||||
1.00000000 1.00000000 9.0000
|
||||
Testing that / has precedence over |
|
||||
select 105 / 5 | 2, (105 / 5) | 2, 105 / (5 | 2);
|
||||
105 / 5 | 2 (105 / 5) | 2 105 / (5 | 2)
|
||||
23 23 15.0000
|
||||
select 105 | 2 / 5, (105 | 2) / 5, 105 | (2 / 5);
|
||||
105 | 2 / 5 (105 | 2) / 5 105 | (2 / 5)
|
||||
105 21.4000 105
|
||||
Testing that / has precedence over &
|
||||
select 105 / 5 & 0x0F, (105 / 5) & 0x0F, 105 / (5 & 0x0F);
|
||||
105 / 5 & 0x0F (105 / 5) & 0x0F 105 / (5 & 0x0F)
|
||||
5 5 21.0000
|
||||
select 0x0F & 105 / 5, (0x0F & 105) / 5, 0x0F & (105 / 5);
|
||||
0x0F & 105 / 5 (0x0F & 105) / 5 0x0F & (105 / 5)
|
||||
5 1.8000 5
|
||||
Testing that / has precedence over <<
|
||||
select 0x80 / 4 << 2, (0x80 / 4) << 2, 0x80 / (4 << 2);
|
||||
0x80 / 4 << 2 (0x80 / 4) << 2 0x80 / (4 << 2)
|
||||
128 128 8.0000
|
||||
select 0x80 << 4 / 2, (0x80 << 4) / 2, 0x80 << (4 / 2);
|
||||
0x80 << 4 / 2 (0x80 << 4) / 2 0x80 << (4 / 2)
|
||||
512 1024.0000 512
|
||||
Testing that / has precedence over >>
|
||||
select 0x80 / 4 >> 2, (0x80 / 4) >> 2, 0x80 / (4 >> 2);
|
||||
0x80 / 4 >> 2 (0x80 / 4) >> 2 0x80 / (4 >> 2)
|
||||
8 8 128.0000
|
||||
select 0x80 >> 4 / 2, (0x80 >> 4) / 2, 0x80 >> (4 / 2);
|
||||
0x80 >> 4 / 2 (0x80 >> 4) / 2 0x80 >> (4 / 2)
|
||||
32 4.0000 32
|
||||
Testing that / has precedence over binary +
|
||||
select 0x80 / 2 + 2, (0x80 / 2) + 2, 0x80 / (2 + 2);
|
||||
0x80 / 2 + 2 (0x80 / 2) + 2 0x80 / (2 + 2)
|
||||
66.0000 66.0000 32.0000
|
||||
select 0x80 + 2 / 2, (0x80 + 2) / 2, 0x80 + (2 / 2);
|
||||
0x80 + 2 / 2 (0x80 + 2) / 2 0x80 + (2 / 2)
|
||||
129.0000 65.0000 129.0000
|
||||
Testing that / has precedence over binary -
|
||||
select 0x80 / 4 - 2, (0x80 / 4) - 2, 0x80 / (4 - 2);
|
||||
0x80 / 4 - 2 (0x80 / 4) - 2 0x80 / (4 - 2)
|
||||
30.0000 30.0000 64.0000
|
||||
select 0x80 - 4 / 2, (0x80 - 4) / 2, 0x80 - (4 / 2);
|
||||
0x80 - 4 / 2 (0x80 - 4) / 2 0x80 - (4 / 2)
|
||||
126.0000 62.0000 126.0000
|
||||
Testing that ^ is associative
|
||||
select 0xFF ^ 0xF0 ^ 0x0F, (0xFF ^ 0xF0) ^ 0x0F, 0xFF ^ (0xF0 ^ 0x0F);
|
||||
0xFF ^ 0xF0 ^ 0x0F (0xFF ^ 0xF0) ^ 0x0F 0xFF ^ (0xF0 ^ 0x0F)
|
||||
0 0 0
|
||||
select 0xFF ^ 0xF0 ^ 0x55, (0xFF ^ 0xF0) ^ 0x55, 0xFF ^ (0xF0 ^ 0x55);
|
||||
0xFF ^ 0xF0 ^ 0x55 (0xFF ^ 0xF0) ^ 0x55 0xFF ^ (0xF0 ^ 0x55)
|
||||
90 90 90
|
||||
Testing that ^ has precedence over |
|
||||
select 0xFF ^ 0xF0 | 0x0F, (0xFF ^ 0xF0) | 0x0F, 0xFF ^ (0xF0 | 0x0F);
|
||||
0xFF ^ 0xF0 | 0x0F (0xFF ^ 0xF0) | 0x0F 0xFF ^ (0xF0 | 0x0F)
|
||||
15 15 0
|
||||
select 0xF0 | 0xFF ^ 0xF0, (0xF0 | 0xFF) ^ 0xF0, 0xF0 | (0xFF ^ 0xF0);
|
||||
0xF0 | 0xFF ^ 0xF0 (0xF0 | 0xFF) ^ 0xF0 0xF0 | (0xFF ^ 0xF0)
|
||||
255 15 255
|
||||
Testing that ^ has precedence over &
|
||||
select 0xFF ^ 0xF0 & 0x0F, (0xFF ^ 0xF0) & 0x0F, 0xFF ^ (0xF0 & 0x0F);
|
||||
0xFF ^ 0xF0 & 0x0F (0xFF ^ 0xF0) & 0x0F 0xFF ^ (0xF0 & 0x0F)
|
||||
15 15 255
|
||||
select 0x0F & 0xFF ^ 0xF0, (0x0F & 0xFF) ^ 0xF0, 0x0F & (0xFF ^ 0xF0);
|
||||
0x0F & 0xFF ^ 0xF0 (0x0F & 0xFF) ^ 0xF0 0x0F & (0xFF ^ 0xF0)
|
||||
15 255 15
|
||||
Testing that ^ has precedence over <<
|
||||
select 0xFF ^ 0xF0 << 2, (0xFF ^ 0xF0) << 2, 0xFF ^ (0xF0 << 2);
|
||||
0xFF ^ 0xF0 << 2 (0xFF ^ 0xF0) << 2 0xFF ^ (0xF0 << 2)
|
||||
60 60 831
|
||||
select 0x0F << 2 ^ 0xFF, (0x0F << 2) ^ 0xFF, 0x0F << (2 ^ 0xFF);
|
||||
0x0F << 2 ^ 0xFF (0x0F << 2) ^ 0xFF 0x0F << (2 ^ 0xFF)
|
||||
0 195 0
|
||||
Testing that ^ has precedence over >>
|
||||
select 0xFF ^ 0xF0 >> 2, (0xFF ^ 0xF0) >> 2, 0xFF ^ (0xF0 >> 2);
|
||||
0xFF ^ 0xF0 >> 2 (0xFF ^ 0xF0) >> 2 0xFF ^ (0xF0 >> 2)
|
||||
3 3 195
|
||||
select 0xFF >> 2 ^ 0xF0, (0xFF >> 2) ^ 0xF0, 0xFF >> (2 ^ 0xF0);
|
||||
0xFF >> 2 ^ 0xF0 (0xFF >> 2) ^ 0xF0 0xFF >> (2 ^ 0xF0)
|
||||
0 207 0
|
||||
Testing that ^ has precedence over binary +
|
||||
select 0xFF ^ 0xF0 + 0x0F, (0xFF ^ 0xF0) + 0x0F, 0xFF ^ (0xF0 + 0x0F);
|
||||
0xFF ^ 0xF0 + 0x0F (0xFF ^ 0xF0) + 0x0F 0xFF ^ (0xF0 + 0x0F)
|
||||
30 30 0
|
||||
select 0x0F + 0xFF ^ 0xF0, (0x0F + 0xFF) ^ 0xF0, 0x0F + (0xFF ^ 0xF0);
|
||||
0x0F + 0xFF ^ 0xF0 (0x0F + 0xFF) ^ 0xF0 0x0F + (0xFF ^ 0xF0)
|
||||
30 510 30
|
||||
Testing that ^ has precedence over binary -
|
||||
select 0xFF ^ 0xF0 - 1, (0xFF ^ 0xF0) - 1, 0xFF ^ (0xF0 - 1);
|
||||
0xFF ^ 0xF0 - 1 (0xFF ^ 0xF0) - 1 0xFF ^ (0xF0 - 1)
|
||||
14 14 16
|
||||
select 0x55 - 0x0F ^ 0x55, (0x55 - 0x0F) ^ 0x55, 0x55 - (0x0F ^ 0x55);
|
||||
0x55 - 0x0F ^ 0x55 (0x55 - 0x0F) ^ 0x55 0x55 - (0x0F ^ 0x55)
|
||||
-5 19 -5
|
||||
Testing that ^ has precedence over *
|
||||
select 0xFF ^ 0xF0 * 2, (0xFF ^ 0xF0) * 2, 0xFF ^ (0xF0 * 2);
|
||||
0xFF ^ 0xF0 * 2 (0xFF ^ 0xF0) * 2 0xFF ^ (0xF0 * 2)
|
||||
30 30 287
|
||||
select 2 * 0xFF ^ 0xF0, (2 * 0xFF) ^ 0xF0, 2 * (0xFF ^ 0xF0);
|
||||
2 * 0xFF ^ 0xF0 (2 * 0xFF) ^ 0xF0 2 * (0xFF ^ 0xF0)
|
||||
30 270 30
|
||||
Testing that ^ has precedence over /
|
||||
select 0xFF ^ 0xF0 / 2, (0xFF ^ 0xF0) / 2, 0xFF ^ (0xF0 / 2);
|
||||
0xFF ^ 0xF0 / 2 (0xFF ^ 0xF0) / 2 0xFF ^ (0xF0 / 2)
|
||||
7.5000 7.5000 135
|
||||
select 0xF2 / 2 ^ 0xF0, (0xF2 / 2) ^ 0xF0, 0xF2 / (2 ^ 0xF0);
|
||||
0xF2 / 2 ^ 0xF0 (0xF2 / 2) ^ 0xF0 0xF2 / (2 ^ 0xF0)
|
||||
1.0000 137 1.0000
|
||||
Testing that ^ has precedence over %
|
||||
select 0xFF ^ 0xF0 % 0x20, (0xFF ^ 0xF0) % 0x20, 0xFF ^ (0xF0 % 0x20);
|
||||
0xFF ^ 0xF0 % 0x20 (0xFF ^ 0xF0) % 0x20 0xFF ^ (0xF0 % 0x20)
|
||||
15 15 239
|
||||
select 0xFF % 0x20 ^ 0xF0, (0xFF % 0x20) ^ 0xF0, 0xFF % (0x20 ^ 0xF0);
|
||||
0xFF % 0x20 ^ 0xF0 (0xFF % 0x20) ^ 0xF0 0xFF % (0x20 ^ 0xF0)
|
||||
47 239 47
|
||||
Testing that ^ has precedence over DIV
|
||||
select 0xFF ^ 0xF0 DIV 2, (0xFF ^ 0xF0) DIV 2, 0xFF ^ (0xF0 DIV 2);
|
||||
0xFF ^ 0xF0 DIV 2 (0xFF ^ 0xF0) DIV 2 0xFF ^ (0xF0 DIV 2)
|
||||
7 7 135
|
||||
select 0xF2 DIV 2 ^ 0xF0, (0xF2 DIV 2) ^ 0xF0, 0xF2 DIV (2 ^ 0xF0);
|
||||
0xF2 DIV 2 ^ 0xF0 (0xF2 DIV 2) ^ 0xF0 0xF2 DIV (2 ^ 0xF0)
|
||||
1 137 1
|
||||
Testing that ^ has precedence over MOD
|
||||
select 0xFF ^ 0xF0 MOD 0x20, (0xFF ^ 0xF0) MOD 0x20, 0xFF ^ (0xF0 MOD 0x20);
|
||||
0xFF ^ 0xF0 MOD 0x20 (0xFF ^ 0xF0) MOD 0x20 0xFF ^ (0xF0 MOD 0x20)
|
||||
15 15 239
|
||||
select 0xFF MOD 0x20 ^ 0xF0, (0xFF MOD 0x20) ^ 0xF0, 0xFF MOD (0x20 ^ 0xF0);
|
||||
0xFF MOD 0x20 ^ 0xF0 (0xFF MOD 0x20) ^ 0xF0 0xFF MOD (0x20 ^ 0xF0)
|
||||
47 239 47
|
@@ -631,7 +631,7 @@ flush status;
|
||||
delete from t2 where b > 5;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
Variable_name Value
|
||||
Handler_read_rnd_next 1215
|
||||
Handler_read_rnd_next 1115
|
||||
show status like 'Handler_read_key';
|
||||
Variable_name Value
|
||||
Handler_read_key 0
|
||||
@@ -645,7 +645,7 @@ flush status;
|
||||
delete from t2 where b < 5 or b > 3;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
Variable_name Value
|
||||
Handler_read_rnd_next 1215
|
||||
Handler_read_rnd_next 1115
|
||||
show status like 'Handler_read_key';
|
||||
Variable_name Value
|
||||
Handler_read_key 0
|
||||
|
@@ -1650,6 +1650,35 @@ a (select count(*) from t2)
|
||||
3 0
|
||||
4 0
|
||||
drop table t1,t2;
|
||||
DROP DATABASE IF EXISTS bug30269;
|
||||
FLUSH STATUS;
|
||||
CREATE DATABASE bug30269;
|
||||
USE bug30269;
|
||||
CREATE TABLE test1 (id int, name varchar(23));
|
||||
CREATE VIEW view1 AS SELECT * FROM test1;
|
||||
INSERT INTO test1 VALUES (5, 'testit');
|
||||
GRANT SELECT (id) ON TABLE bug30269.test1 TO 'bug30269'@'localhost';
|
||||
GRANT SELECT ON TABLE bug30269.view1 TO 'bug30269'@'localhost';
|
||||
set global query_cache_size= 81920;
|
||||
USE bug30269;
|
||||
show status like 'Qcache_queries_in_cache';
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
# Select statement not stored in query cache because of column privileges.
|
||||
SELECT id FROM test1 WHERE id>2;
|
||||
id
|
||||
5
|
||||
show status like 'Qcache_queries_in_cache';
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
SELECT id FROM view1 WHERE id>2;
|
||||
id
|
||||
5
|
||||
show status like 'Qcache_queries_in_cache';
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
DROP DATABASE bug30269;
|
||||
DROP USER 'bug30269'@'localhost';
|
||||
set GLOBAL query_cache_type=default;
|
||||
set GLOBAL query_cache_limit=default;
|
||||
set GLOBAL query_cache_min_res_unit=default;
|
||||
|
@@ -371,5 +371,163 @@ Variable_name Value
|
||||
Qcache_hits 21
|
||||
drop table t1;
|
||||
---- disconnect connection con1 ----
|
||||
########################################################################
|
||||
#
|
||||
# BUG#25843: Changing default database between PREPARE and EXECUTE of
|
||||
# statement breaks binlog.
|
||||
#
|
||||
########################################################################
|
||||
|
||||
#
|
||||
# Check that default database and its attributes are fixed at the
|
||||
# creation time.
|
||||
#
|
||||
|
||||
DROP DATABASE IF EXISTS mysqltest1;
|
||||
DROP DATABASE IF EXISTS mysqltest2;
|
||||
|
||||
CREATE DATABASE mysqltest1 COLLATE utf8_unicode_ci;
|
||||
CREATE DATABASE mysqltest2 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE mysqltest1.t1(msg VARCHAR(255));
|
||||
CREATE TABLE mysqltest2.t1(msg VARCHAR(255));
|
||||
|
||||
use mysqltest1;
|
||||
PREPARE stmt_a_1 FROM 'INSERT INTO t1 VALUES(DATABASE())';
|
||||
PREPARE stmt_a_2 FROM 'INSERT INTO t1 VALUES(@@collation_database)';
|
||||
|
||||
EXECUTE stmt_a_1;
|
||||
EXECUTE stmt_a_2;
|
||||
|
||||
use mysqltest2;
|
||||
EXECUTE stmt_a_1;
|
||||
EXECUTE stmt_a_2;
|
||||
|
||||
SELECT * FROM mysqltest1.t1;
|
||||
msg
|
||||
mysqltest1
|
||||
utf8_unicode_ci
|
||||
mysqltest1
|
||||
utf8_unicode_ci
|
||||
|
||||
SELECT * FROM mysqltest2.t1;
|
||||
msg
|
||||
|
||||
DROP PREPARE stmt_a_1;
|
||||
DROP PREPARE stmt_a_2;
|
||||
|
||||
#
|
||||
# The Query Cache test case.
|
||||
#
|
||||
|
||||
DELETE FROM mysqltest1.t1;
|
||||
DELETE FROM mysqltest2.t1;
|
||||
|
||||
INSERT INTO mysqltest1.t1 VALUES('mysqltest1.t1');
|
||||
INSERT INTO mysqltest2.t1 VALUES('mysqltest2.t1');
|
||||
|
||||
use mysqltest1;
|
||||
PREPARE stmt_b_1 FROM 'SELECT * FROM t1';
|
||||
|
||||
use mysqltest2;
|
||||
PREPARE stmt_b_2 FROM 'SELECT * FROM t1';
|
||||
|
||||
EXECUTE stmt_b_1;
|
||||
msg
|
||||
mysqltest1.t1
|
||||
|
||||
EXECUTE stmt_b_2;
|
||||
msg
|
||||
mysqltest2.t1
|
||||
|
||||
use mysqltest1;
|
||||
|
||||
EXECUTE stmt_b_1;
|
||||
msg
|
||||
mysqltest1.t1
|
||||
|
||||
EXECUTE stmt_b_2;
|
||||
msg
|
||||
mysqltest2.t1
|
||||
|
||||
DROP PREPARE stmt_b_1;
|
||||
DROP PREPARE stmt_b_2;
|
||||
|
||||
use test;
|
||||
|
||||
DROP DATABASE mysqltest1;
|
||||
DROP DATABASE mysqltest2;
|
||||
|
||||
#
|
||||
# Check that prepared statements work properly when there is no current
|
||||
# database.
|
||||
#
|
||||
|
||||
CREATE DATABASE mysqltest1 COLLATE utf8_unicode_ci;
|
||||
CREATE DATABASE mysqltest2 COLLATE utf8_general_ci;
|
||||
|
||||
use mysqltest1;
|
||||
|
||||
PREPARE stmt_c_1 FROM 'SELECT DATABASE(), @@collation_database';
|
||||
|
||||
use mysqltest2;
|
||||
|
||||
PREPARE stmt_c_2 FROM 'SELECT DATABASE(), @@collation_database';
|
||||
|
||||
DROP DATABASE mysqltest2;
|
||||
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
|
||||
EXECUTE stmt_c_1;
|
||||
DATABASE() @@collation_database
|
||||
mysqltest1 utf8_unicode_ci
|
||||
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
|
||||
EXECUTE stmt_c_2;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
Warnings:
|
||||
Note 1049 Unknown database 'mysqltest2'
|
||||
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
|
||||
PREPARE stmt_c_3 FROM 'SELECT DATABASE(), @@collation_database';
|
||||
|
||||
EXECUTE stmt_c_3;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
|
||||
use mysqltest1;
|
||||
|
||||
EXECUTE stmt_c_2;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
Warnings:
|
||||
Note 1049 Unknown database 'mysqltest2'
|
||||
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
DATABASE() @@collation_database
|
||||
mysqltest1 utf8_unicode_ci
|
||||
|
||||
EXECUTE stmt_c_3;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
DATABASE() @@collation_database
|
||||
mysqltest1 utf8_unicode_ci
|
||||
|
||||
DROP DATABASE mysqltest1;
|
||||
|
||||
use test;
|
||||
|
||||
########################################################################
|
||||
set @@global.query_cache_size=@initial_query_cache_size;
|
||||
flush status;
|
||||
|
@@ -371,5 +371,163 @@ Variable_name Value
|
||||
Qcache_hits 19
|
||||
drop table t1;
|
||||
---- disconnect connection con1 ----
|
||||
########################################################################
|
||||
#
|
||||
# BUG#25843: Changing default database between PREPARE and EXECUTE of
|
||||
# statement breaks binlog.
|
||||
#
|
||||
########################################################################
|
||||
|
||||
#
|
||||
# Check that default database and its attributes are fixed at the
|
||||
# creation time.
|
||||
#
|
||||
|
||||
DROP DATABASE IF EXISTS mysqltest1;
|
||||
DROP DATABASE IF EXISTS mysqltest2;
|
||||
|
||||
CREATE DATABASE mysqltest1 COLLATE utf8_unicode_ci;
|
||||
CREATE DATABASE mysqltest2 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE mysqltest1.t1(msg VARCHAR(255));
|
||||
CREATE TABLE mysqltest2.t1(msg VARCHAR(255));
|
||||
|
||||
use mysqltest1;
|
||||
PREPARE stmt_a_1 FROM 'INSERT INTO t1 VALUES(DATABASE())';
|
||||
PREPARE stmt_a_2 FROM 'INSERT INTO t1 VALUES(@@collation_database)';
|
||||
|
||||
EXECUTE stmt_a_1;
|
||||
EXECUTE stmt_a_2;
|
||||
|
||||
use mysqltest2;
|
||||
EXECUTE stmt_a_1;
|
||||
EXECUTE stmt_a_2;
|
||||
|
||||
SELECT * FROM mysqltest1.t1;
|
||||
msg
|
||||
mysqltest1
|
||||
utf8_unicode_ci
|
||||
mysqltest1
|
||||
utf8_unicode_ci
|
||||
|
||||
SELECT * FROM mysqltest2.t1;
|
||||
msg
|
||||
|
||||
DROP PREPARE stmt_a_1;
|
||||
DROP PREPARE stmt_a_2;
|
||||
|
||||
#
|
||||
# The Query Cache test case.
|
||||
#
|
||||
|
||||
DELETE FROM mysqltest1.t1;
|
||||
DELETE FROM mysqltest2.t1;
|
||||
|
||||
INSERT INTO mysqltest1.t1 VALUES('mysqltest1.t1');
|
||||
INSERT INTO mysqltest2.t1 VALUES('mysqltest2.t1');
|
||||
|
||||
use mysqltest1;
|
||||
PREPARE stmt_b_1 FROM 'SELECT * FROM t1';
|
||||
|
||||
use mysqltest2;
|
||||
PREPARE stmt_b_2 FROM 'SELECT * FROM t1';
|
||||
|
||||
EXECUTE stmt_b_1;
|
||||
msg
|
||||
mysqltest1.t1
|
||||
|
||||
EXECUTE stmt_b_2;
|
||||
msg
|
||||
mysqltest2.t1
|
||||
|
||||
use mysqltest1;
|
||||
|
||||
EXECUTE stmt_b_1;
|
||||
msg
|
||||
mysqltest1.t1
|
||||
|
||||
EXECUTE stmt_b_2;
|
||||
msg
|
||||
mysqltest2.t1
|
||||
|
||||
DROP PREPARE stmt_b_1;
|
||||
DROP PREPARE stmt_b_2;
|
||||
|
||||
use test;
|
||||
|
||||
DROP DATABASE mysqltest1;
|
||||
DROP DATABASE mysqltest2;
|
||||
|
||||
#
|
||||
# Check that prepared statements work properly when there is no current
|
||||
# database.
|
||||
#
|
||||
|
||||
CREATE DATABASE mysqltest1 COLLATE utf8_unicode_ci;
|
||||
CREATE DATABASE mysqltest2 COLLATE utf8_general_ci;
|
||||
|
||||
use mysqltest1;
|
||||
|
||||
PREPARE stmt_c_1 FROM 'SELECT DATABASE(), @@collation_database';
|
||||
|
||||
use mysqltest2;
|
||||
|
||||
PREPARE stmt_c_2 FROM 'SELECT DATABASE(), @@collation_database';
|
||||
|
||||
DROP DATABASE mysqltest2;
|
||||
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
|
||||
EXECUTE stmt_c_1;
|
||||
DATABASE() @@collation_database
|
||||
mysqltest1 utf8_unicode_ci
|
||||
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
|
||||
EXECUTE stmt_c_2;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
Warnings:
|
||||
Note 1049 Unknown database 'mysqltest2'
|
||||
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
|
||||
PREPARE stmt_c_3 FROM 'SELECT DATABASE(), @@collation_database';
|
||||
|
||||
EXECUTE stmt_c_3;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
|
||||
use mysqltest1;
|
||||
|
||||
EXECUTE stmt_c_2;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
Warnings:
|
||||
Note 1049 Unknown database 'mysqltest2'
|
||||
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
DATABASE() @@collation_database
|
||||
mysqltest1 utf8_unicode_ci
|
||||
|
||||
EXECUTE stmt_c_3;
|
||||
DATABASE() @@collation_database
|
||||
NULL latin1_swedish_ci
|
||||
|
||||
SELECT DATABASE(), @@collation_database;
|
||||
DATABASE() @@collation_database
|
||||
mysqltest1 utf8_unicode_ci
|
||||
|
||||
DROP DATABASE mysqltest1;
|
||||
|
||||
use test;
|
||||
|
||||
########################################################################
|
||||
set @@global.query_cache_size=@initial_query_cache_size;
|
||||
flush status;
|
||||
|
@@ -3990,4 +3990,61 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
EXPLAIN SELECT c1 FROM t1 WHERE (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT COUNT(c2))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) > 0;
|
||||
ERROR HY000: Too high level of nesting for select
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 int(11) NOT NULL AUTO_INCREMENT,
|
||||
c2 varchar(1000) DEFAULT NULL,
|
||||
c3 bigint(20) DEFAULT NULL,
|
||||
c4 bigint(20) DEFAULT NULL,
|
||||
PRIMARY KEY (c1)
|
||||
);
|
||||
EXPLAIN EXTENDED
|
||||
SELECT join_2.c1
|
||||
FROM
|
||||
t1 AS join_0,
|
||||
t1 AS join_1,
|
||||
t1 AS join_2,
|
||||
t1 AS join_3,
|
||||
t1 AS join_4,
|
||||
t1 AS join_5,
|
||||
t1 AS join_6,
|
||||
t1 AS join_7
|
||||
WHERE
|
||||
join_0.c1=join_1.c1 AND
|
||||
join_1.c1=join_2.c1 AND
|
||||
join_2.c1=join_3.c1 AND
|
||||
join_3.c1=join_4.c1 AND
|
||||
join_4.c1=join_5.c1 AND
|
||||
join_5.c1=join_6.c1 AND
|
||||
join_6.c1=join_7.c1
|
||||
OR
|
||||
join_0.c2 < '?' AND
|
||||
join_1.c2 < '?' AND
|
||||
join_2.c2 > '?' AND
|
||||
join_2.c2 < '!' AND
|
||||
join_3.c2 > '?' AND
|
||||
join_4.c2 = '?' AND
|
||||
join_5.c2 <> '?' AND
|
||||
join_6.c2 <> '?' AND
|
||||
join_7.c2 >= '?' AND
|
||||
join_0.c1=join_1.c1 AND
|
||||
join_1.c1=join_2.c1 AND
|
||||
join_2.c1=join_3.c1 AND
|
||||
join_3.c1=join_4.c1 AND
|
||||
join_4.c1=join_5.c1 AND
|
||||
join_5.c1=join_6.c1 AND
|
||||
join_6.c1=join_7.c1
|
||||
GROUP BY
|
||||
join_3.c1,
|
||||
join_2.c1,
|
||||
join_7.c1,
|
||||
join_1.c1,
|
||||
join_0.c1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select '0' AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by '0','0','0','0','0'
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1003 select '0' AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by '0','0','0','0','0'
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@@ -969,6 +969,18 @@ CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create user 'mysqltest
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN create user 'mysqltest_1'; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN grant select on t1 to 'mysqltest_1'; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug21975() returns int BEGIN grant select on t1 to 'mysqltest_1'; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN revoke select on t1 from 'mysqltest_1'; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug21975() returns int BEGIN revoke select on t1 from 'mysqltest_1'; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN revoke all privileges on *.* from 'mysqltest_1'; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug21975() returns int BEGIN revoke all privileges on *.* from 'mysqltest_1'; return 1; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop user 'mysqltest_1'; END |
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
CREATE FUNCTION bug_13627_f() returns int BEGIN drop user 'mysqltest_1'; return 1; END |
|
||||
|
@@ -6546,4 +6546,56 @@ DROP VIEW v1;
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Bug#13675.
|
||||
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
CREATE PROCEDURE p1(v DATETIME) CREATE TABLE t1 SELECT v;
|
||||
CREATE PROCEDURE p2(v INT) CREATE TABLE t1 SELECT v;
|
||||
|
||||
CALL p1(NOW());
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`v` datetime DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
CALL p1('text');
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'v' at row 1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`v` datetime DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
CALL p2(10);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`v` bigint(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
CALL p2('text');
|
||||
Warnings:
|
||||
Warning 1366 Incorrect integer value: 'text' for column 'v' at row 1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`v` bigint(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
End of 5.0 tests
|
||||
|
@@ -208,3 +208,26 @@ GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
drop user mysqltest_1@localhost;
|
||||
drop procedure 15298_1;
|
||||
drop procedure 15298_2;
|
||||
drop table if exists t1;
|
||||
drop procedure if exists p1;
|
||||
create table t1 (value varchar(15));
|
||||
create procedure p1() update t1 set value='updated' where value='old';
|
||||
call p1();
|
||||
insert into t1 (value) values ("old");
|
||||
select get_lock('b26162',120);
|
||||
get_lock('b26162',120)
|
||||
1
|
||||
select 'rl_acquirer', value from t1 where get_lock('b26162',120);;
|
||||
set session low_priority_updates=on;
|
||||
call p1();;
|
||||
select 'rl_contender', value from t1;
|
||||
rl_contender value
|
||||
rl_contender old
|
||||
select release_lock('b26162');
|
||||
release_lock('b26162')
|
||||
1
|
||||
rl_acquirer value
|
||||
rl_acquirer old
|
||||
drop procedure p1;
|
||||
drop table t1;
|
||||
set session low_priority_updates=default;
|
||||
|
@@ -16,12 +16,9 @@ unlock tables;
|
||||
lock tables t1 read;
|
||||
update t1 set n = 3;
|
||||
unlock tables;
|
||||
show status like 'Table_locks_waited%';
|
||||
show status like 'Table_locks_waited';
|
||||
Variable_name Value
|
||||
Table_locks_waited 1
|
||||
select * from information_schema.session_status where variable_name like 'Table_locks_waited%';
|
||||
VARIABLE_NAME VARIABLE_VALUE
|
||||
TABLE_LOCKS_WAITED 1
|
||||
drop table t1;
|
||||
select 1;
|
||||
1
|
||||
|
@@ -215,11 +215,11 @@ ERROR 22007: Incorrect date value: '2004-10-00 15:30:00' for column 'col1' at ro
|
||||
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
|
||||
ERROR 22007: Incorrect date value: '2004-09-31 15:30:00' for column 'col1' at row 1
|
||||
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
|
||||
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
|
||||
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
|
||||
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
|
||||
ERROR 22007: Incorrect date value: '2003-02-29 15:30:00' for column 'col1' at row 1
|
||||
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
|
||||
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_time
|
||||
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date
|
||||
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
|
||||
ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
|
||||
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
|
||||
@@ -230,11 +230,11 @@ ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' a
|
||||
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
|
||||
ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col2' at row 1
|
||||
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
|
||||
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
|
||||
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
|
||||
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
|
||||
ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col2' at row 1
|
||||
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
|
||||
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_time
|
||||
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date
|
||||
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
|
||||
ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col2' at row 1
|
||||
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
|
||||
@@ -246,11 +246,11 @@ ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' a
|
||||
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
|
||||
ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col3' at row 1
|
||||
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
|
||||
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
|
||||
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
|
||||
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
|
||||
ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col3' at row 1
|
||||
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
|
||||
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_time
|
||||
ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date
|
||||
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
|
||||
ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col3' at row 1
|
||||
drop table t1;
|
||||
@@ -1070,24 +1070,24 @@ create table t1 (col1 datetime);
|
||||
insert into t1 values(STR_TO_DATE('31.10.2004 15.30 abc','%d.%m.%Y %H.%i'));
|
||||
ERROR 22007: Truncated incorrect datetime value: '31.10.2004 15.30 abc'
|
||||
insert into t1 values(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
|
||||
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
|
||||
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
|
||||
insert into t1 values(STR_TO_DATE('2004.12.12 22:22:33 AM','%Y.%m.%d %r'));
|
||||
ERROR HY000: Incorrect time value: '22:22:33 AM' for function str_to_time
|
||||
ERROR HY000: Incorrect time value: '22:22:33 AM' for function str_to_date
|
||||
insert into t1 values(STR_TO_DATE('2004.12.12 abc','%Y.%m.%d %T'));
|
||||
ERROR HY000: Incorrect time value: 'abc' for function str_to_time
|
||||
ERROR HY000: Incorrect time value: 'abc' for function str_to_date
|
||||
set sql_mode='';
|
||||
insert into t1 values(STR_TO_DATE('31.10.2004 15.30 abc','%d.%m.%Y %H.%i'));
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '31.10.2004 15.30 abc'
|
||||
insert into t1 values(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
|
||||
Warnings:
|
||||
Error 1411 Incorrect datetime value: '32.10.2004 15.30' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
|
||||
insert into t1 values(STR_TO_DATE('2004.12.12 22:22:33 AM','%Y.%m.%d %r'));
|
||||
Warnings:
|
||||
Error 1411 Incorrect time value: '22:22:33 AM' for function str_to_time
|
||||
Error 1411 Incorrect time value: '22:22:33 AM' for function str_to_date
|
||||
insert into t1 values(STR_TO_DATE('2004.12.12 abc','%Y.%m.%d %T'));
|
||||
Warnings:
|
||||
Error 1411 Incorrect time value: 'abc' for function str_to_time
|
||||
Error 1411 Incorrect time value: 'abc' for function str_to_date
|
||||
insert into t1 values(STR_TO_DATE('31.10.2004 15.30','%d.%m.%Y %H.%i'));
|
||||
insert into t1 values(STR_TO_DATE('2004.12.12 11:22:33 AM','%Y.%m.%d %r'));
|
||||
insert into t1 values(STR_TO_DATE('2004.12.12 10:22:59','%Y.%m.%d %T'));
|
||||
@@ -1105,9 +1105,9 @@ select count(*) from t1 where STR_TO_DATE('2004.12.12 10:22:61','%Y.%m.%d %T') I
|
||||
count(*)
|
||||
7
|
||||
Warnings:
|
||||
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_time
|
||||
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
|
||||
drop table t1;
|
||||
create table t1 (col1 char(3), col2 integer);
|
||||
insert into t1 (col1) values (cast(1000 as char(3)));
|
||||
|
@@ -334,4 +334,28 @@ Qcache_queries_in_cache 0
|
||||
drop table t1;
|
||||
drop function metaphon;
|
||||
set GLOBAL query_cache_size=default;
|
||||
CREATE TABLE const_len_bug (
|
||||
str_const varchar(4000),
|
||||
result1 varchar(4000),
|
||||
result2 varchar(4000)
|
||||
);
|
||||
CREATE TRIGGER check_const_len_trigger BEFORE INSERT ON const_len_bug FOR EACH ROW BEGIN
|
||||
set NEW.str_const = 'bar';
|
||||
set NEW.result2 = check_const_len(NEW.str_const);
|
||||
END |
|
||||
CREATE PROCEDURE check_const_len_sp (IN str_const VARCHAR(4000))
|
||||
BEGIN
|
||||
DECLARE result VARCHAR(4000);
|
||||
SET result = check_const_len(str_const);
|
||||
insert into const_len_bug values(str_const, result, "");
|
||||
END |
|
||||
CREATE FUNCTION check_const_len RETURNS string SONAME "UDF_EXAMPLE_LIB";
|
||||
CALL check_const_len_sp("foo");
|
||||
SELECT * from const_len_bug;
|
||||
str_const result1 result2
|
||||
bar Correct length Correct length
|
||||
DROP FUNCTION check_const_len;
|
||||
DROP PROCEDURE check_const_len_sp;
|
||||
DROP TRIGGER check_const_len_trigger;
|
||||
DROP TABLE const_len_bug;
|
||||
End of 5.0 tests.
|
||||
|
@@ -135,4 +135,37 @@ show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL auto_increment,
|
||||
`b` int(11) default NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
|
||||
CREATE TABLE `t2` (
|
||||
`a` int(11) NOT NULL auto_increment,
|
||||
`b` int(11) default NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=INNODB DEFAULT CHARSET=latin1 ;
|
||||
insert into t1 values (1,1),(2,2);
|
||||
insert into t2 values (1,1),(4,4);
|
||||
reset master;
|
||||
UPDATE t2,t1 SET t2.a=t1.a+2;
|
||||
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
|
||||
select * from t2 /* must be (3,1), (4,4) */;
|
||||
a b
|
||||
1 1
|
||||
4 4
|
||||
show master status /* there must no UPDATE in binlog */;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 106
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
insert into t1 values (1,2),(3,4),(4,4);
|
||||
insert into t2 values (1,2),(3,4),(4,4);
|
||||
reset master;
|
||||
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
|
||||
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
|
||||
show master status /* there must be no UPDATE query event */;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 106
|
||||
drop table t1, t2;
|
||||
End of tests
|
||||
|
@@ -130,4 +130,43 @@ show status like "binlog_cache_use";
|
||||
show status like "binlog_cache_disk_use";
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#27716 multi-update did partially and has not binlogged
|
||||
#
|
||||
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL auto_increment,
|
||||
`b` int(11) default NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
|
||||
|
||||
CREATE TABLE `t2` (
|
||||
`a` int(11) NOT NULL auto_increment,
|
||||
`b` int(11) default NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=INNODB DEFAULT CHARSET=latin1 ;
|
||||
|
||||
# A. testing multi_update::send_eof() execution branch
|
||||
insert into t1 values (1,1),(2,2);
|
||||
insert into t2 values (1,1),(4,4);
|
||||
reset master;
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t2,t1 SET t2.a=t1.a+2;
|
||||
# check
|
||||
select * from t2 /* must be (3,1), (4,4) */;
|
||||
show master status /* there must no UPDATE in binlog */;
|
||||
|
||||
# B. testing multi_update::send_error() execution branch
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
insert into t1 values (1,2),(3,4),(4,4);
|
||||
insert into t2 values (1,2),(3,4),(4,4);
|
||||
reset master;
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
|
||||
show master status /* there must be no UPDATE query event */;
|
||||
|
||||
# cleanup bug#27716
|
||||
drop table t1, t2;
|
||||
|
||||
--echo End of tests
|
||||
|
107
mysql-test/suite/funcs_1/datadict/datadict_priv.inc
Normal file
107
mysql-test/suite/funcs_1/datadict/datadict_priv.inc
Normal file
@@ -0,0 +1,107 @@
|
||||
############## suite/funcs_1/datadict/datadict_priv.inc ################
|
||||
# #
|
||||
# DDL and DML operations on information_schema tables #
|
||||
# #
|
||||
# Creation: #
|
||||
# 2007-08 hhunger Implement this test as part of #
|
||||
# WL#3982 Test information_schema.processlist #
|
||||
# #
|
||||
# Last update: #
|
||||
# 2007-08-14 mleich Some cleanup #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
# These variables have to be set before sourcing this file.
|
||||
#
|
||||
# information_schema table to be tested
|
||||
# let $table= processlist;
|
||||
#
|
||||
# columns of the information_schema table e.g. to use in a select.
|
||||
# let $columns= ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO;
|
||||
#
|
||||
# Where clause for an update.
|
||||
# let $update_where= WHERE id=1 ;
|
||||
#
|
||||
# Column to be used in the SET of an update.
|
||||
# let $set_column= user='any_user' ;
|
||||
#
|
||||
# Where clause of a delete.
|
||||
# let $delete_where= WHERE id=1 ;
|
||||
#
|
||||
# Column to be dropped.
|
||||
# let $drop_column= user;
|
||||
#
|
||||
# Column to be indexed
|
||||
# let $index_col= user;
|
||||
|
||||
|
||||
# data access
|
||||
|
||||
eval CREATE TEMPORARY TABLE test.t_$table AS SELECT * FROM $table;
|
||||
|
||||
eval UPDATE test.t_$table SET user='horst' $update_where ;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
eval INSERT INTO $table SELECT * FROM test.t_$table;
|
||||
|
||||
# bug#30208: CREATE TABLE ...LIKE does not accept dbname.tablename:unknown database
|
||||
eval DROP TABLE test.t_$table;
|
||||
|
||||
--error ER_VIEW_NONUPD_CHECK
|
||||
eval CREATE VIEW test.v_$table ($columns) AS SELECT * FROM $table WITH CHECK OPTION;
|
||||
|
||||
eval CREATE VIEW test.v_$table ($columns) AS SELECT * FROM $table;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
eval UPDATE test.v_$TABLE SET TIME=NOW() WHERE id = 1;
|
||||
|
||||
eval DROP VIEW test.v_$table;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
eval UPDATE $table SET $set_column $update_where;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
eval DELETE FROM $table $delete_where;
|
||||
|
||||
# change privileges
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
eval REVOKE ALL ON $table FROM current_user;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
eval GRANT INSERT,UPDATE ON $table TO current_user;
|
||||
|
||||
SHOW GRANTS;
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# table access
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
eval CREATE INDEX i_$table ON $table ($index_col);
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
eval DROP TABLE $table;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
eval ALTER TABLE $table DROP COLUMN $drop_column;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
eval ALTER TABLE $table ADD COLUMN (my_column INT);
|
||||
|
||||
--error ER_UNKNOWN_TABLE
|
||||
eval RENAME TABLE $table TO new_$table;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
eval RENAME TABLE $table TO files;
|
||||
|
||||
--error ER_UNKNOWN_TABLE
|
||||
eval CREATE TABLE new_$table AS SELECT * FROM $table;
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# database access
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
DROP DATABASE information_schema;
|
||||
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
RENAME DATABASE information_schema TO info_schema;
|
432
mysql-test/suite/funcs_1/datadict/processlist_priv.inc
Normal file
432
mysql-test/suite/funcs_1/datadict/processlist_priv.inc
Normal file
@@ -0,0 +1,432 @@
|
||||
############ suite/funcs_1/datadict/processlist_priv.inc ###############
|
||||
# #
|
||||
# Testing of privileges around #
|
||||
# SELECT ... PROCESSLIST/SHOW PROCESSLIST #
|
||||
# #
|
||||
# Note(mleich): #
|
||||
# There is a significant risk to get an unstable test because of #
|
||||
# timing issues. #
|
||||
# Example1: #
|
||||
# 1. Disconnect connection X #
|
||||
# 2. Switch to connection Y #
|
||||
# 3. SHOW PROCESSLIST might present a record like #
|
||||
# <ID> <user> <host> <db> Quit 0 cleaning up NULL #
|
||||
# or even a row where connection X is without #
|
||||
# "Quit" or "cleaning up". #
|
||||
# That means our SHOW PROCESSLIST can come too early. #
|
||||
# Solution: #
|
||||
# Close the connections at the end of the test. #
|
||||
# Example2: #
|
||||
# 1. connection X: SHOW PROCESSLIST/GRANT ... etc. #
|
||||
# 2. Switch to connection Y #
|
||||
# 3. SHOW PROCESSLIST might present a record like #
|
||||
# <ID> <user> <host> <db> Query TIME cleaning up <command> #
|
||||
# <ID> <user> <host> <db> Query TIME writing to net <command> #
|
||||
# Problems happens more often in case of slow filesystem! #
|
||||
# First Solution: #
|
||||
# Insert a dummy SQL command where the cleanup is most probably #
|
||||
# fast before switching to another connection and running #
|
||||
# SHOW/SELECT PROCESSLIST. #
|
||||
# Suppress writing to protocol by assignment to $variable. #
|
||||
# let $my_var= `SELECT 1`; #
|
||||
# Even the 'SELECT 1' was in some cases in state #
|
||||
# "writing to net". #
|
||||
# Final Solution: #
|
||||
# --real_sleep 0.3 #
|
||||
# This value was at least on my box sufficient. #
|
||||
# Please inform us if this test fails so that we can adjust #
|
||||
# the sleep time better or switch to poll routines. #
|
||||
# #
|
||||
# Storage engine variants of this test do not make sense. #
|
||||
# - I_S tables use the MEMORY storage engine whenever possible. #
|
||||
# - There are some I_S table which need column data types which #
|
||||
# are not supported by MEMORY. Example: LONGTEXT/BLOB #
|
||||
# MyISAM will be used for such tables. #
|
||||
# The column PROCESSLIST.INFO is of data type LONGTEXT #
|
||||
# ----> MyISAM #
|
||||
# - There is no impact of the GLOBAL(server) or SESSION default #
|
||||
# storage engine setting on the engine used for I_S tables. #
|
||||
# That means we cannot get NDB or InnoDB instead. #
|
||||
# #
|
||||
# Creation: #
|
||||
# 2007-08 hhunger Implement this test as part of #
|
||||
# WL#3982 Test information_schema.processlist #
|
||||
# #
|
||||
# Last update: #
|
||||
# 2007-08-14 mleich Corrections #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
# The following variables are used in "datadict_priv.inc" and here.
|
||||
#
|
||||
# information_schema table to be tested
|
||||
let $table= processlist;
|
||||
#
|
||||
# columns of the information_schema table e.g. to use in a select.
|
||||
let $columns= ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO;
|
||||
#
|
||||
# Where clause for an update.
|
||||
let $update_where= WHERE id=1 ;
|
||||
#
|
||||
# Column to be used in the SET of an update.
|
||||
let $set_column= user='any_user' ;
|
||||
#
|
||||
# Where clause of a delete.
|
||||
let $delete_where= WHERE id=1 ;
|
||||
#
|
||||
# Column to be dropped.
|
||||
let $drop_column= user;
|
||||
#
|
||||
# Column to be indexed
|
||||
let $index_col= user;
|
||||
|
||||
USE information_schema;
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 1 Prepare test.
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 1.1 Create two user
|
||||
--echo ####################################################################################
|
||||
# access to info tables as normal user
|
||||
--disable_abort_on_error
|
||||
DROP USER ddicttestuser1@'localhost';
|
||||
DROP USER ddicttestuser2@'localhost';
|
||||
--enable_abort_on_error
|
||||
CREATE USER ddicttestuser1@'localhost';
|
||||
CREATE USER ddicttestuser2@'localhost';
|
||||
SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass');
|
||||
SET PASSWORD FOR ddicttestuser2@'localhost' = PASSWORD('ddictpass');
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 1.2 Establish connection con100 (user=ddicttestuser1 with no PROCESS privilege):
|
||||
connect (con100,localhost,ddicttestuser1,ddictpass,information_schema);
|
||||
--echo ####################################################################################
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 2 connection default(user=root with default privileges):
|
||||
--echo SHOW/SELECT shows all processes/threads.
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
eval SHOW CREATE TABLE $table;
|
||||
--replace_column 6 TIME
|
||||
eval SHOW $table;
|
||||
--replace_column 6 TIME
|
||||
eval SELECT * FROM $table $select_where ORDER BY id;
|
||||
--replace_column 6 TIME
|
||||
eval SELECT $columns FROM $table $select_where ORDER BY id;
|
||||
--source suite/funcs_1/datadict/datadict_priv.inc
|
||||
--real_sleep 0.3
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 3 Switch to connection con100 (user=ddicttestuser1 with no PROCESS privilege):
|
||||
connection con100;
|
||||
--echo SHOW/SELECT shows only the processes (1) of the user.
|
||||
--echo ####################################################################################
|
||||
eval SHOW CREATE TABLE $table;
|
||||
--replace_column 6 TIME
|
||||
eval SHOW $table;
|
||||
--replace_column 6 TIME
|
||||
eval SELECT * FROM $table $select_where ORDER BY id;
|
||||
--replace_column 6 TIME
|
||||
eval SELECT $columns FROM $table $select_where ORDER BY id;
|
||||
--source suite/funcs_1/datadict/datadict_priv.inc
|
||||
--real_sleep 0.3
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 4 Grant PROCESS privilege to ddicttestuser1
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
GRANT PROCESS ON *.* TO ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass';
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 4.1 Existing connection con100 (ddicttestuser1)
|
||||
--echo The user ddicttestuser1 has the PROCESS privilege, but the connection was
|
||||
--echo established before PROCESS was granted.
|
||||
--echo SHOW/SELECT shows only the processes (1) of the user.
|
||||
--echo ####################################################################################
|
||||
connection con100;
|
||||
SHOW GRANTS;
|
||||
--replace_column 6 TIME
|
||||
SHOW processlist;
|
||||
--replace_column 6 TIME
|
||||
SELECT * FROM information_schema.processlist;
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 4.2 New connection con101 (ddicttestuser1 with PROCESS privilege)
|
||||
--echo SHOW/SELECT shows all processes/threads.
|
||||
--echo ####################################################################################
|
||||
connect (con101,localhost,ddicttestuser1,ddictpass,information_schema);
|
||||
SHOW GRANTS;
|
||||
--replace_column 6 TIME
|
||||
SHOW processlist;
|
||||
--replace_column 6 TIME
|
||||
SELECT * FROM information_schema.processlist;
|
||||
--real_sleep 0.3
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 5 Grant PROCESS privilege to anonymous user.
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
GRANT PROCESS ON *.* TO ''@'localhost';
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 5.1 Establish connection (anonymous1,localhost,'',,information_schema)
|
||||
--echo anonymous user with PROCESS privilege
|
||||
--echo SHOW/SELECT shows all processes/threads.
|
||||
--echo ####################################################################################
|
||||
connect (anonymous1,localhost,'',,information_schema);
|
||||
SHOW GRANTS;
|
||||
--replace_column 6 TIME
|
||||
SHOW processlist;
|
||||
--replace_column 6 TIME
|
||||
SELECT * FROM information_schema.processlist;
|
||||
--real_sleep 0.3
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 6 Revoke PROCESS privilege from ddicttestuser1
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
REVOKE PROCESS ON *.* FROM ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass';
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 6.1 New connection con102 (ddicttestuser1 has no more PROCESS privilege)
|
||||
connect (con102,localhost,ddicttestuser1,ddictpass,information_schema);
|
||||
--echo Again (compared to state before GRANT PROCESS) only the processes of
|
||||
--echo ddicttestuser1 are visible.
|
||||
--echo ####################################################################################
|
||||
SHOW GRANTS;
|
||||
--replace_column 6 TIME
|
||||
SHOW processlist;
|
||||
--replace_column 6 TIME
|
||||
SELECT * FROM information_schema.processlist;
|
||||
--real_sleep 0.3
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 7 Revoke PROCESS privilege from anonymous user + disconnect ddicttestuser1
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
REVOKE PROCESS ON *.* FROM ''@'localhost';
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 7.1 New connection (anonymous2,localhost,'',,information_schema)
|
||||
connect (anonymous2,localhost,'',,information_schema);
|
||||
--echo The anonymous user has no more the PROCESS privilege
|
||||
--echo Again only the processes of the anonymous user are visible.
|
||||
--echo ####################################################################################
|
||||
SHOW GRANTS FOR ''@'localhost';
|
||||
if ($fixed_bug_30395)
|
||||
{
|
||||
# Bug#30395 strange results after REVOKE PROCESS ON *.* FROM ...
|
||||
--replace_column 6 TIME
|
||||
SHOW processlist;
|
||||
}
|
||||
--replace_column 6 TIME
|
||||
SELECT * FROM information_schema.processlist;
|
||||
--real_sleep 0.3
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 8 Grant SUPER (does not imply PROCESS) privilege to ddicttestuser1
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost';
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 8.1 New connection con103 (ddicttestuser1 with SUPER privilege)
|
||||
connect (con103,localhost,ddicttestuser1,ddictpass,information_schema);
|
||||
--echo Only the processes of ddicttestuser1 user are visible.
|
||||
--echo ####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
--replace_column 6 TIME
|
||||
SHOW processlist;
|
||||
--replace_column 6 TIME
|
||||
SELECT * FROM information_schema.processlist;
|
||||
--real_sleep 0.3
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 9 Revoke SUPER privilege from user ddicttestuser1
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
REVOKE SUPER ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 9.1 New connection con104 (ddicttestuser1 without SUPER privilege)
|
||||
connect (con104,localhost,ddicttestuser1,ddictpass,information_schema);
|
||||
--echo ddicttestuser1 has no more the SUPER privilege.
|
||||
--echo Only the processes of ddicttestuser1 are visible.
|
||||
--echo ####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
--replace_column 6 TIME
|
||||
SHOW processlist;
|
||||
--replace_column 6 TIME
|
||||
SELECT * FROM information_schema.processlist;
|
||||
--real_sleep 0.3
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 10 Grant SUPER privilege with grant option to user ddicttestuser1.
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 10.1 New connection con105 (ddicttestuser1 with SUPER privilege and GRANT OPTION)
|
||||
connect (con105,localhost,ddicttestuser1,ddictpass,information_schema);
|
||||
--echo Try to grant PROCESS privilege to user ddicttestuser2 without having it.
|
||||
--echo ####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
--error ER_ACCESS_DENIED_ERROR
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 10.2 Grant SUPER and PROCESS privilege with grant option to user ddicttestuser1
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
GRANT SUPER,PROCESS ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 10.3 New connection con106 (ddicttestuser1 with SUPER,PROCESS WITH GRANT OPTION)
|
||||
connect (con106,localhost,ddicttestuser1,ddictpass,information_schema);
|
||||
--echo Grant PROCESS privilege to user ddicttestuser2
|
||||
--echo ####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 10.4 New connection con200 (ddicttestuser2 with PROCESS privilege)
|
||||
connect (con200,localhost,ddicttestuser2,ddictpass,information_schema);
|
||||
--echo ddicttestuser2 has now the PROCESS privilege and sees all connections
|
||||
--echo ####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser2'@'localhost';
|
||||
--replace_column 6 TIME
|
||||
SHOW processlist;
|
||||
--replace_column 6 TIME
|
||||
SELECT * FROM information_schema.processlist;
|
||||
--real_sleep 0.3
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 11 User ddicttestuser1 revokes PROCESS privilege from user ddicttestuser2
|
||||
--echo connection ddicttestuser1;
|
||||
--echo ####################################################################################
|
||||
connection con106;
|
||||
REVOKE PROCESS ON *.* FROM 'ddicttestuser2'@'localhost';
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 11.1 New connection con201 (ddicttestuser2)
|
||||
connect (con201,localhost,ddicttestuser2,ddictpass,information_schema);
|
||||
--echo ddicttestuser2 has no more the PROCESS privilege and can only see own connects
|
||||
--echo ####################################################################################
|
||||
SHOW GRANTS;
|
||||
--replace_column 6 TIME
|
||||
SHOW processlist;
|
||||
--replace_column 6 TIME
|
||||
SELECT * FROM information_schema.processlist;
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 11.2 Revoke SUPER,PROCESS,GRANT OPTION privilege from user ddicttestuser1
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
REVOKE SUPER,PROCESS,GRANT OPTION ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 11.3 New connection con107 (ddicttestuser1)
|
||||
connect (con107,localhost,ddicttestuser1,ddictpass,information_schema);
|
||||
--echo ddicttestuser1 has no more the PROCESS privilege and can only see own connects
|
||||
--echo He is also unable to GRANT the PROCESS privilege to ddicttestuser2
|
||||
--echo ####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
--error ER_ACCESS_DENIED_ERROR
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
--replace_column 6 TIME
|
||||
SHOW processlist;
|
||||
--replace_column 6 TIME
|
||||
SELECT * FROM information_schema.processlist;
|
||||
--real_sleep 0.3
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 12 Revoke the SELECT privilege from user ddicttestuser1
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
REVOKE SELECT ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 12.1 New connection con108 (ddicttestuser1)
|
||||
connect (con108,localhost,ddicttestuser1,ddictpass,information_schema);
|
||||
--echo ddicttestuser1 has neither PROCESS nor SELECT privilege
|
||||
--echo Manual says: Each MySQL user has the right to access these tables, but can see
|
||||
--echo only the rows ...
|
||||
--echo Therefore the missing SELECT privilege does not affect SELECTs on PROCESSLIST.
|
||||
--echo ####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
--replace_column 6 TIME
|
||||
SHOW processlist;
|
||||
--replace_column 6 TIME
|
||||
SELECT * FROM information_schema.processlist;
|
||||
--real_sleep 0.3
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 12.2 Revoke only the SELECT privilege on the information_schema from ddicttestuser1.
|
||||
--echo connection default (user=root)
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
REVOKE SELECT ON information_schema.* FROM 'ddicttestuser3'@'localhost';
|
||||
--real_sleep 0.3
|
||||
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo connection default (user=root)
|
||||
--echo Cleanup: close connections, DROP USER etc.
|
||||
--echo ####################################################################################
|
||||
connection default;
|
||||
disconnect con100;
|
||||
disconnect con101;
|
||||
disconnect con102;
|
||||
disconnect con103;
|
||||
disconnect con104;
|
||||
disconnect con105;
|
||||
disconnect con106;
|
||||
disconnect con107;
|
||||
disconnect con108;
|
||||
disconnect con200;
|
||||
disconnect con201;
|
||||
disconnect anonymous1;
|
||||
disconnect anonymous2;
|
||||
DROP USER ddicttestuser1@'localhost';
|
||||
DROP USER ddicttestuser2@'localhost';
|
333
mysql-test/suite/funcs_1/datadict/processlist_val.inc
Normal file
333
mysql-test/suite/funcs_1/datadict/processlist_val.inc
Normal file
File diff suppressed because one or more lines are too long
@@ -55,7 +55,7 @@ f106 year(3) not null default 2000,
|
||||
f107 year(4) not null default 2000,
|
||||
f108 enum("1enum","2enum") not null default "1enum",
|
||||
f109 set("1set","2set") not null default "1set"
|
||||
) engine = innodb;
|
||||
) engine = ndb;
|
||||
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/ndb_tb2.txt' into table tb2 ;
|
||||
|
469
mysql-test/suite/funcs_1/r/a_processlist_priv_no_prot.result
Normal file
469
mysql-test/suite/funcs_1/r/a_processlist_priv_no_prot.result
Normal file
@@ -0,0 +1,469 @@
|
||||
USE information_schema;
|
||||
####################################################################################
|
||||
1 Prepare test.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
####################################################################################
|
||||
1.1 Create two user
|
||||
####################################################################################
|
||||
DROP USER ddicttestuser1@'localhost';
|
||||
ERROR HY000: Operation DROP USER failed for 'ddicttestuser1'@'localhost'
|
||||
DROP USER ddicttestuser2@'localhost';
|
||||
ERROR HY000: Operation DROP USER failed for 'ddicttestuser2'@'localhost'
|
||||
CREATE USER ddicttestuser1@'localhost';
|
||||
CREATE USER ddicttestuser2@'localhost';
|
||||
SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass');
|
||||
SET PASSWORD FOR ddicttestuser2@'localhost' = PASSWORD('ddictpass');
|
||||
####################################################################################
|
||||
1.2 Establish connection con100 (user=ddicttestuser1 with no PROCESS privilege):
|
||||
####################################################################################
|
||||
####################################################################################
|
||||
2 connection default(user=root with default privileges):
|
||||
SHOW/SELECT shows all processes/threads.
|
||||
####################################################################################
|
||||
SHOW CREATE TABLE processlist;
|
||||
Table Create Table
|
||||
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
|
||||
`ID` bigint(4) NOT NULL DEFAULT '0',
|
||||
`USER` varchar(16) NOT NULL DEFAULT '',
|
||||
`HOST` varchar(64) NOT NULL DEFAULT '',
|
||||
`DB` varchar(64) DEFAULT NULL,
|
||||
`COMMAND` varchar(16) NOT NULL DEFAULT '',
|
||||
`TIME` bigint(7) NOT NULL DEFAULT '0',
|
||||
`STATE` varchar(64) DEFAULT NULL,
|
||||
`INFO` longtext
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
1 root localhost information_schema Query TIME NULL SHOW processlist
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
SELECT * FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
1 root localhost information_schema Query TIME preparing SELECT * FROM processlist ORDER BY id
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
1 root localhost information_schema Query TIME preparing SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
CREATE TEMPORARY TABLE test.t_processlist AS SELECT * FROM processlist;
|
||||
UPDATE test.t_processlist SET user='horst' WHERE id=1 ;
|
||||
INSERT INTO processlist SELECT * FROM test.t_processlist;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP TABLE test.t_processlist;
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist WITH CHECK OPTION;
|
||||
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist'
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist;
|
||||
UPDATE test.v_processlist SET TIME=NOW() WHERE id = 1;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP VIEW test.v_processlist;
|
||||
UPDATE processlist SET user='any_user' WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DELETE FROM processlist WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
REVOKE ALL ON processlist FROM current_user;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
GRANT INSERT,UPDATE ON processlist TO current_user;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
SHOW GRANTS;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
CREATE INDEX i_processlist ON processlist (user);
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP TABLE processlist;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist DROP COLUMN user;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist ADD COLUMN (my_column INT);
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
RENAME TABLE processlist TO new_processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
RENAME TABLE processlist TO files;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
CREATE TABLE new_processlist AS SELECT * FROM processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
DROP DATABASE information_schema;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
RENAME DATABASE information_schema TO info_schema;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
####################################################################################
|
||||
3 Switch to connection con100 (user=ddicttestuser1 with no PROCESS privilege):
|
||||
SHOW/SELECT shows only the processes (1) of the user.
|
||||
####################################################################################
|
||||
SHOW CREATE TABLE processlist;
|
||||
Table Create Table
|
||||
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
|
||||
`ID` bigint(4) NOT NULL DEFAULT '0',
|
||||
`USER` varchar(16) NOT NULL DEFAULT '',
|
||||
`HOST` varchar(64) NOT NULL DEFAULT '',
|
||||
`DB` varchar(64) DEFAULT NULL,
|
||||
`COMMAND` varchar(16) NOT NULL DEFAULT '',
|
||||
`TIME` bigint(7) NOT NULL DEFAULT '0',
|
||||
`STATE` varchar(64) DEFAULT NULL,
|
||||
`INFO` longtext
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
2 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM processlist ORDER BY id
|
||||
SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
2 ddicttestuser1 localhost information_schema Query TIME preparing SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id
|
||||
CREATE TEMPORARY TABLE test.t_processlist AS SELECT * FROM processlist;
|
||||
UPDATE test.t_processlist SET user='horst' WHERE id=1 ;
|
||||
INSERT INTO processlist SELECT * FROM test.t_processlist;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DROP TABLE test.t_processlist;
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist WITH CHECK OPTION;
|
||||
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist'
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist;
|
||||
UPDATE test.v_processlist SET TIME=NOW() WHERE id = 1;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DROP VIEW test.v_processlist;
|
||||
UPDATE processlist SET user='any_user' WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DELETE FROM processlist WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
REVOKE ALL ON processlist FROM current_user;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
GRANT INSERT,UPDATE ON processlist TO current_user;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
CREATE INDEX i_processlist ON processlist (user);
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DROP TABLE processlist;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist DROP COLUMN user;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist ADD COLUMN (my_column INT);
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
RENAME TABLE processlist TO new_processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
RENAME TABLE processlist TO files;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
CREATE TABLE new_processlist AS SELECT * FROM processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
DROP DATABASE information_schema;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
RENAME DATABASE information_schema TO info_schema;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
####################################################################################
|
||||
4 Grant PROCESS privilege to ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT PROCESS ON *.* TO ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass';
|
||||
####################################################################################
|
||||
4.1 Existing connection con100 (ddicttestuser1)
|
||||
The user ddicttestuser1 has the PROCESS privilege, but the connection was
|
||||
established before PROCESS was granted.
|
||||
SHOW/SELECT shows only the processes (1) of the user.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
2 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
####################################################################################
|
||||
4.2 New connection con101 (ddicttestuser1 with PROCESS privilege)
|
||||
SHOW/SELECT shows all processes/threads.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
1 root localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
3 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
1 root localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
5 Grant PROCESS privilege to anonymous user.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT PROCESS ON *.* TO ''@'localhost';
|
||||
####################################################################################
|
||||
5.1 Establish connection (anonymous1,localhost,'',,information_schema)
|
||||
anonymous user with PROCESS privilege
|
||||
SHOW/SELECT shows all processes/threads.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for @localhost
|
||||
GRANT PROCESS ON *.* TO ''@'localhost'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
1 root localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
4 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
1 root localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
6 Revoke PROCESS privilege from ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass';
|
||||
####################################################################################
|
||||
6.1 New connection con102 (ddicttestuser1 has no more PROCESS privilege)
|
||||
Again (compared to state before GRANT PROCESS) only the processes of
|
||||
ddicttestuser1 are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
5 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
7 Revoke PROCESS privilege from anonymous user + disconnect ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM ''@'localhost';
|
||||
####################################################################################
|
||||
7.1 New connection (anonymous2,localhost,'',,information_schema)
|
||||
The anonymous user has no more the PROCESS privilege
|
||||
Again only the processes of the anonymous user are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR ''@'localhost';
|
||||
Grants for @localhost
|
||||
GRANT USAGE ON *.* TO ''@'localhost'
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
6 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
4 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
8 Grant SUPER (does not imply PROCESS) privilege to ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
8.1 New connection con103 (ddicttestuser1 with SUPER privilege)
|
||||
Only the processes of ddicttestuser1 user are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
7 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
9 Revoke SUPER privilege from user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SUPER ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
9.1 New connection con104 (ddicttestuser1 without SUPER privilege)
|
||||
ddicttestuser1 has no more the SUPER privilege.
|
||||
Only the processes of ddicttestuser1 are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
8 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
10 Grant SUPER privilege with grant option to user ddicttestuser1.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
|
||||
####################################################################################
|
||||
10.1 New connection con105 (ddicttestuser1 with SUPER privilege and GRANT OPTION)
|
||||
Try to grant PROCESS privilege to user ddicttestuser2 without having it.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' WITH GRANT OPTION
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password: YES)
|
||||
####################################################################################
|
||||
10.2 Grant SUPER and PROCESS privilege with grant option to user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT SUPER,PROCESS ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
|
||||
####################################################################################
|
||||
10.3 New connection con106 (ddicttestuser1 with SUPER,PROCESS WITH GRANT OPTION)
|
||||
Grant PROCESS privilege to user ddicttestuser2
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT PROCESS, SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' WITH GRANT OPTION
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
####################################################################################
|
||||
10.4 New connection con200 (ddicttestuser2 with PROCESS privilege)
|
||||
ddicttestuser2 has now the PROCESS privilege and sees all connections
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser2'@'localhost';
|
||||
Grants for ddicttestuser2@localhost
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
1 root localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
6 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser2 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
11 ddicttestuser2 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
6 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
1 root localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
11 User ddicttestuser1 revokes PROCESS privilege from user ddicttestuser2
|
||||
connection ddicttestuser1;
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM 'ddicttestuser2'@'localhost';
|
||||
####################################################################################
|
||||
11.1 New connection con201 (ddicttestuser2)
|
||||
ddicttestuser2 has no more the PROCESS privilege and can only see own connects
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser2@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser2'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
11 ddicttestuser2 localhost information_schema Sleep TIME NULL
|
||||
12 ddicttestuser2 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
12 ddicttestuser2 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
11 ddicttestuser2 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
11.2 Revoke SUPER,PROCESS,GRANT OPTION privilege from user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SUPER,PROCESS,GRANT OPTION ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
11.3 New connection con107 (ddicttestuser1)
|
||||
ddicttestuser1 has no more the PROCESS privilege and can only see own connects
|
||||
He is also unable to GRANT the PROCESS privilege to ddicttestuser2
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password: YES)
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
13 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
13 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
12 Revoke the SELECT privilege from user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SELECT ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
12.1 New connection con108 (ddicttestuser1)
|
||||
ddicttestuser1 has neither PROCESS nor SELECT privilege
|
||||
Manual says: Each MySQL user has the right to access these tables, but can see
|
||||
only the rows ...
|
||||
Therefore the missing SELECT privilege does not affect SELECTs on PROCESSLIST.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
13 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
14 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
14 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
13 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
12.2 Revoke only the SELECT privilege on the information_schema from ddicttestuser1.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SELECT ON information_schema.* FROM 'ddicttestuser3'@'localhost';
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
####################################################################################
|
||||
connection default (user=root)
|
||||
Cleanup: close connections, DROP USER etc.
|
||||
####################################################################################
|
||||
DROP USER ddicttestuser1@'localhost';
|
||||
DROP USER ddicttestuser2@'localhost';
|
174
mysql-test/suite/funcs_1/r/a_processlist_val_no_prot.result
Normal file
174
mysql-test/suite/funcs_1/r/a_processlist_val_no_prot.result
Normal file
File diff suppressed because one or more lines are too long
469
mysql-test/suite/funcs_1/r/b_processlist_priv_ps.result
Normal file
469
mysql-test/suite/funcs_1/r/b_processlist_priv_ps.result
Normal file
@@ -0,0 +1,469 @@
|
||||
USE information_schema;
|
||||
####################################################################################
|
||||
1 Prepare test.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
####################################################################################
|
||||
1.1 Create two user
|
||||
####################################################################################
|
||||
DROP USER ddicttestuser1@'localhost';
|
||||
ERROR HY000: Operation DROP USER failed for 'ddicttestuser1'@'localhost'
|
||||
DROP USER ddicttestuser2@'localhost';
|
||||
ERROR HY000: Operation DROP USER failed for 'ddicttestuser2'@'localhost'
|
||||
CREATE USER ddicttestuser1@'localhost';
|
||||
CREATE USER ddicttestuser2@'localhost';
|
||||
SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass');
|
||||
SET PASSWORD FOR ddicttestuser2@'localhost' = PASSWORD('ddictpass');
|
||||
####################################################################################
|
||||
1.2 Establish connection con100 (user=ddicttestuser1 with no PROCESS privilege):
|
||||
####################################################################################
|
||||
####################################################################################
|
||||
2 connection default(user=root with default privileges):
|
||||
SHOW/SELECT shows all processes/threads.
|
||||
####################################################################################
|
||||
SHOW CREATE TABLE processlist;
|
||||
Table Create Table
|
||||
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
|
||||
`ID` bigint(4) NOT NULL DEFAULT '0',
|
||||
`USER` varchar(16) NOT NULL DEFAULT '',
|
||||
`HOST` varchar(64) NOT NULL DEFAULT '',
|
||||
`DB` varchar(64) DEFAULT NULL,
|
||||
`COMMAND` varchar(16) NOT NULL DEFAULT '',
|
||||
`TIME` bigint(7) NOT NULL DEFAULT '0',
|
||||
`STATE` varchar(64) DEFAULT NULL,
|
||||
`INFO` longtext
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
3 root localhost information_schema Query TIME NULL SHOW processlist
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
SELECT * FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
3 root localhost information_schema Execute TIME preparing SELECT * FROM processlist ORDER BY id
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
3 root localhost information_schema Execute TIME preparing SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
CREATE TEMPORARY TABLE test.t_processlist AS SELECT * FROM processlist;
|
||||
UPDATE test.t_processlist SET user='horst' WHERE id=1 ;
|
||||
INSERT INTO processlist SELECT * FROM test.t_processlist;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP TABLE test.t_processlist;
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist WITH CHECK OPTION;
|
||||
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist'
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist;
|
||||
UPDATE test.v_processlist SET TIME=NOW() WHERE id = 1;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP VIEW test.v_processlist;
|
||||
UPDATE processlist SET user='any_user' WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DELETE FROM processlist WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
REVOKE ALL ON processlist FROM current_user;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
GRANT INSERT,UPDATE ON processlist TO current_user;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
SHOW GRANTS;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
CREATE INDEX i_processlist ON processlist (user);
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP TABLE processlist;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist DROP COLUMN user;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist ADD COLUMN (my_column INT);
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
RENAME TABLE processlist TO new_processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
RENAME TABLE processlist TO files;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
CREATE TABLE new_processlist AS SELECT * FROM processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
DROP DATABASE information_schema;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
RENAME DATABASE information_schema TO info_schema;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
####################################################################################
|
||||
3 Switch to connection con100 (user=ddicttestuser1 with no PROCESS privilege):
|
||||
SHOW/SELECT shows only the processes (1) of the user.
|
||||
####################################################################################
|
||||
SHOW CREATE TABLE processlist;
|
||||
Table Create Table
|
||||
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
|
||||
`ID` bigint(4) NOT NULL DEFAULT '0',
|
||||
`USER` varchar(16) NOT NULL DEFAULT '',
|
||||
`HOST` varchar(64) NOT NULL DEFAULT '',
|
||||
`DB` varchar(64) DEFAULT NULL,
|
||||
`COMMAND` varchar(16) NOT NULL DEFAULT '',
|
||||
`TIME` bigint(7) NOT NULL DEFAULT '0',
|
||||
`STATE` varchar(64) DEFAULT NULL,
|
||||
`INFO` longtext
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
4 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM processlist ORDER BY id
|
||||
SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
4 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id
|
||||
CREATE TEMPORARY TABLE test.t_processlist AS SELECT * FROM processlist;
|
||||
UPDATE test.t_processlist SET user='horst' WHERE id=1 ;
|
||||
INSERT INTO processlist SELECT * FROM test.t_processlist;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DROP TABLE test.t_processlist;
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist WITH CHECK OPTION;
|
||||
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist'
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist;
|
||||
UPDATE test.v_processlist SET TIME=NOW() WHERE id = 1;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DROP VIEW test.v_processlist;
|
||||
UPDATE processlist SET user='any_user' WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DELETE FROM processlist WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
REVOKE ALL ON processlist FROM current_user;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
GRANT INSERT,UPDATE ON processlist TO current_user;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
CREATE INDEX i_processlist ON processlist (user);
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DROP TABLE processlist;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist DROP COLUMN user;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist ADD COLUMN (my_column INT);
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
RENAME TABLE processlist TO new_processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
RENAME TABLE processlist TO files;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
CREATE TABLE new_processlist AS SELECT * FROM processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
DROP DATABASE information_schema;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
RENAME DATABASE information_schema TO info_schema;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
####################################################################################
|
||||
4 Grant PROCESS privilege to ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT PROCESS ON *.* TO ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass';
|
||||
####################################################################################
|
||||
4.1 Existing connection con100 (ddicttestuser1)
|
||||
The user ddicttestuser1 has the PROCESS privilege, but the connection was
|
||||
established before PROCESS was granted.
|
||||
SHOW/SELECT shows only the processes (1) of the user.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
4 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
####################################################################################
|
||||
4.2 New connection con101 (ddicttestuser1 with PROCESS privilege)
|
||||
SHOW/SELECT shows all processes/threads.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
3 root localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
5 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 root localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
5 Grant PROCESS privilege to anonymous user.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT PROCESS ON *.* TO ''@'localhost';
|
||||
####################################################################################
|
||||
5.1 Establish connection (anonymous1,localhost,'',,information_schema)
|
||||
anonymous user with PROCESS privilege
|
||||
SHOW/SELECT shows all processes/threads.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for @localhost
|
||||
GRANT PROCESS ON *.* TO ''@'localhost'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
3 root localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
6 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
6 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 root localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
6 Revoke PROCESS privilege from ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass';
|
||||
####################################################################################
|
||||
6.1 New connection con102 (ddicttestuser1 has no more PROCESS privilege)
|
||||
Again (compared to state before GRANT PROCESS) only the processes of
|
||||
ddicttestuser1 are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
7 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
7 Revoke PROCESS privilege from anonymous user + disconnect ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM ''@'localhost';
|
||||
####################################################################################
|
||||
7.1 New connection (anonymous2,localhost,'',,information_schema)
|
||||
The anonymous user has no more the PROCESS privilege
|
||||
Again only the processes of the anonymous user are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR ''@'localhost';
|
||||
Grants for @localhost
|
||||
GRANT USAGE ON *.* TO ''@'localhost'
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
8 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
6 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
8 Grant SUPER (does not imply PROCESS) privilege to ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
8.1 New connection con103 (ddicttestuser1 with SUPER privilege)
|
||||
Only the processes of ddicttestuser1 user are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
9 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
9 Revoke SUPER privilege from user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SUPER ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
9.1 New connection con104 (ddicttestuser1 without SUPER privilege)
|
||||
ddicttestuser1 has no more the SUPER privilege.
|
||||
Only the processes of ddicttestuser1 are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
10 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
10 Grant SUPER privilege with grant option to user ddicttestuser1.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
|
||||
####################################################################################
|
||||
10.1 New connection con105 (ddicttestuser1 with SUPER privilege and GRANT OPTION)
|
||||
Try to grant PROCESS privilege to user ddicttestuser2 without having it.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' WITH GRANT OPTION
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password: YES)
|
||||
####################################################################################
|
||||
10.2 Grant SUPER and PROCESS privilege with grant option to user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT SUPER,PROCESS ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
|
||||
####################################################################################
|
||||
10.3 New connection con106 (ddicttestuser1 with SUPER,PROCESS WITH GRANT OPTION)
|
||||
Grant PROCESS privilege to user ddicttestuser2
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT PROCESS, SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' WITH GRANT OPTION
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
####################################################################################
|
||||
10.4 New connection con200 (ddicttestuser2 with PROCESS privilege)
|
||||
ddicttestuser2 has now the PROCESS privilege and sees all connections
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser2'@'localhost';
|
||||
Grants for ddicttestuser2@localhost
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
3 root localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
6 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
12 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
13 ddicttestuser2 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
13 ddicttestuser2 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
12 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
6 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 root localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
11 User ddicttestuser1 revokes PROCESS privilege from user ddicttestuser2
|
||||
connection ddicttestuser1;
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM 'ddicttestuser2'@'localhost';
|
||||
####################################################################################
|
||||
11.1 New connection con201 (ddicttestuser2)
|
||||
ddicttestuser2 has no more the PROCESS privilege and can only see own connects
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser2@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser2'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
13 ddicttestuser2 localhost information_schema Sleep TIME NULL
|
||||
14 ddicttestuser2 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
14 ddicttestuser2 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
13 ddicttestuser2 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
11.2 Revoke SUPER,PROCESS,GRANT OPTION privilege from user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SUPER,PROCESS,GRANT OPTION ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
11.3 New connection con107 (ddicttestuser1)
|
||||
ddicttestuser1 has no more the PROCESS privilege and can only see own connects
|
||||
He is also unable to GRANT the PROCESS privilege to ddicttestuser2
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password: YES)
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
12 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
15 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
15 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
12 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
12 Revoke the SELECT privilege from user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SELECT ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
12.1 New connection con108 (ddicttestuser1)
|
||||
ddicttestuser1 has neither PROCESS nor SELECT privilege
|
||||
Manual says: Each MySQL user has the right to access these tables, but can see
|
||||
only the rows ...
|
||||
Therefore the missing SELECT privilege does not affect SELECTs on PROCESSLIST.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
12 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
15 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
16 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
16 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
15 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
12 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
12.2 Revoke only the SELECT privilege on the information_schema from ddicttestuser1.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SELECT ON information_schema.* FROM 'ddicttestuser3'@'localhost';
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
####################################################################################
|
||||
connection default (user=root)
|
||||
Cleanup: close connections, DROP USER etc.
|
||||
####################################################################################
|
||||
DROP USER ddicttestuser1@'localhost';
|
||||
DROP USER ddicttestuser2@'localhost';
|
174
mysql-test/suite/funcs_1/r/b_processlist_val_ps.result
Normal file
174
mysql-test/suite/funcs_1/r/b_processlist_val_ps.result
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user