Commit c43a7e2e authored by unknown's avatar unknown

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.0

parents 61938527 3bf3bb20
......@@ -1269,3 +1269,6 @@ vio/viotest.cpp
zlib/*.ds?
zlib/*.vcproj
libmysqld/ha_blackhole.cc
client/my_user.c
libmysqld/my_user.c
sql/my_user.c
......@@ -46,7 +46,7 @@ mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c
mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix)
mysqlcheck_SOURCES= mysqlcheck.c $(yassl_dummy_link_fix)
mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix)
mysqldump_SOURCES= mysqldump.c $(yassl_dummy_link_fix)
mysqldump_SOURCES= mysqldump.c my_user.c $(yassl_dummy_link_fix)
mysqlimport_SOURCES= mysqlimport.c $(yassl_dummy_link_fix)
sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
strings_src=decimal.c
......@@ -62,7 +62,10 @@ link_sources:
for f in $(strings_src) ; do \
rm -f $(srcdir)/$$f; \
@LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \
done;
done; \
rm -f $(srcdir)/my_user.c; \
@LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c;
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -41,6 +41,7 @@
#include <my_global.h>
#include <my_sys.h>
#include <my_user.h>
#include <m_string.h>
#include <m_ctype.h>
#include <hash.h>
......@@ -1840,9 +1841,37 @@ static void dump_triggers_for_table (char *table, char *db)
DELIMITER ;;\n");
while ((row= mysql_fetch_row(result)))
{
fprintf(sql_file, "/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n\
/*!50003 CREATE TRIGGER %s %s %s ON %s FOR EACH ROW%s%s */;;\n\n",
row[6], /* sql_mode */
fprintf(sql_file,
"/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n"
"/*!50003 CREATE */ ",
row[6] /* sql_mode */);
if (mysql_num_fields(result) > 7)
{
/*
mysqldump can be run against the server, that does not support definer
in triggers (there is no DEFINER column in SHOW TRIGGERS output). So,
we should check if we have this column before accessing it.
*/
uint user_name_len;
char user_name_str[USERNAME_LENGTH + 1];
char quoted_user_name_str[USERNAME_LENGTH * 2 + 3];
uint host_name_len;
char host_name_str[HOSTNAME_LENGTH + 1];
char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3];
parse_user(row[7], strlen(row[7]), user_name_str, &user_name_len,
host_name_str, &host_name_len);
fprintf(sql_file,
"/*!50017 DEFINER=%s@%s */ ",
quote_name(user_name_str, quoted_user_name_str, FALSE),
quote_name(host_name_str, quoted_host_name_str, FALSE));
}
fprintf(sql_file,
"/*!50003 TRIGGER %s %s %s ON %s FOR EACH ROW%s%s */;;\n\n",
quote_name(row[0], name_buff, 0), /* Trigger */
row[4], /* Timing */
row[1], /* Event */
......
This diff is collapsed.
......@@ -30,7 +30,9 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
;;
esac
AC_SUBST([yassl_taocrypt_extra_cxxflags])
# Link extra/yassl/include/openssl subdir to include/
yassl_h_ln_cmd="\$(LN) -s \$(top_srcdir)/extra/yassl/include/openssl openssl"
AC_SUBST(yassl_h_ln_cmd)
else
yassl_dir=""
AC_MSG_RESULT(no)
......
......@@ -30,10 +30,11 @@ noinst_HEADERS = config-win.h config-os2.h config-netware.h \
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
my_aes.h my_tree.h hash.h thr_alarm.h \
thr_lock.h t_ctype.h violite.h md5.h base64.h \
mysql_version.h.in my_handler.h my_time.h decimal.h
mysql_version.h.in my_handler.h my_time.h decimal.h \
my_user.h
# mysql_version.h are generated
CLEANFILES = mysql_version.h my_config.h readline
CLEANFILES = mysql_version.h my_config.h readline openssl
# Some include files that may be moved and patched by configure
DISTCLEANFILES = sched.h $(CLEANFILES)
......@@ -41,6 +42,7 @@ DISTCLEANFILES = sched.h $(CLEANFILES)
link_sources:
-$(RM) -fr readline
@readline_h_ln_cmd@
@yassl_h_ln_cmd@
my_config.h: ../config.h
$(CP) ../config.h my_config.h
......
......@@ -95,6 +95,9 @@ extern "C" {
/* On NetWare, stack grows towards lower address*/
#define STACK_DIRECTION -1
/* On NetWare, we need to set stack size for threads, otherwise default 16K is used */
#define NW_THD_STACKSIZE 65536
/* On NetWare, to fix the problem with the deletion of open files */
#define CANT_DELETE_OPEN_FILES 1
......
......@@ -22,6 +22,11 @@ functions */
#define _WIN32_WINNT 0x0500
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1400
/* Avoid endless warnings about sprintf() etc. being unsafe. */
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#include <sys/locking.h>
#include <windows.h>
#include <math.h> /* Because of rint() */
......@@ -103,11 +108,17 @@ functions */
#undef _REENTRANT /* Crashes something for win32 */
#undef SAFE_MUTEX /* Can't be used on windows */
#define LONGLONG_MIN ((__int64) 0x8000000000000000)
#define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF)
#define ULONGLONG_MAX ((unsigned __int64) 0xFFFFFFFFFFFFFFFF)
#define LL(A) ((__int64) A)
#define ULL(A) ((unsigned __int64) A)
#if defined(_MSC_VER) && _MSC_VER >= 1310
#define LL(A) A##ll
#define ULL(A) A##ull
#else
#define LL(A) ((__int64) A)
#define ULL(A) ((unsigned __int64) A)
#endif
#define LONGLONG_MIN LL(0x8000000000000000)
#define LONGLONG_MAX LL(0x7FFFFFFFFFFFFFFF)
#define ULONGLONG_MAX ULL(0xFFFFFFFFFFFFFFFF)
/* Type information */
......@@ -328,6 +339,7 @@ inline double ulonglong2double(ulonglong value)
#define SPRINTF_RETURNS_INT
#define HAVE_SETFILEPOINTER
#define HAVE_VIO_READ_BUFF
#define HAVE_STRNLEN
#ifndef __NT__
#undef FILE_SHARE_DELETE
......
......@@ -33,7 +33,7 @@ typedef void (*hash_free_key)(void *);
typedef struct st_hash {
uint key_offset,key_length; /* Length of key if const length */
uint records,blength,current_record;
uint records, blength;
uint flags;
DYNAMIC_ARRAY array; /* Place for hash_keys */
hash_get_key get_key;
......@@ -41,6 +41,9 @@ typedef struct st_hash {
CHARSET_INFO *charset;
} HASH;
/* A search iterator state */
typedef uint HASH_SEARCH_STATE;
#define hash_init(A,B,C,D,E,F,G,H) _hash_init(A,B,C,D,E,F,G, H CALLER_INFO)
my_bool _hash_init(HASH *hash, CHARSET_INFO *charset,
uint default_array_elements, uint key_offset,
......@@ -49,12 +52,15 @@ my_bool _hash_init(HASH *hash, CHARSET_INFO *charset,
void hash_free(HASH *tree);
void my_hash_reset(HASH *hash);
byte *hash_element(HASH *hash,uint idx);
gptr hash_search(HASH *info,const byte *key,uint length);
gptr hash_next(HASH *info,const byte *key,uint length);
gptr hash_search(const HASH *info, const byte *key, uint length);
gptr hash_first(const HASH *info, const byte *key, uint length,
HASH_SEARCH_STATE *state);
gptr hash_next(const HASH *info, const byte *key, uint length,
HASH_SEARCH_STATE *state);
my_bool my_hash_insert(HASH *info,const byte *data);
my_bool hash_delete(HASH *hash,byte *record);
my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length);
void hash_replace(HASH *hash, uint idx, byte *new_row);
void hash_replace(HASH *hash, HASH_SEARCH_STATE *state, byte *new_row);
my_bool hash_check(HASH *hash); /* Only in debug library */
#define hash_clear(H) bzero((char*) (H),sizeof(*(H)))
......
......@@ -862,6 +862,7 @@ typedef off_t os_off_t;
#define SOCKET_EAGAIN WSAEINPROGRESS
#define SOCKET_ETIMEDOUT WSAETIMEDOUT
#define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK
#define SOCKET_EADDRINUSE WSAEADDRINUSE
#define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE
#elif defined(OS2)
......@@ -870,6 +871,7 @@ typedef off_t os_off_t;
#define SOCKET_EAGAIN SOCEINPROGRESS
#define SOCKET_ETIMEDOUT SOCKET_EINTR
#define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK
#define SOCKET_EADDRINUSE SOCEADDRINUSE
#define SOCKET_ENFILE SOCENFILE
#define SOCKET_EMFILE SOCEMFILE
#define closesocket(A) soclose(A)
......@@ -880,6 +882,7 @@ typedef off_t os_off_t;
#define SOCKET_EAGAIN EAGAIN
#define SOCKET_ETIMEDOUT SOCKET_EINTR
#define SOCKET_EWOULDBLOCK EWOULDBLOCK
#define SOCKET_EADDRINUSE EADDRINUSE
#define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE
#endif
......
/* Copyright (C) 2005 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
This is a header for libraries containing functions used in both server and
only some of clients (but not in libmysql)...
*/
#ifndef _my_user_h_
#define _my_user_h_
#include <my_global.h>
C_MODE_START
void parse_user(const char *user_id_str, uint user_id_len,
char *user_name_str, uint *user_name_len,
char *host_name_str, uint *host_name_len);
C_MODE_END
#endif /* _my_user_h_ */
......@@ -27,6 +27,14 @@
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
/*
USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain
username and hostname parts of the user identifier with trailing zero in
MySQL standard format:
user_name_part@host_name_part\0
*/
#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2
#define LOCAL_HOST "localhost"
#define LOCAL_HOST_NAMEDPIPE "."
......
......@@ -60,8 +60,8 @@ typedef struct SHA1_CONTEXT
C_MODE_START
int sha1_reset( SHA1_CONTEXT* );
int sha1_input( SHA1_CONTEXT*, const uint8 *, unsigned int );
int sha1_result( SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE] );
int mysql_sha1_reset(SHA1_CONTEXT*);
int mysql_sha1_input(SHA1_CONTEXT*, const uint8 *, unsigned int);
int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]);
C_MODE_END
......@@ -147,6 +147,15 @@ os_thread_create(
"InnoDB: Error: pthread_attr_setstacksize returned %d\n", ret);
exit(1);
}
#endif
#ifdef __NETWARE__
ret = pthread_attr_setstacksize(&attr,
(size_t) NW_THD_STACKSIZE);
if (ret) {
fprintf(stderr,
"InnoDB: Error: pthread_attr_setstacksize returned %d\n", ret);
exit(1);
}
#endif
os_mutex_enter(os_sync_mutex);
os_thread_count++;
......
......@@ -22,7 +22,7 @@
target = libmysqlclient_r.la
target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@ @yassl_libs@
LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
......@@ -32,7 +32,7 @@ include $(top_srcdir)/libmysql/Makefile.shared
libmysql_dir = $(top_srcdir)/libmysql
libmysqlclient_r_la_SOURCES = $(target_sources)
libmysqlclient_r_la_LIBADD = $(target_libadd)
libmysqlclient_r_la_LIBADD = $(target_libadd) $(yassl_libs_with_path)
libmysqlclient_r_la_LDFLAGS = $(target_ldflags)
# This is called from the toplevel makefile
......
......@@ -63,7 +63,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
ha_blackhole.cc ha_archive.cc
ha_blackhole.cc ha_archive.cc my_user.c
libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
libmysqld_a_SOURCES=
......
......@@ -9,8 +9,8 @@ disable_query_log;
drop table if exists t1, t2;
--enable_warnings
flush tables;
@r/have_ndb.require show variables like "have_ndbcluster";
# @r/server_id.require show variables like "server_id";
--require r/have_ndb.require
show variables like "have_ndbcluster";
enable_query_log;
# Check that server2 has NDB support
......@@ -20,8 +20,8 @@ disable_query_log;
drop table if exists t1, t2;
--enable_warnings
flush tables;
@r/have_ndb.require show variables like "have_ndbcluster";
# @r/server_id1.require show variables like "server_id";
--require r/have_ndb.require
show variables like "have_ndbcluster";
enable_query_log;
# Set the default connection to 'server1'
......
......@@ -8,7 +8,8 @@ connection slave;
--disable_warnings
stop slave;
--enable_warnings
@r/slave-stopped.result show status like 'Slave_running';
--require r/slave-stopped.result
show status like 'Slave_running';
connection master;
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
......@@ -21,7 +22,8 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
start slave;
@r/slave-running.result show status like 'Slave_running';
--require r/slave-running.result
show status like 'Slave_running';
# Set the default connection to 'master'
connection master;
......@@ -52,7 +52,6 @@ execute stmt1;
##### parameter used for keyword like SELECT (must fail)
set @arg00='SELECT' ;
# mysqltest gives no output for the next statement, Why ??
--error 1064
@arg00 a from t1 where a=1;
--error 1064
......
......@@ -890,7 +890,14 @@ sub mtr_exit ($) {
# cluck("Called mtr_exit()");
mtr_timer_stop_all($::glob_timers);
local $SIG{HUP} = 'IGNORE';
kill('HUP', -$$);
# ToDo: Signalling -$$ will only work if we are the process group
# leader (in fact on QNX it will signal our session group leader,
# which might be Do-compile or Pushbuild, causing tests to be
# aborted). So we only do it if we are the group leader. We might
# set ourselves as the group leader at startup (with
# POSIX::setpgrp(0,0)), but then care must be needed to always do
# proper child process cleanup.
kill('HUP', -$$) if $$ == getpgrp();
sleep 2;
exit($code);
}
......
......@@ -152,6 +152,7 @@ our $path_client_bindir;
our $path_language;
our $path_timefile;
our $path_manager_log; # Used by mysqldadmin
our $path_mysqltest_log;
our $path_slave_load_tmpdir; # What is this?!
our $path_my_basedir;
our $opt_vardir; # A path but set directly on cmd line
......@@ -193,6 +194,9 @@ our $opt_ssl;
our $opt_skip_ssl;
our $opt_ssl_supported;
our $opt_ps_protocol;
our $opt_sp_protocol;
our $opt_cursor_protocol;
our $opt_view_protocol;
our $opt_current_test;
our $opt_ddd;
......@@ -268,6 +272,7 @@ our $opt_user;
our $opt_user_test;
our $opt_valgrind;
our $opt_valgrind_mysqld;
our $opt_valgrind_mysqltest;
our $opt_valgrind_all;
our $opt_valgrind_options;
......@@ -509,6 +514,9 @@ sub command_line_setup () {
# Control what engine/variation to run
'embedded-server' => \$opt_embedded_server,
'ps-protocol' => \$opt_ps_protocol,
'sp-protocol' => \$opt_sp_protocol,
'view-protocol' => \$opt_view_protocol,
'cursor-protocol' => \$opt_cursor_protocol,
'ssl|with-openssl' => \$opt_ssl,
'skip-ssl' => \$opt_skip_ssl,
'compress' => \$opt_compress,
......@@ -762,6 +770,7 @@ sub command_line_setup () {
# "somestring" option is name/path of valgrind executable
# Take executable path from any of them, if any
$opt_valgrind_mysqld= $opt_valgrind;
$opt_valgrind= $opt_valgrind_mysqltest if $opt_valgrind_mysqltest;
$opt_valgrind= $opt_valgrind_all if $opt_valgrind_all;
......@@ -804,6 +813,12 @@ sub command_line_setup () {
}
}
# On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
# considered different, so avoid the extra slash (/) in the socket
# paths.
my $sockdir = $opt_tmpdir;
$sockdir =~ s|/+$||;
# Put this into a hash, will be a C struct
$master->[0]=
......@@ -812,7 +827,7 @@ sub command_line_setup () {
path_myerr => "$opt_vardir/log/master.err",
path_mylog => "$opt_vardir/log/master.log",
path_mypid => "$opt_vardir/run/master.pid",
path_mysock => "$opt_tmpdir/master.sock",
path_mysock => "$sockdir/master.sock",
path_myport => $opt_master_myport,
start_timeout => 400, # enough time create innodb tables
......@@ -825,7 +840,7 @@ sub command_line_setup () {
path_myerr => "$opt_vardir/log/master1.err",
path_mylog => "$opt_vardir/log/master1.log",
path_mypid => "$opt_vardir/run/master1.pid",
path_mysock => "$opt_tmpdir/master1.sock",
path_mysock => "$sockdir/master1.sock",
path_myport => $opt_master_myport + 1,
start_timeout => 400, # enough time create innodb tables
};
......@@ -836,7 +851,7 @@ sub command_line_setup () {
path_myerr => "$opt_vardir/log/slave.err",
path_mylog => "$opt_vardir/log/slave.log",
path_mypid => "$opt_vardir/run/slave.pid",
path_mysock => "$opt_tmpdir/slave.sock",
path_mysock => "$sockdir/slave.sock",
path_myport => $opt_slave_myport,
start_timeout => 400,
};
......@@ -847,7 +862,7 @@ sub command_line_setup () {
path_myerr => "$opt_vardir/log/slave1.err",
path_mylog => "$opt_vardir/log/slave1.log",
path_mypid => "$opt_vardir/run/slave1.pid",
path_mysock => "$opt_tmpdir/slave1.sock",
path_mysock => "$sockdir/slave1.sock",
path_myport => $opt_slave_myport + 1,
start_timeout => 300,
};
......@@ -858,7 +873,7 @@ sub command_line_setup () {
path_myerr => "$opt_vardir/log/slave2.err",
path_mylog => "$opt_vardir/log/slave2.log",
path_mypid => "$opt_vardir/run/slave2.pid",
path_mysock => "$opt_tmpdir/slave2.sock",
path_mysock => "$sockdir/slave2.sock",
path_myport => $opt_slave_myport + 2,
start_timeout => 300,
};
......@@ -868,7 +883,7 @@ sub command_line_setup () {
path_err => "$opt_vardir/log/im.err",
path_log => "$opt_vardir/log/im.log",
path_pid => "$opt_vardir/run/im.pid",
path_sock => "$opt_tmpdir/im.sock",
path_sock => "$sockdir/im.sock",
port => $im_port,
start_timeout => $master->[0]->{'start_timeout'},
admin_login => 'im_admin',
......@@ -883,7 +898,7 @@ sub command_line_setup () {
server_id => 1,
port => $im_mysqld1_port,
path_datadir => "$opt_vardir/im_mysqld_1.data",
path_sock => "$opt_tmpdir/mysqld_1.sock",
path_sock => "$sockdir/mysqld_1.sock",
path_pid => "$opt_vardir/run/mysqld_1.pid",
};
......@@ -892,7 +907,7 @@ sub command_line_setup () {
server_id => 2,
port => $im_mysqld2_port,
path_datadir => "$opt_vardir/im_mysqld_2.data",
path_sock => "$opt_tmpdir/mysqld_2.sock",
path_sock => "$sockdir/mysqld_2.sock",
path_pid => "$opt_vardir/run/mysqld_2.pid",
nonguarded => 1,
};
......@@ -905,6 +920,7 @@ sub command_line_setup () {
}
$path_timefile= "$opt_vardir/log/mysqltest-time";
$path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
}
......@@ -949,7 +965,19 @@ sub executable_setup () {
}
else
{
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
if ( $opt_valgrind_mysqltest )
{
# client/mysqltest might be a libtool .sh script, so look for real exe
# to avoid valgrinding bash ;)
$exe_mysqltest=
mtr_exe_exists("$path_client_bindir/.libs/lt-mysqltest",
"$path_client_bindir/.libs/mysqltest",
"$path_client_bindir/mysqltest");
}
else
{
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
}
$exe_mysql_client_test=
mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
"/usr/bin/false");
......@@ -1880,6 +1908,11 @@ sub run_testcase ($) {
}
report_failure_and_restart($tinfo);
}
# Save info from this testcase run to mysqltest.log
mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n");
my $testcase_log= mtr_fromfile($path_timefile);
mtr_tofile($path_mysqltest_log,
$testcase_log);
}
# ----------------------------------------------------------------------
......@@ -2040,7 +2073,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
if ( defined $opt_valgrind )
if ( defined $opt_valgrind_mysqld )
{
mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
mtr_add_arg($args, "%s--skip-bdb", $prefix);
......@@ -2266,7 +2299,7 @@ sub mysqld_start ($$$$) {
mtr_init_args(\$args);
if ( defined $opt_valgrind )
if ( defined $opt_valgrind_mysqld )
{
valgrind_arguments($args, \$exe);
}
......@@ -2597,6 +2630,21 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--ps-protocol");
}
if ( $opt_sp_protocol )
{
mtr_add_arg($args, "--sp-protocol");
}
if ( $opt_view_protocol )
{
mtr_add_arg($args, "--view-protocol");
}
if ( $opt_cursor_protocol )
{
mtr_add_arg($args, "--cursor-protocol");
}
if ( $opt_strace_client )
{
$exe= "strace"; # FIXME there are ktrace, ....
......@@ -2705,6 +2753,7 @@ sub valgrind_arguments {
mtr_add_arg($args, split(' ', $opt_valgrind_options));
}
mtr_add_arg($args, $$exe);
$$exe= $opt_valgrind || "valgrind";
......@@ -2728,6 +2777,10 @@ Options to control what engine/variation to run
embedded-server Use the embedded server, i.e. no mysqld daemons
ps-protocol Use the binary protocol between client and server
cursor-protocol Use the cursor protocol between client and server
(implies --ps-protocol)
view-protocol Create a view to execute all non updating queries
sp-protocol Create a stored procedure to execute all queries
compress Use the compressed protocol between client and server
ssl Use ssl protocol between client and server
skip-ssl Dont start sterver with support for ssl connections
......@@ -2780,9 +2833,8 @@ Options for coverage, profiling etc
gcov FIXME
gprof FIXME
valgrind[=EXE] Run the "mysqltest" executable as well as the "mysqld"
server using valgrind, optionally specifying the
executable path/name
valgrind[=EXE] Run the "mysqld" server using valgrind, optionally
specifying the executable path/name
valgrind-mysqltest[=EXE] In addition, run the "mysqltest" executable with valgrind
valgrind-all[=EXE] Adds verbose flag, and --show-reachable to valgrind
valgrind-options=ARGS Extra options to give valgrind
......
......@@ -110,6 +110,20 @@ wait_for_pid()
#$WAIT_PID pid $SLEEP_TIME_FOR_DELETE
}
# Check that valgrind is installed
find_valgrind()
{
FIND_VALGRIND=`which valgrind` # this will print an error if not found
# Give good warning to the user and stop
if [ -z "$FIND_VALGRIND" ] ; then
$ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://valgrind.kde.org ."
exit 1
fi
# >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && FIND_VALGRIND="$FIND_VALGRIND --tool=memcheck"
FIND_VALGRIND="$FIND_VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions=$CWD/valgrind.supp"
}
# No paths below as we can't be sure where the program is!
SED=sed
......@@ -255,7 +269,6 @@ DO_GDB=""
MANUAL_GDB=""
DO_DDD=""
DO_CLIENT_GDB=""
DO_VALGRIND_MYSQL_TEST=""
SLEEP_TIME_AFTER_RESTART=1
SLEEP_TIME_FOR_DELETE=10
SLEEP_TIME_FOR_FIRST_MASTER=400 # Enough time to create innodb tables
......@@ -470,15 +483,8 @@ while test $# -gt 0; do
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
;;
--valgrind | --valgrind-all)
VALGRIND=`which valgrind` # this will print an error if not found
# Give good warning to the user and stop
if [ -z "$VALGRIND" ] ; then
$ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://valgrind.kde.org ."
exit 1
fi
# >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && VALGRIND="$VALGRIND --tool=memcheck"
VALGRIND="$VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions=$CWD/valgrind.supp"
find_valgrind;
VALGRIND=$FIND_VALGRIND
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc --skip-bdb"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb"
SLEEP_TIME_AFTER_RESTART=10
......@@ -493,8 +499,13 @@ while test $# -gt 0; do
TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
VALGRIND="$VALGRIND $TMP"
;;
--valgrind-mysqltest)
DO_VALGRIND_MYSQL_TEST=1
--valgrind-mysqltest | --valgrind-mysqltest-all)
find_valgrind;
VALGRIND_MYSQLTEST=$FIND_VALGRIND
if test "$1" = "--valgrind-mysqltest-all"
then
VALGRIND_MYSQLTEST="$VALGRIND_MYSQLTEST -v --show-reachable=yes"
fi
;;
--skip-ndbcluster | --skip-ndb)
USE_NDBCLUSTER=""
......@@ -599,7 +610,7 @@ DASH72=`$ECHO '-------------------------------------------------------'|$CUT -c
if [ x$SOURCE_DIST = x1 ] ; then
if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
if [ -f "$BASEDIR/libmysqld/examples/mysqltest_embedded" ] ; then
MYSQL_TEST="$VALGRIND $BASEDIR/libmysqld/examples/mysqltest_embedded"
MYSQL_TEST="$BASEDIR/libmysqld/examples/mysqltest_embedded"
else
echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>&2
exit 1
......@@ -733,7 +744,7 @@ else
fi
if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
if [ -f "$CLIENT_BINDIR/mysqltest_embedded" ] ; then
MYSQL_TEST="$VALGRIND $CLIENT_BINDIR/mysqltest_embedded"
MYSQL_TEST="$CLIENT_BINDIR/mysqltest_embedded"
else
echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>&2
exit 1
......@@ -744,7 +755,7 @@ else
MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test_embedded"
fi
else
MYSQL_TEST="$VALGRIND_MYSQLTEST $CLIENT_BINDIR/mysqltest"
MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test"
fi
fi
......@@ -759,10 +770,6 @@ then
SLAVE_MYSQLD=$MYSQLD
fi
if [ x$DO_VALGRIND_MYSQL_TEST = x1 ] ; then
MYSQL_TEST="$VALGRIND $MYSQL_TEST"
fi
# If we should run all tests cases, we will use a local server for that
if [ -z "$1" -a -z "$DO_STRESS" ]
......@@ -819,7 +826,10 @@ if [ x$USE_TIMER = x1 ] ; then
fi
MYSQL_TEST_BIN=$MYSQL_TEST
MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
# Export MYSQL_TEST variable for use from .test files
export MYSQL_TEST
GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master
GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
......@@ -829,6 +839,7 @@ GPROF_DIR=$MYSQL_TMP_DIR/gprof
GPROF_MASTER=$GPROF_DIR/master.gprof
GPROF_SLAVE=$GPROF_DIR/slave.gprof
TIMEFILE="$MYSQL_TEST_DIR/var/log/mysqltest-time"
MYSQLTEST_LOG="$MYSQL_TEST_DIR/var/log/mysqltest.log"
if [ -n "$DO_CLIENT_GDB" -o -n "$DO_GDB" ] ; then
XTERM=`which xterm`
fi
......@@ -991,6 +1002,18 @@ report_stats () {
echo "WARNING: Got errors/warnings while running tests. Please examine"
echo "$MY_LOG_DIR/warnings for details."
fi
fi # USE_RUNNING_SERVER
# Check valgrind errors from mysqltest
if [ ! -z "$VALGRIND_MYSQLTEST" ]
then
if $GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors" > /dev/null
then
$ECHO "Valgrind detected errors!"
$GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors"
$ECHO "See $MYSQLTEST_LOG"
fi
fi
}
......@@ -1770,13 +1793,17 @@ run_testcase ()
$RM -f r/$tname.*reject
mysql_test_args="-R $result_file $EXTRA_MYSQL_TEST_OPT"
if [ -z "$DO_CLIENT_GDB" ] ; then
`$MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE`;
`$VALGRIND_MYSQLTEST $MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE`;
else
do_gdb_test "$mysql_test_args" "$tf"
fi
res=$?
# Save the testcase log to mysqltest log file
echo "CURRENT_TEST: $tname" >> $MYSQLTEST_LOG
cat $TIMEFILE >> $MYSQLTEST_LOG
pname=`$ECHO "$tname "|$CUT -c 1-24`
RES="$pname"
......
......@@ -1923,4 +1923,9 @@ d varchar(255) character set utf8,
e varchar(255) character set utf8,
key (a,b,c,d,e)) engine=bdb;
ERROR 42000: Specified key was too long; max key length is 3072 bytes
set autocommit=0;
create table t1 (a int) engine=bdb;
commit;
alter table t1 add primary key(a);
drop table t1;
End of 5.0 tests
......@@ -272,7 +272,6 @@ a b
create table if not exists t1 select 3 as 'a',4 as 'b';
Warnings:
Note 1050 Table 't1' already exists
Warning 1364 Field 'a' doesn't have a default value
create table if not exists t1 select 3 as 'a',3 as 'b';
ERROR 23000: Duplicate entry '3' for key 1
select * from t1;
......@@ -630,8 +629,6 @@ create table t1 (
a varchar(112) charset utf8 collate utf8_bin not null,
primary key (a)
) select 'test' as a ;
Warnings:
Warning 1364 Field 'a' doesn't have a default value
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
......@@ -647,14 +644,39 @@ create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int not null, primary key (a)
) select a, 1 as b from t2 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
`b` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int not null, primary key (a)
) select a, 1 as c from t2 ;
Warnings:
Warning 1364 Field 'a' doesn't have a default value
Warning 1364 Field 'b' doesn't have a default value
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
`b` int(11) NOT NULL,
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
`c` bigint(1) NOT NULL default '0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int null, primary key (a)
) select a, 1 as c from t2 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) default NULL,
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
`c` bigint(1) NOT NULL default '0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
......@@ -662,9 +684,6 @@ create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int not null, primary key (a)
) select 'a' as a , 1 as b from t2 ;
Warnings:
Warning 1364 Field 'a' doesn't have a default value
Warning 1364 Field 'b' doesn't have a default value
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
......@@ -677,8 +696,6 @@ create table t1 (
a varchar(12) charset utf8 collate utf8_bin,
b int not null, primary key (a)
) select 'a' as a , 1 as b from t2 ;
Warnings:
Warning 1364 Field 'b' doesn't have a default value
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
......@@ -697,8 +714,6 @@ a1 varchar(12) charset utf8 collate utf8_bin not null,
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
primary key (a1)
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
Warnings:
Warning 1364 Field 'a1' doesn't have a default value
drop table t2;
create table t2 (
a1 varchar(12) charset utf8 collate utf8_bin,
......@@ -714,8 +729,6 @@ a1 varchar(12) charset utf8 collate utf8_bin not null,
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
primary key (a1)
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
Warnings:
Warning 1364 Field 'a1' doesn't have a default value
drop table t2;
create table t2 ( a int default 3, b int default 3)
select a1,a2 from t1;
......
......@@ -1058,6 +1058,14 @@ char(a)
1
2
drop table t1;
CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8);
INSERT INTO t1 VALUES(REPEAT('a', 100));
CREATE TEMPORARY TABLE t2 SELECT COALESCE(t) AS bug FROM t1;
SELECT LENGTH(bug) FROM t2;
LENGTH(bug)
100
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
SELECT id FROM t1;
......
......@@ -615,3 +615,12 @@ show grants for root@localhost;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
set names latin1;
create user mysqltest_7@;
set password for mysqltest_7@ = password('systpass');
show grants for mysqltest_7@;
Grants for mysqltest_7@
GRANT USAGE ON *.* TO 'mysqltest_7'@'' IDENTIFIED BY PASSWORD '*2FB071A056F9BB745219D9C876814231DAF46517'
drop user mysqltest_7@;
flush privileges;
show grants for mysqltest_7@;
ERROR 42000: There is no such grant defined for user 'mysqltest_7' on host ''
drop table if exists t1;
drop table if exists t1,t3,t4,t5;
create table t1 (a int, b char(10), key a(a), key b(a,b));
insert into t1 values
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
......
......@@ -128,6 +128,19 @@ id description c
1 test 0
2 test2 0
drop table t1,t2,t3;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (3), (4), (1), (3), (1);
SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a)>0;
SUM(a)
2
6
4
SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a);
SUM(a)
2
6
4
DROP TABLE t1;
create table t1 (col1 int, col2 varchar(5), col_t1 int);
create table t2 (col1 int, col2 varchar(5), col_t2 int);
create table t3 (col1 int, col2 varchar(5), col_t3 int);
......
......@@ -384,3 +384,21 @@ max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.ke
8186
set join_buffer_size= @save_join_buffer_size;
drop table t0, t1, t2, t3, t4;
CREATE TABLE t1 (
cola char(3) not null, colb char(3) not null, filler char(200),
key(cola), key(colb)
);
INSERT INTO t1 VALUES ('foo','bar', 'ZZ'),('fuz','baz', 'ZZ');
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
select count(*) from t1;
count(*)
8704
explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 24 Using intersect(cola,colb); Using where
explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 24 Using intersect(cola,colb); Using where
drop table t1;
......@@ -816,40 +816,34 @@ end if;
end|
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1
begin
trg1 INSERT t1 begin
if new.j > 10 then
set new.j := 10;
end if;
end BEFORE NULL root@localhost
trg2 UPDATE t1
begin
trg2 UPDATE t1 begin
if old.i % 2 = 0 then
set new.j := -1;
end if;
end BEFORE NULL root@localhost
trg3 UPDATE t1
begin
trg3 UPDATE t1 begin
if new.j = -1 then
set @fired:= "Yes";
end if;
end AFTER NULL root@localhost
select * from information_schema.triggers;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER
NULL test trg1 INSERT NULL test t1 0 NULL
begin
NULL test trg1 INSERT NULL test t1 0 NULL begin
if new.j > 10 then
set new.j := 10;
end if;
end ROW BEFORE NULL NULL OLD NEW NULL root@localhost
NULL test trg2 UPDATE NULL test t1 0 NULL
begin
NULL test trg2 UPDATE NULL test t1 0 NULL begin
if old.i % 2 = 0 then
set new.j := -1;
end if;
end ROW BEFORE NULL NULL OLD NEW NULL root@localhost
NULL test trg3 UPDATE NULL test t1 0 NULL
begin
NULL test trg3 UPDATE NULL test t1 0 NULL begin
if new.j = -1 then
set @fired:= "Yes";
end if;
......@@ -1074,3 +1068,19 @@ character_maximum_length character_octet_length
32 32
64 64
drop table t1;
CREATE TABLE t1 (f1 BIGINT, f2 VARCHAR(20), f3 BIGINT);
INSERT INTO t1 SET f1 = 1, f2 = 'Schoenenbourg', f3 = 1;
CREATE FUNCTION func2() RETURNS BIGINT RETURN 1;
CREATE FUNCTION func1() RETURNS BIGINT
BEGIN
RETURN ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.VIEWS);
END//
CREATE VIEW v1 AS SELECT 1 FROM t1
WHERE f3 = (SELECT func2 ());
SELECT func1();
func1()
1
DROP TABLE t1;
DROP VIEW v1;
DROP FUNCTION func1;
DROP FUNCTION func2;
......@@ -5,8 +5,6 @@ select ((@id := kill_id) - kill_id) from t1;
((@id := kill_id) - kill_id)
0
kill @id;
select 1;
Got one of the listed errors
select ((@id := kill_id) - kill_id) from t1;
((@id := kill_id) - kill_id)
0
......
......@@ -1937,18 +1937,16 @@ end|
set sql_mode=default|
show triggers like "t1";
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1
begin
trg1 INSERT t1 begin
if new.a > 10 then
set new.a := 10;
set new.a := 11;
end if;
end BEFORE 0000-00-00 00:00:00 root@localhost
trg2 UPDATE t1 begin
trg2 UPDATE t1 begin
if old.a % 2 = 0 then set new.b := 12; end if;
end BEFORE 0000-00-00 00:00:00 root@localhost
trg3 UPDATE t1
begin
trg3 UPDATE t1 begin
if new.a = -1 then
set @fired:= "Yes";
end if;
......@@ -1986,8 +1984,7 @@ UNLOCK TABLES;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW
begin
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW begin
if new.a > 10 then
set new.a := 10;
set new.a := 11;
......@@ -1995,13 +1992,12 @@ end if;
end */;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE TRIGGER `trg2` BEFORE UPDATE ON `t1` FOR EACH ROW begin
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg2` BEFORE UPDATE ON `t1` FOR EACH ROW begin
if old.a % 2 = 0 then set new.b := 12; end if;
end */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
/*!50003 CREATE TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW
begin
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW begin
if new.a = -1 then
set @fired:= "Yes";
end if;
......@@ -2023,8 +2019,7 @@ UNLOCK TABLES;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
/*!50003 CREATE TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW
begin
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW begin
if new.a > 10 then
set @fired:= "No";
end if;
......@@ -2096,24 +2091,21 @@ t1
t2
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1
begin
trg1 INSERT t1 begin
if new.a > 10 then
set new.a := 10;
set new.a := 11;
end if;
end BEFORE # root@localhost
trg2 UPDATE t1 begin
trg2 UPDATE t1 begin
if old.a % 2 = 0 then set new.b := 12; end if;
end BEFORE # root@localhost
trg3 UPDATE t1
begin
trg3 UPDATE t1 begin
if new.a = -1 then
set @fired:= "Yes";
end if;
end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost
trg4 INSERT t2
begin
trg4 INSERT t2 begin
if new.a > 10 then
set @fired:= "No";
end if;
......@@ -2141,7 +2133,7 @@ a2
1
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
testref INSERT test1 BEGIN
testref INSERT test1 BEGIN
INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL root@localhost
SELECT * FROM `test1`;
a1
......@@ -2376,7 +2368,7 @@ UNLOCK TABLES;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
INSERT INTO `t2 test` SET a2 = NEW.a1; END */;;
DELIMITER ;
......@@ -2532,7 +2524,7 @@ UNLOCK TABLES;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="IGNORE_SPACE" */;;
/*!50003 CREATE TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW BEGIN
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW BEGIN
SET new.a = 0;
END */;;
......
DROP TABLE IF EXISTS t1,t2;
DROP TABLE IF EXISTS t1,t2,test1,test2;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3);
CREATE TABLE t2 (a int, b int);
......
......@@ -16,7 +16,7 @@ otto
mysqltest: At line 1: query 'select otto from (select 1 as otto) as t1' succeeded - should have failed with sqlstate 42S22...
select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list'
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22 instead of 00000...
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22: 'Unknown column 'friedrich' in 'field list'', instead of 00000...
select otto from (select 1 as otto) as t1;
otto
1
......@@ -133,7 +133,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
select 1146 as "after_!errno_masked_error" ;
after_!errno_masked_error
1146
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1000...
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1000...
garbage ;
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 'garbage' at line 1
select 1064 as "after_--enable_abort_on_error" ;
......@@ -141,7 +141,7 @@ after_--enable_abort_on_error
1064
select 3 from t1 ;
ERROR 42S02: Table 'test.t1' doesn't exist
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1064...
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1064...
hello
hello
;;;;;;;;
......@@ -149,6 +149,9 @@ hello
mysqltest: At line 1: End of line junk detected: "6"
mysqltest: At line 1: End of line junk detected: "6"
mysqltest: At line 1: Missing delimiter
mysqltest: At line 1: End of line junk detected: "sleep 7
# Another comment
"
mysqltest: At line 1: Extra delimiter ";" found
mysqltest: At line 1: Extra delimiter ";" found
MySQL
......@@ -301,6 +304,7 @@ mysqltest: At line 1: End of line junk detected: "1000"
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: system command 'false' failed
system command 'NonExistsinfComamdn 2> /dev/null' failed
test
test2
test3
......@@ -328,6 +332,7 @@ mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_re
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a;'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a '
OK
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c '
select "a" as col1, "c" as col2;
......@@ -350,9 +355,10 @@ mysqltest: At line 1: Missing connection user
mysqltest: At line 1: Missing connection user
mysqltest: At line 1: Missing connection password
mysqltest: At line 1: Missing connection db
mysqltest: At line 1: Could not open connection 'con2': Unknown database 'illegal_db'
mysqltest: At line 1: Could not open connection 'con2': 1049 Unknown database 'illegal_db'
mysqltest: At line 1: Illegal argument for port: 'illegal_port'
mysqltest: At line 1: Illegal option to connect: SMTP
OK
mysqltest: In included file "./var/tmp/con.sql": At line 7: Connection limit exhausted - increase MAX_CONS in mysqltest.c
mysqltest: In included file "./var/tmp/con.sql": At line 3: connection 'test_con1' not found in connection pool
mysqltest: In included file "./var/tmp/con.sql": At line 2: Connection test_con1 already exists
......@@ -391,20 +397,20 @@ 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);
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
drop table t1;
drop table t1;
create table t1 (a int primary key);
mysqltest: At line 3: query 'create table t1 (a int primary key);
insert into t1 values (1);
select 'select-me';
insertz error query||||
select-me
select-me
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 'insertz error query' at line 1
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
drop table t1;
Multi statement using expected error
create table t1 (a int primary key);
insert into t1 values (1);
select 'select-me';
......@@ -413,3 +419,4 @@ select-me
select-me
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 'insertz error query' at line 1
drop table t1;
drop table t1;
......@@ -85,6 +85,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
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 '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 ';
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 '? a from t1 where a=1' at line 1
set @arg00=1 ;
......
......@@ -85,6 +85,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
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 '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 ';
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 '? a from t1 where a=1' at line 1
set @arg00=1 ;
......
......@@ -86,6 +86,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
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 '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 ';
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 '? a from t1 where a=1' at line 1
set @arg00=1 ;
......
......@@ -128,6 +128,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
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 '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 ';
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 '? a from t1 where a=1' at line 1
set @arg00=1 ;
......@@ -3140,6 +3142,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
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 '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 ';
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 '? a from t1 where a=1' at line 1
set @arg00=1 ;
......
......@@ -85,6 +85,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
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 '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 ';
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 '? a from t1 where a=1' at line 1
set @arg00=1 ;
......
......@@ -85,6 +85,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
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 '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 ';
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 '? a from t1 where a=1' at line 1
set @arg00=1 ;
......
......@@ -1466,12 +1466,12 @@ flush logs;
-------- switch to master -------
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
-------- switch to slave -------
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
######## DROP TRIGGER trg1 ########
......
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
revoke select on *.* from 'user_foo'@'%';
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
select_priv
N
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
revoke select on *.* from 'user_foo'@'%';
select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
select_priv
N
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;
select_priv
Y
revoke select on *.* from 'user_foo';
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
select_priv
N
select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
select_priv
Y
revoke select on *.* FROM 'user_foo';
......@@ -57,6 +57,9 @@ insert into t1 values (15);
grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
SELECT 1;
1
1
create procedure foo4()
deterministic
begin
......
......@@ -918,6 +918,11 @@ drop function if exists f5|
drop function if exists f6|
drop function if exists f7|
drop function if exists f8|
drop function if exists f9|
drop function if exists f10|
drop function if exists f11|
drop function if exists f12_1|
drop function if exists f12_2|
drop view if exists v0|
drop view if exists v1|
drop view if exists v2|
......@@ -1097,6 +1102,62 @@ ERROR HY000: Table 't1' was not locked with LOCK TABLES
select f4()|
ERROR HY000: Table 't2' was not locked with LOCK TABLES
unlock tables|
create function f9() returns int
begin
declare a, b int;
drop temporary table if exists t3;
create temporary table t3 (id int);
insert into t3 values (1), (2), (3);
set a:= (select count(*) from t3);
set b:= (select count(*) from t3 t3_alias);
return a + b;
end|
select f9()|
f9()
6
Warnings:
Note 1051 Unknown table 't3'
select f9() from t1 limit 1|
f9()
6
create function f10() returns int
begin
drop temporary table if exists t3;
create temporary table t3 (id int);
insert into t3 select id from t4;
return (select count(*) from t3);
end|
select f10()|
ERROR 42S02: Table 'test.t4' doesn't exist
create table t4 as select 1 as id|
select f10()|
f10()
1
create function f11() returns int
begin
drop temporary table if exists t3;
create temporary table t3 (id int);
insert into t3 values (1), (2), (3);
return (select count(*) from t3 as a, t3 as b);
end|
select f11()|
ERROR HY000: Can't reopen table: 'a'
select f11() from t1|
ERROR HY000: Can't reopen table: 'a'
create function f12_1() returns int
begin
drop temporary table if exists t3;
create temporary table t3 (id int);
insert into t3 values (1), (2), (3);
return f12_2();
end|
create function f12_2() returns int
return (select count(*) from t3)|
drop temporary table t3|
select f12_1()|
ERROR 42S02: Table 'test.t3' doesn't exist
select f12_1() from t1 limit 1|
ERROR 42S02: Table 'test.t3' doesn't exist
drop function f0|
drop function f1|
drop function f2|
......@@ -1106,11 +1167,17 @@ drop function f5|
drop function f6|
drop function f7|
drop function f8|
drop function f9|
drop function f10|
drop function f11|
drop function f12_1|
drop function f12_2|
drop view v0|
drop view v1|
drop view v2|
delete from t1 |
delete from t2 |
drop table t4|
drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
drop procedure if exists ifac|
......
......@@ -34,7 +34,5 @@ Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER
NULL mysqltest_db1 wl2818_trg1 INSERT NULL mysqltest_db1 t1 0 NULL
INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL
NULL mysqltest_db1 wl2818_trg2 INSERT NULL mysqltest_db1 t1 0 NULL
INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost
NULL mysqltest_db1 wl2818_trg1 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL
NULL mysqltest_db1 wl2818_trg2 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost
......@@ -185,10 +185,8 @@ INSERT INTO t1 VALUES(6);
ERROR 42000: Access denied; you need the SUPER privilege for this operation
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1
SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost
trg2 INSERT t1
SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost
trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost
trg2 INSERT t1 SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost
DROP TRIGGER trg1;
DROP TRIGGER trg2;
CREATE TRIGGER trg1 BEFORE INSERT ON t1
......@@ -219,16 +217,11 @@ Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'trg1'. The trigge
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER
NULL mysqltest_db1 trg1 INSERT NULL mysqltest_db1 t1 0 NULL
SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL
NULL mysqltest_db1 trg2 INSERT NULL mysqltest_db1 t1 0 NULL
SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @
NULL mysqltest_db1 trg3 UPDATE NULL mysqltest_db1 t1 0 NULL
SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@
NULL mysqltest_db1 trg4 UPDATE NULL mysqltest_db1 t1 0 NULL
SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname
NULL mysqltest_db1 trg5 DELETE NULL mysqltest_db1 t1 0 NULL
SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname
NULL mysqltest_db1 trg1 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL
NULL mysqltest_db1 trg2 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @
NULL mysqltest_db1 trg3 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@
NULL mysqltest_db1 trg4 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname
NULL mysqltest_db1 trg5 DELETE NULL mysqltest_db1 t1 0 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname
---> connection: default
DROP USER mysqltest_dfn@localhost;
......
......@@ -613,7 +613,7 @@ select @a;
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
t1_bi INSERT t1 set new."t1 column" = 5 BEFORE # REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI root@localhost
t1_af INSERT t1 set @a=10 AFTER # root@localhost
t1_af INSERT t1 set @a=10 AFTER # root@localhost
drop table t1;
set sql_mode="traditional";
create table t1 (a date);
......@@ -634,7 +634,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost
t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost
drop table t1;
create table t1 (id int);
create trigger t1_ai after insert on t1 for each row flush tables;
......@@ -767,8 +767,7 @@ deallocate prepare stmt1;
drop procedure p1;
drop table t1, t2, t3;
create table t1 (a int);
drop procedure if exists p2;
CREATE PROCEDURE `p2`()
CREATE PROCEDURE `p1`()
begin
insert into t1 values (1);
end//
......@@ -777,8 +776,8 @@ begin
declare done int default 0;
set done= not done;
end//
CALL p2();
drop procedure p2;
CALL p1();
drop procedure p1;
drop table t1;
create trigger t1_bi before insert on test.t1 for each row set @a:=0;
ERROR 3D000: No database selected
......
......@@ -85,27 +85,3 @@ sec_to_time(time_to_sec(t))
13:00:00
09:00:00
drop table t1;
SELECT CAST(235959.123456 AS TIME);
CAST(235959.123456 AS TIME)
23:59:59.123456
SELECT CAST(0.235959123456e+6 AS TIME);
CAST(0.235959123456e+6 AS TIME)
23:59:59.123456
SELECT CAST(235959123456e-6 AS TIME);
CAST(235959123456e-6 AS TIME)
23:59:59.123456
SELECT CAST(235959.1234567 AS TIME);
CAST(235959.1234567 AS TIME)
23:59:59.123456
Warnings:
Warning 1292 Truncated incorrect time value: '235959.1234567'
SELECT CAST(0.2359591234567e6 AS TIME);
CAST(0.2359591234567e6 AS TIME)
23:59:59.123456
Warnings:
Warning 1292 Truncated incorrect time value: '235959.1234567'
SELECT CAST(0.2359591234567e+30 AS TIME);
CAST(0.2359591234567e+30 AS TIME)
NULL
Warnings:
Warning 1292 Truncated incorrect time value: '2.359591234567e+29'
......@@ -2423,6 +2423,9 @@ drop view v1;
drop table t1;
create table t1(f1 int, f2 int);
insert into t1 values (null, 10), (null,2);
select f1, sum(f2) from t1 group by f1;
f1 sum(f2)
NULL 12
create view v1 as select * from t1;
select f1, sum(f2) from v1 group by f1;
f1 sum(f2)
......@@ -2472,3 +2475,32 @@ alias1 alias2
5 5
drop view v2, v1;
drop table t1;
CREATE TABLE t1 (a int PRIMARY KEY, b int);
INSERT INTO t1 VALUES (2,20), (3,10), (1,10), (0,30), (5,10);
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT MAX(a) FROM t1;
MAX(a)
5
SELECT MAX(a) FROM v1;
MAX(a)
5
EXPLAIN SELECT MAX(a) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
EXPLAIN SELECT MAX(a) FROM v1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
SELECT MIN(a) FROM t1;
MIN(a)
0
SELECT MIN(a) FROM v1;
MIN(a)
0
EXPLAIN SELECT MIN(a) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
EXPLAIN SELECT MIN(a) FROM v1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
DROP VIEW v1;
DROP TABLE t1;
......@@ -61,9 +61,7 @@ INSERT INTO t1 VALUES (3359361,406,3359361,'Mustermann Musterfrau',7001,'2000-05
INSERT INTO t1 VALUES (3359362,406,3359362,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1509984,2145874,'+','','P',1909154,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
# This died because we used the field Kundentyp twice
--disable_ps_protocol
SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA','V','VA',''), 'Privat (Private Nutzung)','Privat (Private Nutzung) Sitz im Ausland','Privat (geschaeftliche Nutzung)','Privat (geschaeftliche Nutzung) Sitz im Ausland','Firma (Kapitalgesellschaft)','Firma (Kapitalgesellschaft) Sitz im Ausland','Firma (Personengesellschaft)','Firma (Personengesellschaft) Sitz im Ausland','oeff. rechtl. Koerperschaft','oeff. rechtl. Koerperschaft Sitz im Ausland','Eingetragener Verein','Eingetragener Verein Sitz im Ausland','Typ unbekannt') AS Kundentyp ,kategorie FROM t1 WHERE hdl_nr < 2000000 AND kategorie IN ('Prepaid','Mobilfunk') AND st_klasse = 'Workflow' GROUP BY kundentyp ORDER BY kategorie;
--enable_ps_protocol
drop table t1;
......
......@@ -1010,4 +1010,13 @@ create table t1 (a varchar(255) character set utf8,
e varchar(255) character set utf8,
key (a,b,c,d,e)) engine=bdb;
#
# Bug #14212: Server crash after COMMIT + ALTER TABLE
#
set autocommit=0;
create table t1 (a int) engine=bdb;
commit;
alter table t1 add primary key(a);
drop table t1;
--echo End of 5.0 tests
......@@ -564,6 +564,22 @@ create table t1 (
show create table t1;
drop table t1;
--warning 1364
create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int not null, primary key (a)
) select a, 1 as c from t2 ;
show create table t1;
drop table t1;
--warning 1364
create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int null, primary key (a)
) select a, 1 as c from t2 ;
show create table t1;
drop table t1;
--warning 1364
create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
......
......@@ -868,6 +868,16 @@ set names utf8;
select distinct char(a) from t1;
drop table t1;
#
# Bug#15581: COALESCE function truncates mutli-byte TINYTEXT values
#
CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8);
INSERT INTO t1 VALUES(REPEAT('a', 100));
CREATE TEMPORARY TABLE t2 SELECT COALESCE(t) AS bug FROM t1;
SELECT LENGTH(bug) FROM t2;
DROP TABLE t2;
DROP TABLE t1;
# End of 4.1 tests
#
......
......@@ -11,6 +11,4 @@
##############################################################################
sp-goto : GOTO is currently is disabled - will be fixed in the future
kill : Unstable test case, bug#9712
subselect : Bug#15706
type_time : Bug#15805
......@@ -499,4 +499,16 @@ revoke all privileges on
show grants for root@localhost;
set names latin1;
#
# Bug #15598 Server crashes in specific case during setting new password
# - Caused by a user with host ''
#
create user mysqltest_7@;
set password for mysqltest_7@ = password('systpass');
show grants for mysqltest_7@;
drop user mysqltest_7@;
flush privileges; # BUG#16297(flush should be removed when that bug is fixed)
--error 1141
show grants for mysqltest_7@;
# End of 4.1 tests
......@@ -596,9 +596,7 @@ drop table t1;
CREATE TABLE t1 (n int);
INSERT INTO t1 VALUES (1);
--disable_ps_protocol
SELECT n+1 AS n FROM t1 GROUP BY n;
--enable_ps_protocol
DROP TABLE t1;
#
......@@ -623,11 +621,9 @@ insert into t1 values ('aaa', 'bb1'), ('aaa', 'bb2');
insert into t2 values ('aaa', 'bb1'), ('aaa', 'bb2');
# query with ambiguous column reference 'c2'
--disable_ps_protocol
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
group by c2;
show warnings;
--enable_ps_protocol
# this query has no ambiguity
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
......
......@@ -3,7 +3,7 @@
#
--disable_warnings
drop table if exists t1;
drop table if exists t1,t3,t4,t5;
--enable_warnings
create table t1 (a int, b char(10), key a(a), key b(a,b));
......
......@@ -123,6 +123,18 @@ group by a.id, a.description
having (a.description is not null) and (c=0);
drop table t1,t2,t3;
#
# Bug #14274: HAVING clause containing only set function
#
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (3), (4), (1), (3), (1);
SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a)>0;
SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a);
DROP TABLE t1;
# End of 4.1 tests
#
......
......@@ -327,3 +327,33 @@ set join_buffer_size= @save_join_buffer_size;
drop table t0, t1, t2, t3, t4;
# BUG#16166
CREATE TABLE t1 (
cola char(3) not null, colb char(3) not null, filler char(200),
key(cola), key(colb)
);
INSERT INTO t1 VALUES ('foo','bar', 'ZZ'),('fuz','baz', 'ZZ');
--disable_query_log
let $1=9;
while ($1)
{
eval INSERT INTO t1 SELECT * from t1 WHERE cola = 'foo';
dec $1;
}
let $1=13;
while ($1)
{
eval INSERT INTO t1 SELECT * from t1 WHERE cola <> 'foo';
dec $1;
}
--enable_query_log
OPTIMIZE TABLE t1;
select count(*) from t1;
explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar';
drop table t1;
......@@ -767,3 +767,26 @@ create table t1(f1 binary(32), f2 varbinary(64));
select character_maximum_length, character_octet_length
from information_schema.columns where table_name='t1';
drop table t1;
#
# Bug#15533 crash, information_schema, function, view
#
CREATE TABLE t1 (f1 BIGINT, f2 VARCHAR(20), f3 BIGINT);
INSERT INTO t1 SET f1 = 1, f2 = 'Schoenenbourg', f3 = 1;
CREATE FUNCTION func2() RETURNS BIGINT RETURN 1;
delimiter //;
CREATE FUNCTION func1() RETURNS BIGINT
BEGIN
RETURN ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.VIEWS);
END//
delimiter ;//
CREATE VIEW v1 AS SELECT 1 FROM t1
WHERE f3 = (SELECT func2 ());
SELECT func1();
DROP TABLE t1;
DROP VIEW v1;
DROP FUNCTION func1;
DROP FUNCTION func2;
......@@ -7,3 +7,4 @@
#
# End of 4.1 tests
echo ok;
......@@ -25,11 +25,18 @@ select ((@id := kill_id) - kill_id) from t1;
kill @id;
connection con1;
--sleep 1
--sleep 2
# this statement should fail
--error 2006,2013
--disable_query_log
--disable_result_log
# One of the following statements should fail
--error 0,2006,2013
select 1;
--error 0,2006,2013
select 1;
--enable_query_log
--enable_result_log
--enable_reconnect
# this should work, and we should have a new connection_id()
select ((@id := kill_id) - kill_id) from t1;
......
......@@ -10,3 +10,5 @@
--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
# End of 4.1 tests
echo ok;
......@@ -2,7 +2,7 @@
-- source include/not_embedded.inc
--disable_warnings
DROP TABLE IF EXISTS t1,t2;
DROP TABLE IF EXISTS t1,t2,test1,test2;
--enable_warnings
#
......
......@@ -364,6 +364,15 @@ select 3 from t1 ;
--error 1
--exec $MYSQL_TEST < var/tmp/mysqltest.sql 2>&1
#
# Missing delimiter until eof
# The comment will be "sucked into" the sleep command since
# delimiter is missing
--system echo "sleep 7" > var/tmp/mysqltest.sql
--system echo "# Another comment" >> var/tmp/mysqltest.sql
--error 1
--exec $MYSQL_TEST < var/tmp/mysqltest.sql 2>&1
#
# Extra delimiter
#
......@@ -530,6 +539,42 @@ echo $novar1;
--error 1
--exec echo "let hi;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
# Test to assign let from query
# let $<var_name>=`<query>`;
# ----------------------------------------------------------------------------
--disable_parsing
echo var1;
let $var1= `select "hi" as "Col", 1 as "Column1", "hi there" as Col3`;
echo $var1;
echo $var1_Col;
echo $var1_Column1;
echo $var1_Col3;
echo var2;
let $var2= `select 2 as "Column num 2"`;
echo $var2;
echo $var2_Column num 2;
echo $var2_Column;
echo var2 again;
let $var2= `select 2 as "Column num 2"`;
echo $var2;
echo $var2_Column num 2;
echo $var2_Column_num_2;
echo $var2_Column;
echo var3 two columns with same name;
let $var3= `select 1 as "Col", 2 as "Col", 3 as "var3"`;
echo $var3;
echo $var3_Col;
echo $var3_Col;
echo $var3_var3;
#echo failing query in let;
#--error 1
#--exec echo "let $var2= `failing query;`" | $MYSQL_TEST 2>&1
--enable_parsing
# ----------------------------------------------------------------------------
# Test source command
# ----------------------------------------------------------------------------
......@@ -680,7 +725,7 @@ system echo "hej" > /dev/null;
--exec echo "system false;" | $MYSQL_TEST 2>&1
--disable_abort_on_error
system NonExistsinfComamdn;
system NonExistsinfComamdn 2> /dev/null;
--enable_abort_on_error
......@@ -728,20 +773,20 @@ while ($i)
--error 1
--exec echo "{;" | $MYSQL_TEST 2>&1
--system echo "while (0)" > var/log/mysqltest.sql
--system echo "echo hej;" >> var/log/mysqltest.sql
--system echo "while (0)" > var/tmp/mysqltest.sql
--system echo "echo hej;" >> var/tmp/mysqltest.sql
--error 1
--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
--exec $MYSQL_TEST < var/tmp/mysqltest.sql 2>&1
--system echo "while (0)" > var/log/mysqltest.sql
--system echo "{echo hej;" >> var/log/mysqltest.sql
--system echo "while (0)" > var/tmp/mysqltest.sql
--system echo "{echo hej;" >> var/tmp/mysqltest.sql
--error 1
--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
--exec $MYSQL_TEST < var/tmp/mysqltest.sql 2>&1
--system echo "while (0){" > var/log/mysqltest.sql
--system echo "echo hej;" >> var/log/mysqltest.sql
--system echo "while (0){" > var/tmp/mysqltest.sql
--system echo "echo hej;" >> var/tmp/mysqltest.sql
--error 1
--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
--exec $MYSQL_TEST < var/tmp/mysqltest.sql 2>&1
# ----------------------------------------------------------------------------
# Test error messages returned from comments starting with a command
......@@ -769,7 +814,7 @@ select "a" as col1, "c" as col2;
--exec echo "replace_result a;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "replace_result a ;" | $MYSQL_TEST 2>&1
--exec echo "replace_result a b;" | $MYSQL_TEST 2>&1
--exec echo "replace_result a b; echo OK;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--replace_result a b c" | $MYSQL_TEST 2>&1
--error 1
......@@ -839,7 +884,7 @@ select "a" as col1, "c" as col2;
--exec echo " disconnect test_con1; " >> var/tmp/con.sql
--exec echo " dec \$i; " >> var/tmp/con.sql
--exec echo "}" >> var/tmp/con.sql
--exec echo "source var/tmp/con.sql;" | $MYSQL_TEST 2>&1
--exec echo "source var/tmp/con.sql; echo OK;" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect, exceed max number of connections
--exec echo "let \$i=200;" > var/tmp/con.sql
......@@ -946,13 +991,36 @@ select "this will not be executed";
select "this will be executed";
--enable_query_log
#
# Test zero length result file. Should not pass
#
--exec touch $MYSQL_TEST_DIR/var/tmp/zero_length_file.result
--exec echo "echo ok;" > $MYSQL_TEST_DIR/var/tmp/query.sql
--error 1
--exec $MYSQL_TEST -x var/tmp/query.sql -R var/tmp/zero_length_file.result 2>&1
#
# Test that a test file that does not generate any output fails.
#
--exec echo "let \$i= 1;" > $MYSQL_TEST_DIR/var/tmp/query.sql
--error 1
--exec $MYSQL_TEST -x var/tmp/query.sql 2>&1
#
# Test that mysqltest fails when there are no queries executed
# but a result file exist
# NOTE! This will never happen as long as it's not allowed to have
# test files that does not produce any output
#--exec echo "something" > $MYSQL_TEST_DIR/var/tmp/result_file.result
#--exec echo "let \$i= 1;" > $MYSQL_TEST_DIR/var/tmp/query.sql
#--error 1
#--exec $MYSQL_TEST -x var/tmp/query.sql -R var/tmp/result_file.result 2>&1
#
# Bug #11731 mysqltest in multi-statement queries ignores errors in
# non-1st queries
#
# Failing multi statement query
echo Failing multi statement query;
# PS does not support multi statement
--exec echo "--disable_ps_protocol" > var/tmp/bug11731.sql
--exec echo "delimiter ||||;" >> var/tmp/bug11731.sql
......@@ -967,14 +1035,13 @@ select "this will be executed";
drop table t1;
--error 1
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out
# The .out file should be empty
--error 1
--exec test -s $MYSQL_TEST_DIR/var/tmp/bug11731.out
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out 2>&1
# The .out file should be non existent
--exec test ! -s $MYSQL_TEST_DIR/var/tmp/bug11731.out
drop table t1;
# Using expected error
echo Multi statement using expected error;
# PS does not support multi statement
--exec echo "--disable_ps_protocol" > var/tmp/bug11731.sql
--exec echo "delimiter ||||;" >> var/tmp/bug11731.sql
......@@ -986,12 +1053,12 @@ drop table t1;
--exec echo "delimiter ;||||" >> var/tmp/bug11731.sql
# These two should work since the error is expected
--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql 2>&1
--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql 2>&1
drop table t1;
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out
--exec cat $MYSQL_TEST_DIR/var/tmp/bug11731.out
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out 2>&1
# The .out file should exist
--exec test -s $MYSQL_TEST_DIR/var/tmp/bug11731.out
drop table t1;
--replicate-wild-ignore-table=mysql.%
# test verifies that REVOKE must not be replicated when
# slave server starts with --replicate-wild-ignore-table=mysql.%
# the option is set in rpl_ignore_revoke-slave.opt
# The first part of BUG#9483 for GRANT is checked by
# existed specific rpl_ignore_grant test case (BUG#980)
source include/master-slave.inc;
### CLEAN-UP: create an account and manually duplicate it on the slave
connection master;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
revoke select on *.* from 'user_foo'@'%';
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
sync_slave_with_master;
#connection slave;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
revoke select on *.* from 'user_foo'@'%';
select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
### TEST
#connection slave;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;
connection master;
revoke select on *.* from 'user_foo';
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
sync_slave_with_master;
#connection slave;
select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
### CLEAN-UP
connection slave;
--disable_abort_on_error
revoke select on *.* FROM 'user_foo';
--enable_abort_on_error
......@@ -87,6 +87,14 @@ grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
# ToDo: BUG#14931: There is a race between the last grant binlogging, and
# the binlogging in the new connection made below, causing sporadic test
# failures due to switched statement order in binlog. To fix this we do
# SELECT 1 in the first connection before starting the second, ensuring
# that binlogging is done in the expected order.
# Please remove this SELECT 1 when BUG#14931 is fixed.
SELECT 1;
connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,);
connection con1;
......
......@@ -1157,6 +1157,11 @@ drop function if exists f5|
drop function if exists f6|
drop function if exists f7|
drop function if exists f8|
drop function if exists f9|
drop function if exists f10|
drop function if exists f11|
drop function if exists f12_1|
drop function if exists f12_2|
drop view if exists v0|
drop view if exists v1|
drop view if exists v2|
......@@ -1234,8 +1239,6 @@ create function f7() returns int
select f6()|
select id, f6() from t1|
# TODO Test temporary table handling
#
# Let us test how new locking work with views
#
......@@ -1316,6 +1319,73 @@ select * from v1, t1|
select f4()|
unlock tables|
# Tests for handling of temporary tables in functions.
#
# Unlike for permanent tables we should be able to create, use
# and drop such tables in functions.
#
# Simplest function using temporary table. It is also test case for bug
# #12198 "Temporary table aliasing does not work inside stored functions"
create function f9() returns int
begin
declare a, b int;
drop temporary table if exists t3;
create temporary table t3 (id int);
insert into t3 values (1), (2), (3);
set a:= (select count(*) from t3);
set b:= (select count(*) from t3 t3_alias);
return a + b;
end|
# This will emit warning as t3 was not existing before.
select f9()|
select f9() from t1 limit 1|
# Function which uses both temporary and permanent tables.
create function f10() returns int
begin
drop temporary table if exists t3;
create temporary table t3 (id int);
insert into t3 select id from t4;
return (select count(*) from t3);
end|
# Check that we don't ignore completely tables used in function
--error ER_NO_SUCH_TABLE
select f10()|
create table t4 as select 1 as id|
select f10()|
# Practical cases which we don't handle well (yet)
#
# Function which does not work because of well-known and documented
# limitation of MySQL. We can't use the several instances of the
# same temporary table in statement.
create function f11() returns int
begin
drop temporary table if exists t3;
create temporary table t3 (id int);
insert into t3 values (1), (2), (3);
return (select count(*) from t3 as a, t3 as b);
end|
--error ER_CANT_REOPEN_TABLE
select f11()|
--error ER_CANT_REOPEN_TABLE
select f11() from t1|
# We don't handle temporary tables used by nested functions well
create function f12_1() returns int
begin
drop temporary table if exists t3;
create temporary table t3 (id int);
insert into t3 values (1), (2), (3);
return f12_2();
end|
create function f12_2() returns int
return (select count(*) from t3)|
# We need clean start to get error
drop temporary table t3|
--error ER_NO_SUCH_TABLE
select f12_1()|
--error ER_NO_SUCH_TABLE
select f12_1() from t1 limit 1|
# Cleanup
drop function f0|
......@@ -1327,11 +1397,17 @@ drop function f5|
drop function f6|
drop function f7|
drop function f8|
drop function f9|
drop function f10|
drop function f11|
drop function f12_1|
drop function f12_2|
drop view v0|
drop view v1|
drop view v2|
delete from t1 |
delete from t2 |
drop table t4|
# End of non-bug tests
......
......@@ -930,11 +930,8 @@ drop table t1, t2, t3;
# operator.
#
create table t1 (a int);
--disable_warnings
drop procedure if exists p2;
--enable_warnings
DELIMITER //;
CREATE PROCEDURE `p2`()
CREATE PROCEDURE `p1`()
begin
insert into t1 values (1);
end//
......@@ -944,8 +941,8 @@ begin
set done= not done;
end//
DELIMITER ;//
CALL p2();
drop procedure p2;
CALL p1();
drop procedure p1;
drop table t1;
#
......
......@@ -26,13 +26,17 @@ drop table t1;
# long fraction part and/or large exponent part.
#
# These must return normal result:
SELECT CAST(235959.123456 AS TIME);
SELECT CAST(0.235959123456e+6 AS TIME);
SELECT CAST(235959123456e-6 AS TIME);
# ##########################################################
# To be uncommented after fix BUG #15805
# ##########################################################
# SELECT CAST(235959.123456 AS TIME);
# SELECT CAST(0.235959123456e+6 AS TIME);
# SELECT CAST(235959123456e-6 AS TIME);
# These must cut fraction part and produce warning:
SELECT CAST(235959.1234567 AS TIME);
SELECT CAST(0.2359591234567e6 AS TIME);
# SELECT CAST(235959.1234567 AS TIME);
# SELECT CAST(0.2359591234567e6 AS TIME);
# This must return NULL and produce warning:
SELECT CAST(0.2359591234567e+30 AS TIME);
# SELECT CAST(0.2359591234567e+30 AS TIME);
# ##########################################################
# End of 4.1 tests
......@@ -27,12 +27,9 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows();
select sql_calc_found_rows a,b from t1 union all select a,b from t2 limit 2;
select found_rows();
--enable_ps_protocol
#
# Test some error conditions with UNION
......@@ -210,27 +207,15 @@ insert into t2 values (3),(4),(5);
# Test global limits
(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2) LIMIT 1;
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows();
--enable_ps_protocol
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2) LIMIT 2;
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows();
--enable_ps_protocol
# Test cases where found_rows() should return number of returned rows
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2);
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows();
--enable_ps_protocol
(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1);
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows();
--enable_ps_protocol
# This used to work in 4.0 but not anymore in 4.1
--error 1064
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1;
......@@ -238,15 +223,9 @@ select found_rows();
# In these case found_rows() should work
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2;
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows();
--disable_ps_protocol
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION all SELECT * FROM t2 LIMIT 2;
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows();
--disable_ps_protocol
# The following examples will not be exact
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2;
......
......@@ -2275,6 +2275,7 @@ drop table t1;
#
create table t1(f1 int, f2 int);
insert into t1 values (null, 10), (null,2);
select f1, sum(f2) from t1 group by f1;
create view v1 as select * from t1;
select f1, sum(f2) from v1 group by f1;
drop view v1;
......@@ -2338,3 +2339,27 @@ order by v2.receipt_id;
drop view v2, v1;
drop table t1;
#
# Bug#16016: MIN/MAX optimization for views
#
CREATE TABLE t1 (a int PRIMARY KEY, b int);
INSERT INTO t1 VALUES (2,20), (3,10), (1,10), (0,30), (5,10);
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT MAX(a) FROM t1;
SELECT MAX(a) FROM v1;
EXPLAIN SELECT MAX(a) FROM t1;
EXPLAIN SELECT MAX(a) FROM v1;
SELECT MIN(a) FROM t1;
SELECT MIN(a) FROM v1;
EXPLAIN SELECT MIN(a) FROM t1;
EXPLAIN SELECT MIN(a) FROM v1;
DROP VIEW v1;
DROP TABLE t1;
This diff is collapsed.
This diff is collapsed.
......@@ -74,7 +74,7 @@ static int do_test()
bzero((char*) key1,sizeof(key1[0])*1000);
printf("- Creating hash\n");
if (hash_init(&hash,recant/2,0,6,0,free_record,0))
if (hash_init(&hash, default_charset_info, recant/2, 0, 6, 0, free_record, 0))
goto err;
printf("- Writing records:\n");
......@@ -172,15 +172,16 @@ static int do_test()
break;
if (key1[j] > 1)
{
HASH_SEARCH_STATE state;
printf("- Testing identical read\n");
sprintf(key,"%6d",j);
pos=1;
if (!(recpos=hash_search(&hash,key,0)))
if (!(recpos= hash_first(&hash, key, 0, &state)))
{
printf("can't find key1: \"%s\"\n",key);
goto err;
}
while (hash_next(&hash,key,0) && pos < (ulong) (key1[j]+10))
while (hash_next(&hash, key, 0, &state) && pos < (ulong) (key1[j]+10))
pos++;
if (pos != (ulong) key1[j])
{
......@@ -189,7 +190,7 @@ static int do_test()
}
}
printf("- Creating output heap-file 2\n");
if (hash_init(&hash2,hash.records,0,0,hash2_key,free_record,0))
if (hash_init(&hash2, default_charset_info, hash.records, 0, 0, hash2_key, free_record,0))
goto err;
printf("- Copying and removing records\n");
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment