mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03:00
Merge bk-internal:/home/bk/mysql-5.0
into sergbook.mysql.com:/usr/home/serg/Abk/mysql-5.0 sql/sql_show.cc: Auto merged
This commit is contained in:
@@ -1036,7 +1036,9 @@ support-files/MacOSX/Description.plist
|
||||
support-files/MacOSX/Info.plist
|
||||
support-files/MacOSX/ReadMe.txt
|
||||
support-files/MacOSX/StartupParameters.plist
|
||||
support-files/MacOSX/postflight
|
||||
support-files/MacOSX/postinstall
|
||||
support-files/MacOSX/preflight
|
||||
support-files/MacOSX/preinstall
|
||||
support-files/binary-configure
|
||||
support-files/my-huge.cnf
|
||||
@@ -1121,5 +1123,3 @@ vio/test-ssl
|
||||
vio/test-sslclient
|
||||
vio/test-sslserver
|
||||
vio/viotest-ssl
|
||||
support-files/MacOSX/postflight
|
||||
support-files/MacOSX/preflight
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
EXTRA_DIST = FINISH.sh \
|
||||
SETUP.sh \
|
||||
autorun.sh \
|
||||
check-cpu \
|
||||
compile-alpha \
|
||||
compile-alpha-ccc \
|
||||
|
@@ -71,5 +71,7 @@ hours:
|
||||
[arjen:]checkout:get
|
||||
[kostja:]checkout:get
|
||||
[nick:]checkout:get
|
||||
[jonas:]checkout:get
|
||||
[tomas:]checkout:get
|
||||
checkout:edit
|
||||
eoln:unix
|
||||
|
@@ -49,7 +49,7 @@ RSC=rc.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../zlib" /I "../include" /I "../regex" /I "../extra/yassl/include" /D "NDEBUG" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../zlib" /I "../include" /I "../regex" /I "../extra/yassl/include" /D "NDEBUG" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "HAVE_ARCHIVE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x410 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
@@ -75,7 +75,7 @@ LINK32=xilink6.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_ARCHIVE_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
|
||||
# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_ARCHIVE_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_FEDERATED_DB" /D "HAVE_EXAMPLE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
|
||||
# SUBTRACT CPP /Fr /YX
|
||||
# ADD BASE RSC /l 0x410 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
@@ -102,7 +102,7 @@ LINK32=xilink6.exe
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /G5 /MT /W3 /O2 /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "__WIN32__" /D "DBUG_OFF" /FD /c
|
||||
# SUBTRACT BASE CPP /YX
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /I "../extra/yassl/include" /D "__NT__" /D "DBUG_OFF" /D "NDEBUG" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-nt /FD /c
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /I "../extra/yassl/include" /D "__NT__" /D "DBUG_OFF" /D "NDEBUG" /D "HAVE_INNOBASE_DB" /D "HAVE_ARCHIVE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-nt /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x410 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
@@ -130,7 +130,7 @@ LINK32=xilink6.exe
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c
|
||||
# SUBTRACT BASE CPP /YX
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_ARCHIVE_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-nt-max /FD /c
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_ARCHIVE_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_EXAMPLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-nt-max /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
@@ -159,7 +159,7 @@ LINK32=xilink6.exe
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c
|
||||
# SUBTRACT BASE CPP /YX
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_ARCHIVE_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-max /FD /c
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_ARCHIVE_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_EXAMPLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-max /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
@@ -215,7 +215,7 @@ LINK32=xilink6.exe
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /D "NDEBUG" /FD /c
|
||||
# SUBTRACT BASE CPP /YX
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /I "../extra/yassl/include" /D "MYSQL_SERVER" /D LICENSE=Commercial /D "_MBCS" /D "HAVE_DLOPEN" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "NDEBUG" /D "_WINDOWS" /D "_CONSOLE" /D MYSQL_SERVER_SUFFIX=-pro /FD /c
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /I "../extra/yassl/include" /D "MYSQL_SERVER" /D LICENSE=Commercial /D "_MBCS" /D "HAVE_DLOPEN" /D "HAVE_INNOBASE_DB" /D "HAVE_ARCHIVE_DB" /D "DBUG_OFF" /D "NDEBUG" /D "_WINDOWS" /D "_CONSOLE" /D MYSQL_SERVER_SUFFIX=-pro /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
@@ -272,7 +272,7 @@ LINK32=xilink6.exe
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /D "NDEBUG" /FD /c
|
||||
# SUBTRACT BASE CPP /YX
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /I "../extra/yassl/include" /D "__NT__" /D "DBUG_OFF" /D "NDEBUG" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D LICENSE=Commercial /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-pro-nt /FD /c
|
||||
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /I "../extra/yassl/include" /D "__NT__" /D "DBUG_OFF" /D "NDEBUG" /D "HAVE_INNOBASE_DB" /D "HAVE_ARCHIVE_DB" /D "MYSQL_SERVER" /D LICENSE=Commercial /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-pro-nt /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
@@ -460,6 +460,10 @@ SOURCE=.\examples\ha_archive.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\examples\ha_example.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ha_blackhole.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
10
configure.in
10
configure.in
@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
|
||||
AC_CANONICAL_SYSTEM
|
||||
# The Docs Makefile.am parses this line!
|
||||
# remember to also change ndb version below and update version.c in ndb
|
||||
AM_INIT_AUTOMAKE(mysql, 5.0.12-beta)
|
||||
AM_INIT_AUTOMAKE(mysql, 5.0.13-beta)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
PROTOCOL_VERSION=10
|
||||
@@ -18,7 +18,7 @@ SHARED_LIB_VERSION=15:0:0
|
||||
# ndb version
|
||||
NDB_VERSION_MAJOR=5
|
||||
NDB_VERSION_MINOR=0
|
||||
NDB_VERSION_BUILD=12
|
||||
NDB_VERSION_BUILD=13
|
||||
NDB_VERSION_STATUS="beta"
|
||||
|
||||
# Set all version vars based on $VERSION. How do we do this more elegant ?
|
||||
@@ -2446,7 +2446,7 @@ thread_dirs=
|
||||
|
||||
dnl This probably should be cleaned up more - for now the threaded
|
||||
dnl client is just using plain-old libs.
|
||||
sql_client_dirs="libmysql strings regex client"
|
||||
sql_client_dirs="strings regex mysys sql/share libmysql client"
|
||||
linked_client_targets="linked_libmysql_sources"
|
||||
|
||||
if test "$THREAD_SAFE_CLIENT" != "no"
|
||||
@@ -2484,7 +2484,7 @@ then
|
||||
AC_DEFINE([THREAD], [1],
|
||||
[Define if you want to have threaded code. This may be undef on client code])
|
||||
# Avoid _PROGRAMS names
|
||||
THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o"
|
||||
THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o mf_keycache.o"
|
||||
AC_SUBST(THREAD_LOBJECTS)
|
||||
server_scripts="mysqld_safe mysql_install_db"
|
||||
sql_server_dirs="strings mysys dbug extra regex"
|
||||
@@ -2595,7 +2595,6 @@ esac
|
||||
# END of configuration for optional table handlers
|
||||
#
|
||||
sql_server_dirs="$sql_server_dirs myisam myisammrg heap vio sql"
|
||||
|
||||
fi
|
||||
|
||||
# IMPORTANT - do not modify LIBS past this line - this hack is the only way
|
||||
@@ -2755,7 +2754,6 @@ AC_CONFIG_FILES(ndb/Makefile ndb/include/Makefile dnl
|
||||
ndb/src/kernel/blocks/backup/Makefile dnl
|
||||
ndb/src/kernel/blocks/dbutil/Makefile dnl
|
||||
ndb/src/kernel/blocks/suma/Makefile dnl
|
||||
ndb/src/kernel/blocks/grep/Makefile dnl
|
||||
ndb/src/kernel/blocks/dbtux/Makefile dnl
|
||||
ndb/src/kernel/vm/Makefile dnl
|
||||
ndb/src/mgmapi/Makefile dnl
|
||||
|
@@ -18,7 +18,9 @@ char *argv[];
|
||||
#if defined(HAVE_PTHREAD_INIT) && defined(THREAD)
|
||||
pthread_init(); /* Must be called before DBUG_ENTER */
|
||||
#endif
|
||||
#ifdef THREAD
|
||||
my_thread_global_init();
|
||||
#endif
|
||||
{
|
||||
DBUG_ENTER ("main");
|
||||
DBUG_PROCESS (argv[0]);
|
||||
|
@@ -80,7 +80,7 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
|
||||
custom_arg.search_flag= SEARCH_SAME;
|
||||
old_allocated= keyinfo->rb_tree.allocated;
|
||||
res= tree_delete(&keyinfo->rb_tree, info->recbuf, &custom_arg);
|
||||
info->s->index_length+= (keyinfo->rb_tree.allocated-old_allocated);
|
||||
info->s->index_length-= (old_allocated - keyinfo->rb_tree.allocated);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@@ -933,10 +933,10 @@ typedef char bool; /* Ordinary boolean values 0 1 */
|
||||
(ABSTIME).ts_nsec=0; \
|
||||
}
|
||||
#define set_timespec_nsec(ABSTIME,NSEC) \
|
||||
{\
|
||||
ulonglong now= my_getsystime(); \
|
||||
(ABSTIME).ts_sec= (now / ULL(10000000)) + (NSEC / ULL(1000000000)); \
|
||||
(ABSTIME).ts_nsec= (now % ULL(10000000)) * 100 + (NSEC % ULL(1000000000)); \
|
||||
{ \
|
||||
ulonglong now= my_getsystime() + (NSEC/100); \
|
||||
(ABSTIME).ts_sec= (now / ULL(10000000)); \
|
||||
(ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
|
||||
}
|
||||
#else
|
||||
#define set_timespec(ABSTIME,SEC) \
|
||||
@@ -948,9 +948,9 @@ typedef char bool; /* Ordinary boolean values 0 1 */
|
||||
}
|
||||
#define set_timespec_nsec(ABSTIME,NSEC) \
|
||||
{\
|
||||
ulonglong now= my_getsystime(); \
|
||||
(ABSTIME).tv_sec= (now / ULL(10000000)) + (NSEC / ULL(1000000000)); \
|
||||
(ABSTIME).tv_nsec= (now % ULL(10000000)) * 100 + (NSEC % ULL(1000000000)); \
|
||||
ulonglong now= my_getsystime() + (NSEC/100); \
|
||||
(ABSTIME).tv_sec= (now / ULL(10000000)); \
|
||||
(ABSTIME).tv_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
|
||||
}
|
||||
#endif /* HAVE_TIMESPEC_TS_SEC */
|
||||
#endif /* set_timespec */
|
||||
|
@@ -47,6 +47,10 @@ innobase_mysql_end_print_arbitrary_thd(void);
|
||||
graph of transactions */
|
||||
#define LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK 1000000
|
||||
|
||||
/* Restricts the recursion depth of the search we will do in the waits-for
|
||||
graph of transactions */
|
||||
#define LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK 200
|
||||
|
||||
/* When releasing transaction locks, this specifies how often we release
|
||||
the kernel mutex for a moment to give also others access to it */
|
||||
|
||||
@@ -389,9 +393,12 @@ lock_deadlock_recursive(
|
||||
trx_t* start, /* in: recursion starting point */
|
||||
trx_t* trx, /* in: a transaction waiting for a lock */
|
||||
lock_t* wait_lock, /* in: the lock trx is waiting to be granted */
|
||||
ulint* cost); /* in/out: number of calculation steps thus
|
||||
ulint* cost, /* in/out: number of calculation steps thus
|
||||
far: if this exceeds LOCK_MAX_N_STEPS_...
|
||||
we return TRUE */
|
||||
we return LOCK_VICTIM_IS_START */
|
||||
uint depth); /* in: recursion depth: if this exceeds
|
||||
LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we
|
||||
return LOCK_VICTIM_IS_START */
|
||||
|
||||
/*************************************************************************
|
||||
Gets the type of a lock. */
|
||||
@@ -3180,7 +3187,7 @@ retry:
|
||||
mark_trx = UT_LIST_GET_NEXT(trx_list, mark_trx);
|
||||
}
|
||||
|
||||
ret = lock_deadlock_recursive(trx, trx, lock, &cost);
|
||||
ret = lock_deadlock_recursive(trx, trx, lock, &cost, 0);
|
||||
|
||||
if (ret == LOCK_VICTIM_IS_OTHER) {
|
||||
/* We chose some other trx as a victim: retry if there still
|
||||
@@ -3226,9 +3233,12 @@ lock_deadlock_recursive(
|
||||
trx_t* start, /* in: recursion starting point */
|
||||
trx_t* trx, /* in: a transaction waiting for a lock */
|
||||
lock_t* wait_lock, /* in: the lock trx is waiting to be granted */
|
||||
ulint* cost) /* in/out: number of calculation steps thus
|
||||
ulint* cost, /* in/out: number of calculation steps thus
|
||||
far: if this exceeds LOCK_MAX_N_STEPS_...
|
||||
we return LOCK_VICTIM_IS_START */
|
||||
uint depth) /* in: recursion depth: if this exceeds
|
||||
LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we
|
||||
return LOCK_VICTIM_IS_START */
|
||||
{
|
||||
lock_t* lock;
|
||||
ulint bit_no = ULINT_UNDEFINED;
|
||||
@@ -3249,7 +3259,8 @@ lock_deadlock_recursive(
|
||||
|
||||
*cost = *cost + 1;
|
||||
|
||||
if (*cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK) {
|
||||
if ((depth > LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK)
|
||||
|| (*cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK)) {
|
||||
|
||||
return(LOCK_VICTIM_IS_START);
|
||||
}
|
||||
@@ -3375,7 +3386,7 @@ lock_deadlock_recursive(
|
||||
a lock */
|
||||
|
||||
ret = lock_deadlock_recursive(start, lock_trx,
|
||||
lock_trx->wait_lock, cost);
|
||||
lock_trx->wait_lock, cost, depth + 1);
|
||||
if (ret != 0) {
|
||||
|
||||
return(ret);
|
||||
|
@@ -576,15 +576,19 @@ set @arg00= 9223372036854775807 ;
|
||||
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
|
||||
@arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||
--vertical_results
|
||||
--replace_result e+0 e+
|
||||
execute my_select ;
|
||||
--horizontal_results
|
||||
--replace_result e+0 e+
|
||||
execute my_delete ;
|
||||
set @arg00= '9223372036854775807' ;
|
||||
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
|
||||
@arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||
--vertical_results
|
||||
--replace_result e+0 e+
|
||||
execute my_select ;
|
||||
--horizontal_results
|
||||
--replace_result e+0 e+
|
||||
execute my_delete ;
|
||||
# Use the minimum BIGINT from the manual
|
||||
#
|
||||
@@ -592,15 +596,19 @@ set @arg00= -9223372036854775808 ;
|
||||
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
|
||||
@arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||
--vertical_results
|
||||
--replace_result e+0 e+
|
||||
execute my_select ;
|
||||
--horizontal_results
|
||||
--replace_result e+0 e+
|
||||
execute my_delete ;
|
||||
set @arg00= '-9223372036854775808' ;
|
||||
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
|
||||
@arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||
--vertical_results
|
||||
--replace_result e+0 e+
|
||||
execute my_select ;
|
||||
--horizontal_results
|
||||
--replace_result e+0 e+
|
||||
execute my_delete ;
|
||||
|
||||
# Numeric overflow of columns(c1, c2, c3, c4, c5, c12) with type not in
|
||||
@@ -610,8 +618,10 @@ set @arg00= 1.11111111111111111111e+50 ;
|
||||
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
|
||||
@arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||
--vertical_results
|
||||
--replace_result e+0 e+
|
||||
execute my_select ;
|
||||
--horizontal_results
|
||||
--replace_result e+0 e+
|
||||
execute my_delete ;
|
||||
# Attention: The columns(c1,c2,c3,c4,c5,c6) do not get the overflow,
|
||||
# because the string is treated as written integer and
|
||||
@@ -620,15 +630,19 @@ set @arg00= '1.11111111111111111111e+50' ;
|
||||
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
|
||||
@arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||
--vertical_results
|
||||
--replace_result e+0 e+
|
||||
execute my_select ;
|
||||
--horizontal_results
|
||||
--replace_result e+0 e+
|
||||
execute my_delete ;
|
||||
set @arg00= -1.11111111111111111111e+50 ;
|
||||
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
|
||||
@arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||
--vertical_results
|
||||
--replace_result e+0 e+
|
||||
execute my_select ;
|
||||
--horizontal_results
|
||||
--replace_result e+0 e+
|
||||
execute my_delete ;
|
||||
# Attention: The columns(c1,c2,c3,c4,c5,c6) do not get the overflow,
|
||||
# because the string is treated as written integer and
|
||||
@@ -637,8 +651,10 @@ set @arg00= '-1.11111111111111111111e+50' ;
|
||||
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
|
||||
@arg00, @arg00, @arg00, @arg00, @arg00 ;
|
||||
--vertical_results
|
||||
--replace_result e+0 e+
|
||||
execute my_select ;
|
||||
--horizontal_results
|
||||
--replace_result e+0 e+
|
||||
execute my_delete ;
|
||||
|
||||
########################## test of string types ##########################
|
||||
|
@@ -349,14 +349,14 @@ drop table if exists t2 ;
|
||||
--enable_warnings
|
||||
create table t2 as select * from t1 ;
|
||||
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
|
||||
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
|
||||
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
|
||||
let $1= 9 ;
|
||||
while ($1)
|
||||
{
|
||||
|
@@ -518,7 +518,7 @@ CREATE TABLE proc (
|
||||
security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL,
|
||||
param_list blob DEFAULT '' NOT NULL,
|
||||
returns char(64) DEFAULT '' NOT NULL,
|
||||
body blob DEFAULT '' NOT NULL,
|
||||
body longblob DEFAULT '' NOT NULL,
|
||||
definer char(77) collate utf8_bin DEFAULT '' NOT NULL,
|
||||
created timestamp,
|
||||
modified timestamp,
|
||||
|
@@ -185,10 +185,6 @@ sub spawn_parent_impl {
|
||||
|
||||
if ( $mode eq 'run' or $mode eq 'test' )
|
||||
{
|
||||
my $exit_value= -1;
|
||||
# my $signal_num= 0;
|
||||
# my $dumped_core= 0;
|
||||
|
||||
if ( $mode eq 'run' )
|
||||
{
|
||||
# Simple run of command, we wait for it to return
|
||||
@@ -199,12 +195,7 @@ sub spawn_parent_impl {
|
||||
mtr_error("$path ($pid) got lost somehow");
|
||||
}
|
||||
|
||||
$exit_value= $?;
|
||||
# $exit_value= $? >> 8;
|
||||
# $signal_num= $? & 127;
|
||||
# $dumped_core= $? & 128;
|
||||
|
||||
return $exit_value;
|
||||
return mtr_process_exit_status($?);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -218,6 +209,8 @@ sub spawn_parent_impl {
|
||||
# FIXME is this as it should be? Can't mysqld terminate
|
||||
# normally from running a test case?
|
||||
|
||||
my $exit_value= -1;
|
||||
my $saved_exit_value;
|
||||
my $ret_pid; # What waitpid() returns
|
||||
|
||||
while ( ($ret_pid= waitpid(-1,0)) != -1 )
|
||||
@@ -227,13 +220,28 @@ sub spawn_parent_impl {
|
||||
# but not $exit_value, this is flagged from
|
||||
#
|
||||
|
||||
my $timer_name= mtr_timer_timeout($::glob_timers, $ret_pid);
|
||||
if ( $timer_name )
|
||||
{
|
||||
if ( $timer_name eq "suite" )
|
||||
{
|
||||
# We give up here
|
||||
# FIXME we should only give up the suite, not all of the run?
|
||||
print STDERR "\n";
|
||||
mtr_error("Test suite timeout");
|
||||
}
|
||||
elsif ( $timer_name eq "testcase" )
|
||||
{
|
||||
$saved_exit_value= 63; # Mark as timeout
|
||||
kill(9, $pid); # Kill mysqltest
|
||||
next; # Go on and catch the termination
|
||||
}
|
||||
}
|
||||
|
||||
if ( $ret_pid == $pid )
|
||||
{
|
||||
# We got termination of mysqltest, we are done
|
||||
$exit_value= $?;
|
||||
# $exit_value= $? >> 8;
|
||||
# $signal_num= $? & 127;
|
||||
# $dumped_core= $? & 128;
|
||||
$exit_value= mtr_process_exit_status($?);
|
||||
last;
|
||||
}
|
||||
|
||||
@@ -281,7 +289,7 @@ sub spawn_parent_impl {
|
||||
}
|
||||
}
|
||||
|
||||
return $exit_value;
|
||||
return $saved_exit_value || $exit_value;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -292,6 +300,23 @@ sub spawn_parent_impl {
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# We try to emulate how an Unix shell calculates the exit code
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
sub mtr_process_exit_status {
|
||||
my $raw_status= shift;
|
||||
|
||||
if ( $raw_status & 127 )
|
||||
{
|
||||
return ($raw_status & 127) + 128; # Signal num + 128
|
||||
}
|
||||
else
|
||||
{
|
||||
return $raw_status >> 8; # Exit code
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -331,7 +356,7 @@ sub mtr_kill_leftovers () {
|
||||
});
|
||||
}
|
||||
|
||||
mtr_mysqladmin_shutdown(\@args);
|
||||
mtr_mysqladmin_shutdown(\@args, 20);
|
||||
|
||||
# We now have tried to terminate nice. We have waited for the listen
|
||||
# port to be free, but can't really tell if the mysqld process died
|
||||
@@ -441,7 +466,8 @@ sub mtr_stop_mysqld_servers ($) {
|
||||
# First try nice normal shutdown using 'mysqladmin'
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
mtr_mysqladmin_shutdown($spec);
|
||||
# Shutdown time must be high as slave may be in reconnect
|
||||
mtr_mysqladmin_shutdown($spec, 70);
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# We loop with waitpid() nonblocking to see how many of the ones we
|
||||
@@ -591,8 +617,9 @@ sub mtr_stop_mysqld_servers ($) {
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub mtr_mysqladmin_shutdown () {
|
||||
sub mtr_mysqladmin_shutdown {
|
||||
my $spec= shift;
|
||||
my $adm_shutdown_tmo= shift;
|
||||
|
||||
my %mysql_admin_pids;
|
||||
my @to_kill_specs;
|
||||
@@ -631,7 +658,7 @@ sub mtr_mysqladmin_shutdown () {
|
||||
mtr_add_arg($args, "--protocol=tcp"); # Needed if no --socket
|
||||
}
|
||||
mtr_add_arg($args, "--connect_timeout=5");
|
||||
mtr_add_arg($args, "--shutdown_timeout=20");
|
||||
mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo");
|
||||
mtr_add_arg($args, "shutdown");
|
||||
# We don't wait for termination of mysqladmin
|
||||
my $pid= mtr_spawn($::exe_mysqladmin, $args,
|
||||
@@ -808,11 +835,15 @@ sub sleep_until_file_created ($$$) {
|
||||
# FIXME something is wrong, we sometimes terminate with "Hangup" written
|
||||
# to tty, and no STDERR output telling us why.
|
||||
|
||||
# FIXME for some readon, setting HUP to 'IGNORE' will cause exit() to
|
||||
# write out "Hangup", and maybe loose some output. We insert a sleep...
|
||||
|
||||
sub mtr_exit ($) {
|
||||
my $code= shift;
|
||||
# cluck("Called mtr_exit()");
|
||||
local $SIG{HUP} = 'IGNORE';
|
||||
kill('HUP', -$$);
|
||||
sleep 2;
|
||||
exit($code);
|
||||
}
|
||||
|
||||
|
@@ -109,7 +109,14 @@ sub mtr_report_test_failed ($) {
|
||||
my $tinfo= shift;
|
||||
|
||||
$tinfo->{'result'}= 'MTR_RES_FAILED';
|
||||
if ( $tinfo->{'timeout'} )
|
||||
{
|
||||
print "[ fail ] timeout\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "[ fail ]\n";
|
||||
}
|
||||
|
||||
# FIXME Instead of this test, and meaningless error message in 'else'
|
||||
# we should write out into $::path_timefile when the error occurs.
|
||||
|
127
mysql-test/lib/mtr_timer.pl
Normal file
127
mysql-test/lib/mtr_timer.pl
Normal file
@@ -0,0 +1,127 @@
|
||||
# -*- cperl -*-
|
||||
|
||||
# This is a library file used by the Perl version of mysql-test-run,
|
||||
# and is part of the translation of the Bourne shell script with the
|
||||
# same name.
|
||||
|
||||
use Carp qw(cluck);
|
||||
use Socket;
|
||||
use Errno;
|
||||
use strict;
|
||||
|
||||
#use POSIX ":sys_wait_h";
|
||||
use POSIX 'WNOHANG';
|
||||
|
||||
sub mtr_init_timers ();
|
||||
sub mtr_timer_start($$$);
|
||||
sub mtr_timer_stop($$);
|
||||
sub mtr_timer_waitpid($$$);
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Initiate a structure shared by all timers
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub mtr_init_timers () {
|
||||
my $timers = { timers => {}, pids => {}};
|
||||
return $timers;
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Start, stop and poll a timer
|
||||
#
|
||||
# As alarm() isn't portable to Windows, we use separate processes to
|
||||
# implement timers. That is why there is a mtr_timer_waitpid(), as this
|
||||
# is where we catch a timeout.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub mtr_timer_start($$$) {
|
||||
my ($timers,$name,$duration)= @_;
|
||||
|
||||
if ( exists $timers->{'timers'}->{$name} )
|
||||
{
|
||||
# We have an old running timer, kill it
|
||||
mtr_timer_stop($timers,$name);
|
||||
}
|
||||
|
||||
FORK:
|
||||
{
|
||||
my $tpid= fork();
|
||||
|
||||
if ( ! defined $tpid )
|
||||
{
|
||||
if ( $! == $!{EAGAIN} ) # See "perldoc Errno"
|
||||
{
|
||||
mtr_debug("Got EAGAIN from fork(), sleep 1 second and redo");
|
||||
sleep(1);
|
||||
redo FORK;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_error("can't fork");
|
||||
}
|
||||
}
|
||||
|
||||
if ( $tpid )
|
||||
{
|
||||
# Parent, record the information
|
||||
$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?
|
||||
$0= "mtr_timer(timers,$name,$duration)";
|
||||
sleep($duration);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub mtr_timer_stop ($$) {
|
||||
my ($timers,$name)= @_;
|
||||
|
||||
if ( exists $timers->{'timers'}->{$name} )
|
||||
{
|
||||
my $tpid= $timers->{'timers'}->{$name}->{'pid'};
|
||||
|
||||
# FIXME as Cygwin reuses pids fast, maybe check that is
|
||||
# the expected process somehow?!
|
||||
kill(9, $tpid);
|
||||
|
||||
# As the timers are so simple programs, we trust them to terminate,
|
||||
# and use blocking wait for it. We wait just to avoid a zombie.
|
||||
waitpid($tpid,0);
|
||||
|
||||
delete $timers->{'timers'}->{$name}; # Remove the timer information
|
||||
delete $timers->{'pids'}->{$tpid}; # and PID reference
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtr_debug("Asked to stop timer \"$name\" not started");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub mtr_timer_timeout ($$) {
|
||||
my ($timers,$pid)= @_;
|
||||
|
||||
return "" unless exists $timers->{'pids'}->{$pid};
|
||||
|
||||
# We got a timeout
|
||||
my $name= $timers->{'pids'}->{$pid};
|
||||
mtr_timer_stop($timers, $timers->{'timers'}->{$name});
|
||||
return $name;
|
||||
}
|
||||
|
||||
1;
|
@@ -90,6 +90,7 @@ use strict;
|
||||
|
||||
require "lib/mtr_cases.pl";
|
||||
require "lib/mtr_process.pl";
|
||||
require "lib/mtr_timer.pl";
|
||||
require "lib/mtr_io.pl";
|
||||
require "lib/mtr_gcov.pl";
|
||||
require "lib/mtr_gprof.pl";
|
||||
@@ -137,6 +138,7 @@ 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_running_server= 0;
|
||||
our $glob_use_running_ndbcluster= 0;
|
||||
our $glob_use_embedded_server= 0;
|
||||
@@ -234,6 +236,8 @@ our $opt_ps_protocol;
|
||||
|
||||
our $opt_sleep_time_after_restart= 1;
|
||||
our $opt_sleep_time_for_delete= 10;
|
||||
our $opt_testcase_timeout= 5; # 5 min max
|
||||
our $opt_suite_timeout= 120; # 2 hours max
|
||||
|
||||
our $opt_socket;
|
||||
|
||||
@@ -435,6 +439,8 @@ sub initial_setup () {
|
||||
|
||||
$path_my_basedir=
|
||||
$opt_source_dist ? $glob_mysql_test_dir : $glob_basedir;
|
||||
|
||||
$glob_timers= mtr_init_timers();
|
||||
}
|
||||
|
||||
|
||||
@@ -530,6 +536,8 @@ sub command_line_setup () {
|
||||
'vardir=s' => \$opt_vardir,
|
||||
'verbose' => \$opt_verbose,
|
||||
'wait-timeout=i' => \$opt_wait_timeout,
|
||||
'testcase-timeout=i' => \$opt_testcase_timeout,
|
||||
'suite-timeout=i' => \$opt_suite_timeout,
|
||||
'warnings|log-warnings' => \$opt_warnings,
|
||||
'with-openssl' => \$opt_with_openssl,
|
||||
|
||||
@@ -1194,6 +1202,8 @@ sub run_suite () {
|
||||
|
||||
mtr_report("Finding Tests in the '$suite' suite");
|
||||
|
||||
mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout);
|
||||
|
||||
my $tests= collect_test_cases($suite);
|
||||
|
||||
mtr_report("Starting Tests in the '$suite' suite");
|
||||
@@ -1202,7 +1212,9 @@ sub run_suite () {
|
||||
|
||||
foreach my $tinfo ( @$tests )
|
||||
{
|
||||
mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout);
|
||||
run_testcase($tinfo);
|
||||
mtr_timer_stop($glob_timers,"testcase");
|
||||
}
|
||||
|
||||
mtr_print_line();
|
||||
@@ -1223,6 +1235,8 @@ sub run_suite () {
|
||||
}
|
||||
|
||||
mtr_report_stats($tests);
|
||||
|
||||
mtr_timer_stop($glob_timers,"suite");
|
||||
}
|
||||
|
||||
|
||||
@@ -1520,6 +1534,11 @@ sub run_testcase ($) {
|
||||
# Testcase itself tell us to skip this one
|
||||
mtr_report_test_skipped($tinfo);
|
||||
}
|
||||
elsif ( $res == 63 )
|
||||
{
|
||||
$tinfo->{'timeout'}= 1; # Mark as timeout
|
||||
report_failure_and_restart($tinfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
# Test case failed, if in control mysqltest returns 1
|
||||
@@ -1655,8 +1674,6 @@ sub mysqld_arguments ($$$$$) {
|
||||
my $extra_opt= shift;
|
||||
my $slave_master_info= shift;
|
||||
|
||||
# print STDERR Dumper($extra_opt);
|
||||
|
||||
my $sidx= ""; # Index as string, 0 is empty string
|
||||
if ( $idx > 0 )
|
||||
{
|
||||
@@ -2026,6 +2043,7 @@ sub run_mysqltest ($) {
|
||||
my $tinfo= shift;
|
||||
|
||||
my $cmdline_mysqldump= "$exe_mysqldump --no-defaults -uroot " .
|
||||
"--port=$master->[0]->{'path_myport'} " .
|
||||
"--socket=$master->[0]->{'path_mysock'} --password=";
|
||||
if ( $opt_debug )
|
||||
{
|
||||
@@ -2034,6 +2052,7 @@ sub run_mysqltest ($) {
|
||||
}
|
||||
|
||||
my $cmdline_mysqlshow= "$exe_mysqlshow -uroot " .
|
||||
"--port=$master->[0]->{'path_myport'} " .
|
||||
"--socket=$master->[0]->{'path_mysock'} --password=";
|
||||
if ( $opt_debug )
|
||||
{
|
||||
@@ -2262,6 +2281,10 @@ Misc options
|
||||
help Get this help text
|
||||
unified-diff | udiff When presenting differences, use unified diff
|
||||
|
||||
testcase-timeout=MINUTES Max test case run time (default 5)
|
||||
suite-timeout=MINUTES Max test suite run time (default 120)
|
||||
|
||||
|
||||
Options not yet described, or that I want to look into more
|
||||
|
||||
big-test
|
||||
@@ -2281,4 +2304,5 @@ Options not yet described, or that I want to look into more
|
||||
|
||||
HERE
|
||||
mtr_exit(1);
|
||||
|
||||
}
|
||||
|
@@ -732,6 +732,11 @@ drop table t1;
|
||||
set @a:=now();
|
||||
CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=bdb;
|
||||
insert into t1 (a) values(1),(2),(3);
|
||||
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
select a from t1 natural join t1 as t2 where b >= @a order by a;
|
||||
a
|
||||
1
|
||||
@@ -906,7 +911,7 @@ create temporary table tmp1
|
||||
select branch_id, target_id, platform_id, product_id
|
||||
from t1, t2, t3, t4 ;
|
||||
create temporary table tmp2
|
||||
select branch_id, target_id, platform_id, product_id
|
||||
select tmp1.branch_id, tmp1.target_id, tmp1.platform_id, tmp1.product_id
|
||||
from tmp1 left join t8
|
||||
using (branch_id,target_id,platform_id,product_id)
|
||||
where t8.archive_id is null ;
|
||||
|
@@ -11320,9 +11320,8 @@ CREATE TABLE t1(f1 blob);
|
||||
PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
|
||||
SET @var1= x'8300';
|
||||
EXECUTE stmt1 USING @var1;
|
||||
SHOW BINLOG EVENTS;
|
||||
SHOW BINLOG EVENTS FROM 98;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 98 Server ver: 5.0.12-beta-debug-log, Binlog ver: 4
|
||||
master-bin.000001 98 Query 1 185 use `test`; CREATE TABLE t1(f1 blob)
|
||||
master-bin.000001 185 User var 1 224 @`var1`=_binary 0x8300 COLLATE binary
|
||||
master-bin.000001 224 Query 1 317 use `test`; INSERT INTO t1 VALUES(@'var1')
|
||||
|
@@ -472,3 +472,51 @@ id IFNULL(dsc, '-')
|
||||
2 line number two
|
||||
3 line number three
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||
SELECT DISTINCT a, 1 FROM t1;
|
||||
a 1
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
5 1
|
||||
SELECT DISTINCT 1, a FROM t1;
|
||||
1 a
|
||||
1 1
|
||||
1 2
|
||||
1 3
|
||||
1 4
|
||||
1 5
|
||||
CREATE TABLE t2 (a int, b int);
|
||||
INSERT INTO t2 VALUES (1,1),(2,2),(2,3),(2,4),(3,5);
|
||||
SELECT DISTINCT a, b, 2 FROM t2;
|
||||
a b 2
|
||||
1 1 2
|
||||
2 2 2
|
||||
2 3 2
|
||||
2 4 2
|
||||
3 5 2
|
||||
SELECT DISTINCT 2, a, b FROM t2;
|
||||
2 a b
|
||||
2 1 1
|
||||
2 2 2
|
||||
2 2 3
|
||||
2 2 4
|
||||
2 3 5
|
||||
SELECT DISTINCT a, 2, b FROM t2;
|
||||
a 2 b
|
||||
1 2 1
|
||||
2 2 2
|
||||
2 2 3
|
||||
2 2 4
|
||||
3 2 5
|
||||
DROP TABLE t1,t2;
|
||||
create table t1 (id int, dsc varchar(50));
|
||||
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
|
||||
select distinct id, IFNULL(dsc, '-') from t1;
|
||||
id IFNULL(dsc, '-')
|
||||
1 line number one
|
||||
2 line number two
|
||||
3 line number three
|
||||
drop table t1;
|
||||
|
@@ -70,3 +70,27 @@ select timediff(b, a) >= '00:00:03' from t1;
|
||||
timediff(b, a) >= '00:00:03'
|
||||
1
|
||||
drop table t1;
|
||||
set global query_cache_size=1355776;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(1),(1);
|
||||
create table t2 (a datetime default null, b datetime default null);
|
||||
insert into t2 set a = now();
|
||||
select a from t1 where sleep(1);
|
||||
a
|
||||
update t2 set b = now() where b is null;
|
||||
insert into t2 set a = now();
|
||||
select a from t1 where sleep(a);
|
||||
a
|
||||
update t2 set b = now() where b is null;
|
||||
insert into t2 set a = now();
|
||||
select a from t1 where sleep(1);
|
||||
a
|
||||
update t2 set b = now() where b is null;
|
||||
select timediff(b, a) >= '00:00:03' from t2;
|
||||
timediff(b, a) >= '00:00:03'
|
||||
1
|
||||
1
|
||||
1
|
||||
drop table t2;
|
||||
drop table t1;
|
||||
set global query_cache_size=default;
|
||||
|
@@ -720,3 +720,43 @@ Warning 1292 Truncated incorrect datetime value: '2005-01-00'
|
||||
select time_format('100:00:00', '%H %k %h %I %l');
|
||||
time_format('100:00:00', '%H %k %h %I %l')
|
||||
100 100 04 04 4
|
||||
create table t1 (a timestamp default '2005-05-05 01:01:01',
|
||||
b timestamp default '2005-05-05 01:01:01');
|
||||
create function t_slow_sysdate() returns timestamp
|
||||
begin
|
||||
do sleep(2);
|
||||
return sysdate();
|
||||
end;
|
||||
//
|
||||
insert into t1 set a = sysdate(), b = t_slow_sysdate();//
|
||||
create trigger t_before before insert on t1
|
||||
for each row begin
|
||||
set new.b = t_slow_sysdate();
|
||||
end
|
||||
//
|
||||
insert into t1 set a = sysdate();
|
||||
select a != b from t1;
|
||||
a != b
|
||||
1
|
||||
1
|
||||
drop trigger t_before;
|
||||
drop function t_slow_sysdate;
|
||||
drop table t1;
|
||||
create table t1 (a datetime, i int, b datetime);
|
||||
insert into t1 select sysdate(), sleep(1), sysdate() from dual;
|
||||
select a != b from t1;
|
||||
a != b
|
||||
1
|
||||
drop table t1;
|
||||
create procedure t_sysdate()
|
||||
begin
|
||||
select sysdate() into @a;
|
||||
do sleep(2);
|
||||
select sysdate() into @b;
|
||||
select @a != @b;
|
||||
end;
|
||||
//
|
||||
call t_sysdate();
|
||||
@a != @b
|
||||
1
|
||||
drop procedure t_sysdate;
|
||||
|
@@ -284,5 +284,31 @@ i
|
||||
2
|
||||
3
|
||||
REVOKE ALL ON mysqltest_1.t1 FROM mysqltest_1@'127.0.0.0/255.0.0.0';
|
||||
delete from mysql.user where user like 'mysqltest\_1';
|
||||
flush privileges;
|
||||
drop table mysqltest_1.t1;
|
||||
grant all on mysqltest_1.* to mysqltest_1@'127.0.0.1';
|
||||
select current_user();
|
||||
current_user()
|
||||
mysqltest_1@127.0.0.1
|
||||
set password = password('changed');
|
||||
select host, length(password) from mysql.user where user like 'mysqltest\_1';
|
||||
host length(password)
|
||||
127.0.0.1 41
|
||||
revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.1';
|
||||
delete from mysql.user where user like 'mysqltest\_1';
|
||||
flush privileges;
|
||||
grant all on mysqltest_1.* to mysqltest_1@'127.0.0.0/255.0.0.0';
|
||||
select current_user();
|
||||
current_user()
|
||||
mysqltest_1@127.0.0.0/255.0.0.0
|
||||
set password = password('changed');
|
||||
select host, length(password) from mysql.user where user like 'mysqltest\_1';
|
||||
host length(password)
|
||||
127.0.0.0/255.0.0.0 41
|
||||
revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.0/255.0.0.0';
|
||||
delete from mysql.user where user like 'mysqltest\_1';
|
||||
flush privileges;
|
||||
drop database mysqltest_1;
|
||||
set password = password("changed");
|
||||
ERROR 42000: Access denied for user ''@'localhost' to database 'mysql'
|
||||
|
@@ -152,7 +152,7 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
|
||||
t2 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
|
||||
t3 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
|
||||
t5 MyISAM 10 Fixed 1 7 7 # 2048 0 11 # # NULL latin1_swedish_ci NULL
|
||||
v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view
|
||||
v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL VIEW
|
||||
show full columns from t3 like "a%";
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
a int(11) NULL YES MUL NULL select,insert,update,references
|
||||
@@ -273,10 +273,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE # ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE # ALL NULL NULL NULL NULL 2 Using where
|
||||
select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a,
|
||||
mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8);
|
||||
mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) order by 1;
|
||||
ROUTINE_NAME name
|
||||
sub1 sub1
|
||||
sel2 sel2
|
||||
sub1 sub1
|
||||
select count(*) from information_schema.ROUTINES;
|
||||
count(*)
|
||||
2
|
||||
@@ -966,4 +966,16 @@ column_name column_default
|
||||
a NULL
|
||||
b NULL
|
||||
use test;
|
||||
show columns from t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) NO
|
||||
b int(11) YES NULL
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (b int);
|
||||
SHOW TABLE STATUS FROM test
|
||||
WHERE name IN ( SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_SCHEMA='test' AND TABLE_TYPE='BASE TABLE');
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
|
||||
t2 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
|
||||
|
@@ -750,6 +750,11 @@ drop table t1;
|
||||
set @a:=now();
|
||||
CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb;
|
||||
insert into t1 (a) values(1),(2),(3);
|
||||
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
select a from t1 natural join t1 as t2 where b >= @a order by a;
|
||||
a
|
||||
1
|
||||
|
@@ -121,6 +121,12 @@ id catid stateid countyid
|
||||
drop table t1, t2;
|
||||
create table t1 (a int primary key);
|
||||
insert into t1 values(1),(2);
|
||||
select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a);
|
||||
a
|
||||
1
|
||||
2
|
||||
select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
|
||||
ERROR HY000: Too many tables; MySQL can only use XX tables in a join
|
||||
select a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a);
|
||||
a
|
||||
1
|
||||
@@ -145,6 +151,10 @@ DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (d DATE NOT NULL);
|
||||
CREATE TABLE t2 (d DATE NOT NULL);
|
||||
INSERT INTO t1 (d) VALUES ('2001-08-01'),('0000-00-00');
|
||||
SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE t2.d IS NULL;
|
||||
d
|
||||
2001-08-01
|
||||
0000-00-00
|
||||
SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE d IS NULL;
|
||||
d
|
||||
0000-00-00
|
||||
@@ -264,6 +274,12 @@ PRIMARY KEY (siteid,rate_code),
|
||||
FULLTEXT KEY rate_code (rate_code)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES ('rivercats','cust',20);
|
||||
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats';
|
||||
rate_code base_rate
|
||||
cust 20
|
||||
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith';
|
||||
rate_code base_rate
|
||||
cust 20
|
||||
SELECT rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND siteid = 'rivercats';
|
||||
rate_code base_rate
|
||||
cust 20
|
||||
@@ -326,7 +342,7 @@ select * from t3 right join t2 on (t3.i=t2.i) right join t1 on (t2.i=t1.i);
|
||||
i i i
|
||||
NULL NULL 1
|
||||
2 2 2
|
||||
select * from t1,t2 natural left join t3 order by 1,2;
|
||||
select * from t1,t2 natural left join t3 order by t1.i,t2.i,t3.i;
|
||||
i i
|
||||
1 2
|
||||
1 3
|
||||
@@ -338,36 +354,36 @@ i i i
|
||||
1 3 NULL
|
||||
2 2 2
|
||||
2 3 NULL
|
||||
select * from t2 natural left join t3,t1 order by t1.i;
|
||||
i i
|
||||
2 1
|
||||
3 1
|
||||
2 2
|
||||
3 2
|
||||
select t1.i,t2.i,t3.i from t2 natural left join t3,t1 order by t1.i,t2.i,t3.i;
|
||||
i i i
|
||||
1 2 2
|
||||
1 3 NULL
|
||||
2 2 2
|
||||
2 3 NULL
|
||||
select t1.i,t2.i,t3.i from t2 left join t3 on (t2.i=t3.i),t1 order by t1.i,t2.i,t3.i;
|
||||
i i i
|
||||
1 2 2
|
||||
1 3 NULL
|
||||
2 2 2
|
||||
2 3 NULL
|
||||
select * from t1,t2 natural right join t3 order by 1,2;
|
||||
select * from t1,t2 natural right join t3 order by t1.i,t2.i,t3.i;
|
||||
i i
|
||||
1 2
|
||||
1 4
|
||||
2 2
|
||||
1 2
|
||||
2 4
|
||||
2 2
|
||||
select * from t1,t2 right join t3 on (t2.i=t3.i) order by t1.i,t2.i,t3.i;
|
||||
i i i
|
||||
1 NULL 4
|
||||
1 2 2
|
||||
2 NULL 4
|
||||
2 2 2
|
||||
select * from t2 natural right join t3,t1 order by t1.i;
|
||||
i i
|
||||
2 1
|
||||
4 1
|
||||
2 2
|
||||
4 2
|
||||
select t1.i,t2.i,t3.i from t2 natural right join t3,t1 order by t1.i,t2.i,t3.i;
|
||||
i i i
|
||||
1 NULL 4
|
||||
1 2 2
|
||||
2 NULL 4
|
||||
2 2 2
|
||||
select t1.i,t2.i,t3.i from t2 right join t3 on (t2.i=t3.i),t1 order by t1.i,t2.i,t3.i;
|
||||
i i i
|
||||
1 NULL 4
|
||||
|
@@ -1153,13 +1153,13 @@ a b a1 b
|
||||
4 2 1 2
|
||||
4 2 2 2
|
||||
5 3 NULL NULL
|
||||
SELECT *
|
||||
SELECT t2.a,t2.b,t3.a1,t3.b
|
||||
FROM t2 NATURAL LEFT JOIN t3
|
||||
WHERE t2.a = 4 OR (t2.a > 4 AND t3.a1 IS NULL);
|
||||
b a c a1 c1
|
||||
2 4 0 1 0
|
||||
2 4 0 2 0
|
||||
3 5 0 NULL NULL
|
||||
a b a1 b
|
||||
4 2 1 2
|
||||
4 2 2 2
|
||||
5 3 NULL NULL
|
||||
DROP TABLE t0,t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (a int);
|
||||
|
@@ -36,16 +36,7 @@ grp a c id a c d
|
||||
3 5 C 3 5 B 5
|
||||
3 6 D 3 6 C 6
|
||||
NULL NULL NULL 4 7 D 7
|
||||
select * from t1 left join t2 using (a);
|
||||
a grp c id c d
|
||||
1 1 a 1 a 1
|
||||
2 2 b NULL NULL NULL
|
||||
3 2 c NULL NULL NULL
|
||||
4 3 E 3 A 4
|
||||
5 3 C 3 B 5
|
||||
6 3 D 3 C 6
|
||||
NULL NULL NULL NULL NULL
|
||||
select t1.*,t2.* from t1 left join t2 on t1.a=t2.a;
|
||||
select t1.*,t2.* from t1 left join t2 using (a);
|
||||
grp a c id a c d
|
||||
1 1 a 1 1 a 1
|
||||
2 2 b NULL NULL NULL NULL
|
||||
@@ -54,34 +45,40 @@ grp a c id a c d
|
||||
3 5 C 3 5 B 5
|
||||
3 6 D 3 6 C 6
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
select * from t1 left join t2 using (a,c);
|
||||
a c grp id d
|
||||
1 a 1 1 1
|
||||
2 b 2 NULL NULL
|
||||
3 c 2 NULL NULL
|
||||
4 E 3 NULL NULL
|
||||
5 C 3 NULL NULL
|
||||
6 D 3 NULL NULL
|
||||
NULL NULL NULL NULL
|
||||
select * from t1 left join t2 using (c);
|
||||
c grp a id a d
|
||||
a 1 1 1 1 1
|
||||
a 1 1 3 4 4
|
||||
b 2 2 3 5 5
|
||||
c 2 3 3 6 6
|
||||
E 3 4 NULL NULL NULL
|
||||
C 3 5 3 6 6
|
||||
D 3 6 4 7 7
|
||||
NULL NULL NULL NULL NULL
|
||||
select * from t1 natural left outer join t2;
|
||||
a c grp id d
|
||||
1 a 1 1 1
|
||||
2 b 2 NULL NULL
|
||||
3 c 2 NULL NULL
|
||||
4 E 3 NULL NULL
|
||||
5 C 3 NULL NULL
|
||||
6 D 3 NULL NULL
|
||||
NULL NULL NULL NULL
|
||||
select t1.*,t2.* from t1 left join t2 using (a) where t1.a=t2.a;
|
||||
grp a c id a c d
|
||||
1 1 a 1 1 a 1
|
||||
3 4 E 3 4 A 4
|
||||
3 5 C 3 5 B 5
|
||||
3 6 D 3 6 C 6
|
||||
select t1.*,t2.* from t1 left join t2 using (a,c);
|
||||
grp a c id a c d
|
||||
1 1 a 1 1 a 1
|
||||
2 2 b NULL NULL NULL NULL
|
||||
2 3 c NULL NULL NULL NULL
|
||||
3 4 E NULL NULL NULL NULL
|
||||
3 5 C NULL NULL NULL NULL
|
||||
3 6 D NULL NULL NULL NULL
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
select t1.*,t2.* from t1 left join t2 using (c);
|
||||
grp a c id a c d
|
||||
1 1 a 1 1 a 1
|
||||
1 1 a 3 4 A 4
|
||||
2 2 b 3 5 B 5
|
||||
2 3 c 3 6 C 6
|
||||
3 4 E NULL NULL NULL NULL
|
||||
3 5 C 3 6 C 6
|
||||
3 6 D 4 7 D 7
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
select t1.*,t2.* from t1 natural left outer join t2;
|
||||
grp a c id a c d
|
||||
1 1 a 1 1 a 1
|
||||
2 2 b NULL NULL NULL NULL
|
||||
2 3 c NULL NULL NULL NULL
|
||||
3 4 E NULL NULL NULL NULL
|
||||
3 5 C NULL NULL NULL NULL
|
||||
3 6 D NULL NULL NULL NULL
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
select t1.*,t2.* from t1 left join t2 on (t1.a=t2.a) where t2.id=3;
|
||||
grp a c id a c d
|
||||
3 4 E 3 4 A 4
|
||||
@@ -114,21 +111,21 @@ select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on
|
||||
ERROR 42S22: Unknown column 't3.a' in 'on clause'
|
||||
select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
|
||||
ERROR 42S22: Unknown column 't3.a' in 'on clause'
|
||||
select * from t1 inner join t2 using (a);
|
||||
a grp c id c d
|
||||
1 1 a 1 a 1
|
||||
4 3 E 3 A 4
|
||||
5 3 C 3 B 5
|
||||
6 3 D 3 C 6
|
||||
select t1.*,t2.* from t1 inner join t2 using (a);
|
||||
grp a c id a c d
|
||||
1 1 a 1 1 a 1
|
||||
3 4 E 3 4 A 4
|
||||
3 5 C 3 5 B 5
|
||||
3 6 D 3 6 C 6
|
||||
select t1.*,t2.* from t1 inner join t2 on (t1.a=t2.a);
|
||||
grp a c id a c d
|
||||
1 1 a 1 1 a 1
|
||||
3 4 E 3 4 A 4
|
||||
3 5 C 3 5 B 5
|
||||
3 6 D 3 6 C 6
|
||||
select * from t1 natural join t2;
|
||||
a c grp id d
|
||||
1 a 1 1 1
|
||||
select t1.*,t2.* from t1 natural join t2;
|
||||
grp a c id a c d
|
||||
1 1 a 1 1 a 1
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
usr_id INT unsigned NOT NULL,
|
||||
@@ -435,7 +432,7 @@ INSERT INTO t2 VALUES (3,'z');
|
||||
SELECT t2.id2 FROM t2 LEFT OUTER JOIN t1 ON t1.id2 = t2.id2 WHERE id1 IS NULL;
|
||||
id2
|
||||
3
|
||||
SELECT id2 FROM t2 NATURAL LEFT OUTER JOIN t1 WHERE id1 IS NULL;
|
||||
SELECT t2.id2 FROM t2 NATURAL LEFT OUTER JOIN t1 WHERE id1 IS NULL;
|
||||
id2
|
||||
3
|
||||
drop table t1,t2;
|
||||
@@ -653,6 +650,13 @@ select * from t1 natural left join t2 natural left join t3;
|
||||
i
|
||||
1
|
||||
2
|
||||
select * from t1 natural left join t2 where (t2.i is not null)=0;
|
||||
i
|
||||
1
|
||||
select * from t1 natural left join t2 where (t2.i is not null) is not null;
|
||||
i
|
||||
1
|
||||
2
|
||||
select * from t1 natural left join t2 where (i is not null)=0;
|
||||
i
|
||||
select * from t1 natural left join t2 where (i is not null) is not null;
|
||||
@@ -931,6 +935,18 @@ create table t1 (a int, b varchar(20));
|
||||
create table t2 (a int, c varchar(20));
|
||||
insert into t1 values (1,"aaaaaaaaaa"),(2,"bbbbbbbbbb");
|
||||
insert into t2 values (1,"cccccccccc"),(2,"dddddddddd");
|
||||
select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by t1.a;
|
||||
group_concat(t1.b,t2.c)
|
||||
aaaaa
|
||||
bbbbb
|
||||
Warnings:
|
||||
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
|
||||
select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by t1.a;
|
||||
group_concat(t1.b,t2.c)
|
||||
aaaaa
|
||||
bbbbb
|
||||
Warnings:
|
||||
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
|
||||
select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by a;
|
||||
group_concat(t1.b,t2.c)
|
||||
aaaaa
|
||||
|
@@ -179,8 +179,24 @@ a b c
|
||||
2 two two
|
||||
alter table t1 drop index c;
|
||||
select * from t1 where b = 'two';
|
||||
ERROR HY000: Table definition has changed, please retry transaction
|
||||
a b c
|
||||
2 two two
|
||||
select * from t1 where b = 'two';
|
||||
a b c
|
||||
2 two two
|
||||
drop table t1;
|
||||
create table t3 (a int primary key) engine=ndbcluster;
|
||||
begin;
|
||||
insert into t3 values (1);
|
||||
alter table t3 rename t4;
|
||||
delete from t3;
|
||||
insert into t3 values (1);
|
||||
commit;
|
||||
select * from t3;
|
||||
ERROR HY000: Can't lock file (errno: 155)
|
||||
select * from t4;
|
||||
a
|
||||
1
|
||||
drop table t4;
|
||||
show tables;
|
||||
Tables_in_test
|
||||
|
@@ -313,16 +313,12 @@ INSERT INTO t1 (order_id, product_id, product_type) VALUES
|
||||
('9d9aad7764b5b2c53004348ef8d34500',2315652, 3);
|
||||
INSERT INTO t2 (order_id, product_id, product_type) VALUES
|
||||
('9d9aad7764b5b2c53004348ef8d34500',2315652, 3);
|
||||
select t1.* from t1 left join t2
|
||||
on (t1.order_id = t2.order_id and
|
||||
t1.product_id = t2.product_id and
|
||||
t1.product_type = t2.product_type)
|
||||
where t2.order_id = NULL;
|
||||
select t1.* from t1
|
||||
left join t2 using(order_id, product_id, product_type)
|
||||
where t2.order_id=NULL;
|
||||
order_id product_id product_type
|
||||
select t1.* from t1 left join t2
|
||||
on (t1.order_id = t2.order_id and
|
||||
t1.product_id = t2.product_id and
|
||||
t1.product_type = t2.product_type)
|
||||
select t1.* from t1
|
||||
left join t2 using(order_id, product_id, product_type)
|
||||
where t2.order_id is NULL;
|
||||
order_id product_id product_type
|
||||
3d7ce39b5d4b3e3d22aaafe9b633de51 1206029 3
|
||||
|
@@ -180,6 +180,15 @@ INSERT INTO t3 VALUES (1,'123 Park Place');
|
||||
INSERT INTO t3 VALUES (2,'453 Boardwalk');
|
||||
SELECT a,b,if(b = 1,i,if(b = 2,v,''))
|
||||
FROM t1
|
||||
LEFT JOIN t2 USING(c)
|
||||
LEFT JOIN t3 ON t3.c = t1.c;
|
||||
a b if(b = 1,i,if(b = 2,v,''))
|
||||
1 1 50
|
||||
2 1 25
|
||||
3 2 123 Park Place
|
||||
4 2 453 Boardwalk
|
||||
SELECT a,b,if(b = 1,i,if(b = 2,v,''))
|
||||
FROM t1
|
||||
LEFT JOIN t2 ON t1.c = t2.c
|
||||
LEFT JOIN t3 ON t3.c = t1.c;
|
||||
a b if(b = 1,i,if(b = 2,v,''))
|
||||
@@ -189,6 +198,16 @@ a b if(b = 1,i,if(b = 2,v,''))
|
||||
4 2 453 Boardwalk
|
||||
SELECT a,b,if(b = 1,i,if(b = 2,v,''))
|
||||
FROM t1
|
||||
LEFT JOIN t2 USING(c)
|
||||
LEFT JOIN t3 ON t3.c = t1.c
|
||||
ORDER BY a;
|
||||
a b if(b = 1,i,if(b = 2,v,''))
|
||||
1 1 50
|
||||
2 1 25
|
||||
3 2 123 Park Place
|
||||
4 2 453 Boardwalk
|
||||
SELECT a,b,if(b = 1,i,if(b = 2,v,''))
|
||||
FROM t1
|
||||
LEFT JOIN t2 ON t1.c = t2.c
|
||||
LEFT JOIN t3 ON t3.c = t1.c
|
||||
ORDER BY a;
|
||||
@@ -523,9 +542,15 @@ KEY `pseudo` (`pseudo`)
|
||||
);
|
||||
INSERT INTO t1 (titre,auteur,dest) VALUES ('test','joce','bug');
|
||||
INSERT INTO t2 (numeropost,pseudo) VALUES (1,'joce'),(1,'bug');
|
||||
SELECT titre,t1.numeropost,auteur,icone,nbrep,0,date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
|
||||
titre numeropost auteur icone nbrep 0 date vue ouvert lastauteur dest
|
||||
test 1 joce 0 0 0 0000-00-00 00:00:00 0 1 bug
|
||||
SELECT titre,numeropost,auteur,icone,nbrep,0,date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
|
||||
titre numeropost auteur icone nbrep 0 date vue ouvert lastauteur dest
|
||||
test 1 joce 0 0 0 0000-00-00 00:00:00 0 1 bug
|
||||
SELECT titre,t1.numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
|
||||
titre numeropost auteur icone nbrep 0 date vue ouvert lastauteur dest
|
||||
test 1 joce 0 0 0 0000-00-00 00:00:00 0 1 bug
|
||||
SELECT titre,numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
|
||||
titre numeropost auteur icone nbrep 0 date vue ouvert lastauteur dest
|
||||
test 1 joce 0 0 0 0000-00-00 00:00:00 0 1 bug
|
||||
|
@@ -519,16 +519,16 @@ a ? a
|
||||
drop table if exists t2 ;
|
||||
create table t2 as select * from t1 ;
|
||||
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
|
||||
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
|
||||
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
|
||||
the join statement is:
|
||||
SELECT * FROM t2 right join t1 using(a) order by a
|
||||
SELECT * FROM t2 right join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query9 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -549,7 +549,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural right join t1 order by a
|
||||
SELECT * FROM t2 natural right join t1 order by t2.a
|
||||
prepare stmt1 from @query8 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -591,7 +591,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 left join t1 using(a) order by a
|
||||
SELECT * FROM t2 left join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query6 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -612,7 +612,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural left join t1 order by a
|
||||
SELECT * FROM t2 natural left join t1 order by t2.a
|
||||
prepare stmt1 from @query5 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -654,7 +654,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 join t1 using(a) order by a
|
||||
SELECT * FROM t2 join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query3 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -675,7 +675,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural join t1 order by a
|
||||
SELECT * FROM t2 natural join t1 order by t2.a
|
||||
prepare stmt1 from @query2 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
|
@@ -519,16 +519,16 @@ a ? a
|
||||
drop table if exists t2 ;
|
||||
create table t2 as select * from t1 ;
|
||||
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
|
||||
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
|
||||
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
|
||||
the join statement is:
|
||||
SELECT * FROM t2 right join t1 using(a) order by a
|
||||
SELECT * FROM t2 right join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query9 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -549,7 +549,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural right join t1 order by a
|
||||
SELECT * FROM t2 natural right join t1 order by t2.a
|
||||
prepare stmt1 from @query8 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -591,7 +591,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 left join t1 using(a) order by a
|
||||
SELECT * FROM t2 left join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query6 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -612,7 +612,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural left join t1 order by a
|
||||
SELECT * FROM t2 natural left join t1 order by t2.a
|
||||
prepare stmt1 from @query5 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -654,7 +654,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 join t1 using(a) order by a
|
||||
SELECT * FROM t2 join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query3 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -675,7 +675,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural join t1 order by a
|
||||
SELECT * FROM t2 natural join t1 order by t2.a
|
||||
prepare stmt1 from @query2 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
|
@@ -520,16 +520,16 @@ a ? a
|
||||
drop table if exists t2 ;
|
||||
create table t2 as select * from t1 ;
|
||||
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
|
||||
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
|
||||
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
|
||||
the join statement is:
|
||||
SELECT * FROM t2 right join t1 using(a) order by a
|
||||
SELECT * FROM t2 right join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query9 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -550,7 +550,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural right join t1 order by a
|
||||
SELECT * FROM t2 natural right join t1 order by t2.a
|
||||
prepare stmt1 from @query8 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -592,7 +592,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 left join t1 using(a) order by a
|
||||
SELECT * FROM t2 left join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query6 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -613,7 +613,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural left join t1 order by a
|
||||
SELECT * FROM t2 natural left join t1 order by t2.a
|
||||
prepare stmt1 from @query5 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -655,7 +655,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 join t1 using(a) order by a
|
||||
SELECT * FROM t2 join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query3 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -676,7 +676,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural join t1 order by a
|
||||
SELECT * FROM t2 natural join t1 order by t2.a
|
||||
prepare stmt1 from @query2 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
|
@@ -562,16 +562,16 @@ a ? a
|
||||
drop table if exists t2 ;
|
||||
create table t2 as select * from t1 ;
|
||||
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
|
||||
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
|
||||
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
|
||||
the join statement is:
|
||||
SELECT * FROM t2 right join t1 using(a) order by a
|
||||
SELECT * FROM t2 right join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query9 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -592,7 +592,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural right join t1 order by a
|
||||
SELECT * FROM t2 natural right join t1 order by t2.a
|
||||
prepare stmt1 from @query8 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -634,7 +634,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 left join t1 using(a) order by a
|
||||
SELECT * FROM t2 left join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query6 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -655,7 +655,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural left join t1 order by a
|
||||
SELECT * FROM t2 natural left join t1 order by t2.a
|
||||
prepare stmt1 from @query5 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -697,7 +697,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 join t1 using(a) order by a
|
||||
SELECT * FROM t2 join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query3 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -718,7 +718,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural join t1 order by a
|
||||
SELECT * FROM t2 natural join t1 order by t2.a
|
||||
prepare stmt1 from @query2 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -3574,16 +3574,16 @@ a ? a
|
||||
drop table if exists t2 ;
|
||||
create table t2 as select * from t1 ;
|
||||
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
|
||||
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
|
||||
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
|
||||
the join statement is:
|
||||
SELECT * FROM t2 right join t1 using(a) order by a
|
||||
SELECT * FROM t2 right join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query9 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -3604,7 +3604,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural right join t1 order by a
|
||||
SELECT * FROM t2 natural right join t1 order by t2.a
|
||||
prepare stmt1 from @query8 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -3646,7 +3646,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 left join t1 using(a) order by a
|
||||
SELECT * FROM t2 left join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query6 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -3667,7 +3667,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural left join t1 order by a
|
||||
SELECT * FROM t2 natural left join t1 order by t2.a
|
||||
prepare stmt1 from @query5 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -3709,7 +3709,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 join t1 using(a) order by a
|
||||
SELECT * FROM t2 join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query3 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -3730,7 +3730,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural join t1 order by a
|
||||
SELECT * FROM t2 natural join t1 order by t2.a
|
||||
prepare stmt1 from @query2 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
|
@@ -519,16 +519,16 @@ a ? a
|
||||
drop table if exists t2 ;
|
||||
create table t2 as select * from t1 ;
|
||||
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
|
||||
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
|
||||
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
|
||||
the join statement is:
|
||||
SELECT * FROM t2 right join t1 using(a) order by a
|
||||
SELECT * FROM t2 right join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query9 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -549,7 +549,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural right join t1 order by a
|
||||
SELECT * FROM t2 natural right join t1 order by t2.a
|
||||
prepare stmt1 from @query8 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -591,7 +591,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 left join t1 using(a) order by a
|
||||
SELECT * FROM t2 left join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query6 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -612,7 +612,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural left join t1 order by a
|
||||
SELECT * FROM t2 natural left join t1 order by t2.a
|
||||
prepare stmt1 from @query5 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -654,7 +654,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 join t1 using(a) order by a
|
||||
SELECT * FROM t2 join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query3 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -675,7 +675,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural join t1 order by a
|
||||
SELECT * FROM t2 natural join t1 order by t2.a
|
||||
prepare stmt1 from @query2 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
|
@@ -519,16 +519,16 @@ a ? a
|
||||
drop table if exists t2 ;
|
||||
create table t2 as select * from t1 ;
|
||||
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by a ' ;
|
||||
set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
|
||||
set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
|
||||
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by a ' ;
|
||||
set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
|
||||
set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
|
||||
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by a ' ;
|
||||
set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
|
||||
set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
|
||||
the join statement is:
|
||||
SELECT * FROM t2 right join t1 using(a) order by a
|
||||
SELECT * FROM t2 right join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query9 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -549,7 +549,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural right join t1 order by a
|
||||
SELECT * FROM t2 natural right join t1 order by t2.a
|
||||
prepare stmt1 from @query8 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -591,7 +591,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 left join t1 using(a) order by a
|
||||
SELECT * FROM t2 left join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query6 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -612,7 +612,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural left join t1 order by a
|
||||
SELECT * FROM t2 natural left join t1 order by t2.a
|
||||
prepare stmt1 from @query5 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
@@ -654,7 +654,7 @@ a b a b
|
||||
3 three 3 three
|
||||
4 four 4 four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 join t1 using(a) order by a
|
||||
SELECT * FROM t2 join t1 using(a) order by t2.a
|
||||
prepare stmt1 from @query3 ;
|
||||
execute stmt1 ;
|
||||
a b b
|
||||
@@ -675,7 +675,7 @@ a b b
|
||||
3 three three
|
||||
4 four four
|
||||
the join statement is:
|
||||
SELECT * FROM t2 natural join t1 order by a
|
||||
SELECT * FROM t2 natural join t1 order by t2.a
|
||||
prepare stmt1 from @query2 ;
|
||||
execute stmt1 ;
|
||||
a b
|
||||
|
35
mysql-test/r/rpl_drop_db.result
Normal file
35
mysql-test/r/rpl_drop_db.result
Normal file
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
drop database if exists mysqltest;
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1 (n int);
|
||||
insert into mysqltest.t1 values (1);
|
||||
select * from mysqltest.t1 into outfile 'mysqltest/f1.txt';
|
||||
create table mysqltest.t2 (n int);
|
||||
create table mysqltest.t3 (n int);
|
||||
drop database mysqltest;
|
||||
ERROR HY000: Error dropping database (can't rmdir './mysqltest/', errno: 17)
|
||||
use mysqltest;
|
||||
show tables;
|
||||
Tables_in_mysqltest
|
||||
drop database mysqltest;
|
||||
ERROR HY000: Error dropping database (can't rmdir './mysqltest/', errno: 17)
|
||||
use mysqltest;
|
||||
show tables;
|
||||
Tables_in_mysqltest
|
||||
use test;
|
||||
create table t1 (n int);
|
||||
insert into t1 values (1234);
|
||||
use mysqltest;
|
||||
show tables;
|
||||
Tables_in_mysqltest
|
||||
use test;
|
||||
select * from t1;
|
||||
n
|
||||
1234
|
||||
drop table t1;
|
||||
stop slave;
|
17
mysql-test/r/rpl_insert_select.result
Normal file
17
mysql-test/r/rpl_insert_select.result
Normal file
@@ -0,0 +1,17 @@
|
||||
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;
|
||||
create table t1 (n int not null primary key);
|
||||
insert into t1 values (1);
|
||||
create table t2 (n int);
|
||||
insert into t2 values (1);
|
||||
insert ignore into t1 select * from t2;
|
||||
insert into t1 values (2);
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
2
|
||||
drop table t1,t2;
|
@@ -60,7 +60,8 @@ set b = 8;
|
||||
insert into t1 values (b);
|
||||
insert into t1 values (unix_timestamp());
|
||||
end
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; call foo()
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8))
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp())
|
||||
select * from t1;
|
||||
a
|
||||
8
|
||||
@@ -76,8 +77,10 @@ reads sql data
|
||||
select * from mysqltest1.t1;
|
||||
call foo2();
|
||||
a
|
||||
show binlog events from 605;
|
||||
show binlog events from 518;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8))
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp())
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; create procedure foo2()
|
||||
not deterministic
|
||||
@@ -124,7 +127,7 @@ alter procedure foo4 sql security invoker;
|
||||
call foo4();
|
||||
show warnings;
|
||||
Level Code Message
|
||||
show binlog events from 841;
|
||||
show binlog events from 990;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int)
|
||||
@@ -141,9 +144,12 @@ begin
|
||||
insert into t2 values(3);
|
||||
insert into t1 values (5);
|
||||
end
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; call foo3()
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (15)
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo4 sql security invoker
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; call foo4()
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3)
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (5)
|
||||
select * from t1;
|
||||
a
|
||||
15
|
||||
@@ -160,6 +166,8 @@ a
|
||||
select * from t2;
|
||||
a
|
||||
3
|
||||
3
|
||||
3
|
||||
select * from mysql.proc where name="foo4" and db='mysqltest1';
|
||||
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
|
||||
mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES INVOKER begin
|
||||
@@ -196,6 +204,7 @@ a
|
||||
select * from t1;
|
||||
a
|
||||
21
|
||||
20
|
||||
select * from t2;
|
||||
a
|
||||
23
|
||||
|
158
mysql-test/r/rpl_sp_effects.result
Normal file
158
mysql-test/r/rpl_sp_effects.result
Normal file
@@ -0,0 +1,158 @@
|
||||
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;
|
||||
drop procedure if exists p1;
|
||||
drop procedure if exists p2;
|
||||
drop function if exists f1;
|
||||
drop table if exists t1,t2;
|
||||
drop view if exists v1;
|
||||
create table t1 (a int);
|
||||
create procedure p1()
|
||||
begin
|
||||
declare spv int default 0;
|
||||
while spv < 5 do
|
||||
insert into t1 values(spv+1);
|
||||
set spv=spv+1;
|
||||
end while;
|
||||
end//
|
||||
call p1();
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
delete from t1;
|
||||
create procedure p2()
|
||||
begin
|
||||
declare a int default 4;
|
||||
create table t2 as select a;
|
||||
end//
|
||||
call p2();
|
||||
select * from t2;
|
||||
a
|
||||
4
|
||||
select * from t2;
|
||||
a
|
||||
4
|
||||
drop procedure p1;
|
||||
drop procedure p2;
|
||||
drop table t2;
|
||||
create function f1(x int) returns int
|
||||
begin
|
||||
insert into t1 values(x);
|
||||
return x+1;
|
||||
end//
|
||||
create procedure p1(a int, b int)
|
||||
begin
|
||||
declare v int default f1(5);
|
||||
if (f1(6)) then
|
||||
select 'yes';
|
||||
end if;
|
||||
set v = f1(7);
|
||||
while f1(8) < 1 do
|
||||
select 'this cant be';
|
||||
end while;
|
||||
end//
|
||||
call p1(f1(1), f1(2));
|
||||
yes
|
||||
yes
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
create table t2(a int);
|
||||
insert into t2 values (10),(11);
|
||||
select a,f1(a) from t2;
|
||||
a f1(a)
|
||||
10 11
|
||||
11 12
|
||||
insert into t2 select f1(3);
|
||||
select 'master:',a from t1;
|
||||
master: a
|
||||
master: 1
|
||||
master: 2
|
||||
master: 5
|
||||
master: 6
|
||||
master: 7
|
||||
master: 8
|
||||
master: 10
|
||||
master: 11
|
||||
master: 3
|
||||
select 'slave:',a from t1;
|
||||
slave: a
|
||||
slave: 1
|
||||
slave: 2
|
||||
slave: 5
|
||||
slave: 6
|
||||
slave: 7
|
||||
slave: 8
|
||||
slave: 10
|
||||
slave: 11
|
||||
slave: 3
|
||||
drop procedure p1;
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
delete from t1;
|
||||
insert into t2 values(1),(2);
|
||||
create view v1 as select f1(a) from t2;
|
||||
select * from v1;
|
||||
f1(a)
|
||||
2
|
||||
3
|
||||
select 'master:',a from t1;
|
||||
master: a
|
||||
master: 1
|
||||
master: 2
|
||||
select 'slave:',a from t1;
|
||||
slave: a
|
||||
slave: 1
|
||||
slave: 2
|
||||
drop view v1;
|
||||
delete from t1;
|
||||
prepare s1 from 'select f1(?)';
|
||||
set @xx=123;
|
||||
execute s1 using @xx;
|
||||
f1(?)
|
||||
124
|
||||
select 'master:',a from t1;
|
||||
master: a
|
||||
master: 123
|
||||
select 'slave:',a from t1;
|
||||
slave: a
|
||||
slave: 123
|
||||
delete from t1;
|
||||
create procedure p1(spv int)
|
||||
begin
|
||||
declare c cursor for select f1(spv) from t2;
|
||||
while (spv > 2) do
|
||||
open c;
|
||||
fetch c into spv;
|
||||
close c;
|
||||
set spv= spv - 10;
|
||||
end while;
|
||||
end//
|
||||
call p1(15);
|
||||
select 'master:',a from t1;
|
||||
master: a
|
||||
master: 15
|
||||
master: 15
|
||||
master: 6
|
||||
master: 6
|
||||
select 'slave:',a from t1;
|
||||
slave: a
|
||||
slave: 15
|
||||
slave: 15
|
||||
slave: 6
|
||||
slave: 6
|
||||
drop procedure p1;
|
||||
drop function f1;
|
||||
drop table t1,t2;
|
@@ -1350,6 +1350,20 @@ fld1 fld1
|
||||
250504 250505
|
||||
250505 250505
|
||||
insert into t2 (fld1, companynr) values (999999,99);
|
||||
select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
|
||||
companynr companyname
|
||||
99 NULL
|
||||
select count(*) from t2 left join t4 using (companynr) where t4.companynr is not null;
|
||||
count(*)
|
||||
1199
|
||||
explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1200
|
||||
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists
|
||||
select companynr,companyname from t2 left join t4 using (companynr) where companynr is null;
|
||||
companynr companyname
|
||||
select count(*) from t2 left join t4 using (companynr) where companynr is not null;
|
||||
@@ -1362,6 +1376,18 @@ explain select companynr,companyname from t4 left join t2 using (companynr) wher
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
delete from t2 where fld1=999999;
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
|
||||
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
|
||||
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
|
||||
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
|
||||
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
|
||||
@@ -1374,6 +1400,18 @@ explain select companynr,companyname from t4 left join t2 using (companynr) wher
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
|
||||
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
|
||||
@@ -2756,3 +2794,96 @@ DROP TABLE t1,t2;
|
||||
select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
|
||||
x'10' + 0 X'10' + 0 b'10' + 0 B'10' + 0
|
||||
16 16 2 2
|
||||
create table t1 (f1 varchar(6) default NULL, f2 int(6) primary key not null);
|
||||
create table t2 (f3 varchar(5) not null, f4 varchar(5) not null, UNIQUE KEY UKEY (f3,f4));
|
||||
insert into t1 values (" 2", 2);
|
||||
insert into t2 values (" 2", " one "),(" 2", " two ");
|
||||
select * from t1 left join t2 on f1 = f3;
|
||||
f1 f2 f3 f4
|
||||
2 2 2 one
|
||||
2 2 2 two
|
||||
drop table t1,t2;
|
||||
create table t1 (empnum smallint, grp int);
|
||||
create table t2 (empnum int, name char(5));
|
||||
insert into t1 values(1,1);
|
||||
insert into t2 values(1,'bob');
|
||||
create view v1 as select * from t2 inner join t1 using (empnum);
|
||||
select * from v1;
|
||||
empnum name grp
|
||||
1 bob 1
|
||||
drop table t1,t2;
|
||||
drop view v1;
|
||||
create table t1 (pk int primary key, b int);
|
||||
create table t2 (pk int primary key, c int);
|
||||
select pk from t1 inner join t2 using (pk);
|
||||
pk
|
||||
drop table t1,t2;
|
||||
create table t1 (s1 int, s2 char(5), s3 decimal(10));
|
||||
create view v1 as select s1, s2, 'x' as s3 from t1;
|
||||
select * from t1 natural join v1;
|
||||
s1 s2 s3
|
||||
insert into t1 values (1,'x',5);
|
||||
select * from t1 natural join v1;
|
||||
s1 s2 s3
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'x'
|
||||
drop table t1;
|
||||
drop view v1;
|
||||
create table t1(a1 int);
|
||||
create table t2(a2 int);
|
||||
insert into t1 values(1),(2);
|
||||
insert into t2 values(1),(2);
|
||||
create view v2 (c) as select a1 from t1;
|
||||
select * from t1 natural left join t2;
|
||||
a1 a2
|
||||
1 1
|
||||
1 2
|
||||
2 1
|
||||
2 2
|
||||
select * from t1 natural right join t2;
|
||||
a2 a1
|
||||
1 1
|
||||
1 2
|
||||
2 1
|
||||
2 2
|
||||
select * from v2 natural left join t2;
|
||||
c a2
|
||||
1 1
|
||||
1 2
|
||||
2 1
|
||||
2 2
|
||||
select * from v2 natural right join t2;
|
||||
a2 c
|
||||
1 1
|
||||
1 2
|
||||
2 1
|
||||
2 2
|
||||
drop table t1, t2;
|
||||
drop view v2;
|
||||
create table t1 (a int(10), t1_val int(10));
|
||||
create table t2 (b int(10), t2_val int(10));
|
||||
create table t3 (a int(10), b int(10));
|
||||
insert into t1 values (1,1),(2,2);
|
||||
insert into t2 values (1,1),(2,2),(3,3);
|
||||
insert into t3 values (1,1),(2,1),(3,1),(4,1);
|
||||
select * from t1 natural join t2 natural join t3;
|
||||
a b t1_val t2_val
|
||||
1 1 1 1
|
||||
2 1 2 1
|
||||
select * from t1 natural join t3 natural join t2;
|
||||
b a t1_val t2_val
|
||||
1 1 1 1
|
||||
1 2 2 1
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a char(1));
|
||||
create table t2 (a char(1));
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
insert into t2 values ('b'),('c'),('d');
|
||||
select a from t1 natural join t2;
|
||||
a
|
||||
b
|
||||
c
|
||||
select * from t1 natural join t2 where a = 'b';
|
||||
a
|
||||
b
|
||||
drop table t1, t2;
|
||||
|
@@ -299,6 +299,36 @@ lock tables t1 read, mysql.proc read|
|
||||
unlock tables|
|
||||
lock tables mysql.proc write|
|
||||
unlock tables|
|
||||
drop function if exists f1|
|
||||
create function f1(i int) returns int
|
||||
begin
|
||||
insert into t1 (val) values (i);
|
||||
return 0;
|
||||
end|
|
||||
select val, f1(val) from t1|
|
||||
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
|
||||
select val, f1(val) from t1 as tab|
|
||||
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
|
||||
select * from t1|
|
||||
val x
|
||||
42 3.1
|
||||
19 1.2
|
||||
update t1 set val= f1(val)|
|
||||
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
|
||||
select * from t1|
|
||||
val x
|
||||
42 3.1
|
||||
19 1.2
|
||||
select f1(17)|
|
||||
f1(17)
|
||||
0
|
||||
select * from t1|
|
||||
val x
|
||||
42 3.1
|
||||
19 1.2
|
||||
17 NULL
|
||||
delete from t1 where val= 17|
|
||||
drop function f1|
|
||||
create procedure bug1965()
|
||||
begin
|
||||
declare c cursor for select val from t1 order by valname;
|
||||
|
@@ -245,6 +245,8 @@ end//
|
||||
grant usage on *.* to mysqltest_1@localhost;
|
||||
call mysqltest_1.p1();
|
||||
ERROR 42000: execute command denied to user 'mysqltest_1'@'localhost' for routine 'mysqltest_1.p1'
|
||||
call mysqltest_1.p1();
|
||||
ERROR 42000: execute command denied to user 'mysqltest_1'@'localhost' for routine 'mysqltest_1.p1'
|
||||
drop procedure mysqltest_1.p1;
|
||||
drop database mysqltest_1;
|
||||
revoke usage on *.* from mysqltest_1@localhost;
|
||||
|
@@ -3101,16 +3101,16 @@ call p_bug11247(10)|
|
||||
drop function f_bug11247|
|
||||
drop procedure p_bug11247|
|
||||
drop procedure if exists bug12168|
|
||||
drop table if exists t1, t2|
|
||||
create table t1 (a int)|
|
||||
insert into t1 values (1),(2),(3),(4)|
|
||||
create table t2 (a int)|
|
||||
drop table if exists t3, t4|
|
||||
create table t3 (a int)|
|
||||
insert into t3 values (1),(2),(3),(4)|
|
||||
create table t4 (a int)|
|
||||
create procedure bug12168(arg1 char(1))
|
||||
begin
|
||||
declare b, c integer;
|
||||
if arg1 = 'a' then
|
||||
begin
|
||||
declare c1 cursor for select a from t1 where a % 2;
|
||||
declare c1 cursor for select a from t3 where a % 2;
|
||||
declare continue handler for not found set b = 1;
|
||||
set b = 0;
|
||||
open c1;
|
||||
@@ -3119,14 +3119,14 @@ fetch c1 into c;
|
||||
if (b = 1) then
|
||||
leave c1_repeat;
|
||||
end if;
|
||||
insert into t2 values (c);
|
||||
insert into t4 values (c);
|
||||
until b = 1
|
||||
end repeat;
|
||||
end;
|
||||
end if;
|
||||
if arg1 = 'b' then
|
||||
begin
|
||||
declare c2 cursor for select a from t1 where not a % 2;
|
||||
declare c2 cursor for select a from t3 where not a % 2;
|
||||
declare continue handler for not found set b = 1;
|
||||
set b = 0;
|
||||
open c2;
|
||||
@@ -3135,35 +3135,55 @@ fetch c2 into c;
|
||||
if (b = 1) then
|
||||
leave c2_repeat;
|
||||
end if;
|
||||
insert into t2 values (c);
|
||||
insert into t4 values (c);
|
||||
until b = 1
|
||||
end repeat;
|
||||
end;
|
||||
end if;
|
||||
end|
|
||||
call bug12168('a')|
|
||||
select * from t2|
|
||||
select * from t4|
|
||||
a
|
||||
1
|
||||
3
|
||||
truncate t2|
|
||||
truncate t4|
|
||||
call bug12168('b')|
|
||||
select * from t2|
|
||||
select * from t4|
|
||||
a
|
||||
2
|
||||
4
|
||||
truncate t2|
|
||||
truncate t4|
|
||||
call bug12168('a')|
|
||||
select * from t2|
|
||||
select * from t4|
|
||||
a
|
||||
1
|
||||
3
|
||||
truncate t2|
|
||||
truncate t4|
|
||||
call bug12168('b')|
|
||||
select * from t2|
|
||||
select * from t4|
|
||||
a
|
||||
2
|
||||
4
|
||||
truncate t2|
|
||||
truncate t4|
|
||||
drop table t3, t4|
|
||||
drop procedure if exists bug12168|
|
||||
drop table if exists t3|
|
||||
drop procedure if exists bug11333|
|
||||
create table t3 (c1 char(128))|
|
||||
insert into t3 values
|
||||
('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')|
|
||||
create procedure bug11333(i int)
|
||||
begin
|
||||
declare tmp varchar(128);
|
||||
set @x = 0;
|
||||
repeat
|
||||
select c1 into tmp from t3
|
||||
where c1 = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
|
||||
set @x = @x + 1;
|
||||
until @x >= i
|
||||
end repeat;
|
||||
end|
|
||||
call bug11333(10)|
|
||||
drop procedure bug11333|
|
||||
drop table t3|
|
||||
drop table t1,t2;
|
||||
|
@@ -1789,10 +1789,18 @@ CREATE TABLE t1 (id INT);
|
||||
CREATE TABLE t2 (id INT);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
|
||||
id c
|
||||
1 1
|
||||
2 0
|
||||
SELECT id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
|
||||
id c
|
||||
1 1
|
||||
2 0
|
||||
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY t1.id;
|
||||
id c
|
||||
1 1
|
||||
2 0
|
||||
SELECT id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY id;
|
||||
id c
|
||||
1 1
|
||||
|
@@ -120,8 +120,8 @@ DOCID DOCNAME DOCTYPEID FOLDERID AUTHOR CREATED TITLE SUBTITLE DOCABSTRACT PUBLI
|
||||
c373e9f5ad07993f3859444553544200 Last Discussion c373e9f5ad079174ff17444553544200 c373e9f5ad0796c0eca4444553544200 Goldilocks 2003-06-09 11:21:06 Title: Last Discussion NULL Setting new abstract and keeping doc checked out 2003-06-09 10:51:26 2003-06-09 10:51:26 NULL NULL NULL 03eea05112b845949f3fd03278b5fe43 2003-06-09 11:21:06 admin 0 NULL Discussion NULL NULL
|
||||
EXPLAIN SELECT t2.*, t4.DOCTYPENAME, t1.CONTENTSIZE,t1.MIMETYPE FROM t2 INNER JOIN t4 ON t2.DOCTYPEID = t4.DOCTYPEID LEFT OUTER JOIN t1 ON t2.DOCID = t1.DOCID WHERE t2.FOLDERID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t3.FOLDERNAME = 'Level1') AND t3.FOLDERNAME = 'Level2') AND t3.FOLDERNAME = 'Level3') AND t3.FOLDERNAME = 'CopiedFolder') AND t3.FOLDERNAME = 'Movie Reviews') AND t2.DOCNAME = 'Last Discussion';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 0 const row not found
|
||||
1 PRIMARY t2 ALL DDOCTYPEID_IDX NULL NULL NULL 9 Using where
|
||||
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 34 test.t2.DOCID 1
|
||||
1 PRIMARY t4 eq_ref PRIMARY PRIMARY 34 test.t2.DOCTYPEID 1
|
||||
2 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 34 func 1 Using index; Using where
|
||||
3 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 34 func 1 Using index; Using where
|
||||
|
@@ -697,3 +697,44 @@ c1 c2
|
||||
3 NULL
|
||||
drop procedure bug11587;
|
||||
drop table t1;
|
||||
create table t1 (f1 integer);
|
||||
create table t2 (f2 integer);
|
||||
create trigger t1_ai after insert on t1
|
||||
for each row insert into t2 values (new.f1+1);
|
||||
create trigger t2_ai after insert on t2
|
||||
for each row insert into t1 values (new.f2+1);
|
||||
insert into t1 values (1);
|
||||
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
|
||||
select * from t1;
|
||||
f1
|
||||
1
|
||||
select * from t2;
|
||||
f2
|
||||
2
|
||||
drop trigger t1_ai;
|
||||
drop trigger t2_ai;
|
||||
create trigger t1_bu before update on t1
|
||||
for each row insert into t1 values (2);
|
||||
update t1 set f1= 10;
|
||||
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
|
||||
select * from t1;
|
||||
f1
|
||||
1
|
||||
drop trigger t1_bu;
|
||||
create trigger t1_bu before update on t1
|
||||
for each row delete from t1 where f1=new.f1;
|
||||
update t1 set f1= 10;
|
||||
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
|
||||
select * from t1;
|
||||
f1
|
||||
1
|
||||
drop trigger t1_bu;
|
||||
create trigger t1_bi before insert on t1
|
||||
for each row set new.f1=(select sum(f1) from t1);
|
||||
insert into t1 values (3);
|
||||
select * from t1;
|
||||
f1
|
||||
1
|
||||
1
|
||||
drop trigger t1_bi;
|
||||
drop tables t1, t2;
|
||||
|
@@ -307,17 +307,33 @@ create table t1 ( id integer unsigned not null primary key );
|
||||
create table t2 ( id integer unsigned not null primary key );
|
||||
insert into t1 values (1), (2);
|
||||
insert into t2 values (1);
|
||||
select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
|
||||
id_A id_B
|
||||
1 1
|
||||
2 NULL
|
||||
select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
|
||||
id_A id_B
|
||||
1 1
|
||||
2 NULL
|
||||
create table t3 (id_A integer unsigned not null, id_B integer unsigned null );
|
||||
insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
|
||||
select * from t3;
|
||||
id_A id_B
|
||||
1 1
|
||||
2 NULL
|
||||
delete from t3;
|
||||
insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
|
||||
select * from t3;
|
||||
id_A id_B
|
||||
1 1
|
||||
2 NULL
|
||||
drop table t3;
|
||||
create table t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
|
||||
select * from t3;
|
||||
id_A id_B
|
||||
1 1
|
||||
2 NULL
|
||||
drop table t3;
|
||||
create table t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
|
||||
select * from t3;
|
||||
id_A id_B
|
||||
|
@@ -150,12 +150,12 @@ v6 VIEW
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 MyISAM 10 Fixed 5 9 45 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
|
||||
v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view
|
||||
v2 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view
|
||||
v3 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view
|
||||
v4 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view
|
||||
v5 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view
|
||||
v6 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL view
|
||||
v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL VIEW
|
||||
v2 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL VIEW
|
||||
v3 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL VIEW
|
||||
v4 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL VIEW
|
||||
v5 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL VIEW
|
||||
v6 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL VIEW
|
||||
drop view v1,v2,v3,v4,v5,v6;
|
||||
create view v1 (c,d,e,f) as select a,b,
|
||||
a in (select a+2 from t1), a = all (select a from t1) from t1;
|
||||
@@ -2097,6 +2097,14 @@ select * from v1;
|
||||
f1
|
||||
1
|
||||
drop view v1;
|
||||
create table t1(a int);
|
||||
create procedure p1() create view v1 as select * from t1;
|
||||
drop table t1;
|
||||
call p1();
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
call p1();
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
drop procedure p1;
|
||||
create table t1 (f1 int);
|
||||
create table t2 (f1 int);
|
||||
insert into t1 values (1);
|
||||
@@ -2115,3 +2123,15 @@ CREATE VIEW v1 AS SELECT f1();
|
||||
ERROR HY000: View's SELECT refers to a temporary table 't1'
|
||||
DROP FUNCTION f1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
CREATE TABLE t1 (f4 CHAR(5));
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
DESCRIBE v1;
|
||||
Field Type Null Key Default Extra
|
||||
f4 char(5) YES NULL
|
||||
ALTER TABLE t1 CHANGE COLUMN f4 f4x CHAR(5);
|
||||
DESCRIBE v1;
|
||||
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s)
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
|
@@ -400,6 +400,7 @@ drop table t1;
|
||||
set @a:=now();
|
||||
CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=bdb;
|
||||
insert into t1 (a) values(1),(2),(3);
|
||||
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
|
||||
select a from t1 natural join t1 as t2 where b >= @a order by a;
|
||||
update t1 set a=5 where a=1;
|
||||
select a from t1;
|
||||
@@ -571,7 +572,7 @@ create temporary table tmp1
|
||||
select branch_id, target_id, platform_id, product_id
|
||||
from t1, t2, t3, t4 ;
|
||||
create temporary table tmp2
|
||||
select branch_id, target_id, platform_id, product_id
|
||||
select tmp1.branch_id, tmp1.target_id, tmp1.platform_id, tmp1.product_id
|
||||
from tmp1 left join t8
|
||||
using (branch_id,target_id,platform_id,product_id)
|
||||
where t8.archive_id is null ;
|
||||
|
@@ -415,7 +415,7 @@ SET @var1= x'8300';
|
||||
# code (and I have used it to test the fix) until there is some way to
|
||||
# exercise this code from mysql-test-run.
|
||||
EXECUTE stmt1 USING @var1;
|
||||
SHOW BINLOG EVENTS;
|
||||
SHOW BINLOG EVENTS FROM 98;
|
||||
SELECT HEX(f1) FROM t1;
|
||||
DROP table t1;
|
||||
# end test for bug#11338
|
||||
|
@@ -10,5 +10,8 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sp-goto:GOTO is currently is disabled - will be fixed in the future
|
||||
|
||||
sp-goto : GOTO is currently is disabled - will be fixed in the future
|
||||
rpl_relayrotate : Unstable test case, bug#12429
|
||||
rpl_until : Unstable test case, bug#12429
|
||||
rpl_deadlock : Unstable test case, bug#12429
|
||||
kill : Unstable test case, bug#9712
|
||||
|
@@ -1,344 +0,0 @@
|
||||
#
|
||||
# Bug with distinct and INSERT INTO
|
||||
# Bug with group by and not used fields
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (id int,facility char(20));
|
||||
CREATE TABLE t2 (facility char(20));
|
||||
INSERT INTO t1 VALUES (NULL,NULL);
|
||||
INSERT INTO t1 VALUES (-1,'');
|
||||
INSERT INTO t1 VALUES (0,'');
|
||||
INSERT INTO t1 VALUES (1,'/L');
|
||||
INSERT INTO t1 VALUES (2,'A01');
|
||||
INSERT INTO t1 VALUES (3,'ANC');
|
||||
INSERT INTO t1 VALUES (4,'F01');
|
||||
INSERT INTO t1 VALUES (5,'FBX');
|
||||
INSERT INTO t1 VALUES (6,'MT');
|
||||
INSERT INTO t1 VALUES (7,'P');
|
||||
INSERT INTO t1 VALUES (8,'RV');
|
||||
INSERT INTO t1 VALUES (9,'SRV');
|
||||
INSERT INTO t1 VALUES (10,'VMT');
|
||||
INSERT INTO t2 SELECT DISTINCT FACILITY FROM t1;
|
||||
|
||||
select id from t1 group by id;
|
||||
select * from t1 order by id;
|
||||
select id-5,facility from t1 order by "id-5";
|
||||
select id,concat(facility) from t1 group by id ;
|
||||
select id+0 as a,max(id),concat(facility) as b from t1 group by a order by b desc,a;
|
||||
select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
|
||||
|
||||
SELECT DISTINCT FACILITY FROM t1;
|
||||
SELECT FACILITY FROM t2;
|
||||
SELECT count(*) from t1,t2 where t1.facility=t2.facility;
|
||||
select count(facility) from t1;
|
||||
select count(*) from t1;
|
||||
select count(*) from t1 where facility IS NULL;
|
||||
select count(*) from t1 where facility = NULL;
|
||||
select count(*) from t1 where facility IS NOT NULL;
|
||||
select count(*) from t1 where id IS NULL;
|
||||
select count(*) from t1 where id IS NOT NULL;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Problem with distinct without results
|
||||
#
|
||||
CREATE TABLE t1 (UserId int(11) DEFAULT '0' NOT NULL);
|
||||
INSERT INTO t1 VALUES (20);
|
||||
INSERT INTO t1 VALUES (27);
|
||||
|
||||
SELECT UserId FROM t1 WHERE Userid=22;
|
||||
SELECT UserId FROM t1 WHERE UserId=22 group by Userid;
|
||||
SELECT DISTINCT UserId FROM t1 WHERE UserId=22 group by Userid;
|
||||
SELECT DISTINCT UserId FROM t1 WHERE UserId=22;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test of distinct
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int(10) unsigned not null primary key,b int(10) unsigned);
|
||||
INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1);
|
||||
CREATE TABLE t2 (a int(10) unsigned not null, key (A));
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
CREATE TABLE t3 (a int(10) unsigned, key(A), b text);
|
||||
INSERT INTO t3 VALUES (1,'1'),(2,'2');
|
||||
SELECT DISTINCT t3.b FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
|
||||
INSERT INTO t2 values (1),(2),(3);
|
||||
INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2');
|
||||
explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
|
||||
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
|
||||
|
||||
# Create a lot of data into t3;
|
||||
create temporary table t4 select * from t3;
|
||||
insert into t3 select * from t4;
|
||||
insert into t4 select * from t3;
|
||||
insert into t3 select * from t4;
|
||||
insert into t4 select * from t3;
|
||||
insert into t3 select * from t4;
|
||||
insert into t4 select * from t3;
|
||||
insert into t3 select * from t4;
|
||||
|
||||
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
|
||||
#flush status;
|
||||
select distinct t1.a from t1,t3 where t1.a=t3.a;
|
||||
#show status like 'Handler%';
|
||||
#flush status;
|
||||
select distinct 1 from t1,t3 where t1.a=t3.a;
|
||||
#show status like 'Handler%';
|
||||
|
||||
explain SELECT distinct t1.a from t1;
|
||||
explain SELECT distinct t1.a from t1 order by a desc;
|
||||
explain SELECT t1.a from t1 group by a order by a desc;
|
||||
explain SELECT distinct t1.a from t1 order by a desc limit 1;
|
||||
explain SELECT distinct a from t3 order by a desc limit 2;
|
||||
explain SELECT distinct a,b from t3 order by a+1;
|
||||
explain SELECT distinct a,b from t3 order by a limit 10;
|
||||
explain SELECT a,b from t3 group by a,b order by a+1;
|
||||
|
||||
drop table t1,t2,t3,t4;
|
||||
|
||||
CREATE TABLE t1 (name varchar(255));
|
||||
INSERT INTO t1 VALUES ('aa'),('ab'),('ac'),('ad'),('ae');
|
||||
SELECT DISTINCT * FROM t1 LIMIT 2;
|
||||
SELECT DISTINCT name FROM t1 LIMIT 2;
|
||||
SELECT DISTINCT 1 FROM t1 LIMIT 2;
|
||||
drop table t1;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
ID int(11) NOT NULL auto_increment,
|
||||
NAME varchar(75) DEFAULT '' NOT NULL,
|
||||
LINK_ID int(11) DEFAULT '0' NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
KEY NAME (NAME),
|
||||
KEY LINK_ID (LINK_ID)
|
||||
);
|
||||
|
||||
INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0),(2,'Jack',0),(3,'Bill',0);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
ID int(11) NOT NULL auto_increment,
|
||||
NAME varchar(150) DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
KEY NAME (NAME)
|
||||
);
|
||||
|
||||
SELECT DISTINCT
|
||||
t2.id AS key_link_id,
|
||||
t2.name AS link
|
||||
FROM t1
|
||||
LEFT JOIN t2 ON t1.link_id=t2.id
|
||||
GROUP BY t1.id
|
||||
ORDER BY link;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Problem with table dependencies
|
||||
#
|
||||
|
||||
create table t1 (
|
||||
id int not null,
|
||||
name tinytext not null,
|
||||
unique (id)
|
||||
);
|
||||
create table t2 (
|
||||
id int not null,
|
||||
idx int not null,
|
||||
unique (id, idx)
|
||||
);
|
||||
create table t3 (
|
||||
id int not null,
|
||||
idx int not null,
|
||||
unique (id, idx)
|
||||
);
|
||||
insert into t1 values (1,'yes'), (2,'no');
|
||||
insert into t2 values (1,1);
|
||||
insert into t3 values (1,1);
|
||||
EXPLAIN
|
||||
SELECT DISTINCT
|
||||
t1.id
|
||||
from
|
||||
t1
|
||||
straight_join
|
||||
t2
|
||||
straight_join
|
||||
t3
|
||||
straight_join
|
||||
t1 as j_lj_t2 left join t2 as t2_lj
|
||||
on j_lj_t2.id=t2_lj.id
|
||||
straight_join
|
||||
t1 as j_lj_t3 left join t3 as t3_lj
|
||||
on j_lj_t3.id=t3_lj.id
|
||||
WHERE
|
||||
((t1.id=j_lj_t2.id AND t2_lj.id IS NULL) OR (t1.id=t2.id AND t2.idx=2))
|
||||
AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
|
||||
SELECT DISTINCT
|
||||
t1.id
|
||||
from
|
||||
t1
|
||||
straight_join
|
||||
t2
|
||||
straight_join
|
||||
t3
|
||||
straight_join
|
||||
t1 as j_lj_t2 left join t2 as t2_lj
|
||||
on j_lj_t2.id=t2_lj.id
|
||||
straight_join
|
||||
t1 as j_lj_t3 left join t3 as t3_lj
|
||||
on j_lj_t3.id=t3_lj.id
|
||||
WHERE
|
||||
((t1.id=j_lj_t2.id AND t2_lj.id IS NULL) OR (t1.id=t2.id AND t2.idx=2))
|
||||
AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
|
||||
drop table t1,t2,t3;
|
||||
|
||||
#
|
||||
# Test using DISTINCT on a function that contains a group function
|
||||
# This also test the case when one doesn't use all fields in GROUP BY.
|
||||
#
|
||||
|
||||
create table t1 (a int not null, b int not null, t time);
|
||||
insert into t1 values (1,1,"00:06:15"),(1,2,"00:06:15"),(1,2,"00:30:15"),(1,3,"00:06:15"),(1,3,"00:30:15");
|
||||
select a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b;
|
||||
select distinct a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b;
|
||||
create table t2 (a int not null primary key, b int);
|
||||
insert into t2 values (1,1),(2,2),(3,3);
|
||||
select t1.a,sec_to_time(sum(time_to_sec(t))) from t1 left join t2 on (t1.b=t2.a) group by t1.a,t2.b;
|
||||
select distinct t1.a,sec_to_time(sum(time_to_sec(t))) from t1 left join t2 on (t1.b=t2.a) group by t1.a,t2.b;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Test problem with DISTINCT and HAVING
|
||||
#
|
||||
create table t1 (a int not null,b char(5), c text);
|
||||
insert into t1 (a) values (1),(2),(3),(4),(1),(2),(3),(4);
|
||||
select distinct a from t1 group by b,a having a > 2 order by a desc;
|
||||
select distinct a,c from t1 group by b,c,a having a > 2 order by a desc;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test problem with DISTINCT and ORDER BY DESC
|
||||
#
|
||||
|
||||
create table t1 (a char(1), key(a)) engine=myisam;
|
||||
insert into t1 values('1'),('1');
|
||||
select * from t1 where a >= '1';
|
||||
select distinct a from t1 order by a desc;
|
||||
select distinct a from t1 where a >= '1' order by a desc;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test when using a not previously used column in ORDER BY
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered DATETIME);
|
||||
CREATE TABLE t2 (infoID BIGINT, shipcode varchar(10));
|
||||
|
||||
INSERT INTO t1 (email, infoID, dateentered) VALUES
|
||||
('test1@testdomain.com', 1, '2002-07-30 22:56:38'),
|
||||
('test1@testdomain.com', 1, '2002-07-27 22:58:16'),
|
||||
('test2@testdomain.com', 1, '2002-06-19 15:22:19'),
|
||||
('test2@testdomain.com', 2, '2002-06-18 14:23:47'),
|
||||
('test3@testdomain.com', 1, '2002-05-19 22:17:32');
|
||||
|
||||
INSERT INTO t2(infoID, shipcode) VALUES
|
||||
(1, 'Z001'),
|
||||
(2, 'R002');
|
||||
|
||||
SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID;
|
||||
SELECT DISTINCTROW email FROM t1 ORDER BY dateentered DESC;
|
||||
SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID ORDER BY dateentered DESC;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# test with table.* in DISTINCT
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0);
|
||||
CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1);
|
||||
SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid);
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# test with const_item in ORDER BY
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int primary key, b int, c int);
|
||||
INSERT t1 VALUES (1,2,3);
|
||||
CREATE TABLE t2 (a int primary key, b int, c int);
|
||||
INSERT t2 VALUES (3,4,5);
|
||||
SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Test of LEFT() with distinct
|
||||
#
|
||||
|
||||
CREATE table t1 ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=3 ;
|
||||
INSERT INTO t1 VALUES (1, 'aaaaa');
|
||||
INSERT INTO t1 VALUES (3, 'aaaaa');
|
||||
INSERT INTO t1 VALUES (2, 'eeeeeee');
|
||||
select distinct left(name,1) as name from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test case from sel000100
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
ID int(11) NOT NULL auto_increment,
|
||||
NAME varchar(75) DEFAULT '' NOT NULL,
|
||||
LINK_ID int(11) DEFAULT '0' NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
KEY NAME (NAME),
|
||||
KEY LINK_ID (LINK_ID)
|
||||
);
|
||||
|
||||
INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0);
|
||||
INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0);
|
||||
INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
ID int(11) NOT NULL auto_increment,
|
||||
NAME varchar(150) DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
KEY NAME (NAME)
|
||||
);
|
||||
|
||||
SELECT DISTINCT
|
||||
t2.id AS key_link_id,
|
||||
t2.name AS link
|
||||
FROM t1
|
||||
LEFT JOIN t2 ON t1.link_id=t2.id
|
||||
GROUP BY t1.id
|
||||
ORDER BY link;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# test case for #674
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
html varchar(5) default NULL,
|
||||
rin int(11) default '0',
|
||||
rout int(11) default '0'
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
INSERT INTO t1 VALUES ('1',1,0);
|
||||
SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug 9784 DISTINCT IFNULL truncates data
|
||||
#
|
||||
create table t1 (id int, dsc varchar(50));
|
||||
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
|
||||
select distinct id, IFNULL(dsc, '-') from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@@ -55,3 +55,26 @@ select sleep(3);
|
||||
update t1 set b = now();
|
||||
select timediff(b, a) >= '00:00:03' from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #12689: SLEEP() gets incorrectly cached/optimized-away
|
||||
#
|
||||
set global query_cache_size=1355776;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(1),(1);
|
||||
create table t2 (a datetime default null, b datetime default null);
|
||||
insert into t2 set a = now();
|
||||
select a from t1 where sleep(1);
|
||||
update t2 set b = now() where b is null;
|
||||
insert into t2 set a = now();
|
||||
select a from t1 where sleep(a);
|
||||
update t2 set b = now() where b is null;
|
||||
insert into t2 set a = now();
|
||||
select a from t1 where sleep(1);
|
||||
update t2 set b = now() where b is null;
|
||||
select timediff(b, a) >= '00:00:03' from t2;
|
||||
drop table t2;
|
||||
drop table t1;
|
||||
set global query_cache_size=default;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
@@ -353,3 +353,55 @@ select last_day('2005-01-00');
|
||||
# the 0-11 range
|
||||
#
|
||||
select time_format('100:00:00', '%H %k %h %I %l');
|
||||
|
||||
#
|
||||
# Bug #12562: Make SYSDATE behave like it does in Oracle: always the current
|
||||
# time, regardless of magic to make NOW() always the same for the
|
||||
# entirety of a statement.
|
||||
create table t1 (a timestamp default '2005-05-05 01:01:01',
|
||||
b timestamp default '2005-05-05 01:01:01');
|
||||
delimiter //;
|
||||
create function t_slow_sysdate() returns timestamp
|
||||
begin
|
||||
do sleep(2);
|
||||
return sysdate();
|
||||
end;
|
||||
//
|
||||
|
||||
insert into t1 set a = sysdate(), b = t_slow_sysdate();//
|
||||
|
||||
create trigger t_before before insert on t1
|
||||
for each row begin
|
||||
set new.b = t_slow_sysdate();
|
||||
end
|
||||
//
|
||||
|
||||
delimiter ;//
|
||||
|
||||
insert into t1 set a = sysdate();
|
||||
|
||||
select a != b from t1;
|
||||
|
||||
drop trigger t_before;
|
||||
drop function t_slow_sysdate;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a datetime, i int, b datetime);
|
||||
insert into t1 select sysdate(), sleep(1), sysdate() from dual;
|
||||
select a != b from t1;
|
||||
drop table t1;
|
||||
|
||||
delimiter //;
|
||||
create procedure t_sysdate()
|
||||
begin
|
||||
select sysdate() into @a;
|
||||
do sleep(2);
|
||||
select sysdate() into @b;
|
||||
select @a != @b;
|
||||
end;
|
||||
//
|
||||
delimiter ;//
|
||||
call t_sysdate();
|
||||
drop procedure t_sysdate;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
@@ -310,7 +310,45 @@ select * from t1;
|
||||
disconnect n1;
|
||||
connection default;
|
||||
REVOKE ALL ON mysqltest_1.t1 FROM mysqltest_1@'127.0.0.0/255.0.0.0';
|
||||
delete from mysql.user where user like 'mysqltest\_1';
|
||||
flush privileges;
|
||||
drop table mysqltest_1.t1;
|
||||
|
||||
#
|
||||
# Bug #12302: 'SET PASSWORD = ...' didn't work if connecting hostname !=
|
||||
# hostname the current user is authenticated as. Note that a test for this
|
||||
# was also added to the test above.
|
||||
#
|
||||
grant all on mysqltest_1.* to mysqltest_1@'127.0.0.1';
|
||||
connect (b12302,127.0.0.1,mysqltest_1,,mysqltest_1,$MASTER_MYPORT,);
|
||||
connection b12302;
|
||||
select current_user();
|
||||
set password = password('changed');
|
||||
disconnect b12302;
|
||||
connection default;
|
||||
select host, length(password) from mysql.user where user like 'mysqltest\_1';
|
||||
revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.1';
|
||||
delete from mysql.user where user like 'mysqltest\_1';
|
||||
flush privileges;
|
||||
grant all on mysqltest_1.* to mysqltest_1@'127.0.0.0/255.0.0.0';
|
||||
connect (b12302_2,127.0.0.1,mysqltest_1,,mysqltest_1,$MASTER_MYPORT,);
|
||||
connection b12302_2;
|
||||
select current_user();
|
||||
set password = password('changed');
|
||||
disconnect b12302_2;
|
||||
connection default;
|
||||
select host, length(password) from mysql.user where user like 'mysqltest\_1';
|
||||
revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.0/255.0.0.0';
|
||||
delete from mysql.user where user like 'mysqltest\_1';
|
||||
flush privileges;
|
||||
drop database mysqltest_1;
|
||||
|
||||
# But anonymous users can't change their password
|
||||
connect (n5,localhost,test,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection n5;
|
||||
--error 1044
|
||||
set password = password("changed");
|
||||
disconnect n5;
|
||||
connection default;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@@ -138,7 +138,7 @@ information_schema.SCHEMATA b where
|
||||
a.ROUTINE_SCHEMA = b.SCHEMA_NAME;
|
||||
|
||||
select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a,
|
||||
mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8);
|
||||
mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) order by 1;
|
||||
select count(*) from information_schema.ROUTINES;
|
||||
|
||||
connect (user1,localhost,mysqltest_1,,);
|
||||
@@ -649,4 +649,20 @@ use information_schema;
|
||||
select column_name, column_default from columns
|
||||
where table_schema='test' and table_name='t1';
|
||||
use test;
|
||||
show columns from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #12636: SHOW TABLE STATUS with where condition containing a subquery
|
||||
# over information schema
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (b int);
|
||||
|
||||
--replace_column 8 # 12 # 13 #
|
||||
SHOW TABLE STATUS FROM test
|
||||
WHERE name IN ( SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_SCHEMA='test' AND TABLE_TYPE='BASE TABLE');
|
||||
|
||||
DROP TABLE t1,t2
|
||||
|
@@ -440,6 +440,7 @@ drop table t1;
|
||||
set @a:=now();
|
||||
CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb;
|
||||
insert into t1 (a) values(1),(2),(3);
|
||||
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
|
||||
select a from t1 natural join t1 as t2 where b >= @a order by a;
|
||||
update t1 set a=5 where a=1;
|
||||
select a from t1;
|
||||
|
@@ -111,6 +111,10 @@ drop table t1, t2;
|
||||
|
||||
create table t1 (a int primary key);
|
||||
insert into t1 values(1),(2);
|
||||
select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a);
|
||||
--replace_result "31 tables" "XX tables" "61 tables" "XX tables"
|
||||
--error 1116
|
||||
select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
|
||||
select a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a);
|
||||
--replace_result "31 tables" "XX tables" "61 tables" "XX tables"
|
||||
--error 1116
|
||||
@@ -144,6 +148,7 @@ DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (d DATE NOT NULL);
|
||||
CREATE TABLE t2 (d DATE NOT NULL);
|
||||
INSERT INTO t1 (d) VALUES ('2001-08-01'),('0000-00-00');
|
||||
SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE t2.d IS NULL;
|
||||
SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE d IS NULL;
|
||||
SELECT * from t1 WHERE t1.d IS NULL;
|
||||
SELECT * FROM t1 WHERE 1/0 IS NULL;
|
||||
@@ -266,6 +271,8 @@ CREATE TABLE t2 (
|
||||
FULLTEXT KEY rate_code (rate_code)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES ('rivercats','cust',20);
|
||||
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats';
|
||||
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith';
|
||||
SELECT rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND siteid = 'rivercats';
|
||||
SELECT rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE siteid = 'rivercats' AND emp.emp_id = 'psmith';
|
||||
drop table t1,t2;
|
||||
@@ -315,14 +322,14 @@ select * from t3 right join t2 on (t3.i=t2.i);
|
||||
select * from t3 natural right join t2 natural right join t1;
|
||||
select * from t3 right join t2 on (t3.i=t2.i) right join t1 on (t2.i=t1.i);
|
||||
|
||||
select * from t1,t2 natural left join t3 order by 1,2;
|
||||
select * from t1,t2 natural left join t3 order by t1.i,t2.i,t3.i;
|
||||
select * from t1,t2 left join t3 on (t2.i=t3.i) order by t1.i,t2.i,t3.i;
|
||||
select * from t2 natural left join t3,t1 order by t1.i;
|
||||
select t1.i,t2.i,t3.i from t2 natural left join t3,t1 order by t1.i,t2.i,t3.i;
|
||||
select t1.i,t2.i,t3.i from t2 left join t3 on (t2.i=t3.i),t1 order by t1.i,t2.i,t3.i;
|
||||
|
||||
select * from t1,t2 natural right join t3 order by 1,2;
|
||||
select * from t1,t2 natural right join t3 order by t1.i,t2.i,t3.i;
|
||||
select * from t1,t2 right join t3 on (t2.i=t3.i) order by t1.i,t2.i,t3.i;
|
||||
select * from t2 natural right join t3,t1 order by t1.i;
|
||||
select t1.i,t2.i,t3.i from t2 natural right join t3,t1 order by t1.i,t2.i,t3.i;
|
||||
select t1.i,t2.i,t3.i from t2 right join t3 on (t2.i=t3.i),t1 order by t1.i,t2.i,t3.i;
|
||||
drop table t1,t2,t3;
|
||||
|
||||
|
@@ -678,7 +678,7 @@ SELECT t2.a,t2.b,t3.a1,t3.b
|
||||
FROM t2 LEFT JOIN t3 ON t2.b=t3.b
|
||||
WHERE t2.a = 4 OR (t2.a > 4 AND t3.a1 IS NULL);
|
||||
|
||||
SELECT *
|
||||
SELECT t2.a,t2.b,t3.a1,t3.b
|
||||
FROM t2 NATURAL LEFT JOIN t3
|
||||
WHERE t2.a = 4 OR (t2.a > 4 AND t3.a1 IS NULL);
|
||||
|
||||
|
@@ -19,11 +19,11 @@ select t1.*,t2.* from t1 JOIN t2 where t1.a=t2.a;
|
||||
select t1.*,t2.* from t1 left join t2 on (t1.a=t2.a) order by t1.grp,t1.a,t2.c;
|
||||
select t1.*,t2.* from { oj t2 left outer join t1 on (t1.a=t2.a) };
|
||||
select t1.*,t2.* from t1 as t0,{ oj t2 left outer join t1 on (t1.a=t2.a) } WHERE t0.a=2;
|
||||
select * from t1 left join t2 using (a);
|
||||
select t1.*,t2.* from t1 left join t2 on t1.a=t2.a;
|
||||
select * from t1 left join t2 using (a,c);
|
||||
select * from t1 left join t2 using (c);
|
||||
select * from t1 natural left outer join t2;
|
||||
select t1.*,t2.* from t1 left join t2 using (a);
|
||||
select t1.*,t2.* from t1 left join t2 using (a) where t1.a=t2.a;
|
||||
select t1.*,t2.* from t1 left join t2 using (a,c);
|
||||
select t1.*,t2.* from t1 left join t2 using (c);
|
||||
select t1.*,t2.* from t1 natural left outer join t2;
|
||||
|
||||
select t1.*,t2.* from t1 left join t2 on (t1.a=t2.a) where t2.id=3;
|
||||
select t1.*,t2.* from t1 left join t2 on (t1.a=t2.a) where t2.id is null;
|
||||
@@ -44,9 +44,9 @@ select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on
|
||||
select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
|
||||
|
||||
# Test of inner join
|
||||
select * from t1 inner join t2 using (a);
|
||||
select t1.*,t2.* from t1 inner join t2 using (a);
|
||||
select t1.*,t2.* from t1 inner join t2 on (t1.a=t2.a);
|
||||
select * from t1 natural join t2;
|
||||
select t1.*,t2.* from t1 natural join t2;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
@@ -325,7 +325,7 @@ INSERT INTO t2 VALUES (2,'y');
|
||||
INSERT INTO t2 VALUES (3,'z');
|
||||
|
||||
SELECT t2.id2 FROM t2 LEFT OUTER JOIN t1 ON t1.id2 = t2.id2 WHERE id1 IS NULL;
|
||||
SELECT id2 FROM t2 NATURAL LEFT OUTER JOIN t1 WHERE id1 IS NULL;
|
||||
SELECT t2.id2 FROM t2 NATURAL LEFT OUTER JOIN t1 WHERE id1 IS NULL;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
@@ -430,6 +430,8 @@ insert into t1 values(1),(2);
|
||||
insert into t2 values(2),(3);
|
||||
insert into t3 values(2),(4);
|
||||
select * from t1 natural left join t2 natural left join t3;
|
||||
select * from t1 natural left join t2 where (t2.i is not null)=0;
|
||||
select * from t1 natural left join t2 where (t2.i is not null) is not null;
|
||||
select * from t1 natural left join t2 where (i is not null)=0;
|
||||
select * from t1 natural left join t2 where (i is not null) is not null;
|
||||
drop table t1,t2,t3;
|
||||
@@ -656,6 +658,8 @@ create table t1 (a int, b varchar(20));
|
||||
create table t2 (a int, c varchar(20));
|
||||
insert into t1 values (1,"aaaaaaaaaa"),(2,"bbbbbbbbbb");
|
||||
insert into t2 values (1,"cccccccccc"),(2,"dddddddddd");
|
||||
select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by t1.a;
|
||||
select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by t1.a;
|
||||
select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by a;
|
||||
select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by a;
|
||||
drop table t1, t2;
|
||||
|
@@ -151,7 +151,6 @@ select * from t1 where b = 'two';
|
||||
connection server1;
|
||||
alter table t1 drop index c;
|
||||
connection server2;
|
||||
--error 1412
|
||||
select * from t1 where b = 'two';
|
||||
select * from t1 where b = 'two';
|
||||
connection server1;
|
||||
@@ -180,4 +179,29 @@ drop table t1;
|
||||
#select count(*) from t2;
|
||||
#drop table t2;
|
||||
|
||||
connection server1;
|
||||
create table t3 (a int primary key) engine=ndbcluster;
|
||||
|
||||
connection server2;
|
||||
begin;
|
||||
insert into t3 values (1);
|
||||
|
||||
connection server1;
|
||||
alter table t3 rename t4;
|
||||
|
||||
connection server2;
|
||||
# This should work as transaction is ongoing...
|
||||
delete from t3;
|
||||
insert into t3 values (1);
|
||||
commit;
|
||||
|
||||
# This should fail as its a new transaction
|
||||
--error 1015
|
||||
select * from t3;
|
||||
select * from t4;
|
||||
drop table t4;
|
||||
show tables;
|
||||
connection server1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_default_cluster.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=type,nodeid,host 2> /dev/null
|
||||
|
@@ -152,18 +152,12 @@ INSERT INTO t1 (order_id, product_id, product_type) VALUES
|
||||
INSERT INTO t2 (order_id, product_id, product_type) VALUES
|
||||
('9d9aad7764b5b2c53004348ef8d34500',2315652, 3);
|
||||
|
||||
select t1.* from t1 left join t2
|
||||
on (t1.order_id = t2.order_id and
|
||||
t1.product_id = t2.product_id and
|
||||
t1.product_type = t2.product_type)
|
||||
where t2.order_id = NULL;
|
||||
|
||||
select t1.* from t1 left join t2
|
||||
on (t1.order_id = t2.order_id and
|
||||
t1.product_id = t2.product_id and
|
||||
t1.product_type = t2.product_type)
|
||||
select t1.* from t1
|
||||
left join t2 using(order_id, product_id, product_type)
|
||||
where t2.order_id=NULL;
|
||||
select t1.* from t1
|
||||
left join t2 using(order_id, product_id, product_type)
|
||||
where t2.order_id is NULL;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
|
@@ -151,11 +151,22 @@ INSERT INTO t2 VALUES (2,25);
|
||||
INSERT INTO t3 VALUES (1,'123 Park Place');
|
||||
INSERT INTO t3 VALUES (2,'453 Boardwalk');
|
||||
|
||||
SELECT a,b,if(b = 1,i,if(b = 2,v,''))
|
||||
FROM t1
|
||||
LEFT JOIN t2 USING(c)
|
||||
LEFT JOIN t3 ON t3.c = t1.c;
|
||||
|
||||
SELECT a,b,if(b = 1,i,if(b = 2,v,''))
|
||||
FROM t1
|
||||
LEFT JOIN t2 ON t1.c = t2.c
|
||||
LEFT JOIN t3 ON t3.c = t1.c;
|
||||
|
||||
SELECT a,b,if(b = 1,i,if(b = 2,v,''))
|
||||
FROM t1
|
||||
LEFT JOIN t2 USING(c)
|
||||
LEFT JOIN t3 ON t3.c = t1.c
|
||||
ORDER BY a;
|
||||
|
||||
SELECT a,b,if(b = 1,i,if(b = 2,v,''))
|
||||
FROM t1
|
||||
LEFT JOIN t2 ON t1.c = t2.c
|
||||
@@ -339,7 +350,9 @@ CREATE TABLE t2 (
|
||||
|
||||
INSERT INTO t1 (titre,auteur,dest) VALUES ('test','joce','bug');
|
||||
INSERT INTO t2 (numeropost,pseudo) VALUES (1,'joce'),(1,'bug');
|
||||
SELECT titre,t1.numeropost,auteur,icone,nbrep,0,date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
|
||||
SELECT titre,numeropost,auteur,icone,nbrep,0,date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
|
||||
SELECT titre,t1.numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
|
||||
SELECT titre,numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
|
||||
drop table t1,t2;
|
||||
|
||||
|
56
mysql-test/t/rpl_drop_db.test
Normal file
56
mysql-test/t/rpl_drop_db.test
Normal file
@@ -0,0 +1,56 @@
|
||||
# test case for BUG#4680 -- if there are extra files in the db directory
|
||||
# dropping the db on the master causes replication problems
|
||||
|
||||
-- source include/master-slave.inc
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1 (n int);
|
||||
insert into mysqltest.t1 values (1);
|
||||
select * from mysqltest.t1 into outfile 'mysqltest/f1.txt';
|
||||
create table mysqltest.t2 (n int);
|
||||
create table mysqltest.t3 (n int);
|
||||
--error 1010
|
||||
drop database mysqltest;
|
||||
use mysqltest;
|
||||
show tables;
|
||||
|
||||
# test the branch of the code that deals with the query buffer overflow
|
||||
|
||||
disable_query_log;
|
||||
let $1=50;
|
||||
while ($1)
|
||||
{
|
||||
eval create table mysqltest.mysql_test_long_table_name$1 (n int);
|
||||
dec $1;
|
||||
}
|
||||
enable_query_log;
|
||||
--error 1010
|
||||
drop database mysqltest;
|
||||
use mysqltest;
|
||||
show tables;
|
||||
use test;
|
||||
create table t1 (n int);
|
||||
insert into t1 values (1234);
|
||||
sync_slave_with_master;
|
||||
|
||||
connection slave;
|
||||
use mysqltest;
|
||||
show tables;
|
||||
use test;
|
||||
select * from t1;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#cleanup
|
||||
connection slave;
|
||||
stop slave;
|
||||
system rm -rf var/master-data/mysqltest;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
19
mysql-test/t/rpl_insert_select.test
Normal file
19
mysql-test/t/rpl_insert_select.test
Normal file
@@ -0,0 +1,19 @@
|
||||
# Testcase for BUG#10456 - INSERT INTO ... SELECT violating a primary key
|
||||
# breaks replication
|
||||
|
||||
-- source include/master-slave.inc
|
||||
connection master;
|
||||
|
||||
create table t1 (n int not null primary key);
|
||||
insert into t1 values (1);
|
||||
create table t2 (n int);
|
||||
insert into t2 values (1);
|
||||
insert ignore into t1 select * from t2;
|
||||
insert into t1 values (2);
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select * from t1;
|
||||
|
||||
connection master;
|
||||
drop table t1,t2;
|
||||
sync_slave_with_master;
|
@@ -83,7 +83,7 @@ create procedure foo2()
|
||||
call foo2();
|
||||
# verify CALL is not in binlog
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events from 605;
|
||||
show binlog events from 518;
|
||||
|
||||
--error 1418;
|
||||
alter procedure foo2 contains sql;
|
||||
@@ -147,7 +147,7 @@ show warnings;
|
||||
|
||||
# Check that only successful CALLs are in binlog
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events from 841;
|
||||
show binlog events from 990;
|
||||
|
||||
# Note that half-failed CALLs are not in binlog, which is a known
|
||||
# bug. If we compare t2 on master and slave we see they differ:
|
||||
|
1
mysql-test/t/rpl_sp_effects-master.opt
Normal file
1
mysql-test/t/rpl_sp_effects-master.opt
Normal file
@@ -0,0 +1 @@
|
||||
--log_bin_trust_routine_creators=1
|
1
mysql-test/t/rpl_sp_effects-slave.opt
Normal file
1
mysql-test/t/rpl_sp_effects-slave.opt
Normal file
@@ -0,0 +1 @@
|
||||
--log_bin_trust_routine_creators=1
|
155
mysql-test/t/rpl_sp_effects.test
Normal file
155
mysql-test/t/rpl_sp_effects.test
Normal file
@@ -0,0 +1,155 @@
|
||||
# Test of replication of stored procedures (WL#2146 for MySQL 5.0)
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
# ****************************************************************
|
||||
connection master;
|
||||
|
||||
# cleanup
|
||||
--disable_warnings
|
||||
drop procedure if exists p1;
|
||||
drop procedure if exists p2;
|
||||
drop function if exists f1;
|
||||
drop table if exists t1,t2;
|
||||
drop view if exists v1;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
|
||||
# 1. Test simple variables use.
|
||||
delimiter //;
|
||||
create procedure p1()
|
||||
begin
|
||||
declare spv int default 0;
|
||||
while spv < 5 do
|
||||
insert into t1 values(spv+1);
|
||||
set spv=spv+1;
|
||||
end while;
|
||||
end//
|
||||
delimiter ;//
|
||||
|
||||
call p1();
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select * from t1;
|
||||
connection master;
|
||||
delete from t1;
|
||||
|
||||
# 2. Test SP variable name
|
||||
delimiter //;
|
||||
create procedure p2()
|
||||
begin
|
||||
declare a int default 4;
|
||||
create table t2 as select a;
|
||||
end//
|
||||
delimiter ;//
|
||||
|
||||
call p2();
|
||||
select * from t2;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select * from t2;
|
||||
|
||||
connection master;
|
||||
drop procedure p1;
|
||||
drop procedure p2;
|
||||
drop table t2;
|
||||
|
||||
# 3. Test FUNCTIONs in various places
|
||||
|
||||
delimiter //;
|
||||
create function f1(x int) returns int
|
||||
begin
|
||||
insert into t1 values(x);
|
||||
return x+1;
|
||||
end//
|
||||
|
||||
create procedure p1(a int, b int)
|
||||
begin
|
||||
declare v int default f1(5);
|
||||
if (f1(6)) then
|
||||
select 'yes';
|
||||
end if;
|
||||
set v = f1(7);
|
||||
while f1(8) < 1 do
|
||||
select 'this cant be';
|
||||
end while;
|
||||
|
||||
end//
|
||||
delimiter ;//
|
||||
|
||||
call p1(f1(1), f1(2));
|
||||
select * from t1;
|
||||
|
||||
create table t2(a int);
|
||||
insert into t2 values (10),(11);
|
||||
select a,f1(a) from t2;
|
||||
|
||||
# This shouldn't put separate 'call f1(3)' into binlog:
|
||||
insert into t2 select f1(3);
|
||||
select 'master:',a from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select 'slave:',a from t1;
|
||||
|
||||
connection master;
|
||||
drop procedure p1;
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
|
||||
# 4. VIEWs
|
||||
delete from t1;
|
||||
insert into t2 values(1),(2);
|
||||
create view v1 as select f1(a) from t2;
|
||||
select * from v1;
|
||||
select 'master:',a from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select 'slave:',a from t1;
|
||||
|
||||
connection master;
|
||||
drop view v1;
|
||||
delete from t1;
|
||||
|
||||
# 5. Prepared statements.
|
||||
prepare s1 from 'select f1(?)';
|
||||
set @xx=123;
|
||||
execute s1 using @xx;
|
||||
select 'master:',a from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select 'slave:',a from t1;
|
||||
|
||||
connection master;
|
||||
delete from t1;
|
||||
|
||||
# 5. Cursors.
|
||||
# t2 has (1),(2);
|
||||
delimiter //;
|
||||
create procedure p1(spv int)
|
||||
begin
|
||||
declare c cursor for select f1(spv) from t2;
|
||||
while (spv > 2) do
|
||||
open c;
|
||||
fetch c into spv;
|
||||
close c;
|
||||
set spv= spv - 10;
|
||||
end while;
|
||||
end//
|
||||
delimiter ;//
|
||||
|
||||
call p1(15);
|
||||
select 'master:',a from t1;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select 'slave:',a from t1;
|
||||
|
||||
connection master;
|
||||
drop procedure p1;
|
||||
drop function f1;
|
||||
drop table t1,t2;
|
||||
|
||||
sync_slave_with_master;
|
@@ -1538,6 +1538,11 @@ select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 25
|
||||
#
|
||||
insert into t2 (fld1, companynr) values (999999,99);
|
||||
|
||||
select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
|
||||
select count(*) from t2 left join t4 using (companynr) where t4.companynr is not null;
|
||||
explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
|
||||
|
||||
select companynr,companyname from t2 left join t4 using (companynr) where companynr is null;
|
||||
select count(*) from t2 left join t4 using (companynr) where companynr is not null;
|
||||
explain select companynr,companyname from t2 left join t4 using (companynr) where companynr is null;
|
||||
@@ -1547,10 +1552,18 @@ delete from t2 where fld1=999999;
|
||||
#
|
||||
# Test left join optimization
|
||||
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0;
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0;
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0;
|
||||
|
||||
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0;
|
||||
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0;
|
||||
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0;
|
||||
# Following can't be optimized
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0;
|
||||
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0;
|
||||
|
||||
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null;
|
||||
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0;
|
||||
explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0;
|
||||
@@ -2348,3 +2361,98 @@ DROP TABLE t1,t2;
|
||||
#
|
||||
|
||||
select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
|
||||
|
||||
#
|
||||
# Bug #11398 Bug in field_conv() results in wrong result of join with index
|
||||
#
|
||||
create table t1 (f1 varchar(6) default NULL, f2 int(6) primary key not null);
|
||||
create table t2 (f3 varchar(5) not null, f4 varchar(5) not null, UNIQUE KEY UKEY (f3,f4));
|
||||
insert into t1 values (" 2", 2);
|
||||
insert into t2 values (" 2", " one "),(" 2", " two ");
|
||||
select * from t1 left join t2 on f1 = f3;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug #6558 Views: CREATE VIEW fails with JOIN ... USING
|
||||
#
|
||||
|
||||
create table t1 (empnum smallint, grp int);
|
||||
create table t2 (empnum int, name char(5));
|
||||
insert into t1 values(1,1);
|
||||
insert into t2 values(1,'bob');
|
||||
create view v1 as select * from t2 inner join t1 using (empnum);
|
||||
select * from v1;
|
||||
drop table t1,t2;
|
||||
drop view v1;
|
||||
|
||||
#
|
||||
# Bug #10646 Columns included in the join between two tables are ambigious
|
||||
# in the select
|
||||
#
|
||||
|
||||
create table t1 (pk int primary key, b int);
|
||||
create table t2 (pk int primary key, c int);
|
||||
select pk from t1 inner join t2 using (pk);
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug #10972 Natural join of view and underlying table gives wrong result
|
||||
#
|
||||
|
||||
create table t1 (s1 int, s2 char(5), s3 decimal(10));
|
||||
create view v1 as select s1, s2, 'x' as s3 from t1;
|
||||
select * from t1 natural join v1;
|
||||
insert into t1 values (1,'x',5);
|
||||
select * from t1 natural join v1;
|
||||
drop table t1;
|
||||
drop view v1;
|
||||
|
||||
#
|
||||
# Bug #6276 A SELECT that does a NATURAL OUTER JOIN without common
|
||||
# columns crashes server because of empty ON condition
|
||||
#
|
||||
|
||||
create table t1(a1 int);
|
||||
create table t2(a2 int);
|
||||
insert into t1 values(1),(2);
|
||||
insert into t2 values(1),(2);
|
||||
create view v2 (c) as select a1 from t1;
|
||||
|
||||
select * from t1 natural left join t2;
|
||||
select * from t1 natural right join t2;
|
||||
|
||||
select * from v2 natural left join t2;
|
||||
select * from v2 natural right join t2;
|
||||
|
||||
drop table t1, t2;
|
||||
drop view v2;
|
||||
|
||||
|
||||
#
|
||||
# Bug #4789 Incosistent results of more than 2-way natural joins due to
|
||||
# incorrect transformation to join ... on.
|
||||
#
|
||||
|
||||
create table t1 (a int(10), t1_val int(10));
|
||||
create table t2 (b int(10), t2_val int(10));
|
||||
create table t3 (a int(10), b int(10));
|
||||
insert into t1 values (1,1),(2,2);
|
||||
insert into t2 values (1,1),(2,2),(3,3);
|
||||
insert into t3 values (1,1),(2,1),(3,1),(4,1);
|
||||
# the following two queries must return the same result
|
||||
select * from t1 natural join t2 natural join t3;
|
||||
select * from t1 natural join t3 natural join t2;
|
||||
drop table t1, t2, t3;
|
||||
|
||||
|
||||
#
|
||||
# Bug #6495 Illogical requirement for column qualification in NATURAL join
|
||||
#
|
||||
|
||||
create table t1 (a char(1));
|
||||
create table t2 (a char(1));
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
insert into t2 values ('b'),('c'),('d');
|
||||
select a from t1 natural join t2;
|
||||
select * from t1 natural join t2 where a = 'b';
|
||||
drop table t1, t2;
|
||||
|
@@ -409,6 +409,35 @@ lock tables mysql.proc write|
|
||||
unlock tables|
|
||||
|
||||
|
||||
#
|
||||
# Check that in functions we don't allow to update tables which
|
||||
# are used by statements which invoke these functions.
|
||||
#
|
||||
--disable_warnings
|
||||
drop function if exists f1|
|
||||
--enable_warnings
|
||||
create function f1(i int) returns int
|
||||
begin
|
||||
insert into t1 (val) values (i);
|
||||
return 0;
|
||||
end|
|
||||
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
|
||||
select val, f1(val) from t1|
|
||||
# Table alias should not matter
|
||||
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
|
||||
select val, f1(val) from t1 as tab|
|
||||
select * from t1|
|
||||
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
|
||||
update t1 set val= f1(val)|
|
||||
select * from t1|
|
||||
# But this should be OK
|
||||
select f1(17)|
|
||||
select * from t1|
|
||||
# Cleanup
|
||||
delete from t1 where val= 17|
|
||||
drop function f1|
|
||||
|
||||
|
||||
#
|
||||
# BUG#1965
|
||||
#
|
||||
|
@@ -397,6 +397,12 @@ connection n1;
|
||||
--error 1370
|
||||
call mysqltest_1.p1();
|
||||
disconnect n1;
|
||||
# Test also without a current database
|
||||
connect (n2,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection n2;
|
||||
--error 1370
|
||||
call mysqltest_1.p1();
|
||||
disconnect n2;
|
||||
|
||||
connection default;
|
||||
|
||||
|
@@ -3934,20 +3934,20 @@ drop procedure p_bug11247|
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug12168|
|
||||
drop table if exists t1, t2|
|
||||
drop table if exists t3, t4|
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int)|
|
||||
insert into t1 values (1),(2),(3),(4)|
|
||||
create table t3 (a int)|
|
||||
insert into t3 values (1),(2),(3),(4)|
|
||||
|
||||
create table t2 (a int)|
|
||||
create table t4 (a int)|
|
||||
|
||||
create procedure bug12168(arg1 char(1))
|
||||
begin
|
||||
declare b, c integer;
|
||||
if arg1 = 'a' then
|
||||
begin
|
||||
declare c1 cursor for select a from t1 where a % 2;
|
||||
declare c1 cursor for select a from t3 where a % 2;
|
||||
declare continue handler for not found set b = 1;
|
||||
set b = 0;
|
||||
open c1;
|
||||
@@ -3957,14 +3957,14 @@ begin
|
||||
leave c1_repeat;
|
||||
end if;
|
||||
|
||||
insert into t2 values (c);
|
||||
insert into t4 values (c);
|
||||
until b = 1
|
||||
end repeat;
|
||||
end;
|
||||
end if;
|
||||
if arg1 = 'b' then
|
||||
begin
|
||||
declare c2 cursor for select a from t1 where not a % 2;
|
||||
declare c2 cursor for select a from t3 where not a % 2;
|
||||
declare continue handler for not found set b = 1;
|
||||
set b = 0;
|
||||
open c2;
|
||||
@@ -3974,7 +3974,7 @@ begin
|
||||
leave c2_repeat;
|
||||
end if;
|
||||
|
||||
insert into t2 values (c);
|
||||
insert into t4 values (c);
|
||||
until b = 1
|
||||
end repeat;
|
||||
end;
|
||||
@@ -3982,19 +3982,54 @@ begin
|
||||
end|
|
||||
|
||||
call bug12168('a')|
|
||||
select * from t2|
|
||||
truncate t2|
|
||||
select * from t4|
|
||||
truncate t4|
|
||||
call bug12168('b')|
|
||||
select * from t2|
|
||||
truncate t2|
|
||||
select * from t4|
|
||||
truncate t4|
|
||||
call bug12168('a')|
|
||||
select * from t2|
|
||||
truncate t2|
|
||||
select * from t4|
|
||||
truncate t4|
|
||||
call bug12168('b')|
|
||||
select * from t2|
|
||||
truncate t2|
|
||||
select * from t4|
|
||||
truncate t4|
|
||||
drop table t3, t4|
|
||||
drop procedure if exists bug12168|
|
||||
|
||||
#
|
||||
# Bug #11333 "Stored Procedure: Memory blow up on repeated SELECT ... INTO
|
||||
# query"
|
||||
# One more memleak bug. Use the test to check memory consumption.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t3|
|
||||
drop procedure if exists bug11333|
|
||||
--enable_warnings
|
||||
|
||||
create table t3 (c1 char(128))|
|
||||
|
||||
insert into t3 values
|
||||
('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')|
|
||||
|
||||
|
||||
create procedure bug11333(i int)
|
||||
begin
|
||||
declare tmp varchar(128);
|
||||
set @x = 0;
|
||||
repeat
|
||||
select c1 into tmp from t3
|
||||
where c1 = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
|
||||
set @x = @x + 1;
|
||||
until @x >= i
|
||||
end repeat;
|
||||
end|
|
||||
|
||||
call bug11333(10)|
|
||||
|
||||
drop procedure bug11333|
|
||||
drop table t3|
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
|
@@ -1132,7 +1132,9 @@ CREATE TABLE t1 (id INT);
|
||||
CREATE TABLE t2 (id INT);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
|
||||
SELECT id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
|
||||
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY t1.id;
|
||||
SELECT id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY id;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
|
@@ -729,3 +729,39 @@ select * from t1;
|
||||
|
||||
drop procedure bug11587;
|
||||
drop table t1;
|
||||
|
||||
# Test for bug #11896 "Partial locking in case of recursive trigger
|
||||
# definitions". Recursion in triggers should not be allowed.
|
||||
# We also should not allow to change tables which are used in
|
||||
# statements invoking this trigger.
|
||||
create table t1 (f1 integer);
|
||||
create table t2 (f2 integer);
|
||||
create trigger t1_ai after insert on t1
|
||||
for each row insert into t2 values (new.f1+1);
|
||||
create trigger t2_ai after insert on t2
|
||||
for each row insert into t1 values (new.f2+1);
|
||||
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
|
||||
insert into t1 values (1);
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
drop trigger t1_ai;
|
||||
drop trigger t2_ai;
|
||||
create trigger t1_bu before update on t1
|
||||
for each row insert into t1 values (2);
|
||||
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
|
||||
update t1 set f1= 10;
|
||||
select * from t1;
|
||||
drop trigger t1_bu;
|
||||
create trigger t1_bu before update on t1
|
||||
for each row delete from t1 where f1=new.f1;
|
||||
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
|
||||
update t1 set f1= 10;
|
||||
select * from t1;
|
||||
drop trigger t1_bu;
|
||||
# This should work tough
|
||||
create trigger t1_bi before insert on t1
|
||||
for each row set new.f1=(select sum(f1) from t1);
|
||||
insert into t1 values (3);
|
||||
select * from t1;
|
||||
drop trigger t1_bi;
|
||||
drop tables t1, t2;
|
||||
|
@@ -157,11 +157,18 @@ create table t1 ( id integer unsigned not null primary key );
|
||||
create table t2 ( id integer unsigned not null primary key );
|
||||
insert into t1 values (1), (2);
|
||||
insert into t2 values (1);
|
||||
select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
|
||||
select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
|
||||
create table t3 (id_A integer unsigned not null, id_B integer unsigned null );
|
||||
insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
|
||||
select * from t3;
|
||||
delete from t3;
|
||||
insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
|
||||
select * from t3;
|
||||
drop table t3;
|
||||
create table t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
|
||||
select * from t3;
|
||||
drop table t3;
|
||||
create table t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
|
||||
select * from t3;
|
||||
drop table t1,t2,t3;
|
||||
|
@@ -1943,6 +1943,18 @@ create view v1 as select timestampdiff(day,'1997-01-01 00:00:00','1997-01-02 00:
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
|
||||
#
|
||||
# repeatable CREATE VIEW statement BUG#12468
|
||||
#
|
||||
create table t1(a int);
|
||||
create procedure p1() create view v1 as select * from t1;
|
||||
drop table t1;
|
||||
-- error 1146
|
||||
call p1();
|
||||
-- error 1146
|
||||
call p1();
|
||||
drop procedure p1;
|
||||
|
||||
#
|
||||
# Bug #10624 Views with multiple UNION and UNION ALL produce incorrect results
|
||||
#
|
||||
@@ -1966,3 +1978,20 @@ CREATE VIEW v1 AS SELECT f1();
|
||||
DROP FUNCTION f1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# BUG #12533 (crash on DESCRIBE <view> after renaming base table column)
|
||||
#
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (f4 CHAR(5));
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
DESCRIBE v1;
|
||||
|
||||
ALTER TABLE t1 CHANGE COLUMN f4 f4x CHAR(5);
|
||||
--error 1356
|
||||
DESCRIBE v1;
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
|
@@ -30,7 +30,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
|
||||
mf_path.c mf_loadpath.c my_file.c \
|
||||
my_open.c my_create.c my_dup.c my_seek.c my_read.c \
|
||||
my_pread.c my_write.c \
|
||||
mf_keycache.c mf_keycaches.c my_crc32.c \
|
||||
mf_keycaches.c my_crc32.c \
|
||||
mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \
|
||||
mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \
|
||||
my_malloc.c my_realloc.c my_once.c mulalloc.c \
|
||||
|
@@ -54,7 +54,7 @@ void get_date(register my_string to, int flag, time_t date)
|
||||
if (flag & GETDATE_GMT)
|
||||
start_time= localtime(&skr);
|
||||
else
|
||||
gmtime(&skr,&tm_tmp);
|
||||
start_time= gmtime(&skr);
|
||||
#endif
|
||||
if (flag & GETDATE_SHORT_DATE)
|
||||
sprintf(to,"%02d%02d%02d",
|
||||
|
@@ -23,6 +23,7 @@ class AttributeDescriptor {
|
||||
friend class Dbacc;
|
||||
friend class Dbtup;
|
||||
friend class Dbtux;
|
||||
friend class SimulatedBlock;
|
||||
|
||||
private:
|
||||
static void setType(Uint32 &, Uint32 type);
|
||||
|
@@ -44,8 +44,7 @@
|
||||
#define TRIX 0xFF
|
||||
#define DBUTIL 0x100
|
||||
#define SUMA 0x101
|
||||
#define GREP 0x102
|
||||
#define DBTUX 0x103
|
||||
#define DBTUX 0x102
|
||||
|
||||
const BlockReference BACKUP_REF = numberToRef(BACKUP, 0);
|
||||
const BlockReference DBTC_REF = numberToRef(DBTC, 0);
|
||||
@@ -61,7 +60,6 @@ const BlockReference CMVMI_REF = numberToRef(CMVMI, 0);
|
||||
const BlockReference TRIX_REF = numberToRef(TRIX, 0);
|
||||
const BlockReference DBUTIL_REF = numberToRef(DBUTIL, 0);
|
||||
const BlockReference SUMA_REF = numberToRef(SUMA, 0);
|
||||
const BlockReference GREP_REF = numberToRef(GREP, 0);
|
||||
const BlockReference DBTUX_REF = numberToRef(DBTUX, 0);
|
||||
|
||||
const BlockNumber MIN_BLOCK_NO = BACKUP;
|
||||
|
@@ -777,8 +777,8 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
|
||||
/**
|
||||
* Grep signals
|
||||
*/
|
||||
#define GSN_GREP_SUB_CREATE_REQ 606
|
||||
#define GSN_GREP_SUB_CREATE_REF 607
|
||||
#define GSN_ALTER_TABLE_REP 606
|
||||
#define GSN_API_BROADCAST_REP 607
|
||||
#define GSN_GREP_SUB_CREATE_CONF 608
|
||||
#define GSN_GREP_CREATE_REQ 609
|
||||
#define GSN_GREP_CREATE_REF 610
|
||||
|
@@ -36,6 +36,13 @@ enum Operation_t {
|
||||
#endif
|
||||
};
|
||||
|
||||
inline
|
||||
Uint32
|
||||
table_version_major(Uint32 ver)
|
||||
{
|
||||
return ver & 0x00FFFFFF;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -129,7 +129,8 @@ public:
|
||||
InvalidPrimaryKeySize = 739,
|
||||
NullablePrimaryKey = 740,
|
||||
UnsupportedChange = 741,
|
||||
BackupInProgress = 762
|
||||
BackupInProgress = 762,
|
||||
IncompatibleVersions = 763
|
||||
};
|
||||
|
||||
private:
|
||||
@@ -177,4 +178,26 @@ private:
|
||||
Uint32 tableVersion;
|
||||
};
|
||||
|
||||
/**
|
||||
* Inform API about change of table definition
|
||||
*/
|
||||
struct AlterTableRep
|
||||
{
|
||||
friend bool printALTER_TABLE_REP(FILE*, const Uint32*, Uint32, Uint16);
|
||||
|
||||
STATIC_CONST( SignalLength = 3 );
|
||||
|
||||
enum Change_type
|
||||
{
|
||||
CT_ALTERED = 0x1,
|
||||
CT_DROPPED = 0x2
|
||||
};
|
||||
|
||||
Uint32 tableId;
|
||||
Uint32 tableVersion;
|
||||
Uint32 changeType;
|
||||
|
||||
SECTION( TABLE_NAME = 0 );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
31
ndb/include/kernel/signaldata/ApiBroadcast.hpp
Normal file
31
ndb/include/kernel/signaldata/ApiBroadcast.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/* Copyright (C) 2003 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 */
|
||||
|
||||
#ifndef API_BROADCAST_HPP
|
||||
#define API_BROADCAST_HPP
|
||||
|
||||
#include "SignalData.hpp"
|
||||
|
||||
struct ApiBroadcastRep
|
||||
{
|
||||
STATIC_CONST( SignalLength = 2 );
|
||||
|
||||
Uint32 gsn;
|
||||
Uint32 minVersion;
|
||||
Uint32 theData[1];
|
||||
};
|
||||
|
||||
#endif
|
@@ -78,9 +78,10 @@ public:
|
||||
///< changes to take effect
|
||||
Retrieved, ///< The object exist and has been read
|
||||
///< into main memory from NDB Kernel
|
||||
Invalid ///< The object has been invalidated
|
||||
Invalid, ///< The object has been invalidated
|
||||
///< and should not be used
|
||||
|
||||
Altered ///< Table has been altered in NDB kernel
|
||||
///< but is still valid for usage
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -32,7 +32,6 @@ const BlockName BlockNames[] = {
|
||||
{ "BACKUP", BACKUP },
|
||||
{ "DBUTIL", DBUTIL },
|
||||
{ "SUMA", SUMA },
|
||||
{ "GREP", GREP },
|
||||
{ "DBTUX", DBTUX }
|
||||
};
|
||||
|
||||
|
@@ -92,9 +92,10 @@ void ndbSetOwnVersion() {}
|
||||
|
||||
#ifndef TEST_VERSION
|
||||
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
|
||||
{ MAKE_VERSION(5,0,NDB_VERSION_BUILD), MAKE_VERSION(5,0,3), UG_Range},
|
||||
{ MAKE_VERSION(5,0,3), MAKE_VERSION(5,0,2), UG_Exact },
|
||||
{ MAKE_VERSION(4,1,12), MAKE_VERSION(4,1,10), UG_Range },
|
||||
{ MAKE_VERSION(5,0,NDB_VERSION_BUILD), MAKE_VERSION(5,0,12), UG_Range},
|
||||
{ MAKE_VERSION(5,0,11), MAKE_VERSION(5,0,2), UG_Range},
|
||||
{ MAKE_VERSION(4,1,NDB_VERSION_BUILD), MAKE_VERSION(4,1,15), UG_Range },
|
||||
{ MAKE_VERSION(4,1,14), MAKE_VERSION(4,1,10), UG_Range },
|
||||
{ MAKE_VERSION(4,1,10), MAKE_VERSION(4,1,9), UG_Exact },
|
||||
{ MAKE_VERSION(4,1,9), MAKE_VERSION(4,1,8), UG_Exact },
|
||||
{ MAKE_VERSION(3,5,2), MAKE_VERSION(3,5,1), UG_Exact },
|
||||
@@ -102,7 +103,9 @@ struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
|
||||
};
|
||||
|
||||
struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = {
|
||||
{ MAKE_VERSION(5,0,12), MAKE_VERSION(5,0,11), UG_Exact },
|
||||
{ MAKE_VERSION(5,0,2), MAKE_VERSION(4,1,8), UG_Exact },
|
||||
{ MAKE_VERSION(4,1,15), MAKE_VERSION(4,1,14), UG_Exact },
|
||||
{ MAKE_VERSION(3,5,4), MAKE_VERSION(3,5,3), UG_Exact },
|
||||
{ 0, 0, UG_Null }
|
||||
};
|
||||
|
@@ -23,7 +23,6 @@ INCLUDES += \
|
||||
-Iblocks/backup \
|
||||
-Iblocks/dbutil \
|
||||
-Iblocks/suma \
|
||||
-Iblocks/grep \
|
||||
-Iblocks/dbtux
|
||||
|
||||
LDADD += \
|
||||
@@ -41,7 +40,6 @@ LDADD += \
|
||||
blocks/backup/libbackup.a \
|
||||
blocks/dbutil/libdbutil.a \
|
||||
blocks/suma/libsuma.a \
|
||||
blocks/grep/libgrep.a \
|
||||
blocks/dbtux/libdbtux.a \
|
||||
vm/libkernel.a \
|
||||
error/liberror.a \
|
||||
|
@@ -30,7 +30,6 @@
|
||||
#include <Backup.hpp>
|
||||
#include <DbUtil.hpp>
|
||||
#include <Suma.hpp>
|
||||
#include <Grep.hpp>
|
||||
#include <Dbtux.hpp>
|
||||
#include <NdbEnv.h>
|
||||
|
||||
@@ -97,12 +96,13 @@ SimBlockList::load(const Configuration & conf){
|
||||
theList[11] = NEW_BLOCK(Backup)(conf);
|
||||
theList[12] = NEW_BLOCK(DbUtil)(conf);
|
||||
theList[13] = NEW_BLOCK(Suma)(conf);
|
||||
theList[14] = NEW_BLOCK(Grep)(conf);
|
||||
theList[14] = 0; //NEW_BLOCK(Grep)(conf);
|
||||
theList[15] = NEW_BLOCK(Dbtux)(conf);
|
||||
|
||||
// Metadata common part shared by block instances
|
||||
ptrMetaDataCommon = new MetaData::Common(*dbdict, *dbdih);
|
||||
for (int i = 0; i < noOfBlocks; i++)
|
||||
if(theList[i])
|
||||
theList[i]->setMetaDataCommon(ptrMetaDataCommon);
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,6 @@ SUBDIRS = \
|
||||
backup \
|
||||
dbutil \
|
||||
suma \
|
||||
grep \
|
||||
dbtux
|
||||
|
||||
windoze-dsp:
|
||||
|
@@ -988,7 +988,6 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal)
|
||||
sendSignal(BACKUP_REF, GSN_DUMP_STATE_ORD, signal, signal->length(), JBB);
|
||||
sendSignal(DBUTIL_REF, GSN_DUMP_STATE_ORD, signal, signal->length(), JBB);
|
||||
sendSignal(SUMA_REF, GSN_DUMP_STATE_ORD, signal, signal->length(), JBB);
|
||||
sendSignal(GREP_REF, GSN_DUMP_STATE_ORD, signal, signal->length(), JBB);
|
||||
sendSignal(TRIX_REF, GSN_DUMP_STATE_ORD, signal, signal->length(), JBB);
|
||||
sendSignal(DBTUX_REF, GSN_DUMP_STATE_ORD, signal, signal->length(), JBB);
|
||||
|
||||
|
@@ -851,13 +851,6 @@ struct Tabrec {
|
||||
Uint32 fragptrholder[MAX_FRAG_PER_NODE];
|
||||
Uint32 tabUserPtr;
|
||||
BlockReference tabUserRef;
|
||||
|
||||
Uint8 noOfKeyAttr;
|
||||
Uint8 hasCharAttr;
|
||||
struct KeyAttr {
|
||||
Uint32 attributeDescriptor;
|
||||
CHARSET_INFO* charsetInfo;
|
||||
} keyAttr[MAX_ATTRIBUTES_IN_INDEX];
|
||||
};
|
||||
typedef Ptr<Tabrec> TabrecPtr;
|
||||
|
||||
@@ -903,7 +896,6 @@ private:
|
||||
void execACCKEYREQ(Signal* signal);
|
||||
void execACCSEIZEREQ(Signal* signal);
|
||||
void execACCFRAGREQ(Signal* signal);
|
||||
void execTC_SCHVERREQ(Signal* signal);
|
||||
void execACC_SRREQ(Signal* signal);
|
||||
void execNEXT_SCANREQ(Signal* signal);
|
||||
void execACC_ABORTREQ(Signal* signal);
|
||||
|
@@ -179,7 +179,6 @@ Dbacc::Dbacc(const class Configuration & conf):
|
||||
addRecSignal(GSN_ACCKEYREQ, &Dbacc::execACCKEYREQ);
|
||||
addRecSignal(GSN_ACCSEIZEREQ, &Dbacc::execACCSEIZEREQ);
|
||||
addRecSignal(GSN_ACCFRAGREQ, &Dbacc::execACCFRAGREQ);
|
||||
addRecSignal(GSN_TC_SCHVERREQ, &Dbacc::execTC_SCHVERREQ);
|
||||
addRecSignal(GSN_ACC_SRREQ, &Dbacc::execACC_SRREQ);
|
||||
addRecSignal(GSN_NEXT_SCANREQ, &Dbacc::execNEXT_SCANREQ);
|
||||
addRecSignal(GSN_ACC_ABORTREQ, &Dbacc::execACC_ABORTREQ);
|
||||
|
@@ -28,7 +28,8 @@
|
||||
#include <signaldata/FsRemoveReq.hpp>
|
||||
#include <signaldata/DropTab.hpp>
|
||||
#include <signaldata/DumpStateOrd.hpp>
|
||||
#include <SectionReader.hpp>
|
||||
#include <KeyDescriptor.hpp>
|
||||
|
||||
|
||||
// TO_DO_RONM is a label for comments on what needs to be improved in future versions
|
||||
// when more time is given.
|
||||
@@ -1037,12 +1038,6 @@ void Dbacc::initialiseTableRec(Signal* signal)
|
||||
tabptr.p->fragholder[i] = RNIL;
|
||||
tabptr.p->fragptrholder[i] = RNIL;
|
||||
}//for
|
||||
tabptr.p->noOfKeyAttr = 0;
|
||||
tabptr.p->hasCharAttr = 0;
|
||||
for (Uint32 k = 0; k < MAX_ATTRIBUTES_IN_INDEX; k++) {
|
||||
tabptr.p->keyAttr[k].attributeDescriptor = 0;
|
||||
tabptr.p->keyAttr[k].charsetInfo = 0;
|
||||
}
|
||||
}//for
|
||||
}//Dbacc::initialiseTableRec()
|
||||
|
||||
@@ -1172,8 +1167,8 @@ void Dbacc::execACCFRAGREQ(Signal* signal)
|
||||
Uint32 userPtr = req->userPtr;
|
||||
BlockReference retRef = req->userRef;
|
||||
rootfragrecptr.p->rootState = ACTIVEROOT;
|
||||
AccFragConf * const conf = (AccFragConf*)&signal->theData[0];
|
||||
|
||||
AccFragConf * const conf = (AccFragConf*)&signal->theData[0];
|
||||
conf->userPtr = userPtr;
|
||||
conf->rootFragPtr = rootfragrecptr.i;
|
||||
conf->fragId[0] = rootfragrecptr.p->fragmentid[0];
|
||||
@@ -1197,65 +1192,6 @@ void Dbacc::addFragRefuse(Signal* signal, Uint32 errorCode)
|
||||
return;
|
||||
}//Dbacc::addFragRefuseEarly()
|
||||
|
||||
void
|
||||
Dbacc::execTC_SCHVERREQ(Signal* signal)
|
||||
{
|
||||
jamEntry();
|
||||
if (! assembleFragments(signal)) {
|
||||
jam();
|
||||
return;
|
||||
}
|
||||
tabptr.i = signal->theData[0];
|
||||
ptrCheckGuard(tabptr, ctablesize, tabrec);
|
||||
Uint32 noOfKeyAttr = signal->theData[6];
|
||||
ndbrequire(noOfKeyAttr <= MAX_ATTRIBUTES_IN_INDEX);
|
||||
Uint32 hasCharAttr = 0;
|
||||
|
||||
SegmentedSectionPtr s0Ptr;
|
||||
signal->getSection(s0Ptr, 0);
|
||||
SectionReader r0(s0Ptr, getSectionSegmentPool());
|
||||
Uint32 i = 0;
|
||||
while (i < noOfKeyAttr) {
|
||||
jam();
|
||||
Uint32 attributeDescriptor = ~0;
|
||||
Uint32 csNumber = ~0;
|
||||
if (! r0.getWord(&attributeDescriptor) ||
|
||||
! r0.getWord(&csNumber)) {
|
||||
jam();
|
||||
break;
|
||||
}
|
||||
CHARSET_INFO* cs = 0;
|
||||
if (csNumber != 0) {
|
||||
cs = all_charsets[csNumber];
|
||||
ndbrequire(cs != 0);
|
||||
hasCharAttr = 1;
|
||||
}
|
||||
tabptr.p->keyAttr[i].attributeDescriptor = attributeDescriptor;
|
||||
tabptr.p->keyAttr[i].charsetInfo = cs;
|
||||
i++;
|
||||
}
|
||||
ndbrequire(i == noOfKeyAttr);
|
||||
releaseSections(signal);
|
||||
|
||||
tabptr.p->noOfKeyAttr = noOfKeyAttr;
|
||||
tabptr.p->hasCharAttr = hasCharAttr;
|
||||
|
||||
// copy char attr flag to each fragment
|
||||
for (Uint32 i1 = 0; i1 < MAX_FRAG_PER_NODE; i1++) {
|
||||
jam();
|
||||
if (tabptr.p->fragptrholder[i1] != RNIL) {
|
||||
rootfragrecptr.i = tabptr.p->fragptrholder[i1];
|
||||
ptrCheckGuard(rootfragrecptr, crootfragmentsize, rootfragmentrec);
|
||||
for (Uint32 i2 = 0; i2 < 2; i2++) {
|
||||
fragrecptr.i = rootfragrecptr.p->fragmentptr[i2];
|
||||
ptrCheckGuard(fragrecptr, cfragmentsize, fragmentrec);
|
||||
fragrecptr.p->hasCharAttr = hasCharAttr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// no reply to DICT
|
||||
}
|
||||
|
||||
void
|
||||
Dbacc::execDROP_TAB_REQ(Signal* signal){
|
||||
@@ -1841,55 +1777,14 @@ void Dbacc::execACCKEYREQ(Signal* signal)
|
||||
void
|
||||
Dbacc::xfrmKeyData(Signal* signal)
|
||||
{
|
||||
tabptr.i = fragrecptr.p->myTableId;
|
||||
ptrCheckGuard(tabptr, ctablesize, tabrec);
|
||||
|
||||
Uint32 dst[1024 * MAX_XFRM_MULTIPLY];
|
||||
Uint32 dstSize = (sizeof(dst) >> 2);
|
||||
Uint32 table = fragrecptr.p->myTableId;
|
||||
Uint32 dst[MAX_KEY_SIZE_IN_WORDS * MAX_XFRM_MULTIPLY];
|
||||
Uint32 keyPartLen[MAX_ATTRIBUTES_IN_INDEX];
|
||||
Uint32* src = &signal->theData[7];
|
||||
const Uint32 noOfKeyAttr = tabptr.p->noOfKeyAttr;
|
||||
Uint32 dstPos = 0;
|
||||
Uint32 srcPos = 0;
|
||||
Uint32 i = 0;
|
||||
|
||||
while (i < noOfKeyAttr) {
|
||||
const Tabrec::KeyAttr& keyAttr = tabptr.p->keyAttr[i];
|
||||
|
||||
Uint32 srcBytes = AttributeDescriptor::getSizeInBytes(keyAttr.attributeDescriptor);
|
||||
Uint32 srcWords = (srcBytes + 3) / 4;
|
||||
Uint32 dstWords = ~0;
|
||||
uchar* dstPtr = (uchar*)&dst[dstPos];
|
||||
const uchar* srcPtr = (const uchar*)&src[srcPos];
|
||||
CHARSET_INFO* cs = keyAttr.charsetInfo;
|
||||
|
||||
if (cs == 0) {
|
||||
jam();
|
||||
memcpy(dstPtr, srcPtr, srcWords << 2);
|
||||
dstWords = srcWords;
|
||||
} else {
|
||||
jam();
|
||||
Uint32 typeId = AttributeDescriptor::getType(keyAttr.attributeDescriptor);
|
||||
Uint32 lb, len;
|
||||
bool ok = NdbSqlUtil::get_var_length(typeId, srcPtr, srcBytes, lb, len);
|
||||
ndbrequire(ok);
|
||||
Uint32 xmul = cs->strxfrm_multiply;
|
||||
if (xmul == 0)
|
||||
xmul = 1;
|
||||
// see comment in DbtcMain.cpp
|
||||
Uint32 dstLen = xmul * (srcBytes - lb);
|
||||
ndbrequire(dstLen <= ((dstSize - dstPos) << 2));
|
||||
int n = NdbSqlUtil::strnxfrm_bug7284(cs, dstPtr, dstLen, srcPtr + lb, len);
|
||||
ndbrequire(n != -1);
|
||||
while ((n & 3) != 0)
|
||||
dstPtr[n++] = 0;
|
||||
dstWords = (n >> 2);
|
||||
}
|
||||
dstPos += dstWords;
|
||||
srcPos += srcWords;
|
||||
i++;
|
||||
}
|
||||
memcpy(src, dst, dstPos << 2);
|
||||
operationRecPtr.p->xfrmtupkeylen = dstPos;
|
||||
Uint32 len = xfrm_key(table, src, dst, sizeof(dst) >> 2, keyPartLen);
|
||||
ndbrequire(len); // 0 means error
|
||||
memcpy(src, dst, len << 2);
|
||||
operationRecPtr.p->xfrmtupkeylen = len;
|
||||
}
|
||||
|
||||
void Dbacc::accIsLockedLab(Signal* signal)
|
||||
@@ -8024,6 +7919,10 @@ void Dbacc::initFragAdd(Signal* signal,
|
||||
Uint32 Tmp2 = regFragPtr.p->maxloadfactor - regFragPtr.p->minloadfactor;
|
||||
Tmp2 = Tmp1 * Tmp2;
|
||||
regFragPtr.p->slackCheck = Tmp2;
|
||||
|
||||
Uint32 hasCharAttr = g_key_descriptor_pool.getPtr(req->tableId)->hasCharAttr;
|
||||
regFragPtr.p->hasCharAttr = hasCharAttr;
|
||||
|
||||
}//Dbacc::initFragAdd()
|
||||
|
||||
void Dbacc::initFragGeneral(FragmentrecPtr regFragPtr)
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <SectionReader.hpp>
|
||||
#include <SimpleProperties.hpp>
|
||||
#include <AttributeHeader.hpp>
|
||||
#include <KeyDescriptor.hpp>
|
||||
#include <signaldata/DictSchemaInfo.hpp>
|
||||
#include <signaldata/DictTabInfo.hpp>
|
||||
#include <signaldata/DropTabFile.hpp>
|
||||
@@ -77,6 +78,7 @@
|
||||
#include <signaldata/CreateFragmentation.hpp>
|
||||
#include <signaldata/CreateTab.hpp>
|
||||
#include <NdbSleep.h>
|
||||
#include <signaldata/ApiBroadcast.hpp>
|
||||
|
||||
#define ZNOT_FOUND 626
|
||||
#define ZALREADYEXIST 630
|
||||
@@ -91,6 +93,27 @@
|
||||
#define DIV(x,y) (((x)+(y)-1)/(y))
|
||||
#include <ndb_version.h>
|
||||
|
||||
static
|
||||
Uint32
|
||||
alter_table_inc_schema_version(Uint32 old)
|
||||
{
|
||||
return (old & 0x00FFFFFF) + ((old + 0x1000000) & 0xFF000000);
|
||||
}
|
||||
|
||||
static
|
||||
Uint32
|
||||
alter_table_dec_schema_version(Uint32 old)
|
||||
{
|
||||
return (old & 0x00FFFFFF) + ((old - 0x1000000) & 0xFF000000);
|
||||
}
|
||||
|
||||
static
|
||||
Uint32
|
||||
create_table_inc_schema_version(Uint32 old)
|
||||
{
|
||||
return (old + 0x00000001) & 0x00FFFFFF;
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* MODULE: GENERAL MODULE -------------------------------- */
|
||||
@@ -367,6 +390,9 @@ void Dbdict::execFSCLOSECONF(Signal* signal)
|
||||
jam();
|
||||
closeWriteTableConf(signal, fsPtr);
|
||||
break;
|
||||
case FsConnectRecord::FsConnectRecord::OPEN_READ_SCHEMA2:
|
||||
openSchemaFile(signal, 1, fsPtr.i, false, false);
|
||||
break;
|
||||
default:
|
||||
jamLine((fsPtr.p->fsState & 0xFFF));
|
||||
ndbrequire(false);
|
||||
@@ -604,7 +630,7 @@ void Dbdict::openTableFile(Signal* signal,
|
||||
jam();
|
||||
fsOpenReq->fileFlags = FsOpenReq::OM_READONLY;
|
||||
}//if
|
||||
ndbrequire(tablePtr.p->tableVersion < ZNIL);
|
||||
|
||||
fsOpenReq->fileNumber[3] = 0; // Initialise before byte changes
|
||||
FsOpenReq::setVersion(fsOpenReq->fileNumber, 1);
|
||||
FsOpenReq::setSuffix(fsOpenReq->fileNumber, FsOpenReq::S_TABLELIST);
|
||||
@@ -794,7 +820,7 @@ Dbdict::updateSchemaState(Signal* signal, Uint32 tableId,
|
||||
case SchemaFile::ADD_STARTED:
|
||||
jam();
|
||||
ok = true;
|
||||
ndbrequire((oldVersion + 1) == newVersion);
|
||||
ndbrequire(create_table_inc_schema_version(oldVersion) == newVersion);
|
||||
ndbrequire(oldState == SchemaFile::INIT ||
|
||||
oldState == SchemaFile::DROP_TABLE_COMMITTED);
|
||||
break;
|
||||
@@ -807,7 +833,7 @@ Dbdict::updateSchemaState(Signal* signal, Uint32 tableId,
|
||||
case SchemaFile::ALTER_TABLE_COMMITTED:
|
||||
jam();
|
||||
ok = true;
|
||||
ndbrequire((oldVersion + 1) == newVersion);
|
||||
ndbrequire(alter_table_inc_schema_version(oldVersion) == newVersion);
|
||||
ndbrequire(oldState == SchemaFile::TABLE_ADD_COMMITTED ||
|
||||
oldState == SchemaFile::ALTER_TABLE_COMMITTED);
|
||||
break;
|
||||
@@ -1067,10 +1093,13 @@ void Dbdict::readSchemaConf(Signal* signal,
|
||||
void Dbdict::readSchemaRef(Signal* signal,
|
||||
FsConnectRecordPtr fsPtr)
|
||||
{
|
||||
/**
|
||||
* First close corrupt file
|
||||
*/
|
||||
fsPtr.p->fsState = FsConnectRecord::OPEN_READ_SCHEMA2;
|
||||
openSchemaFile(signal, 1, fsPtr.i, false, false);
|
||||
closeFile(signal, fsPtr.p->filePtr, fsPtr.i);
|
||||
return;
|
||||
}//Dbdict::readSchemaRef()
|
||||
}
|
||||
|
||||
void Dbdict::closeReadSchemaConf(Signal* signal,
|
||||
FsConnectRecordPtr fsPtr)
|
||||
@@ -1728,6 +1757,7 @@ void Dbdict::execREAD_CONFIG_REQ(Signal* signal)
|
||||
c_schemaPageRecordArray.setSize(2 * NDB_SF_MAX_PAGES);
|
||||
c_tableRecordPool.setSize(tablerecSize);
|
||||
c_tableRecordHash.setSize(tablerecSize);
|
||||
g_key_descriptor_pool.setSize(tablerecSize);
|
||||
c_triggerRecordPool.setSize(c_maxNoOfTriggers);
|
||||
c_triggerRecordHash.setSize(c_maxNoOfTriggers);
|
||||
c_opRecordPool.setSize(256); // XXX need config params
|
||||
@@ -2982,6 +3012,21 @@ Dbdict::execBACKUP_FRAGMENT_REQ(Signal* signal)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Dbdict::check_ndb_versions() const
|
||||
{
|
||||
Uint32 node = 0;
|
||||
Uint32 version = getNodeInfo(getOwnNodeId()).m_version;
|
||||
while((node = c_aliveNodes.find(node + 1)) != BitmaskImpl::NotFound)
|
||||
{
|
||||
if(getNodeInfo(node).m_version != version)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
Dbdict::execALTER_TABLE_REQ(Signal* signal)
|
||||
{
|
||||
@@ -3019,6 +3064,13 @@ Dbdict::execALTER_TABLE_REQ(Signal* signal)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_ndb_versions())
|
||||
{
|
||||
jam();
|
||||
alterTableRef(signal, req, AlterTableRef::IncompatibleVersions);
|
||||
return;
|
||||
}
|
||||
|
||||
const TableRecord::TabState tabState = tablePtr.p->tabState;
|
||||
bool ok = false;
|
||||
switch(tabState){
|
||||
@@ -3168,7 +3220,7 @@ Dbdict::alterTable_backup_mutex_locked(Signal* signal,
|
||||
lreq->clientData = alterTabPtr.p->m_senderData;
|
||||
lreq->changeMask = alterTabPtr.p->m_changeMask;
|
||||
lreq->tableId = tablePtr.p->tableId;
|
||||
lreq->tableVersion = tablePtr.p->tableVersion + 1;
|
||||
lreq->tableVersion = alter_table_inc_schema_version(tablePtr.p->tableVersion);
|
||||
lreq->gci = tablePtr.p->gciTableCreated;
|
||||
lreq->requestType = AlterTabReq::AlterTablePrepare;
|
||||
|
||||
@@ -3248,6 +3300,14 @@ Dbdict::execALTER_TAB_REQ(Signal * signal)
|
||||
alterTabRef(signal, req, AlterTableRef::Busy);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_ndb_versions())
|
||||
{
|
||||
jam();
|
||||
alterTabRef(signal, req, AlterTableRef::IncompatibleVersions);
|
||||
return;
|
||||
}
|
||||
|
||||
alterTabPtr.p->m_alterTableId = tableId;
|
||||
alterTabPtr.p->m_coordinatorRef = senderRef;
|
||||
|
||||
@@ -3290,7 +3350,7 @@ Dbdict::execALTER_TAB_REQ(Signal * signal)
|
||||
}
|
||||
ndbrequire(ok);
|
||||
|
||||
if(tablePtr.p->tableVersion + 1 != tableVersion){
|
||||
if(alter_table_inc_schema_version(tablePtr.p->tableVersion) != tableVersion){
|
||||
jam();
|
||||
alterTabRef(signal, req, AlterTableRef::InvalidTableVersion);
|
||||
return;
|
||||
@@ -3775,7 +3835,7 @@ void Dbdict::revertAlterTable(Signal * signal,
|
||||
// Restore name
|
||||
strcpy(tablePtr.p->tableName, alterTabPtrP->previousTableName);
|
||||
// Revert schema version
|
||||
tablePtr.p->tableVersion = tablePtr.p->tableVersion - 1;
|
||||
tablePtr.p->tableVersion = alter_table_dec_schema_version(tablePtr.p->tableVersion);
|
||||
// Put it back
|
||||
#ifdef VM_TRACE
|
||||
ndbrequire(!c_tableRecordHash.find(tmp, * tablePtr.p));
|
||||
@@ -3835,6 +3895,27 @@ Dbdict::alterTab_writeTableConf(Signal* signal,
|
||||
conf->requestType = AlterTabReq::AlterTableCommit;
|
||||
sendSignal(coordinatorRef, GSN_ALTER_TAB_CONF, signal,
|
||||
AlterTabConf::SignalLength, JBB);
|
||||
|
||||
|
||||
{
|
||||
ApiBroadcastRep* api= (ApiBroadcastRep*)signal->getDataPtrSend();
|
||||
api->gsn = GSN_ALTER_TABLE_REP;
|
||||
api->minVersion = MAKE_VERSION(4,1,15);
|
||||
|
||||
AlterTableRep* rep = (AlterTableRep*)api->theData;
|
||||
rep->tableId = tabPtr.p->tableId;
|
||||
rep->tableVersion = alter_table_dec_schema_version(tabPtr.p->tableVersion);
|
||||
rep->changeType = AlterTableRep::CT_ALTERED;
|
||||
|
||||
LinearSectionPtr ptr[3];
|
||||
ptr[0].p = (Uint32*)alterTabPtr.p->previousTableName;
|
||||
ptr[0].sz = (sizeof(alterTabPtr.p->previousTableName) + 3) >> 2;
|
||||
|
||||
sendSignal(QMGR_REF, GSN_API_BROADCAST_REP, signal,
|
||||
ApiBroadcastRep::SignalLength + AlterTableRep::SignalLength,
|
||||
JBB, ptr,1);
|
||||
}
|
||||
|
||||
if(coordinatorRef != reference()) {
|
||||
jam();
|
||||
// Release resources
|
||||
@@ -3886,7 +3967,7 @@ Dbdict::execCREATE_FRAGMENTATION_CONF(Signal* signal){
|
||||
XSchemaFile * xsf = &c_schemaFile[c_schemaRecord.schemaPage != 0];
|
||||
SchemaFile::TableEntry * tabEntry = getTableEntry(xsf, tabPtr.i);
|
||||
|
||||
tabPtr.p->tableVersion = tabEntry->m_tableVersion + 1;
|
||||
tabPtr.p->tableVersion = create_table_inc_schema_version(tabEntry->m_tableVersion);
|
||||
|
||||
/**
|
||||
* Pack
|
||||
@@ -3915,7 +3996,7 @@ Dbdict::execCREATE_FRAGMENTATION_CONF(Signal* signal){
|
||||
|
||||
req->gci = 0;
|
||||
req->tableId = tabPtr.i;
|
||||
req->tableVersion = tabEntry->m_tableVersion + 1;
|
||||
req->tableVersion = create_table_inc_schema_version(tabEntry->m_tableVersion);
|
||||
|
||||
sendFragmentedSignal(rg, GSN_CREATE_TAB_REQ, signal,
|
||||
CreateTabReq::SignalLength, JBB);
|
||||
@@ -4377,6 +4458,44 @@ Dbdict::execADD_FRAGREQ(Signal* signal) {
|
||||
sendSignal(DBLQH_REF, GSN_LQHFRAGREQ, signal,
|
||||
LqhFragReq::SignalLength, JBB);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create KeyDescriptor
|
||||
*/
|
||||
KeyDescriptor* desc= g_key_descriptor_pool.getPtr(tabPtr.i);
|
||||
new (desc) KeyDescriptor();
|
||||
|
||||
Uint32 key = 0;
|
||||
Uint32 tAttr = tabPtr.p->firstAttribute;
|
||||
while (tAttr != RNIL)
|
||||
{
|
||||
jam();
|
||||
AttributeRecord* aRec = c_attributeRecordPool.getPtr(tAttr);
|
||||
if (aRec->tupleKey)
|
||||
{
|
||||
desc->noOfKeyAttr ++;
|
||||
desc->keyAttr[key].attributeDescriptor = aRec->attributeDescriptor;
|
||||
|
||||
Uint32 csNumber = (aRec->extPrecision >> 16);
|
||||
if(csNumber)
|
||||
{
|
||||
desc->keyAttr[key].charsetInfo = all_charsets[csNumber];
|
||||
ndbrequire(all_charsets[csNumber]);
|
||||
desc->hasCharAttr = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
desc->keyAttr[key].charsetInfo = 0;
|
||||
}
|
||||
if(AttributeDescriptor::getDKey(aRec->attributeDescriptor))
|
||||
{
|
||||
desc->noOfDistrKeys ++;
|
||||
}
|
||||
key++;
|
||||
}
|
||||
tAttr = aRec->nextAttrInTable;
|
||||
}
|
||||
ndbrequire(key == tabPtr.p->noOfPrimkey);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -4572,27 +4691,7 @@ Dbdict::execTAB_COMMITCONF(Signal* signal){
|
||||
signal->theData[5] = createTabPtr.p->key;
|
||||
signal->theData[6] = (Uint32)tabPtr.p->noOfPrimkey;
|
||||
|
||||
Uint32 buf[2 * MAX_ATTRIBUTES_IN_INDEX];
|
||||
Uint32 sz = 0;
|
||||
Uint32 tAttr = tabPtr.p->firstAttribute;
|
||||
while (tAttr != RNIL) {
|
||||
jam();
|
||||
AttributeRecord* aRec = c_attributeRecordPool.getPtr(tAttr);
|
||||
if (aRec->tupleKey) {
|
||||
buf[sz++] = aRec->attributeDescriptor;
|
||||
buf[sz++] = (aRec->extPrecision >> 16); // charset number
|
||||
}
|
||||
tAttr = aRec->nextAttrInTable;
|
||||
}
|
||||
ndbrequire((int)sz == 2 * tabPtr.p->noOfPrimkey);
|
||||
|
||||
LinearSectionPtr lsPtr[3];
|
||||
lsPtr[0].p = buf;
|
||||
lsPtr[0].sz = sz;
|
||||
// note: ACC does not reply
|
||||
if (tabPtr.p->isTable() || tabPtr.p->isHashIndex())
|
||||
sendSignal(DBACC_REF, GSN_TC_SCHVERREQ, signal, 7, JBB, lsPtr, 1);
|
||||
sendSignal(DBTC_REF, GSN_TC_SCHVERREQ, signal, 7, JBB, lsPtr, 1);
|
||||
sendSignal(DBTC_REF, GSN_TC_SCHVERREQ, signal, 7, JBB);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12269,3 +12368,5 @@ Dbdict::getMetaAttribute(MetaData::Attribute& attr, const MetaData::Table& table
|
||||
new (&attr) MetaData::Attribute(*attrPtr.p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CArray<KeyDescriptor> g_key_descriptor_pool;
|
||||
|
@@ -587,6 +587,7 @@ private:
|
||||
void execALTER_TAB_REQ(Signal* signal);
|
||||
void execALTER_TAB_REF(Signal* signal);
|
||||
void execALTER_TAB_CONF(Signal* signal);
|
||||
bool check_ndb_versions() const;
|
||||
|
||||
/*
|
||||
* 2.4 COMMON STORED VARIABLES
|
||||
|
@@ -85,7 +85,8 @@ print_old(const char * filename, const SchemaFile * sf)
|
||||
te.m_tableState != SchemaFile::DROP_TABLE_COMMITTED)) {
|
||||
ndbout << "Table " << i << ":"
|
||||
<< " State = " << te.m_tableState
|
||||
<< " version = " << te.m_tableVersion
|
||||
<< " version = " << table_version_major(te.m_tableVersion) <<
|
||||
<< "(" << table_version_minor(te.m_tableVersion) << ")"
|
||||
<< " type = " << te.m_tableType
|
||||
<< " noOfPages = " << te.m_noOfPages
|
||||
<< " gcp: " << te.m_gcp << endl;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user